.classpath | 11 etc/agent-versioning/build.xml | 2 etc/apt/pom.xml | 2 etc/classloaders-test/plugin1/pom.xml | 2 etc/classloaders-test/plugin2/pom.xml | 2 etc/eclipse-tools/RHQ | 42 etc/samples/skeleton-plugin/pom.xml | 2 modules/common/drift/pom.xml | 2 modules/common/jboss-as-dmr-client/pom.xml | 2 modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/CoreJBossASClient.java | 79 modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/DatasourceJBossASClient.java | 40 modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/DeploymentJBossASClient.java | 32 modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/JBossASClient.java | 8 modules/core/arquillian-integration/container/src/test/resources/arquillian.xml | 9 modules/core/client-api/pom.xml | 2 modules/core/comm-api/pom.xml | 2 modules/core/dbutils/pom.xml | 2 modules/core/dbutils/src/main/scripts/dbsetup/2.3.1/db-data-combined-2.3.1.xml | 663 modules/core/dbutils/src/main/scripts/dbsetup/2.3.1/db-schema-combined-2.3.1.xml | 1916 -- modules/core/dbutils/src/main/scripts/dbsetup/2.4.0/db-data-combined-2.4.0.xml | 669 modules/core/dbutils/src/main/scripts/dbsetup/2.4.0/db-schema-combined-2.4.0.xml | 2494 ++ modules/core/domain/intentional-api-changes-since-4.5.1.xml | 21 modules/core/domain/pom.xml | 190 modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AgentCriteria.java | 107 modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ServerCriteria.java | 125 modules/core/domain/src/main/java/org/rhq/core/domain/resource/Agent.java | 3 modules/core/domain/src/test/java/org/rhq/core/domain/content/test/ContentSourceSyncResultsTest.java | 8 modules/core/domain/src/test/java/org/rhq/core/domain/content/test/ContentSourceTest.java | 13 modules/core/domain/src/test/java/org/rhq/core/domain/drift/DriftDataAccessTest.java | 9 modules/core/domain/src/test/java/org/rhq/core/domain/drift/DriftDefinitionTemplateTest.java | 13 modules/core/domain/src/test/java/org/rhq/core/domain/drift/JPADriftChangeSetTest.java | 23 modules/core/domain/src/test/java/org/rhq/core/domain/operation/OperationHistoryTest.java | 81 modules/core/domain/src/test/java/org/rhq/core/domain/resource/test/ProblemResourceTest.java | 1 modules/core/domain/src/test/java/org/rhq/core/domain/resource/test/ResourceErrorTest.java | 37 modules/core/domain/src/test/java/org/rhq/core/domain/resource/test/ResourceGroupTest.java | 17 modules/core/domain/src/test/java/org/rhq/core/domain/test/AbstractEJB3Test.java | 44 modules/core/domain/src/test/resources/arquillian.xml | 5 modules/core/domain/src/test/resources/jbossas-oracle-ds.xml | 36 modules/core/domain/src/test/resources/jbossas-postgres-ds.xml | 40 modules/core/gui/pom.xml | 2 modules/core/plugin-container-itest/src/test/resources/arquillian.xml | 8 modules/core/util/pom.xml | 2 modules/enterprise/agent/ant-run.xml | 21 modules/enterprise/agent/src/etc/rhq-agent-env.sh | 4 modules/enterprise/agentupdate/pom.xml | 2 modules/enterprise/binding/pom.xml | 2 modules/enterprise/binding/src/main/java/org/rhq/bindings/StandardScriptPermissions.java | 17 modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientFactory.java | 10 modules/enterprise/binding/src/main/java/org/rhq/bindings/client/RhqManager.java | 2 modules/enterprise/comm/pom.xml | 2 modules/enterprise/gui/content_http-war/pom.xml | 2 modules/enterprise/gui/coregui/pom.xml | 4 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupAgentsSelector.java | 265 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupDetailView.java | 55 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupServersSelector.java | 127 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupTableView.java | 72 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupWithCountsDatasource.java | 11 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDatasource.java | 178 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDatasourceField.java | 84 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDetailView.java | 46 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentNodeDatasource.java | 188 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentNodeDatasourceField.java | 83 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentTableView.java | 39 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/FailoverListItemDatasource.java | 8 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/PartitionEventDatasource.java | 80 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/PartitionEventDetailView.java | 65 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/PartitionEventTableView.java | 259 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerDatasource.java | 66 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerDatasourceField.java | 9 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerDetailView.java | 58 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerTableView.java | 145 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerWithAgentCountDatasource.java | 32 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/CloudGWTService.java | 192 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java | 3 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java | 3 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/operation/schedule/GroupOperationScheduleDetailsView.java | 5 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java | 9 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/schedule/ResourceOperationScheduleDetailsView.java | 5 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryConfigurationStep.java | 2 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/CloudGWTServiceImpl.java | 94 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java | 4 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/SystemGWTServiceImpl.java | 56 modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 39 modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties | 39 modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties | 39 modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties | 39 modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties | 39 modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties | 39 modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties | 39 modules/enterprise/gui/installer/pom.xml | 413 modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/client/Installer.java | 771 modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/client/ServerPropertyRecordList.java | 62 modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/client/gwt/InstallerGWTService.java | 132 modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/client/shared/ServerDetails.java | 109 modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/client/shared/ServerProperties.java | 174 modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/service/ManagementService.java | 105 modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/InstallerGWTServiceImpl.java | 782 modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/LoggerAntBuildListener.java | 103 modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/ServerInstallUtil.java | 1303 - modules/enterprise/gui/installer/src/main/resources/org/rhq/enterprise/gui/installer/Installer.gwt.xml | 35 modules/enterprise/gui/installer/src/main/resources/org/rhq/enterprise/gui/installer/client/Messages.properties | 40 modules/enterprise/gui/installer/src/main/resources/org/rhq/enterprise/gui/installer/client/ServerPropertiesMessages.properties | 23 modules/enterprise/gui/installer/src/main/webapp/WEB-INF/classes/META-INF/services/org.jboss.msc.service.ServiceActivator | 1 modules/enterprise/gui/installer/src/main/webapp/WEB-INF/web.xml | 9 modules/enterprise/gui/installer/src/main/webapp/index.html | 45 modules/enterprise/gui/installer/src/test/java/org/rhq/enterprise/installer/DBInstallationTest.java | 225 modules/enterprise/gui/installer/src/test/java/org/rhq/enterprise/installer/client/controller/DatasourceJBossASClientTest.java | 118 modules/enterprise/gui/installer/src/test/resources/org/rhq/enterprise/installer/db-data-combined-2.4.0.xml | 669 modules/enterprise/gui/installer/src/test/resources/org/rhq/enterprise/installer/db-data-combined-3.0.0.xml | 690 modules/enterprise/gui/installer/src/test/resources/org/rhq/enterprise/installer/db-data-combined-rhq-4.2.0.xml | 396 modules/enterprise/gui/installer/src/test/resources/org/rhq/enterprise/installer/db-data-combined-rhq-4.3.0.xml | 398 modules/enterprise/gui/installer/src/test/resources/org/rhq/enterprise/installer/db-data-combined-rhq-4.4.0.xml | 398 modules/enterprise/gui/installer/src/test/resources/org/rhq/enterprise/installer/db-schema-combined-2.4.0.xml | 2494 -- modules/enterprise/gui/installer/src/test/resources/org/rhq/enterprise/installer/db-schema-combined-3.0.0.xml | 2649 -- modules/enterprise/gui/installer/src/test/resources/org/rhq/enterprise/installer/db-schema-combined-rhq-4.2.0.xml | 2642 -- modules/enterprise/gui/installer/src/test/resources/org/rhq/enterprise/installer/db-schema-combined-rhq-4.3.0.xml | 2649 -- modules/enterprise/gui/installer/src/test/resources/org/rhq/enterprise/installer/db-schema-combined-rhq-4.4.0.xml | 2649 -- modules/enterprise/gui/pom.xml | 2 modules/enterprise/gui/portal-war/pom.xml | 2 modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/DownloadsUIBean.java | 21 modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/client/RemoteClientServlet.java | 85 modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/download/DownloadServlet.java | 122 modules/enterprise/gui/rest-examples-war/pom.xml | 133 modules/enterprise/gui/rest-examples-war/src/main/webapp/WEB-INF/jboss-web.xml | 5 modules/enterprise/gui/rest-examples-war/src/main/webapp/WEB-INF/web.xml | 27 modules/enterprise/gui/rest-examples-war/src/main/webapp/bars_simple.html | 131 modules/enterprise/gui/rest-examples-war/src/main/webapp/index.html | 40 modules/enterprise/gui/rest-examples-war/src/main/webapp/js/d3.behavior.js | 198 modules/enterprise/gui/rest-examples-war/src/main/webapp/js/d3.chart.js | 984 + modules/enterprise/gui/rest-examples-war/src/main/webapp/js/d3.csv.js | 92 modules/enterprise/gui/rest-examples-war/src/main/webapp/js/d3.geo.js | 938 + modules/enterprise/gui/rest-examples-war/src/main/webapp/js/d3.geom.js | 835 modules/enterprise/gui/rest-examples-war/src/main/webapp/js/d3.js | 4695 +++++ modules/enterprise/gui/rest-examples-war/src/main/webapp/js/d3.layout.js | 1889 ++ modules/enterprise/gui/rest-examples-war/src/main/webapp/js/d3.time.js | 687 modules/enterprise/gui/rest-examples-war/src/main/webapp/js/jquery.js | 9266 ++++++++++ modules/enterprise/gui/rest-examples-war/src/main/webapp/js/resource_tree.js | 65 modules/enterprise/gui/rest-examples-war/src/main/webapp/js/rhq.js | 120 modules/enterprise/gui/rest-examples-war/src/main/webapp/raw_graph.html | 184 modules/enterprise/gui/rest-examples-war/src/main/webapp/raw_graph7.html | 225 modules/enterprise/gui/rest-examples-war/src/main/webapp/stacked1.html | 145 modules/enterprise/gui/rest-examples-war/src/main/webapp/stacked2.html | 139 modules/enterprise/gui/rest-examples-war/src/main/webapp/stacked3.html | 95 modules/enterprise/gui/rest-examples-war/src/main/webapp/tree.html | 44 modules/enterprise/gui/rest-examples-war/src/main/webapp/whisker.html | 53 modules/enterprise/gui/rest-examples-war/src/main/webapp/whisker2.html | 35 modules/enterprise/gui/rest-war/pom.xml | 7 modules/enterprise/gui/rest-war/src/main/java/org/rhq/enterprise/rest/RHQApplication.java | 41 modules/enterprise/gui/rest-war/src/main/webapp/WEB-INF/web.xml | 7 modules/enterprise/gui/rest-war/src/main/webapp/bars_simple.html | 131 modules/enterprise/gui/rest-war/src/main/webapp/index.html | 40 modules/enterprise/gui/rest-war/src/main/webapp/js/d3.behavior.js | 198 modules/enterprise/gui/rest-war/src/main/webapp/js/d3.chart.js | 984 - modules/enterprise/gui/rest-war/src/main/webapp/js/d3.csv.js | 92 modules/enterprise/gui/rest-war/src/main/webapp/js/d3.geo.js | 938 - modules/enterprise/gui/rest-war/src/main/webapp/js/d3.geom.js | 835 modules/enterprise/gui/rest-war/src/main/webapp/js/d3.js | 4695 ----- modules/enterprise/gui/rest-war/src/main/webapp/js/d3.layout.js | 1889 -- modules/enterprise/gui/rest-war/src/main/webapp/js/d3.time.js | 687 modules/enterprise/gui/rest-war/src/main/webapp/js/jquery.js | 9266 ---------- modules/enterprise/gui/rest-war/src/main/webapp/js/resource_tree.js | 65 modules/enterprise/gui/rest-war/src/main/webapp/js/rhq.js | 120 modules/enterprise/gui/rest-war/src/main/webapp/raw_graph.html | 184 modules/enterprise/gui/rest-war/src/main/webapp/raw_graph7.html | 225 modules/enterprise/gui/rest-war/src/main/webapp/stacked1.html | 145 modules/enterprise/gui/rest-war/src/main/webapp/stacked2.html | 139 modules/enterprise/gui/rest-war/src/main/webapp/stacked3.html | 95 modules/enterprise/gui/rest-war/src/main/webapp/tree.html | 44 modules/enterprise/gui/rest-war/src/main/webapp/whisker.html | 53 modules/enterprise/gui/rest-war/src/main/webapp/whisker2.html | 35 modules/enterprise/pom.xml | 4 modules/enterprise/remoting/cli/pom.xml | 2 modules/enterprise/remoting/cli/src/main/samples/measurement_utils.js | 4 modules/enterprise/scripting/api/pom.xml | 2 modules/enterprise/scripting/javascript/pom.xml | 2 modules/enterprise/scripting/python/pom.xml | 2 modules/enterprise/server/appserver/pom.xml | 12 modules/enterprise/server/appserver/src/main/bin-resources/bin/generate-db-password.bat | 115 modules/enterprise/server/appserver/src/main/bin-resources/bin/generate-db-password.sh | 159 modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-installer.bat | 161 modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-installer.sh | 243 modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-server.bat | 1 modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-server.sh | 106 modules/enterprise/server/appserver/src/main/dev-resources/bin/rhq-autoinstall.bat | 41 modules/enterprise/server/appserver/src/main/dev-resources/bin/rhq-autoinstall.sh | 29 modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml | 242 modules/enterprise/server/client-api/pom.xml | 9 modules/enterprise/server/client-api/src/main/java/org/rhq/enterprise/client/RhqDownloadsScriptSourceProvider.java | 32 modules/enterprise/server/client-api/src/test/java/org/rhq/enterprise/client/test/RhqDownloadsScriptSourceProviderTest.java | 20 modules/enterprise/server/container-lib/pom.xml | 107 modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/AccessCheckingInitialContextFactoryBuilder.java | 250 modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/AllowRhqServerInternalsAccessPermission.java | 36 modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/DecoratingInitialContextFactory.java | 110 modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingContextDecorator.java | 264 modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingContextDecoratorSetContext.java | 75 modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingDirContextDecorator.java | 187 modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingEventContextDecorator.java | 69 modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingEventDirContextDecorator.java | 96 modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingLdapContextDecorator.java | 85 modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/ContextDecorator.java | 33 modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringContextDecorator.java | 222 modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringContextDecoratorHelper.java | 76 modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringContextDecoratorSetContext.java | 71 modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringDirContextDecorator.java | 185 modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringEventContextDecorator.java | 81 modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringEventDirContextDecorator.java | 104 modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringLdapContextDecorator.java | 94 modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/mbean/AccessCheckingInitialContextFactoryBuilderInstaller.java | 45 modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/mbean/AccessCheckingInitialContextFactoryBuilderInstallerMBean.java | 32 modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/util/DecoratingInvocationHandler.java | 55 modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/util/DecoratorPicker.java | 195 modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/util/DecoratorSetContext.java | 59 modules/enterprise/server/container-lib/src/test/java/org/rhq/jndi/context/DecoratingInvocationHandlerTest.java | 145 modules/enterprise/server/container-lib/src/test/java/org/rhq/jndi/context/DecoratorPickerTest.java | 180 modules/enterprise/server/ear/pom.xml | 77 modules/enterprise/server/ear/src/main/application/META-INF/jboss-deployment-structure.xml | 3 modules/enterprise/server/installer/pom.xml | 250 modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java | 252 modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerConfiguration.java | 62 modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerService.java | 196 modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java | 989 + modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/LoggerAntBuildListener.java | 103 modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ManagementService.java | 40 modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerDetails.java | 105 modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java | 1259 + modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerProperties.java | 174 modules/enterprise/server/installer/src/main/resources/logging.properties | 27 modules/enterprise/server/installer/src/main/resources/module/main/module.xml | 35 modules/enterprise/server/installer/src/main/scripts/module-assembly.xml | 37 modules/enterprise/server/installer/src/test/java/org/rhq/enterprise/server/installer/DBInstallationTest.java | 213 modules/enterprise/server/installer/src/test/java/org/rhq/enterprise/server/installer/client/DatasourceJBossASClientTest.java | 119 modules/enterprise/server/installer/src/test/resources/org/rhq/enterprise/server/installer/db-data-combined-2.4.0.xml | 669 modules/enterprise/server/installer/src/test/resources/org/rhq/enterprise/server/installer/db-data-combined-3.0.0.xml | 690 modules/enterprise/server/installer/src/test/resources/org/rhq/enterprise/server/installer/db-data-combined-rhq-4.2.0.xml | 396 modules/enterprise/server/installer/src/test/resources/org/rhq/enterprise/server/installer/db-data-combined-rhq-4.3.0.xml | 398 modules/enterprise/server/installer/src/test/resources/org/rhq/enterprise/server/installer/db-data-combined-rhq-4.4.0.xml | 398 modules/enterprise/server/installer/src/test/resources/org/rhq/enterprise/server/installer/db-schema-combined-2.4.0.xml | 2494 ++ modules/enterprise/server/installer/src/test/resources/org/rhq/enterprise/server/installer/db-schema-combined-3.0.0.xml | 2649 ++ modules/enterprise/server/installer/src/test/resources/org/rhq/enterprise/server/installer/db-schema-combined-rhq-4.2.0.xml | 2642 ++ modules/enterprise/server/installer/src/test/resources/org/rhq/enterprise/server/installer/db-schema-combined-rhq-4.3.0.xml | 2649 ++ modules/enterprise/server/installer/src/test/resources/org/rhq/enterprise/server/installer/db-schema-combined-rhq-4.4.0.xml | 2649 ++ modules/enterprise/server/itests-2/pom.xml | 77 modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/security/test/JndiAccessTest.java | 113 modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/TestServerPluginService.java | 2 modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/bundle/TestBundleServerPluginService.java | 2 modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/content/test/ContentUIManagerBeanTest.java | 11 modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/content/test/RepoSyncingTest.java | 71 modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/core/CoreServerServiceImplTest.java | 15 modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/core/plugin/DatabaseAndFilePluginDeploymentTest.java | 7 modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/drift/AbstractDriftServerTest.java | 36 modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/drift/DriftManagerBeanTest.java | 7 modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/drift/DriftTemplateManagerBeanTest.java | 53 modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/drift/JPADriftServerBeanTest.java | 8 modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/drift/ManageDriftDefinitionsTest.java | 16 modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/drift/ManageSnapshotsTest.java | 16 modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/inventory/UninventoryTest.java | 15 modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBeanTest.java | 142 modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java | 2 modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementBaselineManagerTest.java | 2 modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/plugin/pc/content/TestContentServerPluginService.java | 2 modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/plugin/pc/generic/TestGenericServerPluginService.java | 2 modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/MetadataBeanTest.java | 36 modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/PluginManagerBeanTest.java | 10 modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/PluginScanningExtensionMetadataTest.java | 12 modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest.java | 46 modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/test/UpdatePluginMetadataTestBase.java | 11 modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java | 85 modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/OldAbstractEJB3Test.java | 445 modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/StandardServerPluginService.java | 2 modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/StrippedDownStartupBean.java | 45 modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/StrippedDownStartupBeanPreparation.java | 75 modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/TestServerPluginService.java | 2 modules/enterprise/server/itests-2/src/test/resources/arquillian.xml | 5 modules/enterprise/server/itests-2/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/dup_drift.xml | 2 modules/enterprise/server/itests-2/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/plugin_v1.xml | 2 modules/enterprise/server/itests-2/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/plugin_v2.xml | 2 modules/enterprise/server/itests-2/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/remove_bundle_drift_config_v1.xml | 2 modules/enterprise/server/itests-2/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/remove_bundle_drift_config_v2.xml | 2 modules/enterprise/server/itests-2/src/test/resources/security.policy | 10 modules/enterprise/server/itests-2/src/test/resources/test/metadata/alerts/type-with-metric.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/BZ_573034_v1.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/BZ_573034_v2.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/addDeleteTemplate1.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/addDeleteTemplate2.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/addDeleteTemplate3.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/constraint.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/constraintMinMax.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/groupDeleted-v1.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/groupDeleted-v2.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/groupPropDeleted-v1.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/groupPropDeleted-v2.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/groupPropDeleted-v3.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/groupPropDeleted-v4.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/groupPropMoved-v1.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/groupPropMoved-v2.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/propertyChanging-v1.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/propertyChanging-v2.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/propertyList-simple.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/propertyList-v1.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/propertyList-v2.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/propertyMap-v1.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/propertyMap-v2.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/update5-v1_0.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/update5-v2_0.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/updateDefaultTemplate1.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/updateDefaultTemplate2.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/events/event1-1.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/events/event1-2.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/measurement/measurementDeletion-v1_0.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/measurement/measurementDeletion-v2_0.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/measurement/update-v1_0.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/measurement/update-v2_0.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/measurement/update6-1.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/measurement/update6-2.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/measurement/update7-1.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/measurement/update7-2.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/natives/update5-v1_0.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/natives/update5-v2_0.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/noTypes.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/operation/operation1-1.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/operation/operation1-2.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/operation/operation2-1.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/operation/operation2-2.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/operation/operation3-1.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/operation/operation3-2.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/operation/update3-v1_0.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/operation/update3-v2_0.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource-type/duplicateResourceType.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource-type/update2-v1_0.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource-type/update2-v2_0.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource-type/update4-v1_0.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource-type/update4-v2_0.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource-type/updateResourceTypeBundleTarget-v1.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource-type/updateResourceTypeBundleTarget-v2.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/illegal-subcat-1.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/nested-subcat-2children.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/nested-subcat-grandchild.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/nested-subcat-services-v1_0.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/nested-subcat-services-v2_0.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/nested-subcat-v1_0.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/nested-subcat-v1_1.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/nested-subcat-v2_0.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/no-subcat.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/one-subcat-v1_0.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/one-subcat-v1_1.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/one-subcat-v2_0.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/one-subcat-v3_0.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/services-v1_0.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/services-v2_0.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/test-subcategories.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/test-subcategories2.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/test-subcategories3.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/two-subcat.xml | 2 modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/undefined-child-subcat-1.xml | 2 modules/enterprise/server/jar/intentional-api-changes-since-4.5.1.xml | 24 modules/enterprise/server/jar/pom.xml | 128 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/AllowRhqServerInternalsAccessPermission.java | 36 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SessionManager.java | 6 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerBean.java | 12 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerLocal.java | 10 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerRemote.java | 90 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java | 72 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java | 3 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerBean.java | 44 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerLocal.java | 13 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CoreServer.java | 39 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CoreServerMBean.java | 12 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/RemoteClientManagerBean.java | 149 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/RemoteClientManagerLocal.java | 67 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/ShutdownListener.java | 59 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java | 76 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/plugin/PluginDeploymentScanner.java | 68 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/plugin/ProductPluginDeployer.java | 2 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/AccessCheckingInitialContextFactoryBuilder.java | 320 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/DecoratingInitialContextFactory.java | 110 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/NamingHack.java | 103 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingContextDecorator.java | 264 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingContextDecoratorSetContext.java | 75 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingDirContextDecorator.java | 187 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingEventContextDecorator.java | 69 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingEventDirContextDecorator.java | 96 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingLdapContextDecorator.java | 85 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/ContextDecorator.java | 33 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringContextDecorator.java | 222 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringContextDecoratorHelper.java | 76 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringContextDecoratorSetContext.java | 71 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringDirContextDecorator.java | 185 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringEventContextDecorator.java | 81 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringEventDirContextDecorator.java | 104 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringLdapContextDecorator.java | 94 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/util/DecoratingInvocationHandler.java | 55 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/util/DecoratorPicker.java | 195 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/util/DecoratorSetContext.java | 59 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/ServerPluginService.java | 6 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertHandlerBean.java | 117 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertHandlerLocal.java | 140 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/EventHandlerBean.java | 85 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/EventHandlerLocal.java | 121 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java | 171 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerLocal.java | 176 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/MetricHandlerBean.java | 167 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/MetricHandlerLocal.java | 254 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/OperationsHandlerBean.java | 100 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/OperationsHandlerLocal.java | 135 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/RHQApplication.java | 44 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceHandlerBean.java | 173 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceHandlerLocal.java | 188 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/RootHandlerBean.java | 108 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/StatusHandlerBean.java | 32 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/StatusHandlerLocal.java | 58 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/UserHandlerBean.java | 50 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/UserHandlerLocal.java | 79 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/support/SupportManagerBean.java | 4 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/sync/ExportingInputStream.java | 15 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerBean.java | 2 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerLocal.java | 1 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/LookupUtil.java | 20 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/RemoteAPIValidator.java | 2 modules/enterprise/server/jar/src/main/resources/rest_templates/alert.ftl | 8 modules/enterprise/server/jar/src/main/resources/rest_templates/availability.ftl | 2 modules/enterprise/server/jar/src/main/resources/rest_templates/group.ftl | 6 modules/enterprise/server/jar/src/main/resources/rest_templates/groupDefinition.ftl | 2 modules/enterprise/server/jar/src/main/resources/rest_templates/index.ftl | 59 modules/enterprise/server/jar/src/main/resources/rest_templates/metricData.ftl | 2 modules/enterprise/server/jar/src/main/resources/rest_templates/resourceWithType.ftl | 16 modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/naming/DecoratingInvocationHandlerTest.java | 144 modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/naming/DecoratorPickerTest.java | 180 modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/sync/test/ExportingInputStreamTest.java | 260 modules/enterprise/server/plugins/alert-cli/pom.xml | 2 modules/enterprise/server/plugins/alert-email/pom.xml | 2 modules/enterprise/server/plugins/alert-irc/pom.xml | 2 modules/enterprise/server/plugins/alert-log4j/pom.xml | 2 modules/enterprise/server/plugins/alert-microblog/pom.xml | 2 modules/enterprise/server/plugins/alert-mobicents/pom.xml | 2 modules/enterprise/server/plugins/alert-operations/pom.xml | 2 modules/enterprise/server/plugins/alert-roles/pom.xml | 2 modules/enterprise/server/plugins/alert-scriptlang/pom.xml | 2 modules/enterprise/server/plugins/alert-sms/pom.xml | 2 modules/enterprise/server/plugins/alert-snmp/pom.xml | 2 modules/enterprise/server/plugins/alert-subject/pom.xml | 2 modules/enterprise/server/plugins/ant-bundle/pom.xml | 2 modules/enterprise/server/plugins/cloud/pom.xml | 2 modules/enterprise/server/plugins/cobbler/pom.xml | 2 modules/enterprise/server/plugins/disk/pom.xml | 2 modules/enterprise/server/plugins/drift-mongodb/pom.xml | 2 modules/enterprise/server/plugins/drift-rhq/pom.xml | 2 modules/enterprise/server/plugins/filetemplate-bundle/pom.xml | 2 modules/enterprise/server/plugins/groovy-script/pom.xml | 2 modules/enterprise/server/plugins/jboss-software/pom.xml | 2 modules/enterprise/server/plugins/packagetype-cli/pom.xml | 2 modules/enterprise/server/plugins/url/pom.xml | 2 modules/enterprise/server/plugins/yum/pom.xml | 2 modules/enterprise/server/pom.xml | 3 modules/enterprise/server/safe-invoker/pom.xml | 2 modules/enterprise/server/sars/agent-sar/src/main/resources/embedded-agent-configuration-overrides.properties | 2 modules/enterprise/server/sars/services-sar/pom.xml | 2 modules/enterprise/server/sars/services-sar/src/main/resources/META-INF/jboss-service.xml | 3 modules/enterprise/server/sars/services-sar/src/main/resources/server-comm-configuration-overrides.properties | 2 modules/enterprise/server/startup-subsystem/pom.xml | 61 modules/enterprise/server/startup-subsystem/src/main/java/org/rhq/enterprise/startup/StartupExtension.java | 24 modules/enterprise/server/startup-subsystem/src/main/java/org/rhq/enterprise/startup/StartupSubsystemAdd.java | 16 modules/enterprise/server/xml-schemas/pom.xml | 2 modules/helpers/rtfilter/pom.xml | 7 modules/integration-tests/jndi-access/jndi-access-test/src/test/java/org/rhq/jndi/test/JndiAccessTest.java | 7 modules/integration-tests/jndi-access/jndi-access-test/src/test/resources/arquillian.xml | 6 modules/integration-tests/mod_cluster-plugin-test/pom.xml | 2 modules/integration-tests/pom.xml | 2 modules/integration-tests/rest-api/pom.xml | 4 modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/GetStatusTest.java | 6 modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/ResourcesTest.java | 4 modules/plugins/aliases/pom.xml | 2 modules/plugins/ant-bundle/pom.xml | 2 modules/plugins/apache/pom.xml | 2 modules/plugins/augeas/pom.xml | 2 modules/plugins/augeas/src/main/java/org/rhq/augeas/tree/impl/DefaultAugeasTreeBuilder.java | 2 modules/plugins/byteman/pom.xml | 2 modules/plugins/cassandra/pom.xml | 307 modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeComponent.java | 203 modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeDiscoveryComponent.java | 95 modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyComponent.java | 266 modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyDiscoveryComponent.java | 70 modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ComplexConfigurationResourceComponent.java | 125 modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceComponent.java | 262 modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceDiscoveryComponent.java | 114 modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/MetricsDiscoveryComponent.java | 61 modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java | 124 modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml | 755 modules/plugins/cassandra/src/test/java/org/rhq/plugins/cassandra/itest/DiscoveryAndConfigurationTest.java | 268 modules/plugins/cobbler/pom.xml | 2 modules/plugins/cron/pom.xml | 2 modules/plugins/database/pom.xml | 2 modules/plugins/filetemplate-bundle/pom.xml | 2 modules/plugins/grub/pom.xml | 2 modules/plugins/hadoop/pom.xml | 2 modules/plugins/hardware/src/main/java/org/rhq/plugins/hardware/SmartDiskComponent.java | 4 modules/plugins/hibernate/pom.xml | 2 modules/plugins/hosts/pom.xml | 2 modules/plugins/iis/pom.xml | 2 modules/plugins/iptables/pom.xml | 2 modules/plugins/irc/pom.xml | 2 modules/plugins/jboss-as-5/pom.xml | 2 modules/plugins/jboss-as-5/src/test/resources/itest/arquillian.xml | 5 modules/plugins/jboss-as-7/pom.xml | 2 modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/JBossProductType.java | 7 modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml | 4 modules/plugins/jboss-as-7/src/test/resources/itest/arquillian.xml | 5 modules/plugins/jboss-as/pom.xml | 2 modules/plugins/jboss-cache-v3/pom.xml | 2 modules/plugins/jboss-cache/pom.xml | 2 modules/plugins/jdbctrace/pom.xml | 2 modules/plugins/jira/pom.xml | 2 modules/plugins/jmx/pom.xml | 2 modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXServerComponent.java | 46 modules/plugins/kickstart/pom.xml | 2 modules/plugins/lsof/pom.xml | 2 modules/plugins/mod-cluster/pom.xml | 4 modules/plugins/mysql/pom.xml | 2 modules/plugins/netservices/pom.xml | 2 modules/plugins/noop/pom.xml | 2 modules/plugins/nss/pom.xml | 2 modules/plugins/onewire/pom.xml | 2 modules/plugins/oracle/pom.xml | 2 modules/plugins/pattern-generator/pom.xml | 2 modules/plugins/perftest/pom.xml | 2 modules/plugins/platform/pom.xml | 2 modules/plugins/pom.xml | 1 modules/plugins/postfix/pom.xml | 2 modules/plugins/postgres/pom.xml | 2 modules/plugins/raw-config-test/pom.xml | 2 modules/plugins/rhq-agent/pom.xml | 2 modules/plugins/rhq-server/pom.xml | 2 modules/plugins/samba/pom.xml | 2 modules/plugins/script/pom.xml | 2 modules/plugins/script2/pom.xml | 2 modules/plugins/services/pom.xml | 2 modules/plugins/snmptrapd/pom.xml | 2 modules/plugins/sshd/pom.xml | 2 modules/plugins/sudoers/pom.xml | 2 modules/plugins/tomcat/pom.xml | 2 modules/plugins/twitter/pom.xml | 2 modules/plugins/virt/pom.xml | 2 modules/pom.xml | 1 pom.xml | 44 543 files changed, 55208 insertions(+), 50955 deletions(-)
New commits: commit 49c19bafe83b2b2f55f514c51d34eb88fe960304 Author: Jirka Kremser jkremser@redhat.com Date: Wed Dec 19 21:10:31 2012 +0100
the rest of l10n for error and other messages, some javadoc
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupAgentsSelector.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupAgentsSelector.java index 5515e18..b1a1a6c 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupAgentsSelector.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupAgentsSelector.java @@ -22,7 +22,7 @@ */ package org.rhq.enterprise.gui.coregui.client.admin.topology;
-import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.NAME; +import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentDatasourceField.FIELD_NAME;
import java.util.ArrayList; import java.util.List; @@ -31,7 +31,6 @@ import com.google.gwt.user.client.rpc.AsyncCallback; import com.smartgwt.client.data.Criteria; import com.smartgwt.client.types.Alignment; import com.smartgwt.client.types.Overflow; -import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.IButton; import com.smartgwt.client.widgets.Window; import com.smartgwt.client.widgets.events.ClickEvent; @@ -47,6 +46,7 @@ import com.smartgwt.client.widgets.layout.VLayout; import org.rhq.core.domain.criteria.AgentCriteria; import org.rhq.core.domain.resource.Agent; import org.rhq.core.domain.util.PageList; +import org.rhq.enterprise.gui.coregui.client.CoreGUI; import org.rhq.enterprise.gui.coregui.client.IconEnum; import org.rhq.enterprise.gui.coregui.client.components.selector.AbstractSelector; import org.rhq.enterprise.gui.coregui.client.components.table.TableSection; @@ -64,6 +64,7 @@ public class AffinityGroupAgentsSelector extends AbstractSelector<Agent, AgentCr
private static RPCDataSource<Agent, AgentCriteria> datasource = null;
+ private static final int MAX_AVAIL_AGENTS = 3000; private static Window modalWindow; private static boolean shouldBeClosed; private static VLayout layout; @@ -79,13 +80,13 @@ public class AffinityGroupAgentsSelector extends AbstractSelector<Agent, AgentCr this.affinityGroupId = affinityGroupId; prepareMembers(this); } - + @Override protected DynamicForm getAvailableFilterForm() { if (availableFilterForm == null) { - availableFilterForm = new LocatableDynamicForm(extendLocatorId("AgeSelectAvailFilterForm")); + availableFilterForm = new LocatableDynamicForm(extendLocatorId("AgentSelectAvailFilterForm")); availableFilterForm.setWidth("75%"); - final TextItem search = new TextItem(NAME.propertyName(), MSG.common_title_search()); + final TextItem search = new TextItem(FIELD_NAME.propertyName(), MSG.common_title_search()); availableFilterForm.setItems(search); } return availableFilterForm; @@ -95,21 +96,21 @@ public class AffinityGroupAgentsSelector extends AbstractSelector<Agent, AgentCr AgentCriteria criteria = new AgentCriteria(); criteria.addFilterAffinityGroupId(affinityGroupId); GWTServiceLookup.getCloudService().findAgentsByCriteria(criteria, new AsyncCallback<PageList<Agent>>() { - public void onSuccess(PageList<Agent> result) { - ListGridRecord[] records = getDataSource().buildRecords(result); - originallyAssignedIds = getIdList(records); - setAssigned(records); - modalWindow.addItem(layout); - modalWindow.show(); - selector.reset(); - } - - @Override - public void onFailure(Throwable t) { - //todo: CoreGUI.getErrorHandler().handleError(MSG.view_admin_plugins_loadFailure(), t); - } - }); + public void onSuccess(PageList<Agent> result) { + ListGridRecord[] records = getDataSource().buildRecords(result); + originallyAssignedIds = getIdList(records); + setAssigned(records); + modalWindow.addItem(layout); + modalWindow.show(); + selector.reset(); + }
+ @Override + public void onFailure(Throwable t) { + CoreGUI.getErrorHandler().handleError( + MSG.view_adminTopology_message_fetchAgentsFail(String.valueOf(affinityGroupId)), t); + } + }); }
@Override @@ -122,15 +123,15 @@ public class AffinityGroupAgentsSelector extends AbstractSelector<Agent, AgentCr
@Override protected int getMaxAvailableRecords() { - return 3000; + return MAX_AVAIL_AGENTS; }
@Override protected Criteria getLatestCriteria(DynamicForm availableFilterForm) { - String search = (String) availableFilterForm.getValue(NAME.propertyName()); + String search = (String) availableFilterForm.getValue(FIELD_NAME.propertyName()); Criteria criteria = new Criteria(); if (null != search) { - criteria.addCriteria(NAME.propertyName(), search); + criteria.addCriteria(FIELD_NAME.propertyName(), search); } return criteria; } @@ -145,15 +146,15 @@ public class AffinityGroupAgentsSelector extends AbstractSelector<Agent, AgentCr return IconEnum.AGENT.getIcon16x16Path(); }
- public static void show(Integer affinityGroupId, final TableSection parrent) { + public static void show(final Integer affinityGroupId, final TableSection<?> parrent) { modalWindow = new Window(); modalWindow.addCloseClickHandler(new CloseClickHandler() { public void onCloseClick(CloseClickEvent event) { closeAndRefresh(parrent, false); } }); - modalWindow.setTitle(MSG.view_adminTopology_agents() + ": " - + MSG.view_adminTopology_affinityGroups_createNew()); + modalWindow + .setTitle(MSG.view_adminTopology_agents() + ": " + MSG.view_adminTopology_affinityGroups_createNew()); modalWindow.setOverflow(Overflow.VISIBLE); modalWindow.setWidth(800); modalWindow.setHeight(400); @@ -167,7 +168,7 @@ public class AffinityGroupAgentsSelector extends AbstractSelector<Agent, AgentCr layout.setPadding(10); layout.setLayoutMargin(10);
- final AffinityGroupAgentsSelector selector = new AffinityGroupAgentsSelector("foo", affinityGroupId); + final AffinityGroupAgentsSelector selector = new AffinityGroupAgentsSelector("assignAgents", affinityGroupId); layout.addMember(selector);
IButton cancel = new LocatableIButton(selector.extendLocatorId("Cancel"), MSG.common_button_cancel()); @@ -193,9 +194,10 @@ public class AffinityGroupAgentsSelector extends AbstractSelector<Agent, AgentCr closeAndRefresh(parrent, true); }
- public void onFailure(Throwable caught) { - //todo: error handling - SC.say("errX"); + public void onFailure(Throwable t) { + CoreGUI.getErrorHandler().handleError( + MSG.view_adminTopology_message_agroupAssingAgentsFail(String + .valueOf(affinityGroupId)), t); } }); } @@ -208,17 +210,16 @@ public class AffinityGroupAgentsSelector extends AbstractSelector<Agent, AgentCr closeAndRefresh(parrent, true); }
- public void onFailure(Throwable caught) { - //todo: error handling - SC.say("errX"); + public void onFailure(Throwable t) { + CoreGUI.getErrorHandler().handleError( + MSG.view_adminTopology_message_agroupRemovingAgentsFail(String + .valueOf(affinityGroupId)), t); } }); } if (shouldBeClosed) { closeAndRefresh(parrent, false); } - // SC.say("To del: " + originallySelected + "\n\nTo add: " + actuallySelected); - } });
@@ -231,7 +232,7 @@ public class AffinityGroupAgentsSelector extends AbstractSelector<Agent, AgentCr layout.addMember(buttons); }
- private static void closeAndRefresh(TableSection parrent, boolean fullRefresh) { + private static void closeAndRefresh(TableSection<?> parrent, boolean fullRefresh) { if (modalWindow != null) { modalWindow.destroy(); } diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupDetailView.java index 4355814..fbd832e 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupDetailView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupDetailView.java @@ -25,7 +25,6 @@ import com.google.gwt.user.client.Timer; import com.google.gwt.user.client.rpc.AsyncCallback; import com.smartgwt.client.types.Overflow; import com.smartgwt.client.types.VisibilityMode; -import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.IButton; import com.smartgwt.client.widgets.events.ClickEvent; import com.smartgwt.client.widgets.events.ClickHandler; @@ -35,9 +34,11 @@ import com.smartgwt.client.widgets.layout.SectionStackSection;
import org.rhq.core.domain.cloud.AffinityGroup; import org.rhq.enterprise.gui.coregui.client.BookmarkableView; +import org.rhq.enterprise.gui.coregui.client.CoreGUI; import org.rhq.enterprise.gui.coregui.client.ViewPath; import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup; import org.rhq.enterprise.gui.coregui.client.util.Log; +import org.rhq.enterprise.gui.coregui.client.util.message.Message; import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm; import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableSectionStack; import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableToolStrip; @@ -50,7 +51,6 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout; */ public class AffinityGroupDetailView extends LocatableVLayout implements BookmarkableView {
- // private final CloudGWTServiceAsync cloudManager = GWTServiceLookup.getCloudService(); private final int affinityGroupId;
private static final int SECTION_COUNT = 3; @@ -79,28 +79,18 @@ public class AffinityGroupDetailView extends LocatableVLayout implements Bookmar @Override protected void onInit() { super.onInit(); - GWTServiceLookup.getCloudService().getAffinityGroupById(this.affinityGroupId, - new AsyncCallback<AffinityGroup>() { - public void onSuccess(final AffinityGroup affinityGroup) { - prepareDetailsSection(sectionStack, affinityGroup); - - // GWTServiceLookup.getCloudService().getAgentsByServerName(server.getName(), - // new AsyncCallback<List<Agent>>() { - // public void onSuccess(List<Agent> agents) { - // prepareAgentSection(sectionStack, server, agents); - // }; - // - // public void onFailure(Throwable caught) { - // //TODO: CoreGUI.getErrorHandler().handleError(MSG.view_admin_plugins_loadFailure(), caught); - // } - // }); - } + GWTServiceLookup.getCloudService().getAffinityGroupById(affinityGroupId, new AsyncCallback<AffinityGroup>() { + public void onSuccess(final AffinityGroup affinityGroup) { + prepareDetailsSection(sectionStack, affinityGroup); + }
- public void onFailure(Throwable caught) { - SC.say("er1:" + caught); - //TODO: CoreGUI.getErrorHandler().handleError(MSG.view_admin_plugins_loadFailure(), caught); - } - }); + public void onFailure(Throwable caught) { + CoreGUI.getErrorHandler().handleError( + MSG.view_adminTopology_message_fetchAgroupFail(String.valueOf(affinityGroupId)), caught); + initSectionCount = SECTION_COUNT; + return; + } + }); prepareAgentSection(sectionStack); prepareServerSection(sectionStack); } @@ -178,7 +168,7 @@ public class AffinityGroupDetailView extends LocatableVLayout implements Bookmar
final TextItem nameItem = new TextItem(FIELD_NAME.propertyName(), FIELD_NAME.title()); nameItem.setValue(affinityGroup.getName()); - + LocatableToolStrip footer = new LocatableToolStrip(extendLocatorId("detailsFooter")); footer.setPadding(5); footer.setWidth100(); @@ -187,25 +177,27 @@ public class AffinityGroupDetailView extends LocatableVLayout implements Bookmar IButton saveButton = new IButton(); saveButton.setOverflow(Overflow.VISIBLE); saveButton.setTitle(MSG.common_button_save()); -// saveButton.setWidth(70); saveButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { affinityGroup.setName(nameItem.getValueAsString()); GWTServiceLookup.getCloudService().updateAffinityGroup(affinityGroup, new AsyncCallback<Void>() { public void onSuccess(Void result) { - // todo: notify + Message msg = new Message(MSG.view_adminTopology_message_agroupRenamed( + String.valueOf(affinityGroupId), affinityGroup.getName(), nameItem.getValueAsString()), + Message.Severity.Info); + CoreGUI.getMessageCenter().notify(msg); }
public void onFailure(Throwable caught) { - // todo: handle + CoreGUI.getErrorHandler().handleError( + MSG.view_adminTopology_message_agroupRenamingFail(String.valueOf(affinityGroupId), + affinityGroup.getName()) + " " + caught.getMessage(), caught); } }); } }); footer.addMember(saveButton); - form.setItems(nameItem); - SectionStackSection section = new SectionStackSection(MSG.common_title_details()); section.setExpanded(true); section.setItems(form, footer); diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupServersSelector.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupServersSelector.java index 13b1559..803214c 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupServersSelector.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupServersSelector.java @@ -22,7 +22,7 @@ */ package org.rhq.enterprise.gui.coregui.client.admin.topology;
-import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.NAME; +import static org.rhq.enterprise.gui.coregui.client.admin.topology.ServerDatasourceField.FIELD_NAME;
import java.util.ArrayList; import java.util.List; @@ -31,7 +31,6 @@ import com.google.gwt.user.client.rpc.AsyncCallback; import com.smartgwt.client.data.Criteria; import com.smartgwt.client.types.Alignment; import com.smartgwt.client.types.Overflow; -import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.IButton; import com.smartgwt.client.widgets.Window; import com.smartgwt.client.widgets.events.ClickEvent; @@ -49,6 +48,7 @@ import org.rhq.core.domain.cloud.Server; import org.rhq.core.domain.cloud.Server.OperationMode; import org.rhq.core.domain.criteria.ServerCriteria; import org.rhq.core.domain.util.PageList; +import org.rhq.enterprise.gui.coregui.client.CoreGUI; import org.rhq.enterprise.gui.coregui.client.IconEnum; import org.rhq.enterprise.gui.coregui.client.components.form.SortedSelectItem; import org.rhq.enterprise.gui.coregui.client.components.selector.AbstractSelector; @@ -82,27 +82,24 @@ public class AffinityGroupServersSelector extends AbstractSelector<Server, Serve this.affinityGroupId = affinityGroupId; prepareMembers(this); } - + @Override protected DynamicForm getAvailableFilterForm() { if (availableFilterForm == null) { availableFilterForm = new LocatableDynamicForm(extendLocatorId("SerSelectAvailFilterForm")); availableFilterForm.setNumCols(4); availableFilterForm.setWidth("75%"); - final TextItem search = new TextItem(NAME.propertyName(), MSG.common_title_search()); - final SelectItem operationModeSelect = new SortedSelectItem(ServerDatasource.FILTER_OPERATION_MODE, MSG.view_adminTopology_serverDetail_operationMode()); + final TextItem search = new TextItem(FIELD_NAME.propertyName(), MSG.common_title_search()); + final SelectItem operationModeSelect = new SortedSelectItem(ServerDatasource.FILTER_OPERATION_MODE, + MSG.view_adminTopology_serverDetail_operationMode()); operationModeSelect.setValueMap(buildOperationModeOptions()); operationModeSelect.setValue("ALL"); -// -// final EnumSelectItem operationModeFilter = new EnumSelectItem(ServerDatasource.FILTER_OPERATION_MODE, -// MSG.view_adminTopology_serverDetail_operationMode(), OperationMode.class, null, null); -
availableFilterForm.setItems(search, operationModeSelect); } return availableFilterForm; } - + private String[] buildOperationModeOptions() { OperationMode[] modes = OperationMode.values(); String[] options = new String[modes.length + 1]; @@ -117,27 +114,28 @@ public class AffinityGroupServersSelector extends AbstractSelector<Server, Serve ServerCriteria criteria = new ServerCriteria(); criteria.addFilterAffinityGroupId(affinityGroupId); GWTServiceLookup.getCloudService().findServersByCriteria(criteria, new AsyncCallback<PageList<Server>>() { - public void onSuccess(PageList<Server> result) { - ListGridRecord[] records = getDataSource().buildRecords(result); - originallyAssignedIds = getIdList(records); - setAssigned(records); - modalWindow.addItem(layout); - modalWindow.show(); - selector.reset(); - } + public void onSuccess(PageList<Server> result) { + ListGridRecord[] records = getDataSource().buildRecords(result); + originallyAssignedIds = getIdList(records); + setAssigned(records); + modalWindow.addItem(layout); + modalWindow.show(); + selector.reset(); + }
- @Override - public void onFailure(Throwable t) { - //todo: CoreGUI.getErrorHandler().handleError(MSG.view_admin_plugins_loadFailure(), t); - } - }); + @Override + public void onFailure(Throwable t) { + CoreGUI.getErrorHandler().handleError( + MSG.view_adminTopology_message_fetchServersFail(String.valueOf(affinityGroupId)), t); + } + });
}
@Override protected RPCDataSource<Server, ServerCriteria> getDataSource() { if (datasource == null) { - datasource = new ServerDatasource(affinityGroupId, false); + datasource = new ServerDatasource(null); } return datasource; } @@ -149,11 +147,11 @@ public class AffinityGroupServersSelector extends AbstractSelector<Server, Serve
@Override protected Criteria getLatestCriteria(DynamicForm availableFilterForm) { - String search = (String) availableFilterForm.getValue(NAME.propertyName()); + String search = (String) availableFilterForm.getValue(FIELD_NAME.propertyName()); String operationMode = (String) availableFilterForm.getValue(ServerDatasource.FILTER_OPERATION_MODE); Criteria criteria = new Criteria(); if (null != search) { - criteria.addCriteria(NAME.propertyName(), search); + criteria.addCriteria(FIELD_NAME.propertyName(), search); } if (operationMode != null && !"ALL".equals(operationMode)) { criteria.addCriteria(ServerDatasource.FILTER_OPERATION_MODE, operationMode); @@ -171,7 +169,7 @@ public class AffinityGroupServersSelector extends AbstractSelector<Server, Serve return IconEnum.SERVERS.getIcon16x16Path(); }
- public static void show(Integer affinityGroupId, final TableSection parrent) { + public static void show(final Integer affinityGroupId, final TableSection<?> parrent) { modalWindow = new Window(); modalWindow.addCloseClickHandler(new CloseClickHandler() { public void onCloseClick(CloseClickEvent event) { @@ -193,7 +191,7 @@ public class AffinityGroupServersSelector extends AbstractSelector<Server, Serve layout.setPadding(10); layout.setLayoutMargin(10);
- final AffinityGroupServersSelector selector = new AffinityGroupServersSelector("foo", affinityGroupId); + final AffinityGroupServersSelector selector = new AffinityGroupServersSelector("assignServers", affinityGroupId); layout.addMember(selector);
IButton cancel = new LocatableIButton(selector.extendLocatorId("Cancel"), MSG.common_button_cancel()); @@ -214,14 +212,14 @@ public class AffinityGroupServersSelector extends AbstractSelector<Server, Serve shouldBeClosed = false; GWTServiceLookup.getCloudService().removeServersFromGroup( originallySelected.toArray(new Integer[originallySelected.size()]), new AsyncCallback<Void>() { - public void onSuccess(Void result) { closeAndRefresh(parrent, true); }
- public void onFailure(Throwable caught) { - //todo: error handling - SC.say("errX"); + public void onFailure(Throwable t) { + CoreGUI.getErrorHandler().handleError( + MSG.view_adminTopology_message_agroupAssingServersFail(String + .valueOf(affinityGroupId)), t); } }); } @@ -229,22 +227,20 @@ public class AffinityGroupServersSelector extends AbstractSelector<Server, Serve shouldBeClosed = false; GWTServiceLookup.getCloudService().addServersToGroup(selector.getAffinityGroupId(), actuallySelected.toArray(new Integer[actuallySelected.size()]), new AsyncCallback<Void>() { - public void onSuccess(Void result) { closeAndRefresh(parrent, true); }
- public void onFailure(Throwable caught) { - //todo: error handling - SC.say("errX"); + public void onFailure(Throwable t) { + CoreGUI.getErrorHandler().handleError( + MSG.view_adminTopology_message_agroupRemovingServersFail(String + .valueOf(affinityGroupId)), t); } }); } if (shouldBeClosed) { closeAndRefresh(parrent, false); } - // SC.say("To del: " + originallySelected + "\n\nTo add: " + actuallySelected); - } });
@@ -257,7 +253,7 @@ public class AffinityGroupServersSelector extends AbstractSelector<Server, Serve layout.addMember(buttons); }
- private static void closeAndRefresh(TableSection parrent, boolean fullRefresh) { + private static void closeAndRefresh(TableSection<?> parrent, boolean fullRefresh) { if (modalWindow != null) { modalWindow.destroy(); } diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupTableView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupTableView.java index ac44d44..dbe8d0f 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupTableView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupTableView.java @@ -36,6 +36,8 @@ import com.smartgwt.client.widgets.events.ClickEvent; import com.smartgwt.client.widgets.events.ClickHandler; import com.smartgwt.client.widgets.form.DynamicForm; import com.smartgwt.client.widgets.form.fields.TextItem; +import com.smartgwt.client.widgets.form.fields.events.KeyUpEvent; +import com.smartgwt.client.widgets.form.fields.events.KeyUpHandler; import com.smartgwt.client.widgets.form.validator.LengthRangeValidator; import com.smartgwt.client.widgets.grid.ListGrid; import com.smartgwt.client.widgets.grid.ListGridField; @@ -98,32 +100,29 @@ public class AffinityGroupTableView extends TableSection<AffinityGroupWithCounts } });
- addTableAction(extendLocatorId("removeSelected"), MSG.view_adminTopology_server_removeSelected(), - MSG.common_msg_areYouSure(), new AuthorizedTableAction(this, TableActionEnablement.ANY, - Permission.MANAGE_SETTINGS) { + addTableAction(extendLocatorId("removeSelected"), MSG.view_adminTopology_server_removeSelected(), null, + new AuthorizedTableAction(this, TableActionEnablement.ANY, Permission.MANAGE_SETTINGS) { public void executeAction(final ListGridRecord[] selections, Object actionValue) { - List<String> selectedNames = getSelectedNames(selections); - String message = "Really? Delete? For all I've done for you? " + selectedNames; + final List<String> selectedNames = getSelectedNames(selections); + String message = MSG.view_adminTopology_message_removeAGroupsConfirm(selectedNames.toString()); SC.ask(message, new BooleanCallback() { public void execute(Boolean confirmed) { if (confirmed) { int[] selectedIds = getSelectedIds(selections); - SC.say("setting servers to maintenance mode, ids: " + selectedIds); GWTServiceLookup.getCloudService().deleteAffinityGroups(selectedIds, new AsyncCallback<Integer>() { public void onSuccess(Integer count) { - // TODO: msg with count Message msg = new Message(MSG - .view_admin_plugins_disabledServerPlugins("sdf"), Message.Severity.Info); + .view_adminTopology_message_removedAGroups(String.valueOf(count)), + Message.Severity.Info); CoreGUI.getMessageCenter().notify(msg); refresh(); }
public void onFailure(Throwable caught) { - // TODO: msg CoreGUI.getErrorHandler().handleError( - MSG.view_admin_plugins_disabledServerPluginsFailure() + " " - + caught.getMessage(), caught); + MSG.view_adminTopology_message_removeAGroupsFail(selectedNames + .toString()) + " " + caught.getMessage(), caught); refreshTableInfo(); }
@@ -190,9 +189,16 @@ public class AffinityGroupTableView extends TableSection<AffinityGroupWithCounts nameLengthValidator.setMin(3); nameLengthValidator.setMax(100); name.setValidators(nameLengthValidator); + name.addKeyUpHandler(new KeyUpHandler() { + public void onKeyUp(KeyUpEvent event) { + if ("Enter".equals(event.getKeyName())) { + createNewGroup(modalWindow, form); + } + } + }); + form.setFields(name); layout.addMember(form); - VLayout spacer = new VLayout(); spacer.setHeight(10); layout.addMember(spacer); @@ -203,32 +209,17 @@ public class AffinityGroupTableView extends TableSection<AffinityGroupWithCounts modalWindow.destroy(); } }); - IButton save = new LocatableIButton(this.extendLocatorId("Create"), + final IButton create = new LocatableIButton(this.extendLocatorId("Create"), MSG.view_adminTopology_affinityGroups_createNew()); - save.addClickHandler(new ClickHandler() { + create.addClickHandler(new ClickHandler() { public void onClick(ClickEvent clickEvent) { - if (form.validate()) { - String name = form.getValueAsString(FIELD_NAME); - AffinityGroup affinityGroup = new AffinityGroup(name); - GWTServiceLookup.getCloudService().createAffinityGroup(affinityGroup, new AsyncCallback<Integer>() { - public void onSuccess(Integer affinityGroupId) { - modalWindow.destroy(); - CoreGUI.goToView(VIEW_PATH + "/" + affinityGroupId); - } - - public void onFailure(Throwable caught) { - Map<String, String> errors = new HashMap<String, String>(); - errors.put(FIELD_NAME, caught.getMessage()); - form.setErrors(errors, true); - } - }); - } + createNewGroup(modalWindow, form); } });
HLayout buttons = new HLayout(10); buttons.setLayoutAlign(Alignment.CENTER); - buttons.addMember(save); + buttons.addMember(create); buttons.addMember(cancel); layout.addMember(buttons); modalWindow.addItem(layout); @@ -236,6 +227,25 @@ public class AffinityGroupTableView extends TableSection<AffinityGroupWithCounts name.focusInItem(); }
+ private void createNewGroup(final Window modalWindow, final DynamicForm form) { + if (form.validate()) { + String name = form.getValueAsString(FIELD_NAME); + AffinityGroup affinityGroup = new AffinityGroup(name); + GWTServiceLookup.getCloudService().createAffinityGroup(affinityGroup, new AsyncCallback<Integer>() { + public void onSuccess(Integer affinityGroupId) { + modalWindow.destroy(); + CoreGUI.goToView(VIEW_PATH + "/" + affinityGroupId); + } + + public void onFailure(Throwable caught) { + Map<String, String> errors = new HashMap<String, String>(); + errors.put(FIELD_NAME, caught.getMessage()); + form.setErrors(errors, true); + } + }); + } + } + @Override public ViewName getViewName() { return VIEW_ID; diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupWithCountsDatasource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupWithCountsDatasource.java index e08a88e..bd8b6b3 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupWithCountsDatasource.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupWithCountsDatasource.java @@ -55,14 +55,7 @@ public class AffinityGroupWithCountsDatasource extends RPCDataSource<AffinityGro
FIELD_SERVER_COUNT("serverCount", CoreGUI.getMessages().view_adminTopology_affinityGroups_serverCount());
- /** - * Corresponds to a property name of Server (e.g. operationMode). - */ private String propertyName; - - /** - * The table header for the field or property (e.g. Mode). - */ private String title;
private Fields(String propertyName, String title) { @@ -131,8 +124,8 @@ public class AffinityGroupWithCountsDatasource extends RPCDataSource<AffinityGro processResponse(request.getRequestId(), response); }
- public void onFailure(Throwable caught) { - //todo: CoreGUI.getErrorHandler().handleError(MSG.view_admin_plugins_loadFailure(), t); + public void onFailure(Throwable t) { + CoreGUI.getErrorHandler().handleError(MSG.view_adminTopology_message_fetchAgroupsFail(), t); response.setStatus(DSResponse.STATUS_FAILURE); processResponse(request.getRequestId(), response); } diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDatasource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDatasource.java index ac1d26b..dd596e9 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDatasource.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDatasource.java @@ -42,9 +42,8 @@ import com.smartgwt.client.widgets.grid.ListGridRecord;
import org.rhq.core.domain.criteria.AgentCriteria; import org.rhq.core.domain.resource.Agent; -import org.rhq.core.domain.util.PageControl; import org.rhq.core.domain.util.PageList; -import org.rhq.core.domain.util.PageOrdering; +import org.rhq.enterprise.gui.coregui.client.CoreGUI; import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter; import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup; import org.rhq.enterprise.gui.coregui.client.util.Log; @@ -61,7 +60,6 @@ public class AgentDatasource extends RPCDataSource<Agent, AgentCriteria> { public static final String FILTER_PORT = FIELD_PORT.propertyName(); public static final String FILTER_SERVER_ID = "serverId"; public static final String FILTER_AFFINITY_GROUP_ID = "affinityGroupId"; -
private final Integer id; private final boolean isAffinityGroupId; @@ -115,31 +113,10 @@ public class AgentDatasource extends RPCDataSource<Agent, AgentCriteria> {
@Override protected void executeFetch(final DSRequest request, final DSResponse response, AgentCriteria criteria) { -// final PageControl pc = getPageControl(request); - -// AsyncCallback<PageList<Agent>> callback = new AsyncCallback<PageList<Agent>>() { -// public void onSuccess(PageList<Agent> result) { -// response.setData(buildRecords(result)); -// response.setTotalRows(result.size()); -// processResponse(request.getRequestId(), response); -// } -// -// @Override -// public void onFailure(Throwable t) { -// //todo: CoreGUI.getErrorHandler().handleError(MSG.view_admin_plugins_loadFailure(), t); -// response.setStatus(DSResponse.STATUS_FAILURE); -// processResponse(request.getRequestId(), response); -// } -// }; -// -// if (isAffinityGroupId) { -// GWTServiceLookup.getCloudService().getAgentMembersByAffinityGroupId(id, pc, callback); criteria.addFilterAffinityGroupId(id); - } else if (id != null) { - // if id == null all agent are returned + } else { criteria.addFilterServerId(id); -// GWTServiceLookup.getAgentService().getAgentsByServer(id, pc, callback); }
GWTServiceLookup.getCloudService().findAgentsByCriteria(criteria, new AsyncCallback<PageList<Agent>>() { @@ -151,38 +128,13 @@ public class AgentDatasource extends RPCDataSource<Agent, AgentCriteria> {
@Override public void onFailure(Throwable t) { - //todo: CoreGUI.getErrorHandler().handleError(MSG.view_admin_plugins_loadFailure(), t); + CoreGUI.getErrorHandler().handleError(MSG.view_adminTopology_message_fetchAgents2Fail(), t); response.setStatus(DSResponse.STATUS_FAILURE); processResponse(request.getRequestId(), response); } }); }
- /** - * Returns a prepopulated PageControl based on the provided DSRequest. This will set sort fields, - * pagination, but *not* filter fields. - * - * @param request the request to turn into a page control - * @return the page control for passing to criteria and other queries - */ - protected PageControl getPageControl(DSRequest request) { - // Initialize paging. - PageControl pageControl = new PageControl(0, getDataPageSize()); - - // Initialize sorting. - String sortBy = request.getAttribute("sortBy"); - if (sortBy != null) { - String[] sorts = sortBy.split(","); - for (String sort : sorts) { - PageOrdering ordering = (sort.startsWith("-")) ? PageOrdering.DESC : PageOrdering.ASC; - String columnName = (ordering == PageOrdering.DESC) ? sort.substring(1) : sort; - pageControl.addDefaultOrderingField(columnName, ordering); - } - } - - return pageControl; - } - @Override public Agent copyValues(Record from) { throw new UnsupportedOperationException("AgentNodeDatasource.copyValues(Record from)"); @@ -216,7 +168,6 @@ public class AgentDatasource extends RPCDataSource<Agent, AgentCriteria> { criteria.addFilterPort(getFilter(request, FILTER_PORT, Integer.class)); criteria.addFilterServerId(getFilter(request, FILTER_SERVER_ID, Integer.class)); criteria.addFilterAffinityGroupId(getFilter(request, FILTER_AFFINITY_GROUP_ID, Integer.class)); -
//@todo: Remove me when finished debugging search expression Log.debug(" *** AgentCriteria Search String: " + getFilter(request, "search", String.class)); diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDatasourceField.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDatasourceField.java index 26792d4..7935446 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDatasourceField.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDatasourceField.java @@ -33,19 +33,20 @@ public enum AgentDatasourceField { FIELD_NAME("name", CoreGUI.getMessages().common_title_name()),
FIELD_SERVER("server", CoreGUI.getMessages().view_adminTopology_agent_connectedServer()), - + FIELD_SERVER_ID("serverId", "serverId"),
FIELD_ADDRESS("address", CoreGUI.getMessages().view_adminTopology_agent_agentBindAddress()),
FIELD_PORT("port", CoreGUI.getMessages().view_adminTopology_agent_agentBindPort()),
- FIELD_LAST_AVAILABILITY_REPORT("lastAvailabilityReport", CoreGUI.getMessages().view_adminTopology_agent_lastAvailabilityReport()), + FIELD_LAST_AVAILABILITY_REPORT("lastAvailabilityReport", CoreGUI.getMessages() + .view_adminTopology_agent_lastAvailabilityReport()),
FIELD_AGENT_TOKEN("agentToken", CoreGUI.getMessages().view_adminTopology_agentDetail_token()),
FIELD_AFFINITY_GROUP("affinityGroup", CoreGUI.getMessages().view_adminTopology_server_affinityGroup()), - + FIELD_AFFINITY_GROUP_ID("affinityGroupId", "affinityGroupId");
/** diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDetailView.java index f48e7b7..7e5c3ac 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDetailView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDetailView.java @@ -31,7 +31,6 @@ import com.google.gwt.user.client.Timer; import com.google.gwt.user.client.rpc.AsyncCallback; import com.smartgwt.client.types.Overflow; import com.smartgwt.client.types.VisibilityMode; -import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.form.fields.StaticTextItem; import com.smartgwt.client.widgets.layout.SectionStack; import com.smartgwt.client.widgets.layout.SectionStackSection; diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentTableView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentTableView.java index dc34602..8c47813 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentTableView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentTableView.java @@ -55,7 +55,7 @@ public class AgentTableView extends TableSection<AgentDatasource> implements Has + AdministrationView.SECTION_TOPOLOGY_VIEW_ID + "/" + VIEW_ID;
private final boolean isAffinityGroupId; - + private final Integer id;
public AgentTableView(String locatorId, Integer id, boolean isAffinityGroupId) { @@ -91,7 +91,7 @@ public class AgentTableView extends TableSection<AgentDatasource> implements Has } }); } else if (field.getName() == FIELD_SERVER.propertyName()) { - // adding the cell formatter for server field (clickable link) + // adding the cell formatter for server field (clickable link) field.setCellFormatter(new CellFormatter() { @Override public String format(Object value, ListGridRecord record, int rowNum, int colNum) { @@ -105,7 +105,7 @@ public class AgentTableView extends TableSection<AgentDatasource> implements Has } }); } else if (field.getName() == FIELD_AFFINITY_GROUP.propertyName()) { - // adding the cell formatter for affinity group field (clickable link) + // adding the cell formatter for affinity group field (clickable link) field.setCellFormatter(new CellFormatter() { @Override public String format(Object value, ListGridRecord record, int rowNum, int colNum) { diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/FailoverListItemDatasource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/FailoverListItemDatasource.java index 6dd2430..6bfa378 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/FailoverListItemDatasource.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/FailoverListItemDatasource.java @@ -43,6 +43,7 @@ import com.smartgwt.client.widgets.grid.ListGridRecord; import org.rhq.core.domain.cloud.FailoverListDetails; import org.rhq.core.domain.criteria.Criteria; import org.rhq.core.domain.util.PageControl; +import org.rhq.enterprise.gui.coregui.client.CoreGUI; import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter; import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
@@ -53,14 +54,14 @@ import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup; public class FailoverListItemDatasource extends AbstractServerNodeDatasource<FailoverListDetails, Criteria> {
private final int agentId; - + // this delegate is there to not repeat the copyValues code private final ServerDatasource serverDatasource;
public FailoverListItemDatasource(int agentId) { super(); this.agentId = agentId; - this.serverDatasource = new ServerDatasource(null, false); + this.serverDatasource = new ServerDatasource(null); List<DataSourceField> fields = addDataSourceFields(); addFields(fields); } @@ -111,13 +112,14 @@ public class FailoverListItemDatasource extends AbstractServerNodeDatasource<Fai
@Override public void onFailure(Throwable t) { - //todo: CoreGUI.getErrorHandler().handleError(MSG.view_admin_plugins_loadFailure(), t); + CoreGUI.getErrorHandler().handleError(MSG.view_adminTopology_message_fetchFailOverLists(), t); response.setStatus(DSResponse.STATUS_FAILURE); processResponse(request.getRequestId(), response); } }); }
+ @Override protected PageControl getPageControl(DSRequest request) { return serverDatasource.getPageControl(request); } diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/PartitionEventDatasource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/PartitionEventDatasource.java index f77a843..c3d103b 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/PartitionEventDatasource.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/PartitionEventDatasource.java @@ -27,7 +27,6 @@ import static org.rhq.enterprise.gui.coregui.client.admin.topology.PartitionEven
import java.util.ArrayList; import java.util.List; -import java.util.Map;
import com.google.gwt.user.client.rpc.AsyncCallback; import com.smartgwt.client.data.DSRequest; @@ -42,11 +41,11 @@ import org.rhq.core.domain.cloud.PartitionEvent; import org.rhq.core.domain.cloud.PartitionEvent.ExecutionStatus; import org.rhq.core.domain.cloud.PartitionEventType; import org.rhq.core.domain.criteria.PartitionEventCriteria; -import org.rhq.core.domain.util.PageControl; import org.rhq.core.domain.util.PageList; -import org.rhq.core.domain.util.PageOrdering; +import org.rhq.enterprise.gui.coregui.client.CoreGUI; import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter; import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup; +import org.rhq.enterprise.gui.coregui.client.util.Log; import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
/** @@ -95,8 +94,6 @@ public class PartitionEventDatasource extends RPCDataSource<PartitionEvent, Part
@Override protected void executeFetch(final DSRequest request, final DSResponse response, PartitionEventCriteria criteria) { - // final PageControl pc = getPageControl(request); - GWTServiceLookup.getCloudService().findPartitionEventsByCriteria(criteria, new AsyncCallback<PageList<PartitionEvent>>() { public void onSuccess(PageList<PartitionEvent> result) { @@ -107,38 +104,13 @@ public class PartitionEventDatasource extends RPCDataSource<PartitionEvent, Part
@Override public void onFailure(Throwable t) { - //todo: CoreGUI.getErrorHandler().handleError(MSG.view_admin_plugins_loadFailure(), t); + CoreGUI.getErrorHandler().handleError(MSG.view_adminTopology_message_fetchPEventFail(), t); response.setStatus(DSResponse.STATUS_FAILURE); processResponse(request.getRequestId(), response); } }); }
- /** - * Returns a prepopulated PageControl based on the provided DSRequest. This will set sort fields, - * pagination, but *not* filter fields. - * - * @param request the request to turn into a page control - * @return the page control for passing to criteria and other queries - */ - protected PageControl getPageControl(DSRequest request) { - // Initialize paging. - PageControl pageControl = new PageControl(0, getDataPageSize()); - - // Initialize sorting. - String sortBy = request.getAttribute("sortBy"); - if (sortBy != null) { - String[] sorts = sortBy.split(","); - for (String sort : sorts) { - PageOrdering ordering = (sort.startsWith("-")) ? PageOrdering.DESC : PageOrdering.ASC; - String columnName = (ordering == PageOrdering.DESC) ? sort.substring(1) : sort; - pageControl.addDefaultOrderingField(columnName, ordering); - } - } - - return pageControl; - } - @Override public PartitionEvent copyValues(Record from) { throw new UnsupportedOperationException("PartitionEventDatasource.copyValues(Record from)"); @@ -150,46 +122,27 @@ public class PartitionEventDatasource extends RPCDataSource<PartitionEvent, Part record.setAttribute(FIELD_ID.propertyName(), from.getId()); record.setAttribute(FIELD_CTIME.propertyName(), from.getCtime()); record.setAttribute(FIELD_EVENT_TYPE.propertyName(), from.getEventType() == null ? "" : from.getEventType()); - record.setAttribute(FIELD_EVENT_DETAIL.propertyName(), from.getEventDetail() == null ? "" : from.getEventDetail()); - record.setAttribute(FIELD_SUBJECT_NAME.propertyName(), from.getSubjectName() == null ? "" : from.getSubjectName()); - record.setAttribute(FIELD_EXECUTION_STATUS.propertyName(), from.getExecutionStatus() == null ? "" : from.getExecutionStatus()); + record.setAttribute(FIELD_EVENT_DETAIL.propertyName(), + from.getEventDetail() == null ? "" : from.getEventDetail()); + record.setAttribute(FIELD_SUBJECT_NAME.propertyName(), + from.getSubjectName() == null ? "" : from.getSubjectName()); + record.setAttribute(FIELD_EXECUTION_STATUS.propertyName(), + from.getExecutionStatus() == null ? "" : from.getExecutionStatus()); return record; }
@Override protected PartitionEventCriteria getFetchCriteria(DSRequest request) { - //todo: do it like in ResourceDatasource.class - - - ExecutionStatus[] statuses = getArrayFilter(request, FILTER_EXECUTION_STATUS, ExecutionStatus.class); - PartitionEventType[] types = getArrayFilter(request, FILTER_EVENT_TYPE, PartitionEventType.class); - if (types == null || types.length == 0 || statuses == null || statuses.length == 0) { - return null; // user didn't select any type or status - return null to indicate no data should be displayed - } - PartitionEventCriteria criteria = new PartitionEventCriteria(); - // This code is unlikely to be necessary as the encompassing view should be using an initial - // sort specifier. But just in case, make sure we set the initial sort. Note that we have to - // manipulate the PageControl directly as per the restrictions on getFetchCriteria() (see jdoc). - PageControl pageControl = getPageControl(request); - if (pageControl.getOrderingFields().isEmpty()) { - pageControl.initDefaultOrderingField(FIELD_CTIME.propertyName(), PageOrdering.DESC); - } - - // TODO: This call is broken in 2.2, http://code.google.com/p/smartgwt/issues/detail?id=490 - // when using AdvancedCriteria - Map<String, Object> criteriaMap = request.getCriteria().getValues(); - criteria.addFilterEventDetail((String) criteriaMap.get(FILTER_EVENT_DETAIL)); - - // There's no need to add a exec. status filter to the criteria if the user specified all exec. statuses. - if (statuses.length != ExecutionStatus.values().length) { - criteria.addFilterExecutionStatus(statuses); - } - - // There's no need to add a event type filter to the criteria if the user specified all event types. - if (types.length != PartitionEventType.values().length) { - criteria.addFilterEventType(types); - } + // printRequestCriteria(request); + criteria.addFilterId(getFilter(request, FIELD_ID.propertyName(), Integer.class)); + criteria.addFilterEventDetail(getFilter(request, FIELD_EVENT_DETAIL.propertyName(), String.class)); + criteria.addFilterExecutionStatus(getArrayFilter(request, FILTER_EXECUTION_STATUS, ExecutionStatus.class)); + criteria.addFilterEventType(getArrayFilter(request, FILTER_EVENT_TYPE, PartitionEventType.class)); + + //@todo: Remove me when finished debugging search expression + Log.debug(" *** PartitionEventCriteria Search String: " + getFilter(request, "search", String.class)); + criteria.setSearchExpression(getFilter(request, "search", String.class));
return criteria; } diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/PartitionEventDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/PartitionEventDetailView.java index dc96374..4210202 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/PartitionEventDetailView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/PartitionEventDetailView.java @@ -29,7 +29,6 @@ import com.google.gwt.user.client.Timer; import com.google.gwt.user.client.rpc.AsyncCallback; import com.smartgwt.client.types.Overflow; import com.smartgwt.client.types.VisibilityMode; -import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.Label; import com.smartgwt.client.widgets.form.fields.StaticTextItem; import com.smartgwt.client.widgets.grid.ListGrid; @@ -44,6 +43,7 @@ import org.rhq.core.domain.criteria.PartitionEventCriteria; import org.rhq.core.domain.util.PageControl; import org.rhq.core.domain.util.PageList; import org.rhq.enterprise.gui.coregui.client.BookmarkableView; +import org.rhq.enterprise.gui.coregui.client.CoreGUI; import org.rhq.enterprise.gui.coregui.client.ViewPath; import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter; import org.rhq.enterprise.gui.coregui.client.gwt.CloudGWTServiceAsync; @@ -90,32 +90,39 @@ public class PartitionEventDetailView extends LocatableVLayout implements Bookma PartitionEventCriteria criteria = new PartitionEventCriteria(); criteria.addFilterId(partitionEventId); final CloudGWTServiceAsync service = GWTServiceLookup.getCloudService(); - service.findPartitionEventsByCriteria(criteria, - new AsyncCallback<PageList<PartitionEvent>>() { - public void onSuccess(final PageList<PartitionEvent> events) { - if (events == null || events.size() != 1) { - //TODO: notify user in msg center - return; - } - prepareDetailsSection(sectionStack, events.get(0)); - service.getPartitionEventDetails(partitionEventId, - PageControl.getUnlimitedInstance(), new AsyncCallback<PageList<PartitionEventDetails>>() { - public void onSuccess(PageList<PartitionEventDetails> result) { - prepareAssignmentsSection(sectionStack, result); - } - public void onFailure(Throwable caught) { - SC.say("er2:" + caught); - //TODO: CoreGUI.getErrorHandler().handleError(MSG.view_admin_plugins_loadFailure(), caught); - } - }); - + service.findPartitionEventsByCriteria(criteria, new AsyncCallback<PageList<PartitionEvent>>() { + public void onSuccess(final PageList<PartitionEvent> events) { + if (events == null || events.size() != 1) { + CoreGUI.getErrorHandler().handleError( + MSG.view_adminTopology_message_fetchPEventDetailsFail(String.valueOf(partitionEventId))); + initSectionCount = SECTION_COUNT; + return; } + prepareDetailsSection(sectionStack, events.get(0)); + service.getPartitionEventDetails(partitionEventId, PageControl.getUnlimitedInstance(), + new AsyncCallback<PageList<PartitionEventDetails>>() { + public void onSuccess(PageList<PartitionEventDetails> result) { + prepareAssignmentsSection(sectionStack, result); + } + + public void onFailure(Throwable caught) { + CoreGUI.getErrorHandler() + .handleError( + MSG.view_adminTopology_message_fetchPEventDetailsFail(String + .valueOf(partitionEventId))); + initSectionCount = SECTION_COUNT; + return; + } + });
- public void onFailure(Throwable caught) { - SC.say("er1:" + caught); - //TODO: CoreGUI.getErrorHandler().handleError(MSG.view_admin_plugins_loadFailure(), caught); - } - }); + } + + public void onFailure(Throwable caught) { + CoreGUI.getErrorHandler().handleError( + MSG.view_adminTopology_message_fetchPEventDetailsFail(String.valueOf(partitionEventId))); + initSectionCount = SECTION_COUNT; + } + }); }
public boolean isInitialized() { @@ -165,7 +172,8 @@ public class PartitionEventDetailView extends LocatableVLayout implements Bookma // there is no need for datasource, it is a simple table with two columns ListGrid assignments = new ListGrid(); ListGridField agentName = new ListGridField("agentName", MSG.view_adminTopology_agent_agentName()); - ListGridField serverName = new ListGridField("serverName", MSG.view_admin_systemSettings_serverDetails_serverName()); + ListGridField serverName = new ListGridField("serverName", + MSG.view_admin_systemSettings_serverDetails_serverName()); assignments.setFields(agentName, serverName); ListGridRecord[] records = new ListGridRecord[eventDetails.size()]; for (int i = 0; i < eventDetails.size(); i++) { diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/PartitionEventTableView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/PartitionEventTableView.java index b25a4d3..7fa9a7c 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/PartitionEventTableView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/PartitionEventTableView.java @@ -18,6 +18,7 @@ */ package org.rhq.enterprise.gui.coregui.client.admin.topology;
+import java.util.ArrayList; import java.util.List;
import com.google.gwt.user.client.rpc.AsyncCallback; @@ -63,18 +64,29 @@ public class PartitionEventTableView extends TableSection<PartitionEventDatasour public static final String VIEW_PATH = AdministrationView.VIEW_ID + "/" + AdministrationView.SECTION_TOPOLOGY_VIEW_ID + "/" + VIEW_ID;
- private static final Criteria INITIAL_CRITERIA = new Criteria();
- private static SortSpecifier DEFAULT_SORT_SPECIFIER = new SortSpecifier(PartitionEventCriteria.SORT_FIELD_CTIME, - SortDirection.DESCENDING); + private static final SortSpecifier DEFAULT_SORT_SPECIFIER = new SortSpecifier( + PartitionEventCriteria.SORT_FIELD_CTIME, SortDirection.DESCENDING); + + private enum TableAction { + REMOVE_SELECTED(MSG.view_adminTopology_server_removeSelected(), TableActionEnablement.ANY), PURGE_ALL(MSG + .view_adminTopology_partitionEvents_purgeAll(), TableActionEnablement.ALWAYS), FORCE_REPARTITION(MSG + .view_adminTopology_partitionEvents_forceRepartition(), TableActionEnablement.ALWAYS); + + private String title; + private TableActionEnablement enablement; + + private TableAction(String title, TableActionEnablement enablement) { + this.title = title; + this.enablement = enablement; + } + }
public PartitionEventTableView(String locatorId, String tableTitle) { super(locatorId, tableTitle, INITIAL_CRITERIA, new SortSpecifier[] { DEFAULT_SORT_SPECIFIER }); - setHeight100(); setWidth100(); - setInitialCriteriaFixed(false); setDataSource(new PartitionEventDatasource()); } @@ -89,22 +101,6 @@ public class PartitionEventTableView extends TableSection<PartitionEventDatasour
final TextItem detail = new TextItem(PartitionEventDatasource.FILTER_EVENT_DETAIL, MSG.view_adminTopology_partitionEvents_detailsFilter()); - // detail.setValue(""); - - // startDateFilter = new DateFilterItem(DateFilterItem.START_DATE_FILTER, MSG.filter_from_date()); - // endDateFilter = new DateFilterItem(DateFilterItem.END_DATE_FILTER, MSG.filter_to_date()); - -// SpacerItem spacerItem = new SpacerItem(); -// spacerItem.setColSpan(1); -// final ButtonItem showAll = new ButtonItem("showAll", "Show All"); -// showAll.addClickHandler(new ClickHandler() { -// public void onClick(ClickEvent event) { -// statusFilter.init(ExecutionStatus.class, null, null); -// typeFilter.init(PartitionEventType.class, null, null); -// detail.setValue(""); -// refresh(); -// } -// });
if (isShowFilterForm()) { setFilterFormItems(statusFilter, detail, typeFilter); @@ -118,7 +114,7 @@ public class PartitionEventTableView extends TableSection<PartitionEventDatasour ListGrid listGrid = getListGrid(); listGrid.setFields(fields.toArray(new ListGridField[fields.size()])); showActions(); - + for (ListGridField field : fields) { // adding the cell formatter for name field (clickable link) if (field.getName() == PartitionEventDatasourceField.FIELD_EVENT_TYPE.propertyName()) { @@ -137,140 +133,97 @@ public class PartitionEventTableView extends TableSection<PartitionEventDatasour } }
- // @Override - // protected String getDetailsLinkColumnName() { - // return PartitionEventDatasourceField.FIELD_EVENT_TYPE.propertyName(); - // } - // - // @Override - // protected CellFormatter getDetailsLinkColumnCellFormatter() { - // return new CellFormatter() { - // public String format(Object value, ListGridRecord record, int rowNum, int colNum) { - // Integer recordId = getId(record); - // String detailsUrl = "#" + VIEW_PATH + "/" + recordId; - // return SeleniumUtility.getLocatableHref(detailsUrl, detailsUrl, null); - // } - // }; - // } - @Override public Canvas getDetailsView(Integer id) { return new PartitionEventDetailView(extendLocatorId("detailsView"), id); }
private void showActions() { - addTableAction(extendLocatorId("removeSelected"), MSG.view_adminTopology_server_removeSelected(), - MSG.common_msg_areYouSure(), new AuthorizedTableAction(this, TableActionEnablement.ANY, - Permission.MANAGE_SETTINGS) { - public void executeAction(final ListGridRecord[] selections, Object actionValue) { - String message = "Really? Delete? For all I've done for you? "; - SC.ask(message, new BooleanCallback() { - public void execute(Boolean confirmed) { - if (confirmed) { - int[] selectedIds = getSelectedIds(selections); - SC.say("setting servers to maintenance mode, ids: " + selectedIds); - GWTServiceLookup.getCloudService().deletePartitionEvents(selectedIds, - new AsyncCallback<Void>() { - public void onSuccess(Void arg0) { - // TODO: msg - Message msg = new Message(MSG - .view_admin_plugins_disabledServerPlugins("sdf"), Message.Severity.Info); - CoreGUI.getMessageCenter().notify(msg); - refresh(); - } - - public void onFailure(Throwable caught) { - // TODO: msg - CoreGUI.getErrorHandler().handleError( - MSG.view_admin_plugins_disabledServerPluginsFailure() + " " - + caught.getMessage(), caught); - refreshTableInfo(); - } + addTableAction(TableAction.REMOVE_SELECTED); + addTableAction(TableAction.PURGE_ALL); + addTableAction(TableAction.FORCE_REPARTITION); + }
- }); - } else { - refreshTableInfo(); - } - } - }); + private void addTableAction(final TableAction action) { + addTableAction(extendLocatorId(action.toString()), action.title, null, new AuthorizedTableAction(this, + action.enablement, Permission.MANAGE_SETTINGS) { + public void executeAction(final ListGridRecord[] selections, Object actionValue) { + String eventTypes = getSelectedEventTypes(selections).toString(); + String message = null; + switch (action) { + case REMOVE_SELECTED: + message = MSG.view_adminTopology_message_removePEventConfirm(eventTypes); + break; + case PURGE_ALL: + message = MSG.view_adminTopology_message_removeAllPEventConfirm(); + break; + case FORCE_REPARTITION: + message = MSG.view_adminTopology_message_forceRepartition(); + break; + default: + throw new IllegalArgumentException("unknown table action type"); } - }); - - addTableAction(extendLocatorId("purgeAll"), MSG.view_adminTopology_partitionEvents_purgeAll(), - MSG.common_msg_areYouSure(), new AuthorizedTableAction(this, TableActionEnablement.ALWAYS, - Permission.MANAGE_SETTINGS) { - public void executeAction(final ListGridRecord[] selections, Object actionValue) { - // TODO: msg - // String message = MSG.view_admin_plugins_serverDisableConfirm(selectedNames.toString()); - String message = "Really? Normal? For all I've done for you? "; - SC.ask(message, new BooleanCallback() { - public void execute(Boolean confirmed) { - if (confirmed) { - int[] selectedIds = getSelectedIds(selections); - SC.say("setting servers to maintenance mode, ids: " + selectedIds); - GWTServiceLookup.getCloudService().purgeAllEvents(new AsyncCallback<Void>() { - public void onSuccess(Void arg0) { - // TODO: msg - Message msg = new Message(MSG.view_admin_plugins_disabledServerPlugins("sdf"), - Message.Severity.Info); - CoreGUI.getMessageCenter().notify(msg); - refresh(); + SC.ask(message, new BooleanCallback() { + public void execute(Boolean confirmed) { + if (confirmed) { + int[] selectedIds = getSelectedIds(selections); + + AsyncCallback<Void> callback = new AsyncCallback<Void>() { + public void onSuccess(Void arg0) { + String msgString = null; + switch (action) { + case REMOVE_SELECTED: + msgString = MSG.view_adminTopology_message_removedPEvent(String + .valueOf(selections.length)); + break; + case PURGE_ALL: + msgString = MSG.view_adminTopology_message_removedAllPEvent(); + break; + case FORCE_REPARTITION: + msgString = MSG.view_adminTopology_message_repartitioned(); } - - public void onFailure(Throwable caught) { - // TODO: msg - CoreGUI.getErrorHandler().handleError( - MSG.view_admin_plugins_disabledServerPluginsFailure() + " " - + caught.getMessage(), caught); - refreshTableInfo(); + Message msg = new Message(msgString, Message.Severity.Info); + CoreGUI.getMessageCenter().notify(msg); + refresh(); + } + + public void onFailure(Throwable caught) { + String msgString = null; + switch (action) { + case REMOVE_SELECTED: + msgString = MSG.view_adminTopology_message_removePEventFail(String + .valueOf(selections.length)); + break; + case PURGE_ALL: + msgString = MSG.view_adminTopology_message_removedAllPEventFail(); + break; + case FORCE_REPARTITION: + msgString = MSG.view_adminTopology_message_forceRepartitionFail(); } - - }); - } else { - refreshTableInfo(); + CoreGUI.getErrorHandler() + .handleError(msgString + " " + caught.getMessage(), caught); + refreshTableInfo(); + } + + }; + switch (action) { + case REMOVE_SELECTED: + GWTServiceLookup.getCloudService().deletePartitionEvents(selectedIds, callback); + break; + case PURGE_ALL: + GWTServiceLookup.getCloudService().purgeAllEvents(callback); + break; + case FORCE_REPARTITION: + GWTServiceLookup.getCloudService().cloudPartitionEventRequest(callback); } - } - }); - } - }); - - addTableAction(extendLocatorId("forceRepartition"), MSG.view_adminTopology_partitionEvents_forceRepartition(), - new AuthorizedTableAction(this, TableActionEnablement.ALWAYS, Permission.MANAGE_SETTINGS) { - public void executeAction(final ListGridRecord[] selections, Object actionValue) { - // List<String> selectedNames = getSelectedNames(selections); - // TODO: msg - // String message = MSG.view_admin_plugins_serverDisableConfirm(selectedNames.toString()); - String message = "Really? Repartition? For all I've done for you? ";// + selectedNames; - SC.ask(message, new BooleanCallback() { - public void execute(Boolean confirmed) { - if (confirmed) { - SC.say("repartition is now forced"); - GWTServiceLookup.getCloudService().cloudPartitionEventRequest( - new AsyncCallback<Void>() { - public void onSuccess(Void arg0) { - // TODO: msg - Message msg = new Message(MSG - .view_admin_plugins_disabledServerPlugins("sdf"), Message.Severity.Info); - CoreGUI.getMessageCenter().notify(msg); - refresh(); - }
- public void onFailure(Throwable caught) { - // TODO: msg - CoreGUI.getErrorHandler().handleError( - MSG.view_admin_plugins_disabledServerPluginsFailure() + " " - + caught.getMessage(), caught); - refreshTableInfo(); - } - - }); - } else { - refreshTableInfo(); - } + } else { + refreshTableInfo(); } - }); - } - }); + } + }); + } + }); }
private int[] getSelectedIds(ListGridRecord[] selections) { @@ -285,16 +238,16 @@ public class PartitionEventTableView extends TableSection<PartitionEventDatasour return ids; }
- // private List<String> getSelectedNames(ListGridRecord[] selections) { - // if (selections == null) { - // return new ArrayList<String>(0); - // } - // List<String> ids = new ArrayList<String>(selections.length); - // for (ListGridRecord selection : selections) { - // ids.add(selection.getAttributeAsString(FIELD_NAME)); - // } - // return ids; - // } + private List<String> getSelectedEventTypes(ListGridRecord[] selections) { + if (selections == null) { + return new ArrayList<String>(0); + } + List<String> ids = new ArrayList<String>(selections.length); + for (ListGridRecord selection : selections) { + ids.add(selection.getAttributeAsString(PartitionEventDatasourceField.FIELD_EVENT_TYPE.propertyName())); + } + return ids; + }
@Override public ViewName getViewName() { diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerDatasource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerDatasource.java index 2d1a75e..0e7fd48 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerDatasource.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerDatasource.java @@ -21,7 +21,6 @@ package org.rhq.enterprise.gui.coregui.client.admin.topology; import static org.rhq.enterprise.gui.coregui.client.admin.topology.ServerDatasourceField.FIELD_ADDRESS; import static org.rhq.enterprise.gui.coregui.client.admin.topology.ServerDatasourceField.FIELD_AFFINITY_GROUP; import static org.rhq.enterprise.gui.coregui.client.admin.topology.ServerDatasourceField.FIELD_AFFINITY_GROUP_ID; -import static org.rhq.enterprise.gui.coregui.client.admin.topology.ServerDatasourceField.FIELD_AGENT_COUNT; import static org.rhq.enterprise.gui.coregui.client.admin.topology.ServerDatasourceField.FIELD_ID; import static org.rhq.enterprise.gui.coregui.client.admin.topology.ServerDatasourceField.FIELD_MTIME; import static org.rhq.enterprise.gui.coregui.client.admin.topology.ServerDatasourceField.FIELD_NAME; @@ -47,6 +46,7 @@ import org.rhq.core.domain.criteria.ServerCriteria; import org.rhq.core.domain.util.PageControl; import org.rhq.core.domain.util.PageList; import org.rhq.core.domain.util.PageOrdering; +import org.rhq.enterprise.gui.coregui.client.CoreGUI; import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter; import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup; import org.rhq.enterprise.gui.coregui.client.util.Log; @@ -56,7 +56,7 @@ import org.rhq.enterprise.gui.coregui.client.util.Log; * */ public class ServerDatasource extends AbstractServerNodeDatasource<Server, ServerCriteria> { - + // filters public static final String FILTER_ADDRESS = FIELD_ADDRESS.propertyName(); public static final String FILTER_PORT = FIELD_PORT.propertyName(); @@ -66,13 +66,10 @@ public class ServerDatasource extends AbstractServerNodeDatasource<Server, Serve public static final String FILTER_AFFINITY_GROUP_ID = "affinityGroupId";
private final Integer affinityGroupId; - - private final boolean fetchMembers;
- public ServerDatasource(Integer affinityGroupId, boolean fetchMembers) { + public ServerDatasource(Integer affinityGroupId) { super(); this.affinityGroupId = affinityGroupId; - this.fetchMembers = fetchMembers; List<DataSourceField> fields = addDataSourceFields(); addFields(fields); } @@ -107,36 +104,28 @@ public class ServerDatasource extends AbstractServerNodeDatasource<Server, Serve ListGridField affinityGroupIdField = FIELD_AFFINITY_GROUP_ID.getListGridField(); affinityGroupIdField.setHidden(true); fields.add(affinityGroupIdField); - fields.add(FIELD_AGENT_COUNT.getListGridField("75"));
return fields; }
@Override protected void executeFetch(final DSRequest request, final DSResponse response, ServerCriteria criteria) { - if (affinityGroupId == null) { - return; + if (affinityGroupId != null) { + criteria.addFilterAffinityGroupId(affinityGroupId); } - final PageControl pc = getPageControl(request); - AsyncCallback<PageList<Server>> callback = new AsyncCallback<PageList<Server>>() { + GWTServiceLookup.getCloudService().findServersByCriteria(criteria, new AsyncCallback<PageList<Server>>() { public void onSuccess(PageList<Server> result) { response.setData(buildRecords(result)); response.setTotalRows(result.size()); processResponse(request.getRequestId(), response); }
- @Override public void onFailure(Throwable t) { - //todo: CoreGUI.getErrorHandler().handleError(MSG.view_admin_plugins_loadFailure(), t); + CoreGUI.getErrorHandler().handleError(MSG.view_adminTopology_message_fetchServers2Fail(), t); response.setStatus(DSResponse.STATUS_FAILURE); processResponse(request.getRequestId(), response); } - }; - - if(fetchMembers) { - criteria.addFilterAffinityGroupId(affinityGroupId); - } - GWTServiceLookup.getCloudService().findServersByCriteria(criteria, callback); + }); }
/** @@ -146,6 +135,7 @@ public class ServerDatasource extends AbstractServerNodeDatasource<Server, Serve * @param request the request to turn into a page control * @return the page control for passing to criteria and other queries */ + @Override protected PageControl getPageControl(DSRequest request) { // Initialize paging. PageControl pageControl = new PageControl(0, getDataPageSize()); @@ -167,10 +157,6 @@ public class ServerDatasource extends AbstractServerNodeDatasource<Server, Serve @Override public Server copyValues(Record from) { throw new UnsupportedOperationException("ServerDatasource.copyValues(Record from)"); -// Server server = new Server(); -// server.setId(from.getAttributeAsInt(FIELD_ID.propertyName())); -// server.setName(from.getAttributeAsString(FIELD_NAME.propertyName())); -// return server; }
@Override @@ -193,7 +179,7 @@ public class ServerDatasource extends AbstractServerNodeDatasource<Server, Serve @Override protected ServerCriteria getFetchCriteria(DSRequest request) { ServerCriteria criteria = new ServerCriteria(); -// printRequestCriteria(request); + // printRequestCriteria(request); criteria.addFilterId(getFilter(request, FIELD_ID.propertyName(), Integer.class)); criteria.addFilterName(getFilter(request, FIELD_NAME.propertyName(), String.class)); criteria.addFilterAddress(getFilter(request, FILTER_ADDRESS, String.class)); @@ -202,7 +188,7 @@ public class ServerDatasource extends AbstractServerNodeDatasource<Server, Serve criteria.addFilterOperationMode(getFilter(request, FILTER_OPERATION_MODE, OperationMode.class)); criteria.addFilterComputePower(getFilter(request, FILTER_COMPUTE_POWER, Integer.class)); criteria.addFilterAffinityGroupId(getFilter(request, FILTER_AFFINITY_GROUP_ID, Integer.class)); - + //@todo: Remove me when finished debugging search expression Log.debug(" *** ServerCriteria Search String: " + getFilter(request, "search", String.class)); criteria.setSearchExpression(getFilter(request, "search", String.class)); diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerDatasourceField.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerDatasourceField.java index 09577d8..6dbcee3 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerDatasourceField.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerDatasourceField.java @@ -29,9 +29,8 @@ import org.rhq.enterprise.gui.coregui.client.CoreGUI; public enum ServerDatasourceField {
FIELD_ID("id", CoreGUI.getMessages().common_title_id()), - - // todo: i18n - FIELD_ORDINAL("ordinal", "Order"), + + FIELD_ORDINAL("ordinal", CoreGUI.getMessages().view_adminTopology_message_order()),
FIELD_NAME("name", CoreGUI.getMessages().common_title_name()),
@@ -42,13 +41,13 @@ public enum ServerDatasourceField { FIELD_PORT("port", CoreGUI.getMessages().view_adminTopology_server_nonSecurePort()),
FIELD_SECURE_PORT("securePort", CoreGUI.getMessages().view_adminTopology_server_securePort()), - + FIELD_CTIME("ctime", CoreGUI.getMessages().view_adminTopology_serverDetail_installationDate()),
FIELD_MTIME("mtime", CoreGUI.getMessages().view_adminTopology_server_lastUpdateTime()),
FIELD_AFFINITY_GROUP("affinityGroup", CoreGUI.getMessages().view_adminTopology_server_affinityGroup()), - + FIELD_AFFINITY_GROUP_ID("affinityGroupId", "affinityGroupId"),
FIELD_AGENT_COUNT("agentCount", CoreGUI.getMessages().view_adminTopology_server_agentCount()); diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerTableView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerTableView.java index b50e18c..d38d95d 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerTableView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerTableView.java @@ -79,7 +79,7 @@ public class ServerTableView extends setHeight100(); setWidth100(); if (isAffinityGroupId) { - setDataSource(new ServerDatasource(id, true)); + setDataSource(new ServerDatasource(id)); } else { setDataSource(showActions ? new ServerWithAgentCountDatasource() : new FailoverListItemDatasource(id)); } @@ -96,6 +96,7 @@ public class ServerTableView extends listGrid.sort(FIELD_NAME, SortDirection.ASCENDING); showCommonActions(); } else if (isAffinityGroupId) { + listGrid.sort(FIELD_NAME, SortDirection.ASCENDING); // displayed from AffinityGroupDetailView showUpdateMembersAction(); } else { @@ -141,7 +142,7 @@ public class ServerTableView extends }
private void showCommonActions() { - addChangeOperationModeAction(OperationMode.NORMAL, MSG.view_adminTopology_server_setMaintenance()); + addChangeOperationModeAction(OperationMode.NORMAL, MSG.view_adminTopology_server_setNormal()); addChangeOperationModeAction(OperationMode.MAINTENANCE, MSG.view_adminTopology_server_setMaintenance());
addTableAction(extendLocatorId("removeSelected"), MSG.view_adminTopology_server_removeSelected(), null, diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerWithAgentCountDatasource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerWithAgentCountDatasource.java index af52e7a..1b6609b 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerWithAgentCountDatasource.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerWithAgentCountDatasource.java @@ -27,25 +27,28 @@ import com.smartgwt.client.data.DSRequest; import com.smartgwt.client.data.DSResponse; import com.smartgwt.client.data.DataSourceField; import com.smartgwt.client.data.Record; +import com.smartgwt.client.widgets.grid.HoverCustomizer; import com.smartgwt.client.widgets.grid.ListGridField; import com.smartgwt.client.widgets.grid.ListGridRecord;
import org.rhq.core.domain.cloud.composite.ServerWithAgentCountComposite; import org.rhq.core.domain.criteria.Criteria; import org.rhq.core.domain.util.PageControl; +import org.rhq.enterprise.gui.coregui.client.CoreGUI; import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
/** * @author Jirka Kremser * */ -public class ServerWithAgentCountDatasource extends AbstractServerNodeDatasource<ServerWithAgentCountComposite, Criteria> { - +public class ServerWithAgentCountDatasource extends + AbstractServerNodeDatasource<ServerWithAgentCountComposite, Criteria> { + private final ServerDatasource serverDatasource;
public ServerWithAgentCountDatasource() { super(); - serverDatasource = new ServerDatasource(null, false); + serverDatasource = new ServerDatasource(null); List<DataSourceField> fields = addDataSourceFields(); addFields(fields); } @@ -56,7 +59,18 @@ public class ServerWithAgentCountDatasource extends AbstractServerNodeDatasource }
public List<ListGridField> getListGridFields() { - return serverDatasource.getListGridFields(); + List<ListGridField> fields = serverDatasource.getListGridFields(); + ListGridField agentCountField = FIELD_AGENT_COUNT.getListGridField("75"); + agentCountField.setHoverCustomizer(new HoverCustomizer() { + public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) { + return MSG.view_adminTopology_message_agentsCount(FIELD_AGENT_COUNT.propertyName()); + // "There are " + record.getAttributeAsInt(FIELD_AGENT_COUNT.propertyName()) + // + " agents registered to this server."; + } + }); + agentCountField.setShowHover(true); + fields.add(agentCountField); + return fields; }
@Override @@ -72,20 +86,14 @@ public class ServerWithAgentCountDatasource extends AbstractServerNodeDatasource
@Override public void onFailure(Throwable t) { - //todo: CoreGUI.getErrorHandler().handleError(MSG.view_admin_plugins_loadFailure(), t); + CoreGUI.getErrorHandler().handleError(MSG.view_adminTopology_message_fetchServers2Fail(), t); response.setStatus(DSResponse.STATUS_FAILURE); processResponse(request.getRequestId(), response); } }); }
- /** - * Returns a prepopulated PageControl based on the provided DSRequest. This will set sort fields, - * pagination, but *not* filter fields. - * - * @param request the request to turn into a page control - * @return the page control for passing to criteria and other queries - */ + @Override protected PageControl getPageControl(DSRequest request) { return serverDatasource.getPageControl(request); } diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/CloudGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/CloudGWTService.java index df83ba8..4b92d6f 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/CloudGWTService.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/CloudGWTService.java @@ -41,72 +41,197 @@ import org.rhq.core.domain.util.PageControl; import org.rhq.core.domain.util.PageList;
/** + * API for HAAC console, mostly CRUD operations for entities <code>Server</code>, <code>Agent</code>, + * <code>PartitionEvent</code> and <code>AffinityGroup</code>. + * * @author Jiri Kremser */ public interface CloudGWTService extends RemoteService {
/** + * Returns all the servers with agent count. * - * @return a list of all available servers (the servers in MAINTENANCE mode are included as well) + * @param pageControl the page control instance + * @return a list of all available servers (the servers in <code>MAINTENANCE</code> or <code>DOWN</code> mode are included as well) * @throws RuntimeException */ - List<ServerWithAgentCountComposite> getServers(PageControl pc) throws RuntimeException; - - Server getServerById(int serverId) throws RuntimeException; - - List<Agent> getAgentsByServerName(String serverName) throws RuntimeException; + List<ServerWithAgentCountComposite> getServers(PageControl pageControl) throws RuntimeException;
+ /** + * Deletes the servers with provided ids. + * + * @param serverIds array of server ids + * @throws RuntimeException + */ void deleteServers(int[] serverIds) throws RuntimeException;
+ /** + * Updates the server mode to particular servers. + * + * @param serverIds the array of ids of the servers whose modes are object of update + * @param mode the new operation mode + * @throws RuntimeException + */ void updateServerMode(int[] serverIds, Server.OperationMode mode) throws RuntimeException;
+ /** + * Updates the server. + * + * @param server instance of Server + * @throws RuntimeException + */ void updateServer(Server server) throws RuntimeException;
- List<FailoverListDetails> getFailoverListDetailsByAgentId(int agentId, PageControl pc) throws RuntimeException;; + /** + * Returns the list of <code>FailoverListDetails</code> for a particular agent. + * + * @param agentId the id the agent + * @param pageControl the page control instance + * @return a list of <code>FailoverListDetails</code> instances + * @throws RuntimeException + */ + List<FailoverListDetails> getFailoverListDetailsByAgentId(int agentId, PageControl pageControl) throws RuntimeException;;
+ /** + * Finder for <code>PartitionEvent</code> instances + * + * @param criteria the criteria for finding partition events + * @return a list of <code>codePartitionEvent</code> instances + * @throws RuntimeException + */ PageList<PartitionEvent> findPartitionEventsByCriteria(PartitionEventCriteria criteria) throws RuntimeException;
+ /** + * Finder for <code>Server</code> instances + * + * @param criteria the criteria for finding servers + * @return a list of <code>Server</code> instances + * @throws RuntimeException + */ PageList<Server> findServersByCriteria(ServerCriteria criteria) throws RuntimeException;
+ /** + * Finder for <code>Agent</code> instances + * + * @param criteria the criteria for finding agents + * @return a list of <code>Agent</code> instances + * @throws RuntimeException + */ PageList<Agent> findAgentsByCriteria(AgentCriteria criteria) throws RuntimeException;
+ /** + * Request forcing the repartition of the cluster. All agents should eventually reconnects to its most preferred server + * (The first one in their failover list.) + * + * @throws RuntimeException + */ void cloudPartitionEventRequest() throws RuntimeException;
+ /** + * Deletes all the partition events. + * + * @throws RuntimeException + */ void purgeAllEvents() throws RuntimeException;
+ /** + * Deletes some partition events. + * + * @param eventIds the list of ids of partition events to delete + * @throws RuntimeException + */ void deletePartitionEvents(int[] eventIds) throws RuntimeException;
+ /** + * Returns the list of <code>PartitionEventDetails</code> instances. + * + * @param partitionEventId + * @param pageControl the page control instance + * @return list of <code>PartitionEventDetails</code> instances + * @throws RuntimeException + */ PageList<PartitionEventDetails> getPartitionEventDetails(int partitionEventId, PageControl pageControl) throws RuntimeException;
+ /** + * Returns the list with <code>AffinityGroupCountComposite</code> instances, i.e. affinity groups with agent and server + * counts. + * + * @param pageControl the page control instance + * @return list with <code>AffinityGroupCountComposite</code> instances + * @throws RuntimeException + */ PageList<AffinityGroupCountComposite> getAffinityGroupCountComposites(PageControl pageControl) throws RuntimeException;
+ /** + * Deletes some affinity groups. + * + * @param affinityGroupIds array of ids of affinity group to delete + * @return the number of deleted affinity groups + * @throws RuntimeException + */ int deleteAffinityGroups(int[] affinityGroupIds) throws RuntimeException;
+ /** + * Creates new affinity group. + * + * @param affinityGroup instance of <code>AffinityGroup</code> to create + * @return the new id of the affinity group + * @throws RuntimeException + */ int createAffinityGroup(AffinityGroup affinityGroup) throws RuntimeException;
+ /** + * Updates existing affinity group. + * + * @param affinityGroup instance of <code>AffinityGroup</code> + * @throws RuntimeException + */ void updateAffinityGroup(AffinityGroup affinityGroup) throws RuntimeException;
- PageList<Server> getServerMembersByAffinityGroupId(int affinityGroupId, PageControl pageControl) - throws RuntimeException; - - PageList<Server> getServerNonMembersByAffinityGroupId(int affinityGroupId, PageControl pageControl) - throws RuntimeException; - - PageList<Agent> getAgentMembersByAffinityGroupId(int affinityGroupId, PageControl pageControl) - throws RuntimeException; - - PageList<Agent> getAgentNonMembersByAffinityGroupId(int affinityGroupId, PageControl pageControl) - throws RuntimeException; - + /** + * Returns the affinity group based on the provided id. + * + * @param affinityGroupId the id of an affinity group + * @return the instance of <code>AffinityGroup</code> + * @throws RuntimeException + */ AffinityGroup getAffinityGroupById(int affinityGroupId) throws RuntimeException;
+ /** + * Add servers to an existing affinity group. + * + * @param affinityGroupId id of the affinity group into which the servers should be added + * @param serverIds array of ids of servers to be added + * @throws RuntimeException + */ void addServersToGroup(int affinityGroupId, Integer[] serverIds) throws RuntimeException;
+ /** + * Removes the servers from the affinity group. There is no need to provide the id of affinity group, + * because it is part of the server data. + * + * @param serverIds array of ids of servers to be removed + * @throws RuntimeException + */ void removeServersFromGroup(Integer[] serverIds) throws RuntimeException;
+ /** + * Add agents to an existing affinity group. + * + * @param affinityGroupId id of the affinity group into which the agents should be added + * @param agentIds array of ids of agents to be added + * @throws RuntimeException + */ void addAgentsToGroup(int affinityGroupId, Integer[] agentIds) throws RuntimeException;
+ /** + * Removes the agents from the affinity group. There is no need to provide the id of affinity group, + * because it is part of the agent data. + * + * @param agentIds array of ids of agents to be removed + * @throws RuntimeException + */ void removeAgentsFromGroup(Integer[] agentIds) throws RuntimeException; } diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/CloudGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/CloudGWTServiceImpl.java index db7ec3c..dd63fa0 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/CloudGWTServiceImpl.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/CloudGWTServiceImpl.java @@ -22,7 +22,6 @@ */ package org.rhq.enterprise.gui.coregui.server.gwt;
-import java.util.ArrayList; import java.util.List;
import org.apache.commons.lang.ArrayUtils; @@ -58,7 +57,7 @@ public class CloudGWTServiceImpl extends AbstractGWTServiceImpl implements Cloud private static final long serialVersionUID = 1L;
private CloudManagerLocal cloudManager = LookupUtil.getCloudManager(); - + private AgentManagerLocal agentManager = LookupUtil.getAgentManager();
private PartitionEventManagerLocal partitionEventManager = LookupUtil.getPartitionEventManager(); @@ -76,26 +75,6 @@ public class CloudGWTServiceImpl extends AbstractGWTServiceImpl implements Cloud }
@Override - public Server getServerById(int serverId) throws RuntimeException { - try { - return SerialUtility.prepare(cloudManager.getServerById(serverId), "CloudGWTServiceImpl.getServerById"); - } catch (Throwable t) { - throw getExceptionToThrowToClient(t); - } - } - - @Override - public List<Agent> getAgentsByServerName(String serverName) throws RuntimeException { - try { - List<Agent> persistentBag = SerialUtility.prepare(cloudManager.getAgentsByServerName(serverName), - "CloudGWTServiceImpl.getAgentsByServerName"); - return new ArrayList<Agent>(persistentBag); - } catch (Throwable t) { - throw getExceptionToThrowToClient(t); - } - } - - @Override public void deleteServers(int[] serverIds) throws RuntimeException { try { cloudManager.deleteServers(ArrayUtils.toObject(serverIds)); @@ -135,24 +114,21 @@ public class CloudGWTServiceImpl extends AbstractGWTServiceImpl implements Cloud throw getExceptionToThrowToClient(t); } } - + @Override - public PageList<Server> findServersByCriteria(ServerCriteria criteria) - throws RuntimeException { + public PageList<Server> findServersByCriteria(ServerCriteria criteria) throws RuntimeException { try { - return SerialUtility.prepare( - cloudManager.findServersByCriteria(getSessionSubject(), criteria), + return SerialUtility.prepare(cloudManager.findServersByCriteria(getSessionSubject(), criteria), "CloudGWTServiceImpl.findServersByCriteria"); } catch (Throwable t) { throw getExceptionToThrowToClient(t); } } - + @Override public PageList<Agent> findAgentsByCriteria(AgentCriteria criteria) throws RuntimeException { try { - return SerialUtility.prepare( - agentManager.findAgentsByCriteria(getSessionSubject(), criteria), + return SerialUtility.prepare(agentManager.findAgentsByCriteria(getSessionSubject(), criteria), "CloudGWTServiceImpl.findAgentsByCriteria"); } catch (Throwable t) { throw getExceptionToThrowToClient(t); @@ -229,54 +205,6 @@ public class CloudGWTServiceImpl extends AbstractGWTServiceImpl implements Cloud }
@Override - public PageList<Server> getServerMembersByAffinityGroupId(int affinityGroupId, PageControl pageControl) - throws RuntimeException { - try { - return SerialUtility.prepare( - affinityGroupManager.getServerMembers(getSessionSubject(), affinityGroupId, pageControl), - "CloudGWTServiceImpl.getServerMembersByAffinityGroupId"); - } catch (Throwable t) { - throw getExceptionToThrowToClient(t); - } - } - - @Override - public PageList<Server> getServerNonMembersByAffinityGroupId(int affinityGroupId, PageControl pageControl) - throws RuntimeException { - try { - return SerialUtility.prepare( - affinityGroupManager.getServerNonMembers(getSessionSubject(), affinityGroupId, pageControl), - "CloudGWTServiceImpl.getServerNonMembersByAffinityGroupId"); - } catch (Throwable t) { - throw getExceptionToThrowToClient(t); - } - } - - @Override - public PageList<Agent> getAgentMembersByAffinityGroupId(int affinityGroupId, PageControl pageControl) - throws RuntimeException { - try { - return SerialUtility.prepare( - affinityGroupManager.getAgentMembers(getSessionSubject(), affinityGroupId, pageControl), - "CloudGWTServiceImpl.getAgentMembersByAffinityGroupId"); - } catch (Throwable t) { - throw getExceptionToThrowToClient(t); - } - } - - @Override - public PageList<Agent> getAgentNonMembersByAffinityGroupId(int affinityGroupId, PageControl pageControl) - throws RuntimeException { - try { - return SerialUtility.prepare( - affinityGroupManager.getAgentNonMembers(getSessionSubject(), affinityGroupId, pageControl), - "CloudGWTServiceImpl.getAgentNonMembersByAffinityGroupId"); - } catch (Throwable t) { - throw getExceptionToThrowToClient(t); - } - } - - @Override public AffinityGroup getAffinityGroupById(int affinityGroupId) throws RuntimeException { try { return SerialUtility.prepare(affinityGroupManager.getById(getSessionSubject(), affinityGroupId), @@ -322,7 +250,6 @@ public class CloudGWTServiceImpl extends AbstractGWTServiceImpl implements Cloud } }
- @Override public void updateServer(Server server) throws RuntimeException { try { @@ -332,7 +259,6 @@ public class CloudGWTServiceImpl extends AbstractGWTServiceImpl implements Cloud } }
- @Override public void updateAffinityGroup(AffinityGroup affinityGroup) throws RuntimeException { try { diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties index ceaad0d..56ed2ac 100644 --- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties +++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties @@ -552,16 +552,45 @@ view_adminTopology_agentDetail_address = Address view_adminTopology_agentDetail_agentFailoverList = Agent Failover List view_adminTopology_agentDetail_currentServer = Current Server view_adminTopology_agentDetail_token = Token -view_adminTopology_message_fetchServerFail=Unable to fetch server details for server with id {0}. -view_adminTopology_message_fetchAgentFail=Unable to fetch agent details for agent with id {0}. -view_adminTopology_message_removeServerConfirm=Do you really want to remove servers [{0}]? -view_adminTopology_message_removeServerFail=Unable to remove {0} server(s). -view_adminTopology_message_removedServer=Removed {0} server(s). -view_adminTopology_message_serverUpdated=The server {0} was successfully updated. -view_adminTopology_message_serverUpdateFail=Unable to update server {0}. -view_adminTopology_message_setMode=Set {0} server(s) to {1} mode. -view_adminTopology_message_setModeConfirm=Do you really want to set servers [{0}] to {1} mode? -view_adminTopology_message_setModeFail=Unable to set {0} server(s) to {1} mode. +view_adminTopology_message_agentsCount = There are {0} agents registered to this server. This number does not correspond to the number of currently connected agents. +view_adminTopology_message_agroupAssingAgentsFail = Unable to assign agents to the affinity group with id {0}. +view_adminTopology_message_agroupAssingServersFail = Unable to assign servers to the affinity group with id {0}. +view_adminTopology_message_agroupRemovingAgentsFail = Unable to remove agents from the affinity group with id {0}. +view_adminTopology_message_agroupRemovingServersFail = Unable to remove servers from the affinity group with id {0}. +view_adminTopology_message_agroupRenamed = Affinity group with id {0} and name {1} was renamed to {2}. +view_adminTopology_message_agroupRenamingFail = Unable to rename affinity group with id {0} and name {1}. +view_adminTopology_message_fetchAgentFail = Unable to fetch agent details for agent with id {0}. +view_adminTopology_message_fetchAgentsFail = Unable to fetch agent(s) for affinity group with id {0}. +view_adminTopology_message_fetchAgents2Fail = Unable to fetch agents. +view_adminTopology_message_fetchAgroupFail = Unable to fetch affinity group details for group with id {0}. +view_adminTopology_message_fetchAgroupsFail = Unable to fetch affinity group(s). +view_adminTopology_message_fetchFailOverLists = Unable to fetch fail over list details. +view_adminTopology_message_fetchPEventDetailsFail = Unable to fetch partition event details for event with id {0}. +view_adminTopology_message_fetchPEventFail = Unable to fetch partition events. +view_adminTopology_message_fetchServerFail = Unable to fetch server details for server with id {0}. +view_adminTopology_message_fetchServersFail = Unable to fetch server(s) for affinity group with id {0}. +view_adminTopology_message_fetchServers2Fail = Unable to fetch servers. +view_adminTopology_message_forceRepartition = Do you really want to force a repartition of whole cluster? It will force all the agents to connect to its most preferred server. +view_adminTopology_message_forceRepartitionFail = Unable to run repartition. +view_adminTopology_message_order = Order +view_adminTopology_message_removeAGroupsFail = Unable to remove following affinity groups(s) {0}. +view_adminTopology_message_removeAGroupsConfirm = Do you really want to remove following affinity groups {0}? +view_adminTopology_message_removeAllPEventConfirm = Do you really want to purge all partition events? +view_adminTopology_message_removePEventConfirm = Do you really want to remove following partition events {0}? +view_adminTopology_message_removePEventFail = Unable to remove {0} partition events(s). +view_adminTopology_message_removeServerConfirm = Do you really want to remove servers {0}? +view_adminTopology_message_removeServerFail = Unable to remove {0} server(s). +view_adminTopology_message_removedAGroups = Removed {0} affinity group(s). +view_adminTopology_message_removedAllPEvent = All partition events have been purged. +view_adminTopology_message_removedAllPEventFail = Unable to purge all partition events. +view_adminTopology_message_removedPEvent = Removed {0} partition events(s). +view_adminTopology_message_removedServer = Removed {0} server(s). +view_adminTopology_message_repartitioned = The cluster repartitioning was successfully invoked. +view_adminTopology_message_serverUpdated = The server {0} was successfully updated. +view_adminTopology_message_serverUpdateFail = Unable to update server {0}. +view_adminTopology_message_setMode = Set {0} server(s) to {1} mode. +view_adminTopology_message_setModeConfirm = Do you really want to set servers {0} to {1} mode? +view_adminTopology_message_setModeFail = Unable to set {0} server(s) to {1} mode. view_adminTopology_partitionEvents = Partition Events view_adminTopology_partitionEvents_details = Details view_adminTopology_partitionEvents_detailsFilter = Details Filter diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties index 35b7b46..0775491 100644 --- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties +++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties @@ -571,6 +571,45 @@ view_adminTopology_agentDetail_address = Adresa view_adminTopology_agentDetail_agentFailoverList = Agentův failover list view_adminTopology_agentDetail_currentServer = Současný server view_adminTopology_agentDetail_token = Token +view_adminTopology_message_agentsCount = K serveru je zaregistrováno {0} agentů. Toto číslo neznamená počet aktuálně připojených agentů. +view_adminTopology_message_agroupAssingAgentsFail = Nepodařilo se přiřadit agenty do afinitní skupiny s id {0}. +view_adminTopology_message_agroupAssingServersFail = Nepodařilo se přiřadit servery do afinitní skupiny s id {0}. +view_adminTopology_message_agroupRemovingAgentsFail = Nepodařilo se odstranit agenty z afinitní skupiny s id {0}. +view_adminTopology_message_agroupRemovingServersFail = Nepodařilo se odstranit servery z afinitní skupiny s id {0}. +view_adminTopology_message_agroupRenamed = Afinitní skupina s id {0} a jménem {1} byla přejmenována na {2}. +view_adminTopology_message_agroupRenamingFail = Nepodařilo se přejmenovat afinitní skupinu s id {0} a jménem {1}. +view_adminTopology_message_fetchAgentFail = Nepodařilo se získat detaily o agentovi s id {0}. +view_adminTopology_message_fetchAgentsFail = Nepodařilo se agenty pro afinitní skupinu s id {0}. +view_adminTopology_message_fetchAgents2Fail = Nepodařilo se získat agenty. +view_adminTopology_message_fetchAgroupFail = Nepodařilo se získat detaily o afinitní skupině s id {0}. +view_adminTopology_message_fetchAgroupsFail = Nepodařilo se získat afinitní skupiny. +view_adminTopology_message_fetchFailOverLists = Nepodařilo se získat dataily failover listu. +view_adminTopology_message_fetchPEventDetailsFail = Nepodařilo se získat detaily události clusteru s id {0}. +view_adminTopology_message_fetchPEventFail = Nepodařilo se získat události clusteru. +view_adminTopology_message_fetchServerFail = Nepodařilo se získat detaily o serveru s id {0}. +view_adminTopology_message_fetchServersFail = Nepodařilo se získat servery pro afinitní skupinu s id {0}. +view_adminTopology_message_fetchServers2Fail = Nepodařilo se získat servery. +view_adminTopology_message_forceRepartition = Přejete si opravdu vynutit přerozdělení celého clusteru? Přiměje to každého z agentů připojit se na svůj preferovaný server tzn. první ve failover listu. +view_adminTopology_message_forceRepartitionFail = Nepodařilo se spustit přerozdělení. +view_adminTopology_message_order = Pořadí +view_adminTopology_message_removeAGroupsFail = Nepodařilo se odstranit následující afinitní skupiny {0}. +view_adminTopology_message_removeAGroupsConfirm = Přejete si opravdu odstanit následující afinitní skupiny {0}? +view_adminTopology_message_removeAllPEventConfirm = Přejete si opravdu odstranit všechny události clusteru? +view_adminTopology_message_removePEventConfirm = Chcete opravdu odstranit následující události clusteru {0}? +view_adminTopology_message_removePEventFail = Nepodařilo se odstranit {0} události clusteru. +view_adminTopology_message_removeServerConfirm = Chcete opravdu odstranit následující servery {0}? +view_adminTopology_message_removeServerFail = Nepodařilo se odstranit {0} serverů. +view_adminTopology_message_removedAGroups = Odstraněno {0} afinitních skupin. +view_adminTopology_message_removedAllPEvent = Všechnz události clusteru byly smazány. +view_adminTopology_message_removedAllPEventFail = Nepodařilo se odstranit všechny události clusteru. +view_adminTopology_message_removedPEvent = Odstraněno {0} událostí clusteru. +view_adminTopology_message_removedServer =Odstraněno {0} serverů. +view_adminTopology_message_repartitioned = Operace přerozdělení clusteru byla úspěšně spuštěna. +view_adminTopology_message_serverUpdated = Server {0} byl úspěšně změněn. +view_adminTopology_message_serverUpdateFail = Nepodařilo se změnit server {0}. +view_adminTopology_message_setMode =Nastaveno {0} serverů do {1} módu. +view_adminTopology_message_setModeConfirm = Přejete si opravdu nastavit servery {0} do {1} módu? +view_adminTopology_message_setModeFail = Nepodařilo se nastavit {0} serverů do {1} módu. view_adminTopology_partitionEvents = Události o clusteru view_adminTopology_partitionEvents_details = Detaily view_adminTopology_partitionEvents_detailsFilter = Filtrovat podle detailu diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties index 6c2cc91..f9876c3 100644 --- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties +++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties @@ -519,6 +519,45 @@ view_adminTopology_agents = Agenten ##view_adminTopology_agentDetail_agentFailoverList = Agent Failover List ##view_adminTopology_agentDetail_currentServer = Current Server ##view_adminTopology_agentDetail_token = Token +##view_adminTopology_message_agentsCount = There are {0} agents registered to this server. This number doesn't correspond to the number of currently connected agents. +##view_adminTopology_message_agroupAssingAgentsFail = Unable to assign agents to the affinity group with id {0}. +##view_adminTopology_message_agroupAssingServersFail = Unable to assign servers to the affinity group with id {0}. +##view_adminTopology_message_agroupRemovingAgentsFail = Unable to remove agents from the affinity group with id {0}. +##view_adminTopology_message_agroupRemovingServersFail = Unable to remove servers from the affinity group with id {0}. +##view_adminTopology_message_agroupRenamed = Affinity group with id {0} and name {1} was renamed to {2}. +##view_adminTopology_message_agroupRenamingFail = Unable to rename affinity group with id {0} and name {1}. +##view_adminTopology_message_fetchAgentFail = Unable to fetch agent details for agent with id {0}. +##view_adminTopology_message_fetchAgentsFail = Unable to fetch agent(s) for affinity group with id {0}. +##view_adminTopology_message_fetchAgents2Fail = Unable to fetch agents. +##view_adminTopology_message_fetchAgroupFail = Unable to fetch affinity group details for group with id {0}. +##view_adminTopology_message_fetchAgroupsFail = Unable to fetch affinity group(s). +##view_adminTopology_message_fetchFailOverLists = Unable to fetch fail over list details. +##view_adminTopology_message_fetchPEventDetailsFail = Unable to fetch partition event details for event with id {0}. +##view_adminTopology_message_fetchPEventFail = Unable to fetch partition events. +##view_adminTopology_message_fetchServerFail = Unable to fetch server details for server with id {0}. +##view_adminTopology_message_fetchServersFail = Unable to fetch server(s) for affinity group with id {0}. +##view_adminTopology_message_fetchServers2Fail = Unable to fetch servers. +##view_adminTopology_message_forceRepartition = Do you really want to force a repartition of whole cluster? It will force all the agents to connect to its most preferred server. +##view_adminTopology_message_forceRepartitionFail = Unable to run repartition. +##view_adminTopology_message_order = Order +##view_adminTopology_message_removeAGroupsFail = Unable to remove following affinity groups(s) {0}. +##view_adminTopology_message_removeAGroupsConfirm = Do you really want to remove following affinity groups {0}? +##view_adminTopology_message_removeAllPEventConfirm = Do you really want to purge all partition events? +##view_adminTopology_message_removePEventConfirm = Do you really want to remove following partition events {0}? +##view_adminTopology_message_removePEventFail = Unable to remove {0} partition events(s). +##view_adminTopology_message_removeServerConfirm = Do you really want to remove servers {0}? +##view_adminTopology_message_removeServerFail = Unable to remove {0} server(s). +##view_adminTopology_message_removedAGroups = Removed {0} affinity group(s). +##view_adminTopology_message_removedAllPEvent = All partition events have been purged. +##view_adminTopology_message_removedAllPEventFail = Unable to purge all partition events. +##view_adminTopology_message_removedPEvent = Removed {0} partition events(s). +##view_adminTopology_message_removedServer = Removed {0} server(s). +##view_adminTopology_message_repartitioned = The cluster repartitioning was successfully invoked. +##view_adminTopology_message_serverUpdated = The server {0} was successfully updated. +##view_adminTopology_message_serverUpdateFail = Unable to update server {0}. +##view_adminTopology_message_setMode = Set {0} server(s) to {1} mode. +##view_adminTopology_message_setModeConfirm = Do you really want to set servers {0} to {1} mode? +##view_adminTopology_message_setModeFail = Unable to set {0} server(s) to {1} mode. view_adminTopology_partitionEvents = Partitionierungs-Ereignisse ##view_adminTopology_partitionEvents_details = Details ##view_adminTopology_partitionEvents_detailsFilter = Details Filter diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties index 2b74e1b..83b705b 100644 --- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties +++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties @@ -550,6 +550,45 @@ view_adminTopology_agents = エージェント ##view_adminTopology_agentDetail_agentFailoverList = Agent Failover List ##view_adminTopology_agentDetail_currentServer = Current Server ##view_adminTopology_agentDetail_token = Token +##view_adminTopology_message_agentsCount = There are {0} agents registered to this server. This number doesn't correspond to the number of currently connected agents. +##view_adminTopology_message_agroupAssingAgentsFail = Unable to assign agents to the affinity group with id {0}. +##view_adminTopology_message_agroupAssingServersFail = Unable to assign servers to the affinity group with id {0}. +##view_adminTopology_message_agroupRemovingAgentsFail = Unable to remove agents from the affinity group with id {0}. +##view_adminTopology_message_agroupRemovingServersFail = Unable to remove servers from the affinity group with id {0}. +##view_adminTopology_message_agroupRenamed = Affinity group with id {0} and name {1} was renamed to {2}. +##view_adminTopology_message_agroupRenamingFail = Unable to rename affinity group with id {0} and name {1}. +##view_adminTopology_message_fetchAgentFail = Unable to fetch agent details for agent with id {0}. +##view_adminTopology_message_fetchAgentsFail = Unable to fetch agent(s) for affinity group with id {0}. +##view_adminTopology_message_fetchAgents2Fail = Unable to fetch agents. +##view_adminTopology_message_fetchAgroupFail = Unable to fetch affinity group details for group with id {0}. +##view_adminTopology_message_fetchAgroupsFail = Unable to fetch affinity group(s). +##view_adminTopology_message_fetchFailOverLists = Unable to fetch fail over list details. +##view_adminTopology_message_fetchPEventDetailsFail = Unable to fetch partition event details for event with id {0}. +##view_adminTopology_message_fetchPEventFail = Unable to fetch partition events. +##view_adminTopology_message_fetchServerFail = Unable to fetch server details for server with id {0}. +##view_adminTopology_message_fetchServersFail = Unable to fetch server(s) for affinity group with id {0}. +##view_adminTopology_message_fetchServers2Fail = Unable to fetch servers. +##view_adminTopology_message_forceRepartition = Do you really want to force a repartition of whole cluster? It will force all the agents to connect to its most preferred server. +##view_adminTopology_message_forceRepartitionFail = Unable to run repartition. +##view_adminTopology_message_order = Order +##view_adminTopology_message_removeAGroupsFail = Unable to remove following affinity groups(s) {0}. +##view_adminTopology_message_removeAGroupsConfirm = Do you really want to remove following affinity groups {0}? +##view_adminTopology_message_removeAllPEventConfirm = Do you really want to purge all partition events? +##view_adminTopology_message_removePEventConfirm = Do you really want to remove following partition events {0}? +##view_adminTopology_message_removePEventFail = Unable to remove {0} partition events(s). +##view_adminTopology_message_removeServerConfirm = Do you really want to remove servers {0}? +##view_adminTopology_message_removeServerFail = Unable to remove {0} server(s). +##view_adminTopology_message_removedAGroups = Removed {0} affinity group(s). +##view_adminTopology_message_removedAllPEvent = All partition events have been purged. +##view_adminTopology_message_removedAllPEventFail = Unable to purge all partition events. +##view_adminTopology_message_removedPEvent = Removed {0} partition events(s). +##view_adminTopology_message_removedServer = Removed {0} server(s). +##view_adminTopology_message_repartitioned = The cluster repartitioning was successfully invoked. +##view_adminTopology_message_serverUpdated = The server {0} was successfully updated. +##view_adminTopology_message_serverUpdateFail = Unable to update server {0}. +##view_adminTopology_message_setMode = Set {0} server(s) to {1} mode. +##view_adminTopology_message_setModeConfirm = Do you really want to set servers {0} to {1} mode? +##view_adminTopology_message_setModeFail = Unable to set {0} server(s) to {1} mode. view_adminTopology_partitionEvents = イベントの分類 ##view_adminTopology_partitionEvents_details = Details ##view_adminTopology_partitionEvents_detailsFilter = Details Filter diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties index ceb89bd..9f545fb 100644 --- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties +++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties @@ -555,6 +555,45 @@ view_adminTopology_agents = Agentes ##view_adminTopology_agentDetail_agentFailoverList = Agent Failover List ##view_adminTopology_agentDetail_currentServer = Current Server ##view_adminTopology_agentDetail_token = Token +##view_adminTopology_message_agentsCount = There are {0} agents registered to this server. This number doesn't correspond to the number of currently connected agents. +##view_adminTopology_message_agroupAssingAgentsFail = Unable to assign agents to the affinity group with id {0}. +##view_adminTopology_message_agroupAssingServersFail = Unable to assign servers to the affinity group with id {0}. +##view_adminTopology_message_agroupRemovingAgentsFail = Unable to remove agents from the affinity group with id {0}. +##view_adminTopology_message_agroupRemovingServersFail = Unable to remove servers from the affinity group with id {0}. +##view_adminTopology_message_agroupRenamed = Affinity group with id {0} and name {1} was renamed to {2}. +##view_adminTopology_message_agroupRenamingFail = Unable to rename affinity group with id {0} and name {1}. +##view_adminTopology_message_fetchAgentFail = Unable to fetch agent details for agent with id {0}. +##view_adminTopology_message_fetchAgentsFail = Unable to fetch agent(s) for affinity group with id {0}. +##view_adminTopology_message_fetchAgents2Fail = Unable to fetch agents. +##view_adminTopology_message_fetchAgroupFail = Unable to fetch affinity group details for group with id {0}. +##view_adminTopology_message_fetchAgroupsFail = Unable to fetch affinity group(s). +##view_adminTopology_message_fetchFailOverLists = Unable to fetch fail over list details. +##view_adminTopology_message_fetchPEventDetailsFail = Unable to fetch partition event details for event with id {0}. +##view_adminTopology_message_fetchPEventFail = Unable to fetch partition events. +##view_adminTopology_message_fetchServerFail = Unable to fetch server details for server with id {0}. +##view_adminTopology_message_fetchServersFail = Unable to fetch server(s) for affinity group with id {0}. +##view_adminTopology_message_fetchServers2Fail = Unable to fetch servers. +##view_adminTopology_message_forceRepartition = Do you really want to force a repartition of whole cluster? It will force all the agents to connect to its most preferred server. +##view_adminTopology_message_forceRepartitionFail = Unable to run repartition. +##view_adminTopology_message_order = Order +##view_adminTopology_message_removeAGroupsFail = Unable to remove following affinity groups(s) {0}. +##view_adminTopology_message_removeAGroupsConfirm = Do you really want to remove following affinity groups {0}? +##view_adminTopology_message_removeAllPEventConfirm = Do you really want to purge all partition events? +##view_adminTopology_message_removePEventConfirm = Do you really want to remove following partition events {0}? +##view_adminTopology_message_removePEventFail = Unable to remove {0} partition events(s). +##view_adminTopology_message_removeServerConfirm = Do you really want to remove servers {0}? +##view_adminTopology_message_removeServerFail = Unable to remove {0} server(s). +##view_adminTopology_message_removedAGroups = Removed {0} affinity group(s). +##view_adminTopology_message_removedAllPEvent = All partition events have been purged. +##view_adminTopology_message_removedAllPEventFail = Unable to purge all partition events. +##view_adminTopology_message_removedPEvent = Removed {0} partition events(s). +##view_adminTopology_message_removedServer = Removed {0} server(s). +##view_adminTopology_message_repartitioned = The cluster repartitioning was successfully invoked. +##view_adminTopology_message_serverUpdated = The server {0} was successfully updated. +##view_adminTopology_message_serverUpdateFail = Unable to update server {0}. +##view_adminTopology_message_setMode = Set {0} server(s) to {1} mode. +##view_adminTopology_message_setModeConfirm = Do you really want to set servers {0} to {1} mode? +##view_adminTopology_message_setModeFail = Unable to set {0} server(s) to {1} mode. view_adminTopology_partitionEvents = Eventos na Parti\u00E7\u00E3o ##view_adminTopology_partitionEvents_details = Details ##view_adminTopology_partitionEvents_detailsFilter = Details Filter diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties index 86c16cb..47025b7 100644 --- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties +++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties @@ -542,6 +542,45 @@ #view_adminTopology_agentDetail_agentFailoverList = Agent Failover List #view_adminTopology_agentDetail_currentServer = Current Server #view_adminTopology_agentDetail_token = Token +##view_adminTopology_message_agentsCount = There are {0} agents registered to this server. This number doesn't correspond to the number of currently connected agents. +##view_adminTopology_message_agroupAssingAgentsFail = Unable to assign agents to the affinity group with id {0}. +##view_adminTopology_message_agroupAssingServersFail = Unable to assign servers to the affinity group with id {0}. +##view_adminTopology_message_agroupRemovingAgentsFail = Unable to remove agents from the affinity group with id {0}. +##view_adminTopology_message_agroupRemovingServersFail = Unable to remove servers from the affinity group with id {0}. +##view_adminTopology_message_agroupRenamed = Affinity group with id {0} and name {1} was renamed to {2}. +##view_adminTopology_message_agroupRenamingFail = Unable to rename affinity group with id {0} and name {1}. +##view_adminTopology_message_fetchAgentFail = Unable to fetch agent details for agent with id {0}. +##view_adminTopology_message_fetchAgentsFail = Unable to fetch agent(s) for affinity group with id {0}. +##view_adminTopology_message_fetchAgents2Fail = Unable to fetch agents. +##view_adminTopology_message_fetchAgroupFail = Unable to fetch affinity group details for group with id {0}. +##view_adminTopology_message_fetchAgroupsFail = Unable to fetch affinity group(s). +##view_adminTopology_message_fetchFailOverLists = Unable to fetch fail over list details. +##view_adminTopology_message_fetchPEventDetailsFail = Unable to fetch partition event details for event with id {0}. +##view_adminTopology_message_fetchPEventFail = Unable to fetch partition events. +##view_adminTopology_message_fetchServerFail = Unable to fetch server details for server with id {0}. +##view_adminTopology_message_fetchServersFail = Unable to fetch server(s) for affinity group with id {0}. +##view_adminTopology_message_fetchServers2Fail = Unable to fetch servers. +##view_adminTopology_message_forceRepartition = Do you really want to force a repartition of whole cluster? It will force all the agents to connect to its most preferred server. +##view_adminTopology_message_forceRepartitionFail = Unable to run repartition. +##view_adminTopology_message_order = Order +##view_adminTopology_message_removeAGroupsFail = Unable to remove following affinity groups(s) {0}. +##view_adminTopology_message_removeAGroupsConfirm = Do you really want to remove following affinity groups {0}? +##view_adminTopology_message_removeAllPEventConfirm = Do you really want to purge all partition events? +##view_adminTopology_message_removePEventConfirm = Do you really want to remove following partition events {0}? +##view_adminTopology_message_removePEventFail = Unable to remove {0} partition events(s). +##view_adminTopology_message_removeServerConfirm = Do you really want to remove servers {0}? +##view_adminTopology_message_removeServerFail = Unable to remove {0} server(s). +##view_adminTopology_message_removedAGroups = Removed {0} affinity group(s). +##view_adminTopology_message_removedAllPEvent = All partition events have been purged. +##view_adminTopology_message_removedAllPEventFail = Unable to purge all partition events. +##view_adminTopology_message_removedPEvent = Removed {0} partition events(s). +##view_adminTopology_message_removedServer = Removed {0} server(s). +##view_adminTopology_message_repartitioned = The cluster repartitioning was successfully invoked. +##view_adminTopology_message_serverUpdated = The server {0} was successfully updated. +##view_adminTopology_message_serverUpdateFail = Unable to update server {0}. +##view_adminTopology_message_setMode = Set {0} server(s) to {1} mode. +##view_adminTopology_message_setModeConfirm = Do you really want to set servers {0} to {1} mode? +##view_adminTopology_message_setModeFail = Unable to set {0} server(s) to {1} mode. #view_adminTopology_partitionEvents = Partition Events ##view_adminTopology_partitionEvents_details = Details ##view_adminTopology_partitionEvents_detailsFilter = Details Filter diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties index 2c649de..b9941fc 100644 --- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties +++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties @@ -542,6 +542,45 @@ view_adminTopology_agents = \u4ee3\u7406 ##view_adminTopology_agentDetail_agentFailoverList = Agent Failover List ##view_adminTopology_agentDetail_currentServer = Current Server ##view_adminTopology_agentDetail_token = Token +##view_adminTopology_message_agentsCount = There are {0} agents registered to this server. This number doesn't correspond to the number of currently connected agents. +##view_adminTopology_message_agroupAssingAgentsFail = Unable to assign agents to the affinity group with id {0}. +##view_adminTopology_message_agroupAssingServersFail = Unable to assign servers to the affinity group with id {0}. +##view_adminTopology_message_agroupRemovingAgentsFail = Unable to remove agents from the affinity group with id {0}. +##view_adminTopology_message_agroupRemovingServersFail = Unable to remove servers from the affinity group with id {0}. +##view_adminTopology_message_agroupRenamed = Affinity group with id {0} and name {1} was renamed to {2}. +##view_adminTopology_message_agroupRenamingFail = Unable to rename affinity group with id {0} and name {1}. +##view_adminTopology_message_fetchAgentFail = Unable to fetch agent details for agent with id {0}. +##view_adminTopology_message_fetchAgentsFail = Unable to fetch agent(s) for affinity group with id {0}. +##view_adminTopology_message_fetchAgents2Fail = Unable to fetch agents. +##view_adminTopology_message_fetchAgroupFail = Unable to fetch affinity group details for group with id {0}. +##view_adminTopology_message_fetchAgroupsFail = Unable to fetch affinity group(s). +##view_adminTopology_message_fetchFailOverLists = Unable to fetch fail over list details. +##view_adminTopology_message_fetchPEventDetailsFail = Unable to fetch partition event details for event with id {0}. +##view_adminTopology_message_fetchPEventFail = Unable to fetch partition events. +##view_adminTopology_message_fetchServerFail = Unable to fetch server details for server with id {0}. +##view_adminTopology_message_fetchServersFail = Unable to fetch server(s) for affinity group with id {0}. +##view_adminTopology_message_fetchServers2Fail = Unable to fetch servers. +##view_adminTopology_message_forceRepartition = Do you really want to force a repartition of whole cluster? It will force all the agents to connect to its most preferred server. +##view_adminTopology_message_forceRepartitionFail = Unable to run repartition. +##view_adminTopology_message_order = Order +##view_adminTopology_message_removeAGroupsFail = Unable to remove following affinity groups(s) {0}. +##view_adminTopology_message_removeAGroupsConfirm = Do you really want to remove following affinity groups {0}? +##view_adminTopology_message_removeAllPEventConfirm = Do you really want to purge all partition events? +##view_adminTopology_message_removePEventConfirm = Do you really want to remove following partition events {0}? +##view_adminTopology_message_removePEventFail = Unable to remove {0} partition events(s). +##view_adminTopology_message_removeServerConfirm = Do you really want to remove servers {0}? +##view_adminTopology_message_removeServerFail = Unable to remove {0} server(s). +##view_adminTopology_message_removedAGroups = Removed {0} affinity group(s). +##view_adminTopology_message_removedAllPEvent = All partition events have been purged. +##view_adminTopology_message_removedAllPEventFail = Unable to purge all partition events. +##view_adminTopology_message_removedPEvent = Removed {0} partition events(s). +##view_adminTopology_message_removedServer = Removed {0} server(s). +##view_adminTopology_message_repartitioned = The cluster repartitioning was successfully invoked. +##view_adminTopology_message_serverUpdated = The server {0} was successfully updated. +##view_adminTopology_message_serverUpdateFail = Unable to update server {0}. +##view_adminTopology_message_setMode = Set {0} server(s) to {1} mode. +##view_adminTopology_message_setModeConfirm = Do you really want to set servers {0} to {1} mode? +##view_adminTopology_message_setModeFail = Unable to set {0} server(s) to {1} mode. view_adminTopology_partitionEvents = Partition\u4e8b\u4ef6 ##view_adminTopology_partitionEvents_details = Details ##view_adminTopology_partitionEvents_detailsFilter = Details Filter diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerLocal.java index 92b59d3..595ca8f 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerLocal.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerLocal.java @@ -90,6 +90,13 @@ public interface CloudManagerLocal { PageList<FailoverListDetails> getFailoverListDetailsByAgentId(int agentId, PageControl pc);
void markStaleServersDown(Subject subject); - + + /** + * Fetches the server based on provided criteria. + * + * @param subject caller + * @param criteria the criteria + * @return + */ PageList<Server> findServersByCriteria(Subject subject, ServerCriteria criteria); }
commit caa81f6bf0a2e126896b8d40e5f066f39e88e013 Author: Jirka Kremser jkremser@redhat.com Date: Wed Dec 19 13:01:23 2012 +0100
i18n for error messages, exception handling for agent and server views
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupDetailView.java index 3005f7d..4355814 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupDetailView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupDetailView.java @@ -53,6 +53,7 @@ public class AffinityGroupDetailView extends LocatableVLayout implements Bookmar // private final CloudGWTServiceAsync cloudManager = GWTServiceLookup.getCloudService(); private final int affinityGroupId;
+ private static final int SECTION_COUNT = 3; private final LocatableSectionStack sectionStack; private SectionStackSection detailsSection = null; private SectionStackSection agentSection = null; @@ -105,7 +106,7 @@ public class AffinityGroupDetailView extends LocatableVLayout implements Bookmar }
public boolean isInitialized() { - return initSectionCount >= 3; + return initSectionCount >= SECTION_COUNT; }
@Override @@ -136,7 +137,7 @@ public class AffinityGroupDetailView extends LocatableVLayout implements Bookmar // don't wait forever, give up after 20s and show what we have long elapsedMillis = System.currentTimeMillis() - startTime; if (elapsedMillis > 20000) { - initSectionCount = 3; + initSectionCount = SECTION_COUNT; } schedule(100); // Reschedule the timer. } diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDetailView.java index 026a846..f48e7b7 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDetailView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDetailView.java @@ -37,7 +37,10 @@ import com.smartgwt.client.widgets.layout.SectionStack; import com.smartgwt.client.widgets.layout.SectionStackSection;
import org.rhq.core.domain.cloud.AffinityGroup; +import org.rhq.core.domain.criteria.AgentCriteria; import org.rhq.core.domain.resource.Agent; +import org.rhq.core.domain.util.PageList; +import org.rhq.enterprise.gui.coregui.client.CoreGUI; import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter; import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup; import org.rhq.enterprise.gui.coregui.client.util.StringUtility; @@ -53,9 +56,9 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility; */ public class AgentDetailView extends LocatableVLayout {
- // private final CloudGWTServiceAsync cloudManager = GWTServiceLookup.getCloudService(); private final int agentId;
+ private static final int SECTION_COUNT = 2; private final LocatableSectionStack sectionStack; private SectionStackSection detailsSection = null; private SectionStackSection failoverListSection = null; @@ -80,21 +83,31 @@ public class AgentDetailView extends LocatableVLayout { @Override protected void onInit() { super.onInit(); - GWTServiceLookup.getAgentService().getAgentByID(this.agentId, new AsyncCallback<Agent>() { - public void onSuccess(final Agent agent) { - prepareDetailsSection(sectionStack, agent); - prepareFailoverListSection(sectionStack, agent); + AgentCriteria criteria = new AgentCriteria(); + criteria.addFilterId(agentId); + GWTServiceLookup.getCloudService().findAgentsByCriteria(criteria, new AsyncCallback<PageList<Agent>>() { + public void onSuccess(final PageList<Agent> agents) { + if (agents == null || agents.isEmpty() || agents.size() != 1) { + CoreGUI.getErrorHandler().handleError( + MSG.view_adminTopology_message_fetchAgentFail(String.valueOf(agentId))); + initSectionCount = SECTION_COUNT; + return; + } + prepareDetailsSection(sectionStack, agents.get(0)); + prepareFailoverListSection(sectionStack, agents.get(0)); }
public void onFailure(Throwable caught) { - SC.say("er1:" + caught); - //TODO: CoreGUI.getErrorHandler().handleError(MSG.view_admin_plugins_loadFailure(), caught); + CoreGUI.getErrorHandler().handleError( + MSG.view_adminTopology_message_fetchAgentFail(String.valueOf(agentId)) + " " + caught.getMessage(), + caught); + initSectionCount = SECTION_COUNT; } }); }
public boolean isInitialized() { - return initSectionCount >= 2; + return initSectionCount >= SECTION_COUNT; }
@Override @@ -122,7 +135,7 @@ public class AgentDetailView extends LocatableVLayout { // don't wait forever, give up after 20s and show what we have long elapsedMillis = System.currentTimeMillis() - startTime; if (elapsedMillis > 20000) { - initSectionCount = 2; + initSectionCount = SECTION_COUNT; } schedule(100); // Reschedule the timer. } diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentTableView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentTableView.java index b50d852..dc34602 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentTableView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentTableView.java @@ -124,7 +124,7 @@ public class AgentTableView extends TableSection<AgentDatasource> implements Has showUpdateMembersAction(); } } - + private void showUpdateMembersAction() { addTableAction(extendLocatorId("editGroupAgents"), MSG.view_groupInventoryMembers_button_updateMembership(), new AuthorizedTableAction(this, TableActionEnablement.ALWAYS, Permission.MANAGE_SETTINGS) { diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/PartitionEventDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/PartitionEventDetailView.java index f09a707..dc96374 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/PartitionEventDetailView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/PartitionEventDetailView.java @@ -62,6 +62,7 @@ public class PartitionEventDetailView extends LocatableVLayout implements Bookma
private final int partitionEventId;
+ private static final int SECTION_COUNT = 2; private final LocatableSectionStack sectionStack; private SectionStackSection detailsSection = null; private SectionStackSection agentSection = null; @@ -118,7 +119,7 @@ public class PartitionEventDetailView extends LocatableVLayout implements Bookma }
public boolean isInitialized() { - return initSectionCount >= 2; + return initSectionCount >= SECTION_COUNT; }
@Override @@ -146,7 +147,7 @@ public class PartitionEventDetailView extends LocatableVLayout implements Bookma // don't wait forever, give up after 20s and show what we have long elapsedMillis = System.currentTimeMillis() - startTime; if (elapsedMillis > 20000) { - initSectionCount = 2; + initSectionCount = SECTION_COUNT; } schedule(100); // Reschedule the timer. } diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerDetailView.java index f3dbd4d..ccc11aa 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerDetailView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerDetailView.java @@ -32,7 +32,6 @@ import com.google.gwt.user.client.Timer; import com.google.gwt.user.client.rpc.AsyncCallback; import com.smartgwt.client.types.Overflow; import com.smartgwt.client.types.VisibilityMode; -import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.IButton; import com.smartgwt.client.widgets.events.ClickEvent; import com.smartgwt.client.widgets.events.ClickHandler; @@ -46,12 +45,16 @@ import com.smartgwt.client.widgets.layout.SectionStackSection; import org.rhq.core.domain.cloud.AffinityGroup; import org.rhq.core.domain.cloud.Server; import org.rhq.core.domain.cloud.Server.OperationMode; +import org.rhq.core.domain.criteria.ServerCriteria; +import org.rhq.core.domain.util.PageList; import org.rhq.enterprise.gui.coregui.client.BookmarkableView; +import org.rhq.enterprise.gui.coregui.client.CoreGUI; import org.rhq.enterprise.gui.coregui.client.ViewPath; import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter; import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup; import org.rhq.enterprise.gui.coregui.client.util.Log; import org.rhq.enterprise.gui.coregui.client.util.StringUtility; +import org.rhq.enterprise.gui.coregui.client.util.message.Message; import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm; import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableSectionStack; import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableToolStrip; @@ -65,9 +68,9 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility; */ public class ServerDetailView extends LocatableVLayout implements BookmarkableView {
- // private final CloudGWTServiceAsync cloudManager = GWTServiceLookup.getCloudService(); private final int serverId;
+ private static final int SECTION_COUNT = 2; private final LocatableSectionStack sectionStack; private SectionStackSection detailsSection = null; private SectionStackSection agentSection = null; @@ -92,31 +95,31 @@ public class ServerDetailView extends LocatableVLayout implements BookmarkableVi @Override protected void onInit() { super.onInit(); - GWTServiceLookup.getCloudService().getServerById(this.serverId, new AsyncCallback<Server>() { - public void onSuccess(final Server server) { - prepareDetailsSection(sectionStack, server); - prepareAgentSection(sectionStack, server); - // GWTServiceLookup.getCloudService().getAgentsByServerName(server.getName(), - // new AsyncCallback<List<Agent>>() { - // public void onSuccess(List<Agent> agents) { - // prepareAgentSection(sectionStack, server, agents); - // }; - // - // public void onFailure(Throwable caught) { - // //TODO: CoreGUI.getErrorHandler().handleError(MSG.view_admin_plugins_loadFailure(), caught); - // } - // }); + ServerCriteria criteria = new ServerCriteria(); + criteria.addFilterId(serverId); + GWTServiceLookup.getCloudService().findServersByCriteria(criteria, new AsyncCallback<PageList<Server>>() { + public void onSuccess(final PageList<Server> servers) { + if (servers == null || servers.isEmpty() || servers.size() != 1) { + CoreGUI.getErrorHandler().handleError( + MSG.view_adminTopology_message_fetchServerFail(String.valueOf(serverId))); + initSectionCount = SECTION_COUNT; + return; + } + prepareDetailsSection(sectionStack, servers.get(0)); + prepareAgentSection(sectionStack, servers.get(0)); }
public void onFailure(Throwable caught) { - SC.say("er1:" + caught); - //TODO: CoreGUI.getErrorHandler().handleError(MSG.view_admin_plugins_loadFailure(), caught); + CoreGUI.getErrorHandler().handleError( + MSG.view_adminTopology_message_fetchServerFail(String.valueOf(serverId)) + " " + + caught.getMessage(), caught); + initSectionCount = SECTION_COUNT; } }); }
public boolean isInitialized() { - return initSectionCount >= 2; + return initSectionCount >= SECTION_COUNT; }
@Override @@ -144,7 +147,7 @@ public class ServerDetailView extends LocatableVLayout implements BookmarkableVi // don't wait forever, give up after 20s and show what we have long elapsedMillis = System.currentTimeMillis() - startTime; if (elapsedMillis > 20000) { - initSectionCount = 2; + initSectionCount = SECTION_COUNT; } schedule(100); // Reschedule the timer. } @@ -228,20 +231,25 @@ public class ServerDetailView extends LocatableVLayout implements BookmarkableVi server.setOperationMode(OperationMode.valueOf(operationModeItem.getValueAsString())); GWTServiceLookup.getCloudService().updateServer(server, new AsyncCallback<Void>() { public void onSuccess(Void result) { - // todo: notify + Message msg = new Message(MSG.view_adminTopology_message_serverUpdated(server.getName()), + Message.Severity.Info); + CoreGUI.getMessageCenter().notify(msg); + }
public void onFailure(Throwable caught) { - // todo: handle + CoreGUI.getErrorHandler().handleError( + MSG.view_adminTopology_message_serverUpdateFail(server.getName()) + " " + + caught.getMessage(), caught); } }); } } }); - + form.setItems(nameItem, addressItem, portItem, securePortItem, operationModeItem, affinityGroupItem, installationDateItem, lastUpdatetem); - + LocatableToolStrip footer = new LocatableToolStrip(extendLocatorId("detailsFooter")); footer.setPadding(5); footer.setWidth100(); diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerTableView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerTableView.java index 3c08618..b50e18c 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerTableView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerTableView.java @@ -37,7 +37,7 @@ import com.smartgwt.client.widgets.grid.ListGridField; import com.smartgwt.client.widgets.grid.ListGridRecord;
import org.rhq.core.domain.authz.Permission; -import org.rhq.core.domain.cloud.Server; +import org.rhq.core.domain.cloud.Server.OperationMode; import org.rhq.core.domain.criteria.BaseCriteria; import org.rhq.enterprise.gui.coregui.client.CoreGUI; import org.rhq.enterprise.gui.coregui.client.IconEnum; @@ -56,8 +56,8 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility; * @author Jirka Kremser * */ -public class ServerTableView extends TableSection<AbstractServerNodeDatasource<? extends Serializable, ? extends BaseCriteria>> - implements HasViewName { +public class ServerTableView extends + TableSection<AbstractServerNodeDatasource<? extends Serializable, ? extends BaseCriteria>> implements HasViewName {
public static final ViewName VIEW_ID = new ViewName("Servers(GWT)", MSG.view_adminTopology_servers() + "(GWT)", IconEnum.SERVERS); @@ -141,117 +141,36 @@ public class ServerTableView extends TableSection<AbstractServerNodeDatasource<? }
private void showCommonActions() { - addTableAction(extendLocatorId("setNormal"), MSG.view_adminTopology_server_setNormal(), - MSG.common_msg_areYouSure(), new AuthorizedTableAction(this, TableActionEnablement.ANY, - Permission.MANAGE_SETTINGS) { - public void executeAction(final ListGridRecord[] selections, Object actionValue) { - List<String> selectedNames = getSelectedNames(selections); - // TODO: msg - // String message = MSG.view_admin_plugins_serverDisableConfirm(selectedNames.toString()); - String message = "Really? Normal? For all I've done for you? " + selectedNames; - SC.ask(message, new BooleanCallback() { - public void execute(Boolean confirmed) { - if (confirmed) { - int[] selectedIds = getSelectedIds(selections); - SC.say("setting servers to maintenance mode, ids: " + selectedIds); - GWTServiceLookup.getCloudService().updateServerMode(selectedIds, - Server.OperationMode.NORMAL, new AsyncCallback<Void>() { - public void onSuccess(Void arg0) { - // TODO: msg - Message msg = new Message(MSG - .view_admin_plugins_disabledServerPlugins("sdf"), Message.Severity.Info); - CoreGUI.getMessageCenter().notify(msg); - refresh(); - } + addChangeOperationModeAction(OperationMode.NORMAL, MSG.view_adminTopology_server_setMaintenance()); + addChangeOperationModeAction(OperationMode.MAINTENANCE, MSG.view_adminTopology_server_setMaintenance());
- public void onFailure(Throwable caught) { - // TODO: msg - CoreGUI.getErrorHandler().handleError( - MSG.view_admin_plugins_disabledServerPluginsFailure() + " " - + caught.getMessage(), caught); - refreshTableInfo(); - } - - }); - } else { - refreshTableInfo(); - } - } - }); - } - }); - - addTableAction(extendLocatorId("setMaintenance"), MSG.view_adminTopology_server_setMaintenance(), + addTableAction(extendLocatorId("removeSelected"), MSG.view_adminTopology_server_removeSelected(), null, new AuthorizedTableAction(this, TableActionEnablement.ANY, Permission.MANAGE_SETTINGS) { public void executeAction(final ListGridRecord[] selections, Object actionValue) { List<String> selectedNames = getSelectedNames(selections); - // TODO: msg - // String message = MSG.view_admin_plugins_serverDisableConfirm(selectedNames.toString()); - String message = "Really? Maitenance? For all I've done for you? " + selectedNames; + String message = MSG.view_adminTopology_message_removeServerConfirm(selectedNames.toString()); SC.ask(message, new BooleanCallback() { public void execute(Boolean confirmed) { if (confirmed) { int[] selectedIds = getSelectedIds(selections); - SC.say("setting servers to maintenance mode, ids: " + selectedIds); - GWTServiceLookup.getCloudService().updateServerMode(selectedIds, - Server.OperationMode.MAINTENANCE, new AsyncCallback<Void>() { - public void onSuccess(Void arg0) { - // TODO: msg - Message msg = new Message(MSG - .view_admin_plugins_disabledServerPlugins("sdf"), Message.Severity.Info); - CoreGUI.getMessageCenter().notify(msg); - refresh(); - } - - public void onFailure(Throwable caught) { - // TODO: msg - CoreGUI.getErrorHandler().handleError( - MSG.view_admin_plugins_disabledServerPluginsFailure() + " " - + caught.getMessage(), caught); - refreshTableInfo(); - } - - }); - } else { - refreshTableInfo(); - } - } - }); - } - }); - - addTableAction(extendLocatorId("removeSelected"), MSG.view_adminTopology_server_removeSelected(), - MSG.common_msg_areYouSure(), new AuthorizedTableAction(this, TableActionEnablement.ANY, - Permission.MANAGE_SETTINGS) { - public void executeAction(final ListGridRecord[] selections, Object actionValue) { - List<String> selectedNames = getSelectedNames(selections); - String message = "Really? Delete? For all I've done for you? " + selectedNames; - SC.ask(message, new BooleanCallback() { - public void execute(Boolean confirmed) { - if (confirmed) { - int[] selectedIds = getSelectedIds(selections); - SC.say("setting servers to maintenance mode, ids: " + selectedIds); GWTServiceLookup.getCloudService().deleteServers(selectedIds, new AsyncCallback<Void>() { public void onSuccess(Void arg0) { - // TODO: msg Message msg = new Message(MSG - .view_admin_plugins_disabledServerPlugins("sdf"), Message.Severity.Info); + .view_adminTopology_message_removedServer(String + .valueOf(selections.length)), Message.Severity.Info); CoreGUI.getMessageCenter().notify(msg); refresh(); }
public void onFailure(Throwable caught) { - // TODO: msg CoreGUI.getErrorHandler().handleError( - MSG.view_admin_plugins_disabledServerPluginsFailure() + " " - + caught.getMessage(), caught); + MSG.view_adminTopology_message_removeServerFail(String + .valueOf(selections.length)) + " " + caught.getMessage(), caught); refreshTableInfo(); }
}); - } else { - refreshTableInfo(); } } }); @@ -259,6 +178,43 @@ public class ServerTableView extends TableSection<AbstractServerNodeDatasource<? }); }
+ private void addChangeOperationModeAction(final OperationMode mode, String label) { + addTableAction(extendLocatorId("set" + mode), label, null, new AuthorizedTableAction(this, + TableActionEnablement.ANY, Permission.MANAGE_SETTINGS) { + public void executeAction(final ListGridRecord[] selections, Object actionValue) { + List<String> selectedNames = getSelectedNames(selections); + String message = MSG.view_adminTopology_message_setModeConfirm(selectedNames.toString(), mode.name()); + SC.ask(message, new BooleanCallback() { + public void execute(Boolean confirmed) { + if (confirmed) { + int[] selectedIds = getSelectedIds(selections); + GWTServiceLookup.getCloudService().updateServerMode(selectedIds, mode, + new AsyncCallback<Void>() { + public void onSuccess(Void result) { + Message msg = new Message(MSG.view_adminTopology_message_setMode( + String.valueOf(selections.length), mode.name()), Message.Severity.Info); + CoreGUI.getMessageCenter().notify(msg); + refresh(); + } + + public void onFailure(Throwable caught) { + CoreGUI.getErrorHandler().handleError( + MSG.view_adminTopology_message_setModeFail( + String.valueOf(selections.length), mode.name()) + + " " + caught.getMessage(), caught); + refreshTableInfo(); + } + + }); + } else { + refreshTableInfo(); + } + } + }); + } + }); + } + private void showUpdateMembersAction() { addTableAction(extendLocatorId("editGroupServers"), MSG.view_groupInventoryMembers_button_updateMembership(), new AuthorizedTableAction(this, TableActionEnablement.ALWAYS, Permission.MANAGE_SETTINGS) { diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties index 47611e8..ceaad0d 100644 --- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties +++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties @@ -552,6 +552,16 @@ view_adminTopology_agentDetail_address = Address view_adminTopology_agentDetail_agentFailoverList = Agent Failover List view_adminTopology_agentDetail_currentServer = Current Server view_adminTopology_agentDetail_token = Token +view_adminTopology_message_fetchServerFail=Unable to fetch server details for server with id {0}. +view_adminTopology_message_fetchAgentFail=Unable to fetch agent details for agent with id {0}. +view_adminTopology_message_removeServerConfirm=Do you really want to remove servers [{0}]? +view_adminTopology_message_removeServerFail=Unable to remove {0} server(s). +view_adminTopology_message_removedServer=Removed {0} server(s). +view_adminTopology_message_serverUpdated=The server {0} was successfully updated. +view_adminTopology_message_serverUpdateFail=Unable to update server {0}. +view_adminTopology_message_setMode=Set {0} server(s) to {1} mode. +view_adminTopology_message_setModeConfirm=Do you really want to set servers [{0}] to {1} mode? +view_adminTopology_message_setModeFail=Unable to set {0} server(s) to {1} mode. view_adminTopology_partitionEvents = Partition Events view_adminTopology_partitionEvents_details = Details view_adminTopology_partitionEvents_detailsFilter = Details Filter
commit e3c531c1f52ef4298b0e5d29a044765cc97c8ac7 Author: Jirka Kremser jkremser@redhat.com Date: Tue Dec 18 17:12:46 2012 +0100
Assigning the agent to the affinity group; some refactoring (renaming AgentNodeDatasource -> AgentDatasource, AgentNodeDatasourceField -> AgentDatasourceField)
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Agent.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Agent.java index 870cc8f..5948a7e 100644 --- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Agent.java +++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Agent.java @@ -172,6 +172,9 @@ public class Agent implements Serializable { public static final String QUERY_UPDATE_STATUS_BY_MEASUREMENT_BASELINE = "Agent.updateStatusByMeasurementBasleine"; public static final String QUERY_UPDATE_STATUS_BY_AGENT = "Agent.updateStatusByAgent"; public static final String QUERY_UPDATE_STATUS_FOR_ALL = "Agent.updateStatusForAll"; + + // this value is set, when authorized user wants to reset the token + public static final String SECURITY_TOKEN_RESET = "@#$reset$#@";
@Column(name = "ID", nullable = false) @GeneratedValue(strategy = GenerationType.AUTO, generator = "id") diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupAgentsSelector.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupAgentsSelector.java new file mode 100644 index 0000000..5515e18 --- /dev/null +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupAgentsSelector.java @@ -0,0 +1,264 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.coregui.client.admin.topology; + +import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.NAME; + +import java.util.ArrayList; +import java.util.List; + +import com.google.gwt.user.client.rpc.AsyncCallback; +import com.smartgwt.client.data.Criteria; +import com.smartgwt.client.types.Alignment; +import com.smartgwt.client.types.Overflow; +import com.smartgwt.client.util.SC; +import com.smartgwt.client.widgets.IButton; +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.events.CloseClickEvent; +import com.smartgwt.client.widgets.events.CloseClickHandler; +import com.smartgwt.client.widgets.form.DynamicForm; +import com.smartgwt.client.widgets.form.fields.TextItem; +import com.smartgwt.client.widgets.grid.ListGridRecord; +import com.smartgwt.client.widgets.layout.HLayout; +import com.smartgwt.client.widgets.layout.VLayout; + +import org.rhq.core.domain.criteria.AgentCriteria; +import org.rhq.core.domain.resource.Agent; +import org.rhq.core.domain.util.PageList; +import org.rhq.enterprise.gui.coregui.client.IconEnum; +import org.rhq.enterprise.gui.coregui.client.components.selector.AbstractSelector; +import org.rhq.enterprise.gui.coregui.client.components.table.TableSection; +import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup; +import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource; +import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm; +import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton; + +/** + * @author Jirka Kremser + */ +public class AffinityGroupAgentsSelector extends AbstractSelector<Agent, AgentCriteria> { + + private final Integer affinityGroupId; + + private static RPCDataSource<Agent, AgentCriteria> datasource = null; + + private static Window modalWindow; + private static boolean shouldBeClosed; + private static VLayout layout; + private List<Integer> originallyAssignedIds; + + private AffinityGroupAgentsSelector() { + super(""); + affinityGroupId = -1; + } + + private AffinityGroupAgentsSelector(String id, Integer affinityGroupId) { + super(id, false); + this.affinityGroupId = affinityGroupId; + prepareMembers(this); + } + + @Override + protected DynamicForm getAvailableFilterForm() { + if (availableFilterForm == null) { + availableFilterForm = new LocatableDynamicForm(extendLocatorId("AgeSelectAvailFilterForm")); + availableFilterForm.setWidth("75%"); + final TextItem search = new TextItem(NAME.propertyName(), MSG.common_title_search()); + availableFilterForm.setItems(search); + } + return availableFilterForm; + } + + private void prepareMembers(final AffinityGroupAgentsSelector selector) { + AgentCriteria criteria = new AgentCriteria(); + criteria.addFilterAffinityGroupId(affinityGroupId); + GWTServiceLookup.getCloudService().findAgentsByCriteria(criteria, new AsyncCallback<PageList<Agent>>() { + public void onSuccess(PageList<Agent> result) { + ListGridRecord[] records = getDataSource().buildRecords(result); + originallyAssignedIds = getIdList(records); + setAssigned(records); + modalWindow.addItem(layout); + modalWindow.show(); + selector.reset(); + } + + @Override + public void onFailure(Throwable t) { + //todo: CoreGUI.getErrorHandler().handleError(MSG.view_admin_plugins_loadFailure(), t); + } + }); + + } + + @Override + protected RPCDataSource<Agent, AgentCriteria> getDataSource() { + if (datasource == null) { + datasource = new AgentDatasource(affinityGroupId, false); + } + return datasource; + } + + @Override + protected int getMaxAvailableRecords() { + return 3000; + } + + @Override + protected Criteria getLatestCriteria(DynamicForm availableFilterForm) { + String search = (String) availableFilterForm.getValue(NAME.propertyName()); + Criteria criteria = new Criteria(); + if (null != search) { + criteria.addCriteria(NAME.propertyName(), search); + } + return criteria; + } + + @Override + protected String getItemTitle() { + return MSG.view_adminTopology_agents(); + } + + @Override + protected String getItemIcon() { + return IconEnum.AGENT.getIcon16x16Path(); + } + + public static void show(Integer affinityGroupId, final TableSection parrent) { + modalWindow = new Window(); + modalWindow.addCloseClickHandler(new CloseClickHandler() { + public void onCloseClick(CloseClickEvent event) { + closeAndRefresh(parrent, false); + } + }); + modalWindow.setTitle(MSG.view_adminTopology_agents() + ": " + + MSG.view_adminTopology_affinityGroups_createNew()); + modalWindow.setOverflow(Overflow.VISIBLE); + modalWindow.setWidth(800); + modalWindow.setHeight(400); + modalWindow.setAutoCenter(true); + modalWindow.setCanDragResize(true); + modalWindow.setCanDragReposition(true); + + layout = new VLayout(); + layout.setWidth100(); + layout.setHeight100(); + layout.setPadding(10); + layout.setLayoutMargin(10); + + final AffinityGroupAgentsSelector selector = new AffinityGroupAgentsSelector("foo", affinityGroupId); + layout.addMember(selector); + + IButton cancel = new LocatableIButton(selector.extendLocatorId("Cancel"), MSG.common_button_cancel()); + cancel.addClickHandler(new ClickHandler() { + public void onClick(ClickEvent clickEvent) { + closeAndRefresh(parrent, false); + } + }); + IButton save = new LocatableIButton(selector.extendLocatorId("Save"), MSG.common_button_save()); + save.addClickHandler(new ClickHandler() { + public void onClick(ClickEvent clickEvent) { + List<Integer> actuallySelected = getIdList(selector.getSelectedRecords()); + List<Integer> originallySelected = selector.getOriginallyAssignedIds(); + originallySelected.removeAll(actuallySelected); + actuallySelected.removeAll(selector.getOriginallyAssignedIds()); + shouldBeClosed = true; + if (!originallySelected.isEmpty()) { + shouldBeClosed = false; + GWTServiceLookup.getCloudService().removeAgentsFromGroup( + originallySelected.toArray(new Integer[originallySelected.size()]), new AsyncCallback<Void>() { + + public void onSuccess(Void result) { + closeAndRefresh(parrent, true); + } + + public void onFailure(Throwable caught) { + //todo: error handling + SC.say("errX"); + } + }); + } + if (!actuallySelected.isEmpty()) { + shouldBeClosed = false; + GWTServiceLookup.getCloudService().addAgentsToGroup(selector.getAffinityGroupId(), + actuallySelected.toArray(new Integer[actuallySelected.size()]), new AsyncCallback<Void>() { + + public void onSuccess(Void result) { + closeAndRefresh(parrent, true); + } + + public void onFailure(Throwable caught) { + //todo: error handling + SC.say("errX"); + } + }); + } + if (shouldBeClosed) { + closeAndRefresh(parrent, false); + } + // SC.say("To del: " + originallySelected + "\n\nTo add: " + actuallySelected); + + } + }); + + HLayout buttons = new HLayout(10); + buttons.setHeight(20); + buttons.setLayoutAlign(Alignment.CENTER); + buttons.setLayoutBottomMargin(0); + buttons.addMember(save); + buttons.addMember(cancel); + layout.addMember(buttons); + } + + private static void closeAndRefresh(TableSection parrent, boolean fullRefresh) { + if (modalWindow != null) { + modalWindow.destroy(); + } + if (fullRefresh) { + parrent.refresh(); + } else { + parrent.refreshTableInfo(); + } + } + + private static List<Integer> getIdList(ListGridRecord[] records) { + if (records == null) { + return null; + } + List<Integer> ids = new ArrayList<Integer>(records.length); + for (ListGridRecord record : records) { + ids.add(record.getAttributeAsInt(AgentDatasourceField.FIELD_ID.propertyName())); + } + return ids; + } + + public List<Integer> getOriginallyAssignedIds() { + return new ArrayList<Integer>(originallyAssignedIds); + } + + public Integer getAffinityGroupId() { + return affinityGroupId; + } + +} diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupServersSelector.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupServersSelector.java index f104d6c..13b1559 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupServersSelector.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupServersSelector.java @@ -22,6 +22,8 @@ */ package org.rhq.enterprise.gui.coregui.client.admin.topology;
+import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.NAME; + import java.util.ArrayList; import java.util.List;
@@ -37,18 +39,23 @@ import com.smartgwt.client.widgets.events.ClickHandler; import com.smartgwt.client.widgets.events.CloseClickEvent; import com.smartgwt.client.widgets.events.CloseClickHandler; import com.smartgwt.client.widgets.form.DynamicForm; +import com.smartgwt.client.widgets.form.fields.SelectItem; +import com.smartgwt.client.widgets.form.fields.TextItem; import com.smartgwt.client.widgets.grid.ListGridRecord; import com.smartgwt.client.widgets.layout.HLayout; import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.cloud.Server; +import org.rhq.core.domain.cloud.Server.OperationMode; import org.rhq.core.domain.criteria.ServerCriteria; -import org.rhq.core.domain.util.PageControl; import org.rhq.core.domain.util.PageList; +import org.rhq.enterprise.gui.coregui.client.IconEnum; +import org.rhq.enterprise.gui.coregui.client.components.form.SortedSelectItem; import org.rhq.enterprise.gui.coregui.client.components.selector.AbstractSelector; import org.rhq.enterprise.gui.coregui.client.components.table.TableSection; import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup; import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource; +import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm; import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
/** @@ -56,8 +63,6 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton; */ public class AffinityGroupServersSelector extends AbstractSelector<Server, ServerCriteria> {
- private static final String ITEM_ICON = "types/Server_up_16.png"; - private final Integer affinityGroupId;
private static RPCDataSource<Server, ServerCriteria> datasource = null; @@ -77,10 +82,41 @@ public class AffinityGroupServersSelector extends AbstractSelector<Server, Serve this.affinityGroupId = affinityGroupId; prepareMembers(this); } + + @Override + protected DynamicForm getAvailableFilterForm() { + if (availableFilterForm == null) { + availableFilterForm = new LocatableDynamicForm(extendLocatorId("SerSelectAvailFilterForm")); + availableFilterForm.setNumCols(4); + availableFilterForm.setWidth("75%"); + final TextItem search = new TextItem(NAME.propertyName(), MSG.common_title_search()); + final SelectItem operationModeSelect = new SortedSelectItem(ServerDatasource.FILTER_OPERATION_MODE, MSG.view_adminTopology_serverDetail_operationMode()); + operationModeSelect.setValueMap(buildOperationModeOptions()); + operationModeSelect.setValue("ALL"); +// +// final EnumSelectItem operationModeFilter = new EnumSelectItem(ServerDatasource.FILTER_OPERATION_MODE, +// MSG.view_adminTopology_serverDetail_operationMode(), OperationMode.class, null, null); + + + availableFilterForm.setItems(search, operationModeSelect); + } + return availableFilterForm; + } + + private String[] buildOperationModeOptions() { + OperationMode[] modes = OperationMode.values(); + String[] options = new String[modes.length + 1]; + for (int i = 0; i < modes.length; i++) { + options[i] = modes[i].toString(); + } + options[modes.length] = "ALL"; + return options; + }
private void prepareMembers(final AffinityGroupServersSelector selector) { - GWTServiceLookup.getCloudService().getServerMembersByAffinityGroupId(affinityGroupId, - PageControl.getUnlimitedInstance(), new AsyncCallback<PageList<Server>>() { + ServerCriteria criteria = new ServerCriteria(); + criteria.addFilterAffinityGroupId(affinityGroupId); + GWTServiceLookup.getCloudService().findServersByCriteria(criteria, new AsyncCallback<PageList<Server>>() { public void onSuccess(PageList<Server> result) { ListGridRecord[] records = getDataSource().buildRecords(result); originallyAssignedIds = getIdList(records); @@ -107,28 +143,32 @@ public class AffinityGroupServersSelector extends AbstractSelector<Server, Serve }
@Override - protected DynamicForm getAvailableFilterForm() { - return null; // No Filters Currently - } - - @Override protected int getMaxAvailableRecords() { return 500; }
@Override protected Criteria getLatestCriteria(DynamicForm availableFilterForm) { - return null; // No Filters Currently + String search = (String) availableFilterForm.getValue(NAME.propertyName()); + String operationMode = (String) availableFilterForm.getValue(ServerDatasource.FILTER_OPERATION_MODE); + Criteria criteria = new Criteria(); + if (null != search) { + criteria.addCriteria(NAME.propertyName(), search); + } + if (operationMode != null && !"ALL".equals(operationMode)) { + criteria.addCriteria(ServerDatasource.FILTER_OPERATION_MODE, operationMode); + } + return criteria; }
@Override protected String getItemTitle() { - return MSG.view_adminTopology_affinityGroups(); + return MSG.view_adminTopology_servers(); }
@Override protected String getItemIcon() { - return ITEM_ICON; + return IconEnum.SERVERS.getIcon16x16Path(); }
public static void show(Integer affinityGroupId, final TableSection parrent) { @@ -138,7 +178,7 @@ public class AffinityGroupServersSelector extends AbstractSelector<Server, Serve closeAndRefresh(parrent, false); } }); - modalWindow.setTitle(MSG.view_adminTopology_affinityGroups() + ": " + modalWindow.setTitle(MSG.view_adminTopology_servers() + ": " + MSG.view_adminTopology_affinityGroups_createNew()); modalWindow.setOverflow(Overflow.VISIBLE); modalWindow.setWidth(800); diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDatasource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDatasource.java new file mode 100644 index 0000000..ac1d26b --- /dev/null +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDatasource.java @@ -0,0 +1,227 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.admin.topology; + +import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentDatasourceField.FIELD_ADDRESS; +import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentDatasourceField.FIELD_AFFINITY_GROUP; +import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentDatasourceField.FIELD_AFFINITY_GROUP_ID; +import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentDatasourceField.FIELD_ID; +import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentDatasourceField.FIELD_LAST_AVAILABILITY_REPORT; +import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentDatasourceField.FIELD_NAME; +import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentDatasourceField.FIELD_PORT; +import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentDatasourceField.FIELD_SERVER; +import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentDatasourceField.FIELD_SERVER_ID; + +import java.util.ArrayList; +import java.util.List; + +import com.google.gwt.user.client.rpc.AsyncCallback; +import com.smartgwt.client.data.DSRequest; +import com.smartgwt.client.data.DSResponse; +import com.smartgwt.client.data.DataSourceField; +import com.smartgwt.client.data.Record; +import com.smartgwt.client.data.fields.DataSourceIntegerField; +import com.smartgwt.client.widgets.grid.ListGridField; +import com.smartgwt.client.widgets.grid.ListGridRecord; + +import org.rhq.core.domain.criteria.AgentCriteria; +import org.rhq.core.domain.resource.Agent; +import org.rhq.core.domain.util.PageControl; +import org.rhq.core.domain.util.PageList; +import org.rhq.core.domain.util.PageOrdering; +import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter; +import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup; +import org.rhq.enterprise.gui.coregui.client.util.Log; +import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource; + +/** + * @author Jirka Kremser + * + */ +public class AgentDatasource extends RPCDataSource<Agent, AgentCriteria> { + + // filters + public static final String FILTER_ADDRESS = FIELD_ADDRESS.propertyName(); + public static final String FILTER_PORT = FIELD_PORT.propertyName(); + public static final String FILTER_SERVER_ID = "serverId"; + public static final String FILTER_AFFINITY_GROUP_ID = "affinityGroupId"; + + + private final Integer id; + private final boolean isAffinityGroupId; + + public AgentDatasource(Integer id, boolean isAffinityGroupId) { + super(); + this.id = id; + this.isAffinityGroupId = isAffinityGroupId; + List<DataSourceField> fields = addDataSourceFields(); + addFields(fields); + } + + @Override + protected List<DataSourceField> addDataSourceFields() { + List<DataSourceField> fields = super.addDataSourceFields(); + DataSourceField idField = new DataSourceIntegerField(FIELD_ID.propertyName(), FIELD_ID.title(), 50); + idField.setPrimaryKey(true); + idField.setHidden(true); + fields.add(idField); + return fields; + } + + public List<ListGridField> getListGridFields() { + List<ListGridField> fields = new ArrayList<ListGridField>(); + + ListGridField idField = FIELD_ID.getListGridField(); + idField.setHidden(true); + fields.add(idField); + fields.add(FIELD_NAME.getListGridField("*")); + fields.add(FIELD_SERVER.getListGridField("120")); + fields.add(FIELD_ADDRESS.getListGridField("110")); + + ListGridField serverIdField = FIELD_SERVER_ID.getListGridField(); + serverIdField.setHidden(true); + fields.add(serverIdField); + + fields.add(FIELD_PORT.getListGridField("90")); + ListGridField lastAvailabilityReportField = FIELD_LAST_AVAILABILITY_REPORT.getListGridField("120"); + TimestampCellFormatter.prepareDateField(lastAvailabilityReportField); + fields.add(lastAvailabilityReportField); + + if (!isAffinityGroupId) { + fields.add(FIELD_AFFINITY_GROUP.getListGridField("100")); + ListGridField affinityGroupIdField = FIELD_AFFINITY_GROUP_ID.getListGridField(); + affinityGroupIdField.setHidden(true); + fields.add(affinityGroupIdField); + } + + return fields; + } + + @Override + protected void executeFetch(final DSRequest request, final DSResponse response, AgentCriteria criteria) { +// final PageControl pc = getPageControl(request); + +// AsyncCallback<PageList<Agent>> callback = new AsyncCallback<PageList<Agent>>() { +// public void onSuccess(PageList<Agent> result) { +// response.setData(buildRecords(result)); +// response.setTotalRows(result.size()); +// processResponse(request.getRequestId(), response); +// } +// +// @Override +// public void onFailure(Throwable t) { +// //todo: CoreGUI.getErrorHandler().handleError(MSG.view_admin_plugins_loadFailure(), t); +// response.setStatus(DSResponse.STATUS_FAILURE); +// processResponse(request.getRequestId(), response); +// } +// }; +// +// + if (isAffinityGroupId) { +// GWTServiceLookup.getCloudService().getAgentMembersByAffinityGroupId(id, pc, callback); + criteria.addFilterAffinityGroupId(id); + } else if (id != null) { + // if id == null all agent are returned + criteria.addFilterServerId(id); +// GWTServiceLookup.getAgentService().getAgentsByServer(id, pc, callback); + } + + GWTServiceLookup.getCloudService().findAgentsByCriteria(criteria, new AsyncCallback<PageList<Agent>>() { + public void onSuccess(PageList<Agent> result) { + response.setData(buildRecords(result)); + response.setTotalRows(result.size()); + processResponse(request.getRequestId(), response); + } + + @Override + public void onFailure(Throwable t) { + //todo: CoreGUI.getErrorHandler().handleError(MSG.view_admin_plugins_loadFailure(), t); + response.setStatus(DSResponse.STATUS_FAILURE); + processResponse(request.getRequestId(), response); + } + }); + } + + /** + * Returns a prepopulated PageControl based on the provided DSRequest. This will set sort fields, + * pagination, but *not* filter fields. + * + * @param request the request to turn into a page control + * @return the page control for passing to criteria and other queries + */ + protected PageControl getPageControl(DSRequest request) { + // Initialize paging. + PageControl pageControl = new PageControl(0, getDataPageSize()); + + // Initialize sorting. + String sortBy = request.getAttribute("sortBy"); + if (sortBy != null) { + String[] sorts = sortBy.split(","); + for (String sort : sorts) { + PageOrdering ordering = (sort.startsWith("-")) ? PageOrdering.DESC : PageOrdering.ASC; + String columnName = (ordering == PageOrdering.DESC) ? sort.substring(1) : sort; + pageControl.addDefaultOrderingField(columnName, ordering); + } + } + + return pageControl; + } + + @Override + public Agent copyValues(Record from) { + throw new UnsupportedOperationException("AgentNodeDatasource.copyValues(Record from)"); + } + + @Override + public ListGridRecord copyValues(Agent from) { + ListGridRecord record = new ListGridRecord(); + record.setAttribute(FIELD_ID.propertyName(), from.getId()); + record.setAttribute(FIELD_NAME.propertyName(), from.getName()); + record.setAttribute(FIELD_ADDRESS.propertyName(), from.getAddress()); + record.setAttribute(FIELD_PORT.propertyName(), from.getPort()); + record.setAttribute(FIELD_SERVER.propertyName(), from.getServer() == null ? "" : from.getServer().getName()); + record.setAttribute(FIELD_SERVER_ID.propertyName(), from.getServer() == null ? "" : from.getServer().getId()); + record.setAttribute(FIELD_LAST_AVAILABILITY_REPORT.propertyName(), from.getLastAvailabilityReport()); + record.setAttribute(FIELD_AFFINITY_GROUP.propertyName(), from.getAffinityGroup() == null ? "" : from + .getAffinityGroup().getName()); + record.setAttribute(FIELD_AFFINITY_GROUP_ID.propertyName(), from.getAffinityGroup() == null ? "" : from + .getAffinityGroup().getId()); + + return record; + } + + @Override + protected AgentCriteria getFetchCriteria(DSRequest request) { + AgentCriteria criteria = new AgentCriteria(); + // printRequestCriteria(request); + criteria.addFilterId(getFilter(request, FIELD_ID.propertyName(), Integer.class)); + criteria.addFilterName(getFilter(request, FIELD_NAME.propertyName(), String.class)); + criteria.addFilterAddress(getFilter(request, FILTER_ADDRESS, String.class)); + criteria.addFilterPort(getFilter(request, FILTER_PORT, Integer.class)); + criteria.addFilterServerId(getFilter(request, FILTER_SERVER_ID, Integer.class)); + criteria.addFilterAffinityGroupId(getFilter(request, FILTER_AFFINITY_GROUP_ID, Integer.class)); + + + //@todo: Remove me when finished debugging search expression + Log.debug(" *** AgentCriteria Search String: " + getFilter(request, "search", String.class)); + criteria.setSearchExpression(getFilter(request, "search", String.class)); + + return criteria; + } +} diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDatasourceField.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDatasourceField.java new file mode 100644 index 0000000..26792d4 --- /dev/null +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDatasourceField.java @@ -0,0 +1,83 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.admin.topology; + +import com.smartgwt.client.widgets.grid.ListGridField; + +import org.rhq.enterprise.gui.coregui.client.CoreGUI; + +/** + * @author Jirka Kremser + * + */ +public enum AgentDatasourceField { + + FIELD_ID("id", CoreGUI.getMessages().common_title_id()), + + FIELD_NAME("name", CoreGUI.getMessages().common_title_name()), + + FIELD_SERVER("server", CoreGUI.getMessages().view_adminTopology_agent_connectedServer()), + + FIELD_SERVER_ID("serverId", "serverId"), + + FIELD_ADDRESS("address", CoreGUI.getMessages().view_adminTopology_agent_agentBindAddress()), + + FIELD_PORT("port", CoreGUI.getMessages().view_adminTopology_agent_agentBindPort()), + + FIELD_LAST_AVAILABILITY_REPORT("lastAvailabilityReport", CoreGUI.getMessages().view_adminTopology_agent_lastAvailabilityReport()), + + FIELD_AGENT_TOKEN("agentToken", CoreGUI.getMessages().view_adminTopology_agentDetail_token()), + + FIELD_AFFINITY_GROUP("affinityGroup", CoreGUI.getMessages().view_adminTopology_server_affinityGroup()), + + FIELD_AFFINITY_GROUP_ID("affinityGroupId", "affinityGroupId"); + + /** + * Corresponds to a property name of Server (e.g. operationMode). + */ + private String propertyName; + + /** + * The table header for the field or property (e.g. Mode). + */ + private String title; + + private AgentDatasourceField(String propertyName, String title) { + this.propertyName = propertyName; + this.title = title; + } + + public String propertyName() { + return propertyName; + } + + public String title() { + return title; + } + + public ListGridField getListGridField() { + return new ListGridField(propertyName, title); + } + + public ListGridField getListGridField(String width) { + ListGridField field = new ListGridField(propertyName, title); + field.setWidth(width); + return field; + } +} \ No newline at end of file diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDetailView.java index b91f71d..026a846 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDetailView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentDetailView.java @@ -19,13 +19,13 @@
package org.rhq.enterprise.gui.coregui.client.admin.topology;
-import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentNodeDatasourceField.FIELD_ADDRESS; -import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentNodeDatasourceField.FIELD_AFFINITY_GROUP; -import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentNodeDatasourceField.FIELD_AGENT_TOKEN; -import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentNodeDatasourceField.FIELD_LAST_AVAILABILITY_REPORT; -import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentNodeDatasourceField.FIELD_NAME; -import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentNodeDatasourceField.FIELD_PORT; -import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentNodeDatasourceField.FIELD_SERVER; +import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentDatasourceField.FIELD_ADDRESS; +import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentDatasourceField.FIELD_AFFINITY_GROUP; +import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentDatasourceField.FIELD_AGENT_TOKEN; +import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentDatasourceField.FIELD_LAST_AVAILABILITY_REPORT; +import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentDatasourceField.FIELD_NAME; +import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentDatasourceField.FIELD_PORT; +import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentDatasourceField.FIELD_SERVER;
import com.google.gwt.user.client.Timer; import com.google.gwt.user.client.rpc.AsyncCallback; diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentNodeDatasource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentNodeDatasource.java deleted file mode 100644 index 8a9da96..0000000 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentNodeDatasource.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.admin.topology; - -import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentNodeDatasourceField.FIELD_ADDRESS; -import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentNodeDatasourceField.FIELD_AFFINITY_GROUP; -import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentNodeDatasourceField.FIELD_AFFINITY_GROUP_ID; -import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentNodeDatasourceField.FIELD_ID; -import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentNodeDatasourceField.FIELD_LAST_AVAILABILITY_REPORT; -import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentNodeDatasourceField.FIELD_NAME; -import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentNodeDatasourceField.FIELD_PORT; -import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentNodeDatasourceField.FIELD_SERVER; -import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentNodeDatasourceField.FIELD_SERVER_ID; - -import java.util.ArrayList; -import java.util.List; - -import com.google.gwt.user.client.rpc.AsyncCallback; -import com.smartgwt.client.data.DSRequest; -import com.smartgwt.client.data.DSResponse; -import com.smartgwt.client.data.DataSourceField; -import com.smartgwt.client.data.Record; -import com.smartgwt.client.data.fields.DataSourceIntegerField; -import com.smartgwt.client.widgets.grid.ListGridField; -import com.smartgwt.client.widgets.grid.ListGridRecord; - -import org.rhq.core.domain.criteria.Criteria; -import org.rhq.core.domain.resource.Agent; -import org.rhq.core.domain.util.PageControl; -import org.rhq.core.domain.util.PageList; -import org.rhq.core.domain.util.PageOrdering; -import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter; -import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup; -import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource; - -/** - * @author Jirka Kremser - * - */ -public class AgentNodeDatasource extends RPCDataSource<Agent, Criteria> { - - private final Integer id; - private final boolean isAffinityGroupId; - - public AgentNodeDatasource(Integer id, boolean isAffinityGroupId) { - super(); - this.id = id; - this.isAffinityGroupId = isAffinityGroupId; - List<DataSourceField> fields = addDataSourceFields(); - addFields(fields); - } - - @Override - protected List<DataSourceField> addDataSourceFields() { - List<DataSourceField> fields = super.addDataSourceFields(); - DataSourceField idField = new DataSourceIntegerField(FIELD_ID.propertyName(), FIELD_ID.title(), 50); - idField.setPrimaryKey(true); - idField.setHidden(true); - fields.add(idField); - return fields; - } - - public List<ListGridField> getListGridFields() { - List<ListGridField> fields = new ArrayList<ListGridField>(); - - ListGridField idField = FIELD_ID.getListGridField(); - idField.setHidden(true); - fields.add(idField); - fields.add(FIELD_NAME.getListGridField("*")); - fields.add(FIELD_SERVER.getListGridField("120")); - fields.add(FIELD_ADDRESS.getListGridField("110")); - - ListGridField serverIdField = FIELD_SERVER_ID.getListGridField(); - serverIdField.setHidden(true); - fields.add(serverIdField); - - fields.add(FIELD_PORT.getListGridField("90")); - ListGridField lastAvailabilityReportField = FIELD_LAST_AVAILABILITY_REPORT.getListGridField("120"); - TimestampCellFormatter.prepareDateField(lastAvailabilityReportField); - fields.add(lastAvailabilityReportField); - - if (!isAffinityGroupId) { - fields.add(FIELD_AFFINITY_GROUP.getListGridField("100")); - ListGridField affinityGroupIdField = FIELD_AFFINITY_GROUP_ID.getListGridField(); - affinityGroupIdField.setHidden(true); - fields.add(affinityGroupIdField); - } - - return fields; - } - - @Override - protected void executeFetch(final DSRequest request, final DSResponse response, Criteria criteria) { - final PageControl pc = getPageControl(request); - - AsyncCallback<PageList<Agent>> callback = new AsyncCallback<PageList<Agent>>() { - public void onSuccess(PageList<Agent> result) { - response.setData(buildRecords(result)); - response.setTotalRows(result.size()); - processResponse(request.getRequestId(), response); - } - - @Override - public void onFailure(Throwable t) { - //todo: CoreGUI.getErrorHandler().handleError(MSG.view_admin_plugins_loadFailure(), t); - response.setStatus(DSResponse.STATUS_FAILURE); - processResponse(request.getRequestId(), response); - } - }; - - if (isAffinityGroupId) { - GWTServiceLookup.getCloudService().getAgentMembersByAffinityGroupId(id, pc, callback); - } else { - // if id == null all agent are returned - GWTServiceLookup.getAgentService().getAgentsByServer(id, pc, callback); - } - } - - /** - * Returns a prepopulated PageControl based on the provided DSRequest. This will set sort fields, - * pagination, but *not* filter fields. - * - * @param request the request to turn into a page control - * @return the page control for passing to criteria and other queries - */ - protected PageControl getPageControl(DSRequest request) { - // Initialize paging. - PageControl pageControl = new PageControl(0, getDataPageSize()); - - // Initialize sorting. - String sortBy = request.getAttribute("sortBy"); - if (sortBy != null) { - String[] sorts = sortBy.split(","); - for (String sort : sorts) { - PageOrdering ordering = (sort.startsWith("-")) ? PageOrdering.DESC : PageOrdering.ASC; - String columnName = (ordering == PageOrdering.DESC) ? sort.substring(1) : sort; - pageControl.addDefaultOrderingField(columnName, ordering); - } - } - - return pageControl; - } - - @Override - public Agent copyValues(Record from) { - throw new UnsupportedOperationException("AgentNodeDatasource.copyValues(Record from)"); - } - - @Override - public ListGridRecord copyValues(Agent from) { - ListGridRecord record = new ListGridRecord(); - record.setAttribute(FIELD_ID.propertyName(), from.getId()); - record.setAttribute(FIELD_NAME.propertyName(), from.getName()); - record.setAttribute(FIELD_ADDRESS.propertyName(), from.getAddress()); - record.setAttribute(FIELD_PORT.propertyName(), from.getPort()); - record.setAttribute(FIELD_SERVER.propertyName(), from.getServer() == null ? "" : from.getServer().getName()); - record.setAttribute(FIELD_SERVER_ID.propertyName(), from.getServer() == null ? "" : from.getServer().getId()); - record.setAttribute(FIELD_LAST_AVAILABILITY_REPORT.propertyName(), from.getLastAvailabilityReport()); - record.setAttribute(FIELD_AFFINITY_GROUP.propertyName(), from.getAffinityGroup() == null ? "" : from - .getAffinityGroup().getName()); - record.setAttribute(FIELD_AFFINITY_GROUP_ID.propertyName(), from.getAffinityGroup() == null ? "" : from - .getAffinityGroup().getId()); - - return record; - } - - @Override - protected Criteria getFetchCriteria(DSRequest request) { - // we don't use criteria for this datasource, just return null - return null; - } -} diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentNodeDatasourceField.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentNodeDatasourceField.java deleted file mode 100644 index dc82130..0000000 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentNodeDatasourceField.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.admin.topology; - -import com.smartgwt.client.widgets.grid.ListGridField; - -import org.rhq.enterprise.gui.coregui.client.CoreGUI; - -/** - * @author Jirka Kremser - * - */ -public enum AgentNodeDatasourceField { - - FIELD_ID("id", CoreGUI.getMessages().common_title_id()), - - FIELD_NAME("name", CoreGUI.getMessages().common_title_name()), - - FIELD_SERVER("server", CoreGUI.getMessages().view_adminTopology_agent_connectedServer()), - - FIELD_SERVER_ID("serverId", "serverId"), - - FIELD_ADDRESS("address", CoreGUI.getMessages().view_adminTopology_agent_agentBindAddress()), - - FIELD_PORT("port", CoreGUI.getMessages().view_adminTopology_agent_agentBindPort()), - - FIELD_LAST_AVAILABILITY_REPORT("lastAvailabilityReport", CoreGUI.getMessages().view_adminTopology_agent_lastAvailabilityReport()), - - FIELD_AGENT_TOKEN("agentToken", CoreGUI.getMessages().view_adminTopology_agentDetail_token()), - - FIELD_AFFINITY_GROUP("affinityGroup", CoreGUI.getMessages().view_adminTopology_server_affinityGroup()), - - FIELD_AFFINITY_GROUP_ID("affinityGroupId", "affinityGroupId"); - - /** - * Corresponds to a property name of Server (e.g. operationMode). - */ - private String propertyName; - - /** - * The table header for the field or property (e.g. Mode). - */ - private String title; - - private AgentNodeDatasourceField(String propertyName, String title) { - this.propertyName = propertyName; - this.title = title; - } - - public String propertyName() { - return propertyName; - } - - public String title() { - return title; - } - - public ListGridField getListGridField() { - return new ListGridField(propertyName, title); - } - - public ListGridField getListGridField(String width) { - ListGridField field = new ListGridField(propertyName, title); - field.setWidth(width); - return field; - } -} \ No newline at end of file diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentTableView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentTableView.java index d3b8761..b50d852 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentTableView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AgentTableView.java @@ -18,15 +18,14 @@ */ package org.rhq.enterprise.gui.coregui.client.admin.topology;
-import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentNodeDatasourceField.FIELD_AFFINITY_GROUP; -import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentNodeDatasourceField.FIELD_AFFINITY_GROUP_ID; -import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentNodeDatasourceField.FIELD_SERVER; -import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentNodeDatasourceField.FIELD_SERVER_ID; +import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentDatasourceField.FIELD_AFFINITY_GROUP; +import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentDatasourceField.FIELD_AFFINITY_GROUP_ID; +import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentDatasourceField.FIELD_SERVER; +import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentDatasourceField.FIELD_SERVER_ID;
import java.util.List;
import com.smartgwt.client.types.SortDirection; -import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.grid.CellFormatter; import com.smartgwt.client.widgets.grid.ListGrid; @@ -47,7 +46,7 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility; /** * @author Jirka Kremser */ -public class AgentTableView extends TableSection<AgentNodeDatasource> implements HasViewName { +public class AgentTableView extends TableSection<AgentDatasource> implements HasViewName {
public static final ViewName VIEW_ID = new ViewName("Agents(GWT)", MSG.view_adminTopology_agents() + "(GWT)", IconEnum.AGENT); @@ -56,13 +55,16 @@ public class AgentTableView extends TableSection<AgentNodeDatasource> implements + AdministrationView.SECTION_TOPOLOGY_VIEW_ID + "/" + VIEW_ID;
private final boolean isAffinityGroupId; + + private final Integer id;
public AgentTableView(String locatorId, Integer id, boolean isAffinityGroupId) { super(locatorId, null); this.isAffinityGroupId = isAffinityGroupId; + this.id = id; setHeight100(); setWidth100(); - setDataSource(new AgentNodeDatasource(id, isAffinityGroupId)); + setDataSource(new AgentDatasource(id, isAffinityGroupId)); }
@Override @@ -118,15 +120,18 @@ public class AgentTableView extends TableSection<AgentNodeDatasource> implements }); } } - - if (isAffinityGroupId) - addTableAction(extendLocatorId("editGroupAgents"), MSG.view_groupInventoryMembers_button_updateMembership(), - new AuthorizedTableAction(this, TableActionEnablement.ALWAYS, Permission.MANAGE_SETTINGS) { - public void executeAction(final ListGridRecord[] selections, Object actionValue) { - SC.say("working.."); - // todo: open editor for agent members - } - }); + if (isAffinityGroupId) { + showUpdateMembersAction(); + } + } + + private void showUpdateMembersAction() { + addTableAction(extendLocatorId("editGroupAgents"), MSG.view_groupInventoryMembers_button_updateMembership(), + new AuthorizedTableAction(this, TableActionEnablement.ALWAYS, Permission.MANAGE_SETTINGS) { + public void executeAction(final ListGridRecord[] selections, Object actionValue) { + AffinityGroupAgentsSelector.show(id, AgentTableView.this); + } + }); }
@Override diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerDatasource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerDatasource.java index 0f76f74..2d1a75e 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerDatasource.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerDatasource.java @@ -135,10 +135,8 @@ public class ServerDatasource extends AbstractServerNodeDatasource<Server, Serve
if(fetchMembers) { criteria.addFilterAffinityGroupId(affinityGroupId); - GWTServiceLookup.getCloudService().findServersByCriteria(criteria, callback); - } else { - GWTServiceLookup.getCloudService().getServerNonMembersByAffinityGroupId(affinityGroupId, pc, callback); } + GWTServiceLookup.getCloudService().findServersByCriteria(criteria, callback); }
/** @@ -195,7 +193,7 @@ public class ServerDatasource extends AbstractServerNodeDatasource<Server, Serve @Override protected ServerCriteria getFetchCriteria(DSRequest request) { ServerCriteria criteria = new ServerCriteria(); - printRequestCriteria(request); +// printRequestCriteria(request); criteria.addFilterId(getFilter(request, FIELD_ID.propertyName(), Integer.class)); criteria.addFilterName(getFilter(request, FIELD_NAME.propertyName(), String.class)); criteria.addFilterAddress(getFilter(request, FILTER_ADDRESS, String.class)); diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerDetailView.java index 7165390..f3dbd4d 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerDetailView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerDetailView.java @@ -19,7 +19,7 @@
package org.rhq.enterprise.gui.coregui.client.admin.topology;
-import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentNodeDatasourceField.FIELD_AFFINITY_GROUP; +import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentDatasourceField.FIELD_AFFINITY_GROUP; import static org.rhq.enterprise.gui.coregui.client.admin.topology.ServerDatasourceField.FIELD_ADDRESS; import static org.rhq.enterprise.gui.coregui.client.admin.topology.ServerDatasourceField.FIELD_CTIME; import static org.rhq.enterprise.gui.coregui.client.admin.topology.ServerDatasourceField.FIELD_MTIME; diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerTableView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerTableView.java index 79be297..3c08618 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerTableView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerTableView.java @@ -18,8 +18,8 @@ */ package org.rhq.enterprise.gui.coregui.client.admin.topology;
-import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentNodeDatasourceField.FIELD_AFFINITY_GROUP; -import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentNodeDatasourceField.FIELD_AFFINITY_GROUP_ID; +import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentDatasourceField.FIELD_AFFINITY_GROUP; +import static org.rhq.enterprise.gui.coregui.client.admin.topology.AgentDatasourceField.FIELD_AFFINITY_GROUP_ID; import static org.rhq.enterprise.gui.coregui.client.admin.topology.ServerDatasourceField.FIELD_ORDINAL;
import java.io.Serializable; diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerBean.java index bd9e88b..f51b246 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerBean.java @@ -296,7 +296,7 @@ public class CloudManagerBean implements CloudManagerLocal { partitionEventManager.processRequestedPartitionEvents(); }
- @RequiredPermission(Permission.MANAGE_INVENTORY) + @RequiredPermission(Permission.MANAGE_SETTINGS) public PageList<Server> findServersByCriteria(Subject subject, ServerCriteria criteria) { CriteriaQueryGenerator generator = new CriteriaQueryGenerator(subject, criteria); CriteriaQueryRunner<Server> runner = new CriteriaQueryRunner<Server>(criteria, generator, entityManager);
commit 9c52b1e5e5e75f65acad0fcd250da92914d7435c Author: Jirka Kremser jkremser@redhat.com Date: Tue Dec 18 17:10:43 2012 +0100
AgentCriteria and Agent finder have been added
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AgentCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AgentCriteria.java new file mode 100644 index 0000000..b18b5d6 --- /dev/null +++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AgentCriteria.java @@ -0,0 +1,107 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.criteria; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; + +import org.rhq.core.domain.cloud.Server; +import org.rhq.core.domain.resource.Agent; +import org.rhq.core.domain.util.PageOrdering; + +/** + * Criteria object for querying {@link Server}s. + * + * @author Jiri Kremser + */ +@XmlAccessorType(XmlAccessType.FIELD) +@SuppressWarnings("unused") +public class AgentCriteria extends Criteria { + + private static final long serialVersionUID = 1L; + + public static final String SORT_FIELD_CTIME = "ctime"; + + public static final String SORT_FIELD_NAME = "name"; + + private Integer filterId; + private String filterName; + private String filterAddress; + private Integer filterPort; + private Integer filterServerId; // requires override + private Integer filterAffinityGroupId; // requires override + + private boolean fetchServer; + private boolean fetchAffinityGroup; + + private PageOrdering sortCtime; + private PageOrdering sortName; + + public AgentCriteria() { + filterOverrides.put("serverId", "server.id = ?"); + filterOverrides.put("affinityGroupId", "affinityGroup.id = ?"); + } + + public Class<?> getPersistentClass() { + return Agent.class; + } + + public void addFilterId(Integer filterId) { + this.filterId = filterId; + } + + public void addFilterName(String filterName) { + this.filterName = filterName; + } + + public void addFilterAffinityGroupId(Integer filterAffinityGroupId) { + this.filterAffinityGroupId = filterAffinityGroupId; + } + + public void addFilterAddress(String filterAddress) { + this.filterAddress = filterAddress; + } + + public void addFilterPort(Integer filterPort) { + this.filterPort = filterPort; + } + + public void addFilterServerId(Integer filterServerId) { + this.filterServerId = filterServerId; + } + + public void fetchAffinityGroup(boolean fetchAffinityGroup) { + this.fetchAffinityGroup = fetchAffinityGroup; + } + + public void fetchServer(boolean fetchServer) { + this.fetchServer = fetchServer; + } + + public void addSortCtime(PageOrdering sort) { + addSortField(SORT_FIELD_CTIME); + this.sortCtime = sort; + } + + public void addSortName(PageOrdering sort) { + addSortField(SORT_FIELD_NAME); + this.sortName = sort; + } +} diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/CloudGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/CloudGWTService.java index 3e64318..df83ba8 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/CloudGWTService.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/CloudGWTService.java @@ -33,6 +33,7 @@ import org.rhq.core.domain.cloud.PartitionEventDetails; import org.rhq.core.domain.cloud.Server; import org.rhq.core.domain.cloud.composite.AffinityGroupCountComposite; import org.rhq.core.domain.cloud.composite.ServerWithAgentCountComposite; +import org.rhq.core.domain.criteria.AgentCriteria; import org.rhq.core.domain.criteria.PartitionEventCriteria; import org.rhq.core.domain.criteria.ServerCriteria; import org.rhq.core.domain.resource.Agent; @@ -58,47 +59,54 @@ public interface CloudGWTService extends RemoteService { void deleteServers(int[] serverIds) throws RuntimeException;
void updateServerMode(int[] serverIds, Server.OperationMode mode) throws RuntimeException; - + void updateServer(Server server) throws RuntimeException;
List<FailoverListDetails> getFailoverListDetailsByAgentId(int agentId, PageControl pc) throws RuntimeException;;
PageList<PartitionEvent> findPartitionEventsByCriteria(PartitionEventCriteria criteria) throws RuntimeException; - + PageList<Server> findServersByCriteria(ServerCriteria criteria) throws RuntimeException;
+ PageList<Agent> findAgentsByCriteria(AgentCriteria criteria) throws RuntimeException; + void cloudPartitionEventRequest() throws RuntimeException;
void purgeAllEvents() throws RuntimeException;
void deletePartitionEvents(int[] eventIds) throws RuntimeException;
- PageList<PartitionEventDetails> getPartitionEventDetails(int partitionEventId, - PageControl pageControl) throws RuntimeException; - - PageList<AffinityGroupCountComposite> getAffinityGroupCountComposites(PageControl pageControl) throws RuntimeException; - + PageList<PartitionEventDetails> getPartitionEventDetails(int partitionEventId, PageControl pageControl) + throws RuntimeException; + + PageList<AffinityGroupCountComposite> getAffinityGroupCountComposites(PageControl pageControl) + throws RuntimeException; + int deleteAffinityGroups(int[] affinityGroupIds) throws RuntimeException; - + int createAffinityGroup(AffinityGroup affinityGroup) throws RuntimeException; - + void updateAffinityGroup(AffinityGroup affinityGroup) throws RuntimeException; - - PageList<Server> getServerMembersByAffinityGroupId(int affinityGroupId, PageControl pageControl) throws RuntimeException; - - PageList<Server> getServerNonMembersByAffinityGroupId(int affinityGroupId, PageControl pageControl) throws RuntimeException; - - PageList<Agent> getAgentMembersByAffinityGroupId(int affinityGroupId, PageControl pageControl) throws RuntimeException; - - PageList<Agent> getAgentNonMembersByAffinityGroupId(int affinityGroupId, PageControl pageControl) throws RuntimeException; - + + PageList<Server> getServerMembersByAffinityGroupId(int affinityGroupId, PageControl pageControl) + throws RuntimeException; + + PageList<Server> getServerNonMembersByAffinityGroupId(int affinityGroupId, PageControl pageControl) + throws RuntimeException; + + PageList<Agent> getAgentMembersByAffinityGroupId(int affinityGroupId, PageControl pageControl) + throws RuntimeException; + + PageList<Agent> getAgentNonMembersByAffinityGroupId(int affinityGroupId, PageControl pageControl) + throws RuntimeException; + AffinityGroup getAffinityGroupById(int affinityGroupId) throws RuntimeException; - + void addServersToGroup(int affinityGroupId, Integer[] serverIds) throws RuntimeException; - + void removeServersFromGroup(Integer[] serverIds) throws RuntimeException; - + void addAgentsToGroup(int affinityGroupId, Integer[] agentIds) throws RuntimeException; - + void removeAgentsFromGroup(Integer[] agentIds) throws RuntimeException; } diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/CloudGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/CloudGWTServiceImpl.java index 1daa1df..db7ec3c 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/CloudGWTServiceImpl.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/CloudGWTServiceImpl.java @@ -36,6 +36,7 @@ import org.rhq.core.domain.cloud.Server; import org.rhq.core.domain.cloud.Server.OperationMode; import org.rhq.core.domain.cloud.composite.AffinityGroupCountComposite; import org.rhq.core.domain.cloud.composite.ServerWithAgentCountComposite; +import org.rhq.core.domain.criteria.AgentCriteria; import org.rhq.core.domain.criteria.PartitionEventCriteria; import org.rhq.core.domain.criteria.ServerCriteria; import org.rhq.core.domain.resource.Agent; @@ -46,6 +47,7 @@ import org.rhq.enterprise.gui.coregui.server.util.SerialUtility; import org.rhq.enterprise.server.cloud.AffinityGroupManagerLocal; import org.rhq.enterprise.server.cloud.CloudManagerLocal; import org.rhq.enterprise.server.cloud.PartitionEventManagerLocal; +import org.rhq.enterprise.server.core.AgentManagerLocal; import org.rhq.enterprise.server.util.LookupUtil;
/** @@ -56,6 +58,8 @@ public class CloudGWTServiceImpl extends AbstractGWTServiceImpl implements Cloud private static final long serialVersionUID = 1L;
private CloudManagerLocal cloudManager = LookupUtil.getCloudManager(); + + private AgentManagerLocal agentManager = LookupUtil.getAgentManager();
private PartitionEventManagerLocal partitionEventManager = LookupUtil.getPartitionEventManager();
@@ -143,6 +147,17 @@ public class CloudGWTServiceImpl extends AbstractGWTServiceImpl implements Cloud throw getExceptionToThrowToClient(t); } } + + @Override + public PageList<Agent> findAgentsByCriteria(AgentCriteria criteria) throws RuntimeException { + try { + return SerialUtility.prepare( + agentManager.findAgentsByCriteria(getSessionSubject(), criteria), + "CloudGWTServiceImpl.findAgentsByCriteria"); + } catch (Throwable t) { + throw getExceptionToThrowToClient(t); + } + }
@Override public void cloudPartitionEventRequest() throws RuntimeException { diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerBean.java index 9cced72..42adb10 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerBean.java @@ -48,6 +48,7 @@ import org.rhq.core.clientapi.server.core.PingRequest; import org.rhq.core.domain.auth.Subject; import org.rhq.core.domain.authz.Permission; import org.rhq.core.domain.common.composite.SystemSetting; +import org.rhq.core.domain.criteria.AgentCriteria; import org.rhq.core.domain.measurement.AvailabilityType; import org.rhq.core.domain.resource.Agent; import org.rhq.core.domain.resource.composite.AgentLastAvailabilityPingComposite; @@ -67,6 +68,8 @@ import org.rhq.enterprise.server.core.comm.ServerCommunicationsServiceMBean; import org.rhq.enterprise.server.core.comm.ServerCommunicationsServiceUtil; import org.rhq.enterprise.server.measurement.AvailabilityManagerLocal; import org.rhq.enterprise.server.system.SystemManagerLocal; +import org.rhq.enterprise.server.util.CriteriaQueryGenerator; +import org.rhq.enterprise.server.util.CriteriaQueryRunner; import org.rhq.enterprise.server.util.LookupUtil; import org.rhq.enterprise.server.util.concurrent.AvailabilityReportSerializer;
@@ -654,5 +657,12 @@ public class AgentManagerBean implements AgentManagerLocal {
return pingResults; } + + @RequiredPermission(Permission.MANAGE_SETTINGS) + public PageList<Agent> findAgentsByCriteria(Subject subject, AgentCriteria criteria) { + CriteriaQueryGenerator generator = new CriteriaQueryGenerator(subject, criteria); + CriteriaQueryRunner<Agent> runner = new CriteriaQueryRunner<Agent>(criteria, generator, entityManager); + return runner.execute(); + }
} \ No newline at end of file diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerLocal.java index e09cfaa..5494e4d 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerLocal.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerLocal.java @@ -30,6 +30,7 @@ import org.rhq.core.clientapi.server.core.AgentVersion; import org.rhq.core.clientapi.server.core.CoreServerService; import org.rhq.core.clientapi.server.core.PingRequest; import org.rhq.core.domain.auth.Subject; +import org.rhq.core.domain.criteria.AgentCriteria; import org.rhq.core.domain.resource.Agent; import org.rhq.core.domain.util.PageControl; import org.rhq.core.domain.util.PageList; @@ -308,4 +309,6 @@ public interface AgentManagerLocal { * @return The updated request object. */ public PingRequest handlePingRequest(PingRequest request); + + PageList<Agent> findAgentsByCriteria(Subject subject, AgentCriteria criteria); } \ No newline at end of file
commit 6ad56994db007039324ad2d6462636546e4e1ce1 Author: Jirka Kremser jkremser@redhat.com Date: Fri Dec 14 19:35:46 2012 +0100
ServerCriteria and Server finder have been added
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ServerCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ServerCriteria.java new file mode 100644 index 0000000..b00b3d7 --- /dev/null +++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ServerCriteria.java @@ -0,0 +1,125 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.criteria; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; + +import org.rhq.core.domain.cloud.Server; +import org.rhq.core.domain.cloud.Server.OperationMode; +import org.rhq.core.domain.util.PageOrdering; + +/** + * Criteria object for querying {@link Server}s. + * + * @author Jiri Kremser + */ +@XmlAccessorType(XmlAccessType.FIELD) +@SuppressWarnings("unused") +public class ServerCriteria extends Criteria { + + private static final long serialVersionUID = 1L; + + public static final String SORT_FIELD_CTIME = "ctime"; + + public static final String SORT_FIELD_NAME = "name"; + + public static final String SORT_FIELD_COMPUTE_POWER = "computePower"; + + private Integer filterId; + private String filterName; + private String filterAddress; + private Integer filterPort; + private Integer filterSecurePort; + private OperationMode filterOperationMode; // requires override + private Integer filterComputePower; + private Integer filterAffinityGroupId; // requires override + + private boolean fetchAgents; + private boolean fetchAffinityGroup; + + private PageOrdering sortCtime; + private PageOrdering sortName; + private PageOrdering sortComputePower; + + public ServerCriteria() { + // filterOverrides.put("operationMode", "operationMode IN ( ? )"); + filterOverrides.put("affinityGroupId", "affinityGroup.id = ?"); + } + + public Class<?> getPersistentClass() { + return Server.class; + } + + public void addFilterId(Integer filterId) { + this.filterId = filterId; + } + + public void addFilterName(String filterName) { + this.filterName = filterName; + } + + public void addFilterAddress(String filterAddress) { + this.filterAddress = filterAddress; + } + + public void addFilterPort(Integer filterPort) { + this.filterPort = filterPort; + } + + public void addFilterSecurePort(Integer filterSecurePort) { + this.filterSecurePort = filterSecurePort; + } + + public void addFilterOperationMode(OperationMode operationMode) { + this.filterOperationMode = operationMode; + } + + public void addFilterComputePower(Integer filterComputePower) { + this.filterComputePower = filterComputePower; + } + + public void addFilterAffinityGroupId(Integer filterAffinityGroupId) { + this.filterAffinityGroupId = filterAffinityGroupId; + } + + public void fetchAgents(boolean fetchAgents) { + this.fetchAgents = fetchAgents; + } + + public void fetchAffinityGroup(boolean fetchAffinityGroup) { + this.fetchAffinityGroup = fetchAffinityGroup; + } + + public void addSortCtime(PageOrdering sort) { + addSortField(SORT_FIELD_CTIME); + this.sortCtime = sort; + } + + public void addSortName(PageOrdering sort) { + addSortField(SORT_FIELD_NAME); + this.sortName = sort; + } + + public void addSortComputePower(PageOrdering sortComputePower) { + addSortField(SORT_FIELD_COMPUTE_POWER); + this.sortComputePower = sortComputePower; + } +} diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupServersSelector.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupServersSelector.java index a1f5507..f104d6c 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupServersSelector.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/AffinityGroupServersSelector.java @@ -42,6 +42,7 @@ import com.smartgwt.client.widgets.layout.HLayout; import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.cloud.Server; +import org.rhq.core.domain.criteria.ServerCriteria; import org.rhq.core.domain.util.PageControl; import org.rhq.core.domain.util.PageList; import org.rhq.enterprise.gui.coregui.client.components.selector.AbstractSelector; @@ -53,13 +54,13 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton; /** * @author Jirka Kremser */ -public class AffinityGroupServersSelector extends AbstractSelector<Server, org.rhq.core.domain.criteria.Criteria> { +public class AffinityGroupServersSelector extends AbstractSelector<Server, ServerCriteria> {
private static final String ITEM_ICON = "types/Server_up_16.png";
private final Integer affinityGroupId;
- private static RPCDataSource<Server, org.rhq.core.domain.criteria.Criteria> datasource = null; + private static RPCDataSource<Server, ServerCriteria> datasource = null;
private static Window modalWindow; private static boolean shouldBeClosed; @@ -98,7 +99,7 @@ public class AffinityGroupServersSelector extends AbstractSelector<Server, org.r }
@Override - protected RPCDataSource<Server, org.rhq.core.domain.criteria.Criteria> getDataSource() { + protected RPCDataSource<Server, ServerCriteria> getDataSource() { if (datasource == null) { datasource = new ServerDatasource(affinityGroupId, false); } diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/PartitionEventDatasource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/PartitionEventDatasource.java index 4a07853..f77a843 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/PartitionEventDatasource.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/PartitionEventDatasource.java @@ -158,6 +158,9 @@ public class PartitionEventDatasource extends RPCDataSource<PartitionEvent, Part
@Override protected PartitionEventCriteria getFetchCriteria(DSRequest request) { + //todo: do it like in ResourceDatasource.class + + ExecutionStatus[] statuses = getArrayFilter(request, FILTER_EXECUTION_STATUS, ExecutionStatus.class); PartitionEventType[] types = getArrayFilter(request, FILTER_EVENT_TYPE, PartitionEventType.class); if (types == null || types.length == 0 || statuses == null || statuses.length == 0) { diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerDatasource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerDatasource.java index d942c44..0f76f74 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerDatasource.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerDatasource.java @@ -42,18 +42,28 @@ import com.smartgwt.client.widgets.grid.ListGridField; import com.smartgwt.client.widgets.grid.ListGridRecord;
import org.rhq.core.domain.cloud.Server; -import org.rhq.core.domain.criteria.Criteria; +import org.rhq.core.domain.cloud.Server.OperationMode; +import org.rhq.core.domain.criteria.ServerCriteria; import org.rhq.core.domain.util.PageControl; import org.rhq.core.domain.util.PageList; import org.rhq.core.domain.util.PageOrdering; import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter; import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup; +import org.rhq.enterprise.gui.coregui.client.util.Log;
/** * @author Jirka Kremser * */ -public class ServerDatasource extends AbstractServerNodeDatasource<Server, Criteria> { +public class ServerDatasource extends AbstractServerNodeDatasource<Server, ServerCriteria> { + + // filters + public static final String FILTER_ADDRESS = FIELD_ADDRESS.propertyName(); + public static final String FILTER_PORT = FIELD_PORT.propertyName(); + public static final String FILTER_SECURE_PORT = FIELD_SECURE_PORT.propertyName(); + public static final String FILTER_OPERATION_MODE = FIELD_OPERATION_MODE.propertyName(); + public static final String FILTER_COMPUTE_POWER = "computePower"; + public static final String FILTER_AFFINITY_GROUP_ID = "affinityGroupId";
private final Integer affinityGroupId;
@@ -103,7 +113,7 @@ public class ServerDatasource extends AbstractServerNodeDatasource<Server, Crite }
@Override - protected void executeFetch(final DSRequest request, final DSResponse response, Criteria criteria) { + protected void executeFetch(final DSRequest request, final DSResponse response, ServerCriteria criteria) { if (affinityGroupId == null) { return; } @@ -122,8 +132,10 @@ public class ServerDatasource extends AbstractServerNodeDatasource<Server, Crite processResponse(request.getRequestId(), response); } }; + if(fetchMembers) { - GWTServiceLookup.getCloudService().getServerMembersByAffinityGroupId(affinityGroupId, pc, callback); + criteria.addFilterAffinityGroupId(affinityGroupId); + GWTServiceLookup.getCloudService().findServersByCriteria(criteria, callback); } else { GWTServiceLookup.getCloudService().getServerNonMembersByAffinityGroupId(affinityGroupId, pc, callback); } @@ -181,8 +193,22 @@ public class ServerDatasource extends AbstractServerNodeDatasource<Server, Crite }
@Override - protected Criteria getFetchCriteria(DSRequest request) { - // we don't use criteria for this datasource, just return null - return null; + protected ServerCriteria getFetchCriteria(DSRequest request) { + ServerCriteria criteria = new ServerCriteria(); + printRequestCriteria(request); + criteria.addFilterId(getFilter(request, FIELD_ID.propertyName(), Integer.class)); + criteria.addFilterName(getFilter(request, FIELD_NAME.propertyName(), String.class)); + criteria.addFilterAddress(getFilter(request, FILTER_ADDRESS, String.class)); + criteria.addFilterPort(getFilter(request, FILTER_PORT, Integer.class)); + criteria.addFilterSecurePort(getFilter(request, FILTER_SECURE_PORT, Integer.class)); + criteria.addFilterOperationMode(getFilter(request, FILTER_OPERATION_MODE, OperationMode.class)); + criteria.addFilterComputePower(getFilter(request, FILTER_COMPUTE_POWER, Integer.class)); + criteria.addFilterAffinityGroupId(getFilter(request, FILTER_AFFINITY_GROUP_ID, Integer.class)); + + //@todo: Remove me when finished debugging search expression + Log.debug(" *** ServerCriteria Search String: " + getFilter(request, "search", String.class)); + criteria.setSearchExpression(getFilter(request, "search", String.class)); + + return criteria; } } diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerTableView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerTableView.java index 24e2d9c..79be297 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerTableView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/ServerTableView.java @@ -38,7 +38,7 @@ import com.smartgwt.client.widgets.grid.ListGridRecord;
import org.rhq.core.domain.authz.Permission; import org.rhq.core.domain.cloud.Server; -import org.rhq.core.domain.criteria.Criteria; +import org.rhq.core.domain.criteria.BaseCriteria; import org.rhq.enterprise.gui.coregui.client.CoreGUI; import org.rhq.enterprise.gui.coregui.client.IconEnum; import org.rhq.enterprise.gui.coregui.client.admin.AdministrationView; @@ -56,7 +56,7 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility; * @author Jirka Kremser * */ -public class ServerTableView extends TableSection<AbstractServerNodeDatasource<? extends Serializable, Criteria>> +public class ServerTableView extends TableSection<AbstractServerNodeDatasource<? extends Serializable, ? extends BaseCriteria>> implements HasViewName {
public static final ViewName VIEW_ID = new ViewName("Servers(GWT)", MSG.view_adminTopology_servers() + "(GWT)", diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/CloudGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/CloudGWTService.java index afaacb8..3e64318 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/CloudGWTService.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/CloudGWTService.java @@ -34,6 +34,7 @@ import org.rhq.core.domain.cloud.Server; import org.rhq.core.domain.cloud.composite.AffinityGroupCountComposite; import org.rhq.core.domain.cloud.composite.ServerWithAgentCountComposite; import org.rhq.core.domain.criteria.PartitionEventCriteria; +import org.rhq.core.domain.criteria.ServerCriteria; import org.rhq.core.domain.resource.Agent; import org.rhq.core.domain.util.PageControl; import org.rhq.core.domain.util.PageList; @@ -63,6 +64,8 @@ public interface CloudGWTService extends RemoteService { List<FailoverListDetails> getFailoverListDetailsByAgentId(int agentId, PageControl pc) throws RuntimeException;;
PageList<PartitionEvent> findPartitionEventsByCriteria(PartitionEventCriteria criteria) throws RuntimeException; + + PageList<Server> findServersByCriteria(ServerCriteria criteria) throws RuntimeException;
void cloudPartitionEventRequest() throws RuntimeException;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/CloudGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/CloudGWTServiceImpl.java index 32fadde..1daa1df 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/CloudGWTServiceImpl.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/CloudGWTServiceImpl.java @@ -37,6 +37,7 @@ import org.rhq.core.domain.cloud.Server.OperationMode; import org.rhq.core.domain.cloud.composite.AffinityGroupCountComposite; import org.rhq.core.domain.cloud.composite.ServerWithAgentCountComposite; import org.rhq.core.domain.criteria.PartitionEventCriteria; +import org.rhq.core.domain.criteria.ServerCriteria; import org.rhq.core.domain.resource.Agent; import org.rhq.core.domain.util.PageControl; import org.rhq.core.domain.util.PageList; @@ -130,6 +131,18 @@ public class CloudGWTServiceImpl extends AbstractGWTServiceImpl implements Cloud throw getExceptionToThrowToClient(t); } } + + @Override + public PageList<Server> findServersByCriteria(ServerCriteria criteria) + throws RuntimeException { + try { + return SerialUtility.prepare( + cloudManager.findServersByCriteria(getSessionSubject(), criteria), + "CloudGWTServiceImpl.findServersByCriteria"); + } catch (Throwable t) { + throw getExceptionToThrowToClient(t); + } + }
@Override public void cloudPartitionEventRequest() throws RuntimeException { diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerBean.java index 4bfc1af..bd9e88b 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerBean.java @@ -36,6 +36,7 @@ import org.rhq.core.domain.cloud.FailoverListDetails; import org.rhq.core.domain.cloud.PartitionEventType; import org.rhq.core.domain.cloud.Server; import org.rhq.core.domain.cloud.composite.ServerWithAgentCountComposite; +import org.rhq.core.domain.criteria.ServerCriteria; import org.rhq.core.domain.resource.Agent; import org.rhq.core.domain.server.PersistenceUtility; import org.rhq.core.domain.util.PageControl; @@ -44,6 +45,8 @@ import org.rhq.enterprise.server.RHQConstants; import org.rhq.enterprise.server.authz.AuthorizationManagerLocal; import org.rhq.enterprise.server.authz.RequiredPermission; import org.rhq.enterprise.server.cloud.instance.ServerManagerLocal; +import org.rhq.enterprise.server.util.CriteriaQueryGenerator; +import org.rhq.enterprise.server.util.CriteriaQueryRunner; import org.rhq.enterprise.server.util.LookupUtil;
/** @@ -292,4 +295,11 @@ public class CloudManagerBean implements CloudManagerLocal { // regardless of the number of pending requests, as the work would be duplicated. partitionEventManager.processRequestedPartitionEvents(); } + + @RequiredPermission(Permission.MANAGE_INVENTORY) + public PageList<Server> findServersByCriteria(Subject subject, ServerCriteria criteria) { + CriteriaQueryGenerator generator = new CriteriaQueryGenerator(subject, criteria); + CriteriaQueryRunner<Server> runner = new CriteriaQueryRunner<Server>(criteria, generator, entityManager); + return runner.execute(); + } } diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerLocal.java index 212f835..92b59d3 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerLocal.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerLocal.java @@ -26,6 +26,7 @@ import org.rhq.core.domain.auth.Subject; import org.rhq.core.domain.cloud.FailoverListDetails; import org.rhq.core.domain.cloud.Server; import org.rhq.core.domain.cloud.composite.ServerWithAgentCountComposite; +import org.rhq.core.domain.criteria.ServerCriteria; import org.rhq.core.domain.resource.Agent; import org.rhq.core.domain.util.PageControl; import org.rhq.core.domain.util.PageList; @@ -89,4 +90,6 @@ public interface CloudManagerLocal { PageList<FailoverListDetails> getFailoverListDetailsByAgentId(int agentId, PageControl pc);
void markStaleServersDown(Subject subject); + + PageList<Server> findServersByCriteria(Subject subject, ServerCriteria criteria); }
commit 134d6f6984e69dc06b105a3024f30f947c8f498a Author: Jirka Kremser jkremser@redhat.com Date: Fri Dec 14 15:21:53 2012 +0100
Revert "exposing the CloudManagerBean via CLI"
This reverts commit 60c1d42fa5750ef5d1829e97b6b15323501bc3f2.
diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/RhqManager.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/RhqManager.java index 151267f..d374324 100644 --- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/RhqManager.java +++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/RhqManager.java @@ -24,7 +24,6 @@ import org.rhq.enterprise.server.alert.AlertManagerRemote; import org.rhq.enterprise.server.auth.SubjectManagerRemote; import org.rhq.enterprise.server.authz.RoleManagerRemote; import org.rhq.enterprise.server.bundle.BundleManagerRemote; -import org.rhq.enterprise.server.cloud.CloudManagerRemote; import org.rhq.enterprise.server.configuration.ConfigurationManagerRemote; import org.rhq.enterprise.server.content.ContentManagerRemote; import org.rhq.enterprise.server.content.RepoManagerRemote; @@ -64,7 +63,6 @@ public enum RhqManager { BundleManager(BundleManagerRemote.class, "${BundleManager}"), // CallTimeDataManager(CallTimeDataManagerRemote.class, "${CallTimeDataManager}"), // RepoManager(RepoManagerRemote.class, "${RepoManager}"), // - CloudManager(CloudManagerRemote.class, "${CloudManager}"), // ConfigurationManager(ConfigurationManagerRemote.class, "${ConfigurationManager}"), // ContentManager(ContentManagerRemote.class, "${ContentManager}"), // DataAccessManager(DataAccessManagerRemote.class, "${DataAccessManager}"), // diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerBean.java index 391b9e4..4bfc1af 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerBean.java @@ -54,7 +54,7 @@ import org.rhq.enterprise.server.util.LookupUtil; * @author Joseph Marques */ @Stateless -public class CloudManagerBean implements CloudManagerLocal, CloudManagerRemote { +public class CloudManagerBean implements CloudManagerLocal { private final Log log = LogFactory.getLog(CloudManagerBean.class);
// A time sufficient to determine whether a server is down. Can be based on the initial delay set for the server instance diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerRemote.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerRemote.java deleted file mode 100644 index 1f97b99..0000000 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerRemote.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.cloud; - -import java.util.List; - -import javax.ejb.Remote; - -import org.rhq.core.domain.auth.Subject; -import org.rhq.core.domain.cloud.Server; -import org.rhq.core.domain.cloud.composite.ServerWithAgentCountComposite; -import org.rhq.core.domain.util.PageControl; -import org.rhq.core.domain.util.PageList; - -/** - * @author Jiri Kremser - */ -@Remote -public interface CloudManagerRemote { - -// void deleteServers(Integer[] serverIds) throws CloudManagerException; -// -// void deleteServer(Integer serverId) throws CloudManagerException; -// -// List<Agent> getAgentsByServerName(String serverName); -// -// Server getServerById(int serverId); -// -// Server getServerByName(String serverName); -// -// /** -// * Return every server registered in the database considered part of the active cloud. This will exclude, for example, -// * servers in INSTALLED mode or any other mode that should not be included when performing cloud operations such as partitioning. -// * @return All servers available to the cloud. -// */ -// List<Server> getAllCloudServers(); -// - /** - * Return every server registered in the database. - * @return All servers, regardless of operation mode. - */ - List<Server> getAllServers(); - - PageList<ServerWithAgentCountComposite> getServerComposites(Subject subject, PageControl pc); -// -// /** -// * Returns the number of servers that are part of the "server cloud", which excludes -// * servers that have been installed but not associated with the cloud. -// * The returned count will include those servers that are down or in maintenance mode, -// * in addition to those servers that are currently running in a normal state. -// * -// * @return count of servers in the cloud -// */ -// int getServerCount(); -// -// /** -// * Returns the number of servers that are part of the "server cloud" that are currently -// * running in "normal" mode. -// * -// * This excludes all other servers such as those servers that have been installed but -// * not associated with the cloud, servers that are down or in maintenance mode. -// * -// * @return count of servers in the cloud that are in a normal running state -// */ -// int getNormalServerCount(); -// -// void updateServerMode(Integer[] serverIds, Server.OperationMode mode); -// -// Server updateServer(Subject subject, Server server); -// -// PageList<FailoverListDetails> getFailoverListDetailsByAgentId(int agentId, PageControl pc); -// -// void markStaleServersDown(Subject subject); -} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/RemoteAPIValidator.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/RemoteAPIValidator.java index 453e0a5..fddc6c6 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/RemoteAPIValidator.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/RemoteAPIValidator.java @@ -34,7 +34,6 @@ import org.rhq.enterprise.server.alert.AlertDefinitionManagerBean; import org.rhq.enterprise.server.alert.AlertManagerBean; import org.rhq.enterprise.server.auth.SubjectManagerBean; import org.rhq.enterprise.server.authz.RoleManagerBean; -import org.rhq.enterprise.server.cloud.CloudManagerBean; import org.rhq.enterprise.server.configuration.ConfigurationManagerBean; import org.rhq.enterprise.server.content.AdvisoryManagerBean; import org.rhq.enterprise.server.content.ContentManagerBean; @@ -69,7 +68,6 @@ public class RemoteAPIValidator { AvailabilityManagerBean.class,// CallTimeDataManagerBean.class, // RepoManagerBean.class,// - CloudManagerBean.class,// ConfigurationManagerBean.class, // ContentManagerBean.class, // //ContentSourceManagerBean.class, //
commit 756bac150c6f31e4dd5a60c9f519226fff7f28c1 Author: Jirka Kremser jkremser@redhat.com Date: Fri Dec 14 14:43:33 2012 +0100
adding comment
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/FailoverListItemDatasource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/FailoverListItemDatasource.java index edce33a..6dd2430 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/FailoverListItemDatasource.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/topology/FailoverListItemDatasource.java @@ -53,6 +53,8 @@ import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup; public class FailoverListItemDatasource extends AbstractServerNodeDatasource<FailoverListDetails, Criteria> {
private final int agentId; + + // this delegate is there to not repeat the copyValues code private final ServerDatasource serverDatasource;
public FailoverListItemDatasource(int agentId) {
commit 2ecf112a35453de2ab40aa4c091aff039c73f26c Merge: 829bede e794a37 Author: Jirka Kremser jkremser@redhat.com Date: Fri Dec 14 13:30:23 2012 +0100
Merge branch 'master' into jkremser/ha-jsf-to-gwt-rewrite
commit e794a376e030ff34e237afcb9b4994768e489cd8 Author: Lukas Krejci lkrejci@redhat.com Date: Thu Dec 13 17:27:45 2012 +0100
Fixed the ExportingInputStream to correctly define the XML namespaces (and thus work under woodstox, which is the XML streaming provider in AS7). Re-enabled the SynchronizationManagerBeanTest.
diff --git a/modules/enterprise/server/itests-2/pom.xml b/modules/enterprise/server/itests-2/pom.xml index f58396a..01b377f 100644 --- a/modules/enterprise/server/itests-2/pom.xml +++ b/modules/enterprise/server/itests-2/pom.xml @@ -656,7 +656,6 @@ <excludes> <!-- NOTE: PERF GROUP AND SOME CLASSES EXCLUDED (SEE BZ 874696) --> <exclude>**/LdapGroupManagerBeanTest.java</exclude> - <exclude>**/SynchronizationManagerBeanTest.java</exclude> <exclude>org/rhq/**/performance/**/*.java</exclude>
<!-- exclude the db tests which are not expected to run in this suite --> diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/sync/ExportingInputStream.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/sync/ExportingInputStream.java index 19734f6..eae8d7d 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/sync/ExportingInputStream.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/sync/ExportingInputStream.java @@ -34,7 +34,6 @@ import java.util.zip.GZIPOutputStream; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; -import javax.xml.namespace.NamespaceContext; import javax.xml.stream.XMLOutputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; @@ -238,19 +237,15 @@ public class ExportingInputStream extends InputStream { */ private void exportPrologue(XMLStreamWriter wrt) throws XMLStreamException { wrt.setDefaultNamespace(SynchronizationConstants.EXPORT_NAMESPACE); - wrt.setPrefix(SynchronizationConstants.EXPORT_NAMESPACE_PREFIX, SynchronizationConstants.EXPORT_NAMESPACE); - wrt.setPrefix(SynchronizationConstants.CONFIGURATION_INSTANCE_NAMESPACE_PREFIX, SynchronizationConstants.CONFIGURATION_INSTANCE_NAMESPACE); - wrt.setPrefix(SynchronizationConstants.CONFIGURATION_NAMESPACE_PREFIX, SynchronizationConstants.CONFIGURATION_NAMESPACE); - - NamespaceContext nsContext = SynchronizationConstants.createConfigurationExportNamespaceContext(); - - wrt.setNamespaceContext(nsContext);
wrt.writeStartDocument(); wrt.writeStartElement(SynchronizationConstants.EXPORT_NAMESPACE, SynchronizationConstants.CONFIGURATION_EXPORT_ELEMENT); - wrt.writeNamespace(SynchronizationConstants.CONFIGURATION_INSTANCE_NAMESPACE_PREFIX, ConfigurationInstanceDescriptorUtil.NS_CONFIGURATION_INSTANCE); - wrt.writeNamespace(SynchronizationConstants.CONFIGURATION_NAMESPACE_PREFIX, SynchronizationConstants.CONFIGURATION_NAMESPACE);
+ wrt.writeNamespace(SynchronizationConstants.CONFIGURATION_INSTANCE_NAMESPACE_PREFIX, + ConfigurationInstanceDescriptorUtil.NS_CONFIGURATION_INSTANCE); + wrt.writeNamespace(SynchronizationConstants.CONFIGURATION_NAMESPACE_PREFIX, + SynchronizationConstants.CONFIGURATION_NAMESPACE); + writeValidators(wrt); }
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/sync/test/ExportingInputStreamTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/sync/test/ExportingInputStreamTest.java index 6d56969..db6393e 100644 --- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/sync/test/ExportingInputStreamTest.java +++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/sync/test/ExportingInputStreamTest.java @@ -28,6 +28,8 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; +import java.nio.charset.Charset; +import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; @@ -36,9 +38,19 @@ import java.util.List; import java.util.Set;
import javax.persistence.EntityManager; +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Unmarshaller; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader;
import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -56,12 +68,14 @@ import org.rhq.core.domain.sync.ExporterMessages; import org.rhq.enterprise.server.sync.ExportReader; import org.rhq.enterprise.server.sync.ExportWriter; import org.rhq.enterprise.server.sync.ExportingInputStream; +import org.rhq.enterprise.server.sync.ImportException; import org.rhq.enterprise.server.sync.NoSingleEntity; import org.rhq.enterprise.server.sync.SynchronizationConstants; import org.rhq.enterprise.server.sync.Synchronizer; import org.rhq.enterprise.server.sync.exporters.AbstractDelegatingExportingIterator; import org.rhq.enterprise.server.sync.exporters.Exporter; import org.rhq.enterprise.server.sync.exporters.ExportingIterator; +import org.rhq.enterprise.server.sync.exporters.JAXBExportingIterator; import org.rhq.enterprise.server.sync.importers.ExportedEntityMatcher; import org.rhq.enterprise.server.sync.importers.Importer; import org.rhq.enterprise.server.sync.validators.ConsistencyValidator; @@ -90,7 +104,9 @@ public class ExportingInputStreamTest extends JMockTest { }
public void export(ExportWriter output) throws XMLStreamException { - output.writeCData(getCurrent().toString()); + output.writeStartElement("datum"); + output.writeCharacters(getCurrent().toString()); + output.writeEndElement(); }
public String getNotes() { @@ -191,6 +207,140 @@ public class ExportingInputStreamTest extends JMockTest { } }
+ public static class Entity { + public int value; + + public Entity(int value) { + this.value = value; + } + } + + @XmlRootElement(name = "exported-entity") + @XmlAccessorType(XmlAccessType.FIELD) + public static class ExportedEntity { + + @XmlAttribute + public int property; + } + + public static class JAXBExporter implements Exporter<Entity, ExportedEntity> { + + private static class JAXBIterator extends JAXBExportingIterator<ExportedEntity, Entity> { + + public JAXBIterator(java.util.Iterator<Entity> sourceIterator) { + super(sourceIterator, ExportedEntity.class); + } + + @Override + protected ExportedEntity convert(Entity object) { + ExportedEntity ret = new ExportedEntity(); + ret.property = object.value; + + return ret; + } + + @Override + public String getNotes() { + return null; + } + } + + @Override + public ExportingIterator<ExportedEntity> getExportingIterator() { + List<Entity> data = new ArrayList<Entity>(); + for(int i = 0; i < 4; ++i) { + data.add(new Entity(i)); + } + + return new JAXBIterator(data.iterator()); + } + + @Override + public String getNotes() { + return null; + } + + } + + public static class JAXBImporter implements Importer<Entity, ExportedEntity> { + + private Unmarshaller unmarshaller; + { + try { + JAXBContext context = JAXBContext.newInstance(ExportedEntity.class); + unmarshaller = context.createUnmarshaller(); + } catch (JAXBException e) { + throw new IllegalStateException(e); + } + } + + @Override + public ConfigurationDefinition getImportConfigurationDefinition() { + return null; + } + + @Override + public void configure(Configuration importConfiguration) { + } + + @Override + public ExportedEntityMatcher<Entity, ExportedEntity> getExportedEntityMatcher() { + return new ExportedEntityMatcher<Entity, ExportedEntity>() { + @Override + public Entity findMatch(ExportedEntity object) { + return new Entity(object.property); + } + }; + } + + @Override + public Set<EntityValidator<ExportedEntity>> getEntityValidators() { + return Collections.emptySet(); + } + + @Override + public void update(Entity entity, ExportedEntity exportedEntity) throws Exception { + entity.value = exportedEntity.property; + } + + @Override + public ExportedEntity unmarshallExportedEntity(ExportReader reader) throws XMLStreamException { + try { + return (ExportedEntity) unmarshaller.unmarshal(reader); + } catch (JAXBException e) { + throw new XMLStreamException(e); + } + } + + @Override + public String finishImport() throws Exception { + return null; + } + + } + + public static class JAXBSynchronizer implements Synchronizer<Entity, ExportedEntity> { + + @Override + public void initialize(Subject subject, EntityManager entityManager) { + } + + @Override + public Exporter<Entity, ExportedEntity> getExporter() { + return new JAXBExporter(); + } + + @Override + public Importer<Entity, ExportedEntity> getImporter() { + return new JAXBImporter(); + } + + @Override + public Set<ConsistencyValidator> getRequiredValidators() { + return Collections.emptySet(); + } + + }
public void testSucessfulExport() throws Exception { List<String> list1 = Arrays.asList("a", "b", "c"); @@ -203,11 +353,11 @@ public class ExportingInputStreamTest extends JMockTest {
InputStream export = new ExportingInputStream(exporters, new HashMap<String, ExporterMessages>(), 1024, false);
-// String exportContents = readAll(new InputStreamReader(export, "UTF-8")); -// -// LOG.info("Export contents:\n" + exportContents); -// -// export = new ByteArrayInputStream(exportContents.getBytes("UTF-8")); + String exportContents = readAll(new InputStreamReader(export, "UTF-8")); + + LOG.info("Export contents:\n" + exportContents); + + export = new ByteArrayInputStream(exportContents.getBytes("UTF-8"));
DocumentBuilder bld = DocumentBuilderFactory.newInstance().newDocumentBuilder();
@@ -264,16 +414,108 @@ public class ExportingInputStreamTest extends JMockTest { Node data = getDirectChildByTagName(entityElement, SynchronizationConstants.DATA_ELEMENT); assertNotNull(data, "Could not find data element in the entity.");
- String dataText = ((Element)data).getTextContent(); + Node datum = getDirectChildByTagName(data, "datum"); + assertNotNull(datum, "Could not find the exported datum element containing the actual data."); + + String datumText = ((Element) datum).getTextContent(); notesText = ((Element)note).getTextContent();
- assertEquals(notesText, ListToStringExporter.NOTE_PREFIX + dataText, "Unexpected discrepancy between data and notes in the export."); + assertEquals(notesText, ListToStringExporter.NOTE_PREFIX + datumText, + "Unexpected discrepancy between data and notes in the export."); }
++elementIndex; } }
+ @Test + public void testJAXBHandled() throws Exception { + JAXBSynchronizer sync = new JAXBSynchronizer(); + + Set<Synchronizer<?, ?>>syncs = this.<Synchronizer<?, ?>> asSet(sync); + + InputStream export = new ExportingInputStream(syncs, new HashMap<String, ExporterMessages>(), 1024, false); + + String exportContents = readAll(new InputStreamReader(export, "UTF-8")); + + XMLStreamReader rdr = XMLInputFactory.newInstance().createXMLStreamReader( + new ByteArrayInputStream(exportContents.getBytes(Charset.forName("UTF-8")))); + + try { + while (rdr.hasNext()) { + switch (rdr.next()) { + case XMLStreamReader.START_ELEMENT: + String tagName = rdr.getName().getLocalPart(); + if (SynchronizationConstants.ENTITIES_EXPORT_ELEMENT.equals(tagName)) { + try { + importSingle(rdr); + } catch (Exception e) { + //fail fast on the import errors... This runs in a single transaction + //so all imports done so far will get rolled-back. + //(Even if we change our minds later and run a transaction per importer + //we should fail fast to prevent further damage due to possible + //constraint violations in the db, etc.) + throw new ImportException("Import failed.", e); + } + } + break; + } + } + } finally { + rdr.close(); + } + } + + private <E, X> void importSingle(XMLStreamReader rdr) + throws Exception { + String synchronizerClassName = rdr.getAttributeValue(null, SynchronizationConstants.ID_ATTRIBUTE); + + @SuppressWarnings("unchecked") + Synchronizer<E, X> synchronizer = instantiate(synchronizerClassName, Synchronizer.class, + "The synchronizer denoted in the export file ('%s') does not implement the importer interface. This should not happen."); + + Importer<E, X> importer = synchronizer.getImporter(); + + ExportedEntityMatcher<E, X> matcher = importer.getExportedEntityMatcher(); + + //the passed in configuration has precedence over the default one inlined in + //the config file. + while (rdr.hasNext()) { + boolean bailout = false; + switch (rdr.next()) { + case XMLStreamConstants.START_ELEMENT: + if (SynchronizationConstants.DATA_ELEMENT.equals(rdr.getName().getLocalPart())) { + + rdr.nextTag(); + X exportedEntity = importer.unmarshallExportedEntity(new ExportReader(rdr)); + E entity = matcher == null ? null : matcher.findMatch(exportedEntity); + importer.update(entity, exportedEntity); + } + break; + case XMLStreamConstants.END_ELEMENT: + if (SynchronizationConstants.ENTITIES_EXPORT_ELEMENT.equals(rdr.getName().getLocalPart())) { + bailout = true; + } + } + + if (bailout) { + break; + } + } + } + + private <T> T instantiate(String className, Class<T> desiredClass, String notAssignableErrorMessage) + throws InstantiationException, IllegalAccessException, ClassNotFoundException { + Class<?> cls = Class.forName(className); + if (!desiredClass.isAssignableFrom(cls)) { + throw new IllegalStateException(String.format(notAssignableErrorMessage, className, desiredClass.getName())); + } + + Object instance = cls.newInstance(); + + return desiredClass.cast(instance); + } + @Test(expectedExceptions = IOException.class) public void testExceptionHandling_Exporter_getExportingIterator() throws Exception { final Exporter<?, ?> failingExporter = context.mock(Exporter.class); @@ -452,7 +694,7 @@ public class ExportingInputStreamTest extends JMockTest { return n; } } - + return null; } }
commit b62fb191a178d06fe48b47b2508fd4cb0aa039ca Author: Lukas Krejci lkrejci@redhat.com Date: Thu Dec 13 16:15:00 2012 +0100
Modified the access checking JNDI lookup wrappers to take into account the slightly different behavior needed when there was originally no initial context factory builder or if there originally was some.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/AccessCheckingInitialContextFactoryBuilder.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/AccessCheckingInitialContextFactoryBuilder.java index 9681014..52addaa 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/AccessCheckingInitialContextFactoryBuilder.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/AccessCheckingInitialContextFactoryBuilder.java @@ -32,6 +32,7 @@ import java.util.EnumMap; import java.util.Enumeration; import java.util.HashSet; import java.util.Hashtable; +import java.util.List; import java.util.Set;
import javax.naming.Context; @@ -138,7 +139,7 @@ public class AccessCheckingInitialContextFactoryBuilder implements InitialContex }
private enum FactoryType { - ACCESS_CHECKING { + ACCESS_CHECKING_URL_PREFERRING {
@Override public InitialContextFactory wrap(InitialContextFactory factory) { @@ -158,15 +159,34 @@ public class AccessCheckingInitialContextFactoryBuilder implements InitialContex
return new DecoratingInitialContextFactory(factory, pickers); } + }, + ACCESS_CHECKING { + + @Override + public InitialContextFactory wrap(InitialContextFactory factory) { + ArrayList<DecoratorPicker<Context, ContextDecorator>> pickers = new ArrayList<DecoratorPicker<Context, ContextDecorator>>(); + pickers.add(getAccessCheckingDecoratorPicker()); + + return new DecoratingInitialContextFactory(factory, pickers); + } + }, + PASS_THROUGH { + + @Override + public InitialContextFactory wrap(InitialContextFactory factory) { + List<DecoratorPicker<Context, ContextDecorator>> pickers = Collections.emptyList(); + + return new DecoratingInitialContextFactory(factory, pickers); + } };
public abstract InitialContextFactory wrap(InitialContextFactory factory);
- public static FactoryType detect(Hashtable<?, ?> environment) { + public static FactoryType detect(Hashtable<?, ?> environment, boolean pretendNoFactoryBuilder) { String providerUrl = (String) environment.get(Context.PROVIDER_URL);
if (providerUrl == null) { - return ACCESS_CHECKING; + return pretendNoFactoryBuilder ? ACCESS_CHECKING_URL_PREFERRING : ACCESS_CHECKING; } else { try { URI uri = new URI(providerUrl); @@ -175,9 +195,9 @@ public class AccessCheckingInitialContextFactoryBuilder implements InitialContex //check if we are accessing the RHQ server through some remoting //interface. if (uri.getPort() == JNP_PORT && SERVER_BIND_IPS.contains(providerHost)) { - return ACCESS_CHECKING; + return pretendNoFactoryBuilder ? ACCESS_CHECKING_URL_PREFERRING : ACCESS_CHECKING; } else { - return URL_PREFERRING; + return pretendNoFactoryBuilder ? URL_PREFERRING : PASS_THROUGH; } } catch (URISyntaxException e) { if (LOG.isDebugEnabled()) { @@ -185,7 +205,7 @@ public class AccessCheckingInitialContextFactoryBuilder implements InitialContex + Context.PROVIDER_URL + " is not a valid URI. Falling back to using the access checking wrapper.", e); } - return ACCESS_CHECKING; + return pretendNoFactoryBuilder ? ACCESS_CHECKING_URL_PREFERRING : ACCESS_CHECKING; } catch (UnknownHostException e) { //let the factory deal with the unknown host... //this most probably shouldn't be secured because localhost addresses @@ -195,7 +215,7 @@ public class AccessCheckingInitialContextFactoryBuilder implements InitialContex + Context.PROVIDER_URL + " is not resolvable. Falling back to using the URL preferring wrapper.", e); } - return URL_PREFERRING; + return pretendNoFactoryBuilder ? URL_PREFERRING : PASS_THROUGH; } } } @@ -219,15 +239,19 @@ public class AccessCheckingInitialContextFactoryBuilder implements InitialContex FactoryType.class);
private final String defaultFactoryClassName; - + private final boolean pretendNoFactoryBuilder; + /** * @param defaultFactory the default factory to use if none can be deduced from the environment. If null, an attempt * is made to obtain the default InitialContextFactory of JBoss AS (which may fail depending on the classloading * "situation"). + * @param pretendNoFactoryBuilder true if the naming contexts should pretend as if there was no initial context + * factory builder installed. This is to support environments as AS4, where there really was no builder initially + * and the lookup relied on that fact. * * @throws NamingException */ - public AccessCheckingInitialContextFactoryBuilder(InitialContextFactory defaultFactory) throws NamingException { + public AccessCheckingInitialContextFactoryBuilder(InitialContextFactory defaultFactory, final boolean pretendNoFactoryBuilder) throws NamingException { if (defaultFactory == null) { defaultFactory = getJbossDefaultInitialContextFactory(); } @@ -237,21 +261,22 @@ public class AccessCheckingInitialContextFactoryBuilder implements InitialContex for (FactoryType ft : FactoryType.values()) { typeDefaults.put(ft, ft.wrap(defaultFactory)); } + + this.pretendNoFactoryBuilder = pretendNoFactoryBuilder; + + this.defaultFactory = new InitialContextFactory() { + public Context getInitialContext(Hashtable<?, ?> environment) throws NamingException { + return typeDefaults.get(FactoryType.detect(environment, pretendNoFactoryBuilder)).getInitialContext( + environment); + } + }; }
/** * This is the default initial context factory that is returned when no other is * configured using the environment variables. - * <p> - * It uses {@link NamingContextFactory} as the underlying mechanism - the same - * as the default configuration in JBoss 4. */ - private final InitialContextFactory defaultFactory = new InitialContextFactory() { - public Context getInitialContext(Hashtable<?, ?> environment) throws NamingException { - return typeDefaults.get(FactoryType.detect(environment)).getInitialContext( - environment); - } - }; + private final InitialContextFactory defaultFactory;
/** * Create a InitialContext factory. If the environment does not override the factory class it will use the @@ -273,7 +298,7 @@ public class AccessCheckingInitialContextFactoryBuilder implements InitialContex try { final Class<?> factoryClass = Class.forName(factoryClassName, true, classLoader); InitialContextFactory configuredFactory = (InitialContextFactory) factoryClass.newInstance(); - return FactoryType.detect(environment).wrap(configuredFactory); + return FactoryType.detect(environment, pretendNoFactoryBuilder).wrap(configuredFactory); } catch (Exception e) { NamingException ne = new NamingException("Failed instantiate InitialContextFactory " + factoryClassName diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/NamingHack.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/NamingHack.java index f21322f..a4173ca 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/NamingHack.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/NamingHack.java @@ -79,7 +79,7 @@ public class NamingHack { }
NamingManager.setInitialContextFactoryBuilder(new AccessCheckingInitialContextFactoryBuilder( - defaultFactory)); + defaultFactory, originalBuilder == null)); } catch (Exception e) { LOG.error("Failed to install a custom initial context factory builder. RHQ installation is unsecure!", e); diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/naming/DecoratingInvocationHandlerTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/naming/DecoratingInvocationHandlerTest.java index c92cc42..a5daa9f 100644 --- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/naming/DecoratingInvocationHandlerTest.java +++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/naming/DecoratingInvocationHandlerTest.java @@ -106,7 +106,7 @@ public class DecoratingInvocationHandlerTest { @BeforeClass public void setBuilder() throws Exception { NamingManager.setInitialContextFactoryBuilder(new AccessCheckingInitialContextFactoryBuilder( - new org.jboss.as.naming.InitialContextFactory())); + new org.jboss.as.naming.InitialContextFactory(), false)); }
public void testSimpleDispatch() throws Exception {
commit 3f1149427123c1bbafdb8596e87b776f84b59d54 Author: Lukas Krejci lkrejci@redhat.com Date: Wed Dec 12 16:59:22 2012 +0100
Recovering from the merge of commit 2ce8b7aa063a56840090ed553f47b6e3a0ba7845. The SessionManager should do the security checks, we've got JNDI security working.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SessionManager.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SessionManager.java index ccffd37..c2b8270 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SessionManager.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SessionManager.java @@ -45,8 +45,7 @@ import org.rhq.enterprise.server.util.LookupUtil; */ public final class SessionManager {
- // TODO JNDI - // private static final AllowRhqServerInternalsAccessPermission ACCESS_PERMISSION = new AllowRhqServerInternalsAccessPermission(); + private static final AllowRhqServerInternalsAccessPermission ACCESS_PERMISSION = new AllowRhqServerInternalsAccessPermission();
/** * Our source for random session IDs. @@ -278,8 +277,7 @@ public final class SessionManager { }
private static void checkPermission() { - // TODO JNDI - // SecurityManager sm = System.getSecurityManager(); - // if (sm != null) sm.checkPermission(ACCESS_PERMISSION); + SecurityManager sm = System.getSecurityManager(); + if (sm != null) sm.checkPermission(ACCESS_PERMISSION); } } \ No newline at end of file
commit 2c9a8bd0e7b79dac706195f7a1a2474b1c39f631 Author: Jay Shaughnessy jshaughn@redhat.com Date: Thu Dec 13 10:02:55 2012 -0500
Replace more instances of straight division with approach that maintains precision.
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBeanTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBeanTest.java index 8861378..e87bff2 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBeanTest.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBeanTest.java @@ -203,7 +203,8 @@ public class MeasurementDataManagerBeanTest extends AbstractEJB3Test { MeasurementAggregate actual = dataManager.getAggregate(overlord, dynamicSchedule.getId(), beginTime.getMillis(), endTime.getMillis());
- MeasurementAggregate expected = new MeasurementAggregate(1.1, (1.1 + 2.2 + 3.3 + 4.4 + 5.5 + 6.6) / 6, 6.6); + MeasurementAggregate expected = new MeasurementAggregate(1.1, divide((1.1 + 2.2 + 3.3 + 4.4 + 5.5 + 6.6), 6), + 6.6);
AssertUtils.assertPropertiesMatch(expected, actual, "Aggregate does not match"); } @@ -236,9 +237,9 @@ public class MeasurementDataManagerBeanTest extends AbstractEJB3Test { assertEquals("Expected to get back 60 data points.", buckets.getNumDataPoints(), actualData.size());
MeasurementDataNumericHighLowComposite expectedBucket0Data = new MeasurementDataNumericHighLowComposite( - buckets.get(0), (2.0 + 5.0 + 3.0) / 3, 6.0, 1.0); + buckets.get(0), divide((2.0 + 5.0 + 3.0), 3), 6.0, 1.0); MeasurementDataNumericHighLowComposite expectedBucket59Data = new MeasurementDataNumericHighLowComposite( - buckets.get(59), (5.0 + 5.0 + 3.0) / 3, 9.0, 2.0); + buckets.get(59), divide((5.0 + 5.0 + 3.0), 3), 9.0, 2.0);
assertPropertiesMatch("The data for bucket 0 does not match the expected values.", expectedBucket0Data, actualData.get(0));
commit 64b887e487f4bc90677148778e3316b4e975c9fb Author: Jay Shaughnessy jshaughn@redhat.com Date: Thu Dec 13 09:41:48 2012 -0500
remove recovery plugin from postgres XA test datasource, not needed since the mem-leak issue is not relevant in a test run and the declaration of this workaround class is problematic.
diff --git a/modules/enterprise/server/itests-2/pom.xml b/modules/enterprise/server/itests-2/pom.xml index e1b466f..f58396a 100644 --- a/modules/enterprise/server/itests-2/pom.xml +++ b/modules/enterprise/server/itests-2/pom.xml @@ -520,9 +520,6 @@ <statement> <prepared-statement-cache-size>75</prepared-statement-cache-size> </statement> - <recovery no-recovery="false"> - <recover-plugin class-name="org.jboss.jca.core.recovery.ValidatingManagedConnectionFactoryRecoveryPlugin"/> - </recovery> </xa-datasource>]]></replacevalue> </replacefilter>
commit 866e7803407fe4fe18c6fdf54ca3344b70b02a25 Author: Jay Shaughnessy jshaughn@redhat.com Date: Wed Dec 12 15:51:21 2012 -0500
installer work - remove debugging system.out.println - protect paths with quotes in rhq-installer.bat - reduce dev installer retry from 5 to 3 if the remote admin endpoint in AS isn't ready - not sure, this retry seems to do some wonky things on win
diff --git a/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/DatasourceJBossASClient.java b/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/DatasourceJBossASClient.java index 1b5b462..c3ceec2 100644 --- a/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/DatasourceJBossASClient.java +++ b/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/DatasourceJBossASClient.java @@ -307,8 +307,6 @@ public class DatasourceJBossASClient extends JBossASClient { preparedStatementCacheSize, recoveryPluginClassName, securityDomain, staleConnectionCheckerClassName, transactionIsolation, validConnectionCheckerClassName);
- System.out.println("**** \n" + dmr); - Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_DATASOURCES, XA_DATA_SOURCE, name); final ModelNode request1 = ModelNode.fromString(dmr); request1.get(OPERATION).set(ADD); diff --git a/modules/enterprise/server/appserver/src/main/dev-resources/bin/rhq-autoinstall.sh b/modules/enterprise/server/appserver/src/main/dev-resources/bin/rhq-autoinstall.sh index e7cadef..5369ab2 100755 --- a/modules/enterprise/server/appserver/src/main/dev-resources/bin/rhq-autoinstall.sh +++ b/modules/enterprise/server/appserver/src/main/dev-resources/bin/rhq-autoinstall.sh @@ -11,7 +11,7 @@ _INSTALLER_SCRIPT="${RHQ_SERVER_HOME}/bin/rhq-installer.sh" # we are normally executed just before the server starts, so give it time to initialize sleep 5
-_TRIES="1 2 3" +_TRIES="1 2" for _TRY in $_TRIES do echo Running Installer Now... diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java index c65001d..5c0316d 100644 --- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java +++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java @@ -522,13 +522,6 @@ public class ServerInstallUtil { props.put("PortNumber", "${rhq.server.database.port:5432}"); props.put("DatabaseName", "${rhq.server.database.db-name:rhq}");
- /* TODO: Use this version which defines the recovery plugin - xaDsRequest = client.createNewXADatasourceRequest(RHQ_DATASOURCE_NAME_XA, 30000, JDBC_DRIVER_POSTGRES, - "org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter", 15, 5, 50, Boolean.FALSE, - (Boolean) null, 75, "org.jboss.jca.core.recovery.ValidatingManagedConnectionFactoryRecoveryPlugin", - RHQ_DS_SECURITY_DOMAIN, (String) null, "TRANSACTION_READ_COMMITTED", - "org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker", props); - */ xaDsRequest = client.createNewXADatasourceRequest(RHQ_DATASOURCE_NAME_XA, 30000, JDBC_DRIVER_POSTGRES, "org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter", 15, 5, 50, (Boolean) null, (Boolean) null, 75, (String) null, RHQ_DS_SECURITY_DOMAIN, (String) null, "TRANSACTION_READ_COMMITTED",
commit 2f61a838d951ef6746eb0f2989ec3cf5a24a8b75 Author: Simeon Pinder spinder@fulliautomatix.conchfritter.com Date: Wed Dec 12 14:47:54 2012 -0500
Update the zip and chmod processing filters for the agent to include all of the shared library file extensions.
diff --git a/modules/enterprise/agent/ant-run.xml b/modules/enterprise/agent/ant-run.xml index 4085efd..93ccd25 100644 --- a/modules/enterprise/agent/ant-run.xml +++ b/modules/enterprise/agent/ant-run.xml @@ -21,6 +21,7 @@ Ant Script that provides ways to package the Agent. <property name="jaxb-api.version" value="2.1"/> <property name="jaxb-impl.version" value="2.1"/> <property name="log4j.version" value="1.2.16"/> + <property name="so.exts" value="*.so.*"/>
<!-- ======================================================================= @@ -129,6 +130,7 @@ Ant Script that provides ways to package the Agent. <include name="**/lib/sigar.jar"/> <include name="**/lib/bcel*.jar"/> <include name="**/lib/*.so"/> + <include name="**/lib/${so.exts}"/> <include name="**/lib/*.sl"/> <include name="**/lib/*.dll"/> <include name="**/lib/*.dylib"/> @@ -139,21 +141,21 @@ Ant Script that provides ways to package the Agent. <fileset refid="augeas.native.fileset" /> <patternset> <include name="**/lib*/*.so"/> - <include name="**/lib*/*.so.1"/> + <include name="**/lib*/${so.exts}"/> </patternset> </unzip>
<move todir="${agent.distro.dir}/lib/augeas/lib" flatten="true" overwrite="false"> <fileset dir="${agent.distro.dir}/lib/augeas-native-${augeas.zip.version}/lib"> <include name="*.so" /> - <include name="*.so.1" /> + <include name="${so.exts}" /> </fileset> </move> <move todir="${agent.distro.dir}/lib/augeas/lib64" flatten="true" overwrite="false"> <fileset dir="${agent.distro.dir}/lib/augeas-native-${augeas.zip.version}/lib64"> <include name="*.so" /> - <include name="*.so.1" /> + <include name="${so.exts}" /> </fileset> </move> @@ -172,9 +174,9 @@ Ant Script that provides ways to package the Agent. <delete failonerror="false" includeEmptyDirs="true" verbose="true"> <fileset dir="${agent.distro.dir}/lib" includes="hyperic-sigar-*/"/> </delete> - <chmod dir="${agent.distro.dir}/lib" perm="ug+rx" includes="*.so,*.sl,*.dylib"/> - <chmod dir="${agent.distro.dir}/lib/augeas/lib" perm="ug+rx" includes="*.so,*.so.1"/> - <chmod dir="${agent.distro.dir}/lib/augeas/lib64" perm="ug+rx" includes="*.so,*.so.1"/> + <chmod dir="${agent.distro.dir}/lib" perm="ug+rx" includes="*.so,${so.exts},*.sl,*.dylib"/> + <chmod dir="${agent.distro.dir}/lib/augeas/lib" perm="ug+rx" includes="*.so,${so.exts}"/> + <chmod dir="${agent.distro.dir}/lib/augeas/lib64" perm="ug+rx" includes="*.so,${so.exts}"/>
<copy todir="${agent.distro.dir}/bin"> <fileset dir="${basedir}/src/etc" @@ -217,7 +219,7 @@ Ant Script that provides ways to package the Agent. <include name="rhq-agent/**"/> <exclude name="rhq-agent/bin/*.sh"/> <exclude name="rhq-agent/lib/*.so"/> - <exclude name="rhq-agent/lib/*.so.1"/> + <exclude name="rhq-agent/lib/${so.exts}"/> <exclude name="rhq-agent/lib/*.sl"/> <exclude name="rhq-agent/lib/*.dylib"/> <exclude name="rhq-agent/lib/augeas/**" /> @@ -225,12 +227,13 @@ Ant Script that provides ways to package the Agent. <zipfileset dir="${basedir}/target" filemode="755" dirmode="755"> <include name="rhq-agent/bin/*.sh"/> <include name="rhq-agent/lib/*.so"/> + <include name="rhq-agent/lib/${so.exts}"/> <include name="rhq-agent/lib/*.sl"/> <include name="rhq-agent/lib/*.dylib"/> <include name="rhq-agent/lib/augeas/lib/*.so"/> - <include name="rhq-agent/lib/augeas/lib/*.so.1"/> + <include name="rhq-agent/lib/augeas/lib/${so.exts}"/> <include name="rhq-agent/lib/augeas/lib64/*.so"/> - <include name="rhq-agent/lib/augeas/lib64/*.so.1"/> + <include name="rhq-agent/lib/augeas/lib64/${so.exts}"/> </zipfileset> </zip>
commit 685985600a5e0e9468b6e393c7fa09d5772b0afe Author: John Mazzitelli mazz@redhat.com Date: Wed Dec 12 12:37:13 2012 -0500
this is for unix developers - only retry 3 times - if the installer can't do its thing by then, something is probably wrong anyway. this doesn't involve production functionality - rhq-autonistaller.sh is only for dev mode builds
diff --git a/modules/enterprise/server/appserver/src/main/dev-resources/bin/rhq-autoinstall.sh b/modules/enterprise/server/appserver/src/main/dev-resources/bin/rhq-autoinstall.sh index f61a482..e7cadef 100755 --- a/modules/enterprise/server/appserver/src/main/dev-resources/bin/rhq-autoinstall.sh +++ b/modules/enterprise/server/appserver/src/main/dev-resources/bin/rhq-autoinstall.sh @@ -11,7 +11,7 @@ _INSTALLER_SCRIPT="${RHQ_SERVER_HOME}/bin/rhq-installer.sh" # we are normally executed just before the server starts, so give it time to initialize sleep 5
-_TRIES="1 2 3 4 5" +_TRIES="1 2 3" for _TRY in $_TRIES do echo Running Installer Now...
commit 7e1c0397aa94683d0efb35166c3970dae969ea46 Author: John Mazzitelli mazz@redhat.com Date: Wed Dec 12 12:33:20 2012 -0500
only have it try 2 times (as opposed to 5). if the server isn't up in time for our installer to do its thing by then, something is probably wrong anyway this is only for windows developers use (dev mode) so this isn't involving production functionality
diff --git a/modules/enterprise/server/appserver/src/main/dev-resources/bin/rhq-autoinstall.bat b/modules/enterprise/server/appserver/src/main/dev-resources/bin/rhq-autoinstall.bat index b756b31..888d147 100644 --- a/modules/enterprise/server/appserver/src/main/dev-resources/bin/rhq-autoinstall.bat +++ b/modules/enterprise/server/appserver/src/main/dev-resources/bin/rhq-autoinstall.bat @@ -19,7 +19,7 @@ rem we are normally executed just before the server starts, so give it time to i rem yes, this is a sleep of 5s, backwards compatible to XP ping 127.0.0.1 -n 5 -w 1000 > nul
-for /L %%i in (1,1,5) do ( +for /L %%i in (1,1,2) do ( echo Running Installer Now... CALL "%_INSTALLER_SCRIPT%" if ERRORLEVEL 2 (
commit 5f3dbdeeb2e800f3b730dc0f3befad9b244e6615 Author: John Mazzitelli mazz@redhat.com Date: Wed Dec 12 12:26:04 2012 -0500
fix windows script so dir names are quoted when starting the vm
diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-installer.bat b/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-installer.bat index 81d83ad..3140467 100644 --- a/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-installer.bat +++ b/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-installer.bat @@ -136,7 +136,7 @@ if defined RHQ_SERVER_DEBUG echo _JBOSS_MODULEPATH: %_JBOSS_MODULEPATH% echo Starting RHQ Server installer ...
rem start the AS instance with our main installer module -%RHQ_SERVER_JAVA_EXE_FILE_PATH% %RHQ_SERVER_INSTALLER_JAVA_OPTS% %RHQ_SERVER_INSTALLER_ADDITIONAL_JAVA_OPTS% -jar %RHQ_SERVER_HOME%\jbossas\jboss-modules.jar -mp %_JBOSS_MODULEPATH% org.rhq.rhq-installer-util %* +"%RHQ_SERVER_JAVA_EXE_FILE_PATH%" %RHQ_SERVER_INSTALLER_JAVA_OPTS% %RHQ_SERVER_INSTALLER_ADDITIONAL_JAVA_OPTS% -jar "%RHQ_SERVER_HOME%\jbossas\jboss-modules.jar" -mp "%_JBOSS_MODULEPATH%" org.rhq.rhq-installer-util %*
goto :done
commit 946dee4b2e8c8ce275f069a3c79efedd3c7aaf74 Author: Jay Shaughnessy jshaughn@jshaughn.csb Date: Wed Dec 12 09:12:47 2012 -0500
Oracle testing - Add no-tx-separate=pools=true for ora XA datasource to avoid connection issues - remove SetBigStringTryClob conn prop for oracle because we shouldn't need it with the Ora11 driver and trying to set hits an AS bug - apply necessary changes to installer as well as test code - fix issues with aggressive and sometimes non-functioning cleanup code in MeasurementDataManagerBeanTest - Add oracle driver jar to test deployment to support dbunit Also - Add support for recovery-plugin class for postgres to avoid mem leak in 7.1.1.Final. (note - the actual use of that hook will be in a subsequent commit)
diff --git a/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/DatasourceJBossASClient.java b/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/DatasourceJBossASClient.java index ab44796..1b5b462 100644 --- a/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/DatasourceJBossASClient.java +++ b/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/DatasourceJBossASClient.java @@ -261,9 +261,12 @@ public class DatasourceJBossASClient extends JBossASClient { * @param idleTimeoutMinutes * @param minPoolSize * @param maxPoolSize + * @param noRecovery optional, left unset if null + * @param noTxSeparatePools optional, left unset if null * @param preparedStatementCacheSize + * @param recoveryPluginClassName optional, left unset if null * @param securityDomain - * @param staleConnectionCheckerClassName + * @param staleConnectionCheckerClassName optional, left unset if null * @param transactionIsolation * @param validConnectionCheckerClassName * @param xaDatasourceProperties @@ -271,9 +274,10 @@ public class DatasourceJBossASClient extends JBossASClient { * @return the request that can be used to create the XA datasource */ public ModelNode createNewXADatasourceRequest(String name, int blockingTimeoutWaitMillis, String driverName, - String exceptionSorterClassName, int idleTimeoutMinutes, int minPoolSize, int maxPoolSize, - int preparedStatementCacheSize, String securityDomain, String staleConnectionCheckerClassName, - String transactionIsolation, String validConnectionCheckerClassName, Map<String, String> xaDatasourceProperties) { + String exceptionSorterClassName, int idleTimeoutMinutes, int minPoolSize, int maxPoolSize, Boolean noRecovery, + Boolean noTxSeparatePools, int preparedStatementCacheSize, String recoveryPluginClassName, + String securityDomain, String staleConnectionCheckerClassName, String transactionIsolation, + String validConnectionCheckerClassName, Map<String, String> xaDatasourceProperties) {
String jndiName = "java:jboss/datasources/" + name;
@@ -286,8 +290,11 @@ public class DatasourceJBossASClient extends JBossASClient { + ", "jndi-name" => "%s" " // + ", "jta" => true " // + ", "min-pool-size" => %d " // - + ", "max-pool-size" => %d " // + + ", "max-pool-size" => %d " // + + ", "no-recovery" => %b " // + + ", "no-tx-separate-pools" => %b " // + ", "prepared-statements-cache-size" => %dL " // + + ", "recovery-plugin-class-name" => "%s" " // + ", "security-domain" => "%s" " // + ", "stale-connection-checker-class-name" => "%s" " // + ", "transaction-isolation" => "%s" " // @@ -296,8 +303,11 @@ public class DatasourceJBossASClient extends JBossASClient { + "}";
String dmr = String.format(dmrTemplate, blockingTimeoutWaitMillis, driverName, exceptionSorterClassName, - idleTimeoutMinutes, jndiName, minPoolSize, maxPoolSize, preparedStatementCacheSize, securityDomain, - staleConnectionCheckerClassName, transactionIsolation, validConnectionCheckerClassName); + idleTimeoutMinutes, jndiName, minPoolSize, maxPoolSize, noRecovery, noTxSeparatePools, + preparedStatementCacheSize, recoveryPluginClassName, securityDomain, staleConnectionCheckerClassName, + transactionIsolation, validConnectionCheckerClassName); + + System.out.println("**** \n" + dmr);
Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_DATASOURCES, XA_DATA_SOURCE, name); final ModelNode request1 = ModelNode.fromString(dmr); @@ -327,6 +337,22 @@ public class DatasourceJBossASClient extends JBossASClient { batch[n++] = requestN; }
- return createBatchRequest(batch); + ModelNode result = createBatchRequest(batch); + + // remove unset args + if (null == noRecovery) { + result.get("steps").get(0).remove("no-recovery"); + } + if (null == noTxSeparatePools) { + result.get("steps").get(0).remove("no-tx-separate-pools"); + } + if (null == recoveryPluginClassName) { + result.get("steps").get(0).remove("recovery-plugin-class-name"); + } + if (null == staleConnectionCheckerClassName) { + result.get("steps").get(0).remove("stale-connection-checker-class-name"); + } + + return result; } } diff --git a/modules/core/domain/pom.xml b/modules/core/domain/pom.xml index e874c08..cb7699b 100644 --- a/modules/core/domain/pom.xml +++ b/modules/core/domain/pom.xml @@ -381,7 +381,7 @@ </timeout> <statement> <prepared-statement-cache-size>75</prepared-statement-cache-size> - </statement> + </statement> </xa-datasource>]]></replacevalue> </replacefilter>
@@ -441,6 +441,11 @@ <xa-pool> <min-pool-size>5</min-pool-size> <max-pool-size>50</max-pool-size> + <!-- + Oracle does not like XA connections getting used both inside and outside a JTA transaction. + To workaround the problem you can create separate sub-pools for the different contexts using <no-tx-separate-pools/> + --> + <no-tx-separate-pools>true</no-tx-separate-pools> </xa-pool> <security> <security-domain>RHQDSSecurityDomain</security-domain> diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java index 516dca6..c65001d 100644 --- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java +++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java @@ -511,7 +511,7 @@ public class ServerInstallUtil { "org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter", 15, false, 2, 5, 75, RHQ_DS_SECURITY_DOMAIN, "-unused-stale-conn-checker-", "TRANSACTION_READ_COMMITTED", "org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker", props); - noTxDsRequest.get("steps").get(0).remove("stale-connection-checker-class-name"); // we don't have one of these for postgres + noTxDsRequest.get("steps").get(0).remove("stale-connection-checker-class-name"); // we don't have one of these for postgres } else { LOG.info("Postgres datasource [" + RHQ_DATASOURCE_NAME_NOTX + "] already exists"); } @@ -522,11 +522,18 @@ public class ServerInstallUtil { props.put("PortNumber", "${rhq.server.database.port:5432}"); props.put("DatabaseName", "${rhq.server.database.db-name:rhq}");
+ /* TODO: Use this version which defines the recovery plugin xaDsRequest = client.createNewXADatasourceRequest(RHQ_DATASOURCE_NAME_XA, 30000, JDBC_DRIVER_POSTGRES, - "org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter", 15, 5, 50, 75, - RHQ_DS_SECURITY_DOMAIN, "-unused-stale-conn-checker-", "TRANSACTION_READ_COMMITTED", + "org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter", 15, 5, 50, Boolean.FALSE, + (Boolean) null, 75, "org.jboss.jca.core.recovery.ValidatingManagedConnectionFactoryRecoveryPlugin", + RHQ_DS_SECURITY_DOMAIN, (String) null, "TRANSACTION_READ_COMMITTED", + "org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker", props); + */ + xaDsRequest = client.createNewXADatasourceRequest(RHQ_DATASOURCE_NAME_XA, 30000, JDBC_DRIVER_POSTGRES, + "org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter", 15, 5, 50, (Boolean) null, + (Boolean) null, 75, (String) null, RHQ_DS_SECURITY_DOMAIN, (String) null, "TRANSACTION_READ_COMMITTED", "org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker", props); - xaDsRequest.get("steps").get(0).remove("stale-connection-checker-class-name"); // we don't have one of these for postgres + } else { LOG.info("Postgres XA datasource [" + RHQ_DATASOURCE_NAME_XA + "] already exists"); } @@ -549,7 +556,6 @@ public class ServerInstallUtil {
if (!client.isDatasource(RHQ_DATASOURCE_NAME_NOTX)) { props.put("char.encoding", "UTF-8"); - props.put("SetBigStringTryClob", "true");
noTxDsRequest = client.createNewDatasourceRequest(RHQ_DATASOURCE_NAME_NOTX, 30000, "${rhq.server.database.connection-url:jdbc:oracle:thin:@127.0.0.1:1521:rhq}", JDBC_DRIVER_ORACLE, @@ -564,11 +570,11 @@ public class ServerInstallUtil { if (!client.isDatasource(RHQ_DATASOURCE_NAME_XA)) { props.clear(); props.put("URL", "${rhq.server.database.connection-url:jdbc:oracle:thin:@127.0.0.1:1521:rhq}"); - props.put("ConnectionProperties", "SetBigStringTryClob=true");
xaDsRequest = client.createNewXADatasourceRequest(RHQ_DATASOURCE_NAME_XA, 30000, JDBC_DRIVER_ORACLE, - "org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter", 15, 5, 50, 75, - RHQ_DS_SECURITY_DOMAIN, "org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker", + "org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter", 15, 5, 50, (Boolean) null, + Boolean.TRUE, 75, (String) null, RHQ_DS_SECURITY_DOMAIN, + "org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker", "TRANSACTION_READ_COMMITTED", "org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker", props); } else { diff --git a/modules/enterprise/server/installer/src/test/java/org/rhq/enterprise/server/installer/client/DatasourceJBossASClientTest.java b/modules/enterprise/server/installer/src/test/java/org/rhq/enterprise/server/installer/client/DatasourceJBossASClientTest.java index f2dd7bc..52a3478 100644 --- a/modules/enterprise/server/installer/src/test/java/org/rhq/enterprise/server/installer/client/DatasourceJBossASClientTest.java +++ b/modules/enterprise/server/installer/src/test/java/org/rhq/enterprise/server/installer/client/DatasourceJBossASClientTest.java @@ -106,7 +106,8 @@ public class DatasourceJBossASClientTest { xaDSProps.put("ConnectionProperties", "SetBigStringTryClob=true");
ModelNode request = client.createNewXADatasourceRequest("RHQDS", 30000, "oracle", - "org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter", 15, 2, 5, 75, "RHQDSSecurityDomain", + "org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter", 15, 2, 5, (Boolean) null, + Boolean.TRUE, 75, (String) null, "RHQDSSecurityDomain", "org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker", "TRANSACTION_READ_COMMITTED", "org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker", xaDSProps);
diff --git a/modules/enterprise/server/itests-2/pom.xml b/modules/enterprise/server/itests-2/pom.xml index c0c420e..e1b466f 100644 --- a/modules/enterprise/server/itests-2/pom.xml +++ b/modules/enterprise/server/itests-2/pom.xml @@ -23,7 +23,8 @@ <properties> <jboss.zip>${settings.localRepository}/org/jboss/as/jboss-as-dist/${jboss.version}/jboss-as-dist-${jboss.version}.zip</jboss.zip> <jboss.unzip.location>${basedir}/target/jboss-as-${jboss.version}</jboss.unzip.location> - <jboss.vm.args>-Xmx700m -XX:MaxPermSize=200m -Djava.security.manager -Djava.security.policy==${jboss.unzip.location}/security.policy</jboss.vm.args> + <jboss.vm.args>-Xmx700m -XX:MaxPermSize=200m -Djava.security.manager + -Djava.security.policy==${jboss.unzip.location}/security.policy</jboss.vm.args> <jboss.vm.args.debug></jboss.vm.args.debug> <!-- -Ditest.debug can override this, see below --> </properties>
@@ -225,11 +226,9 @@ <echo>JBossAS ${jboss.version} should now be at: ${jboss.unzip.location}</echo>
<echo>Copying security policy to JBossAS</echo> - <copy file="${project.build.directory}/test-classes/security.policy" tofile="${jboss.unzip.location}/security.policy"/> - - <property - name="jboss.conf" - location="${jboss.unzip.location}/standalone/configuration/standalone.xml" /> + <copy file="${project.build.directory}/test-classes/security.policy" tofile="${jboss.unzip.location}/security.policy" /> + + <property name="jboss.conf" location="${jboss.unzip.location}/standalone/configuration/standalone.xml" /> <echo>Will now add test configuration to JBossAS config file: ${jboss.conf}</echo> <replace file="${jboss.conf}">
@@ -520,7 +519,10 @@ </timeout> <statement> <prepared-statement-cache-size>75</prepared-statement-cache-size> - </statement> + </statement> + <recovery no-recovery="false"> + <recover-plugin class-name="org.jboss.jca.core.recovery.ValidatingManagedConnectionFactoryRecoveryPlugin"/> + </recovery> </xa-datasource>]]></replacevalue> </replacefilter>
@@ -580,6 +582,11 @@ <xa-pool> <min-pool-size>5</min-pool-size> <max-pool-size>50</max-pool-size> + <!-- + Oracle does not like XA connections getting used both inside and outside a JTA transaction. + To workaround the problem you can create separate sub-pools for the different contexts using <no-tx-separate-pools/> + --> + <no-tx-separate-pools>true</no-tx-separate-pools> </xa-pool> <security> <security-domain>RHQDSSecurityDomain</security-domain> @@ -631,15 +638,8 @@ <clean.db>${clean.db}</clean.db> <log4j.configDebug>false</log4j.configDebug> <project.version>${project.version}</project.version> - - <rhq.test.ds.type-mapping>${rhq.test.ds.type-mapping}</rhq.test.ds.type-mapping> - <rhq.test.ds.server-name>${rhq.test.ds.server-name}</rhq.test.ds.server-name> - <rhq.test.ds.db-name>${rhq.test.ds.db-name}</rhq.test.ds.db-name> - <rhq.test.ds.connection-url>${rhq.test.ds.connection-url}</rhq.test.ds.connection-url> - <rhq.db.admin.username>${rhq.db.admin.username}</rhq.db.admin.username> - <rhq.db.admin.password>${rhq.db.admin.password}</rhq.db.admin.password> - <rhq.test.ds.user-name>${rhq.test.ds.user-name}</rhq.test.ds.user-name> - <rhq.test.ds.password>${rhq.test.ds.password}</rhq.test.ds.password> + <rhq.skip.oracle>${skip.oracle}</rhq.skip.oracle> + <rhq.ojdbc.version>${ojdbc6.version}</rhq.ojdbc.version> </systemPropertyVariables> <additionalClasspathElements> <!-- The below is required for tests to run against Oracle. --> diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBeanTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBeanTest.java index 9c2882c..8861378 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBeanTest.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBeanTest.java @@ -31,6 +31,8 @@ import static org.rhq.core.domain.measurement.NumericType.DYNAMIC; import static org.rhq.core.domain.resource.ResourceCategory.SERVER; import static org.rhq.test.AssertUtils.assertPropertiesMatch;
+import java.math.BigDecimal; +import java.math.MathContext; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; @@ -46,6 +48,7 @@ import org.testng.annotations.Test;
import org.rhq.core.domain.auth.Subject; import org.rhq.core.domain.common.EntityContext; +import org.rhq.core.domain.criteria.ResourceCriteria; import org.rhq.core.domain.measurement.MeasurementDataNumeric; import org.rhq.core.domain.measurement.MeasurementDefinition; import org.rhq.core.domain.measurement.MeasurementReport; @@ -59,8 +62,10 @@ import org.rhq.core.util.jdbc.JDBCUtil; import org.rhq.enterprise.server.auth.SubjectManagerLocal; import org.rhq.enterprise.server.drift.DriftServerPluginService; import org.rhq.enterprise.server.measurement.util.MeasurementDataManagerUtility; +import org.rhq.enterprise.server.resource.ResourceManagerLocal; import org.rhq.enterprise.server.test.AbstractEJB3Test; import org.rhq.enterprise.server.test.TransactionCallback; +import org.rhq.enterprise.server.util.ResourceTreeHelper; import org.rhq.test.AssertUtils;
/** @@ -108,6 +113,9 @@ public class MeasurementDataManagerBeanTest extends AbstractEJB3Test { @EJB private MeasurementDataManagerLocal dataManager;
+ @EJB + private ResourceManagerLocal resourceManager; + @Override protected void beforeMethod() throws Exception { overlord = subjectManager.getOverlord(); @@ -149,15 +157,14 @@ public class MeasurementDataManagerBeanTest extends AbstractEJB3Test { dataManager.mergeMeasurementReport(report);
List<MeasurementDataNumericHighLowComposite> actualData = findDataForContext(overlord, - EntityContext.forResource(resource.getId()), dynamicSchedule, beginTime.getMillis(), - endTime.getMillis()); + EntityContext.forResource(resource.getId()), dynamicSchedule, beginTime.getMillis(), endTime.getMillis());
assertEquals("Expected to get back 60 data points.", buckets.getNumDataPoints(), actualData.size());
MeasurementDataNumericHighLowComposite expectedBucket0Data = new MeasurementDataNumericHighLowComposite( - buckets.get(0), (1.1 + 2.2 + 3.3) / 3, 3.3, 1.1); + buckets.get(0), divide((1.1 + 2.2 + 3.3), 3), 3.3, 1.1); MeasurementDataNumericHighLowComposite expectedBucket59Data = new MeasurementDataNumericHighLowComposite( - buckets.get(59), (4.4 + 5.5 + 6.6) / 3, 6.6, 4.4); + buckets.get(59), divide((4.4 + 5.5 + 6.6), 3), 6.6, 4.4); MeasurementDataNumericHighLowComposite expectedBucket29Data = new MeasurementDataNumericHighLowComposite( buckets.get(29), Double.NaN, Double.NaN, Double.NaN);
@@ -169,6 +176,11 @@ public class MeasurementDataManagerBeanTest extends AbstractEJB3Test { actualData.get(29)); }
+ static double divide(double dividend, int divisor) { + return new BigDecimal(Double.toString(dividend)).divide(new BigDecimal(Integer.toString(divisor)), + MathContext.DECIMAL64).doubleValue(); + } + @Test(enabled = true) public void getRawAggregate() { DateTime now = new DateTime(); @@ -191,8 +203,7 @@ public class MeasurementDataManagerBeanTest extends AbstractEJB3Test { MeasurementAggregate actual = dataManager.getAggregate(overlord, dynamicSchedule.getId(), beginTime.getMillis(), endTime.getMillis());
- MeasurementAggregate expected = new MeasurementAggregate(1.1, (1.1 + 2.2 + 3.3 + 4.4 + 5.5 + 6.6) / 6, - 6.6); + MeasurementAggregate expected = new MeasurementAggregate(1.1, (1.1 + 2.2 + 3.3 + 4.4 + 5.5 + 6.6) / 6, 6.6);
AssertUtils.assertPropertiesMatch(expected, actual, "Aggregate does not match"); } @@ -206,19 +217,16 @@ public class MeasurementDataManagerBeanTest extends AbstractEJB3Test { // results in an interval or bucket size of 4.4 hours Buckets buckets = new Buckets(beginTime, endTime);
- List<AggregateTestData> data = asList( - new AggregateTestData(buckets.get(0), dynamicSchedule.getId(), 2.0, 3.0, 1.0), - new AggregateTestData(buckets.get(0) + Hours.ONE.toStandardDuration().getMillis(), - dynamicSchedule.getId(), 5.0, 6.0, 4.0), - new AggregateTestData(buckets.get(0) + Hours.TWO.toStandardDuration().getMillis(), + List<AggregateTestData> data = asList(new AggregateTestData(buckets.get(0), dynamicSchedule.getId(), 2.0, 3.0, + 1.0), + new AggregateTestData(buckets.get(0) + Hours.ONE.toStandardDuration().getMillis(), dynamicSchedule.getId(), + 5.0, 6.0, 4.0), new AggregateTestData(buckets.get(0) + Hours.TWO.toStandardDuration().getMillis(), dynamicSchedule.getId(), 3.0, 3.0, 3.0),
- new AggregateTestData(buckets.get(59), dynamicSchedule.getId(), 5.0, 9.0, 2.0), - new AggregateTestData(buckets.get(59) + Hours.ONE.toStandardDuration().getMillis(), - dynamicSchedule.getId(), 5.0, 6.0, 4.0), + new AggregateTestData(buckets.get(59), dynamicSchedule.getId(), 5.0, 9.0, 2.0), new AggregateTestData( + buckets.get(59) + Hours.ONE.toStandardDuration().getMillis(), dynamicSchedule.getId(), 5.0, 6.0, 4.0), new AggregateTestData(buckets.get(59) + Hours.TWO.toStandardDuration().getMillis(), - dynamicSchedule.getId(), 3.0, 3.0, 3.0) - ); + dynamicSchedule.getId(), 3.0, 3.0, 3.0));
insert1HourData(data);
@@ -281,11 +289,20 @@ public class MeasurementDataManagerBeanTest extends AbstractEJB3Test { executeInTransaction(false, new TransactionCallback() { @Override public void execute() throws Exception { + ResourceCriteria c = new ResourceCriteria(); + c.addFilterInventoryStatus(null); + c.addFilterResourceKey(RESOURCE_KEY); + c.fetchSchedules(true); + List<Resource> r = resourceManager.findResourcesByCriteria(subjectManager.getOverlord(), c);
// Note that the order of deletes is important due to FK // constraints. - deleteMeasurementSchedules(); - deleteResource(); + if (!r.isEmpty()) { + assertTrue("Should be only 1 resource", r.size() == 1); + Resource doomedResource = r.get(0); + deleteMeasurementSchedules(doomedResource); + deleteResource(doomedResource); + } deleteAgent(); deleteDynamicMeasurementDef(); deleteResourceType(); @@ -294,38 +311,31 @@ public class MeasurementDataManagerBeanTest extends AbstractEJB3Test { }
private void deleteDynamicMeasurementDef() { - em.createQuery("delete from MeasurementDefinition " + - "where dataType = :dataType and " + - "name = :name") - .setParameter("dataType", MEASUREMENT) - .setParameter("name", DYNAMIC_DEF_NAME) - .executeUpdate(); + em.createQuery("delete from MeasurementDefinition " + "where dataType = :dataType and " + "name = :name") + .setParameter("dataType", MEASUREMENT).setParameter("name", DYNAMIC_DEF_NAME).executeUpdate(); }
private void deleteAgent() { - em.createQuery("delete from Agent where name = :name") - .setParameter("name", AGENT_NAME) - .executeUpdate(); + em.createQuery("delete from Agent where name = :name").setParameter("name", AGENT_NAME).executeUpdate(); }
private void deleteResourceType() { em.createQuery("delete from ResourceType where name = :name and plugin = :plugin") - .setParameter("name", RESOURCE_TYPE) - .setParameter("plugin", PLUGIN) - .executeUpdate(); + .setParameter("name", RESOURCE_TYPE).setParameter("plugin", PLUGIN).executeUpdate(); }
- private void deleteResource() { - em.createQuery("delete from Availability").executeUpdate(); - - em.createQuery("delete from Resource where resourceKey = :key and uuid = :uuid") - .setParameter("key", RESOURCE_KEY) - .setParameter("uuid", RESOURCE_UUID) - .executeUpdate(); + private void deleteResource(Resource doomedResource) { + ResourceTreeHelper.deleteResource(em, doomedResource); + em.flush(); }
- private void deleteMeasurementSchedules() { - em.createQuery("delete from MeasurementSchedule").executeUpdate(); + private void deleteMeasurementSchedules(Resource doomedResource) { + for (MeasurementSchedule ms : doomedResource.getSchedules()) { + int i = em.createQuery("delete from MeasurementSchedule where id = :msId").setParameter("msId", ms.getId()) + .executeUpdate(); + em.flush(); + System.out.println("Deleted [" + i + "] schedules with id [" + ms.getId() + "]"); + } }
private void insertDummyReport() { diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java index deceebc..dd46a29 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java @@ -338,6 +338,13 @@ public abstract class AbstractEJB3Test extends Arquillian { dependencies.addAll(resolver.artifact("org.rhq:test-utils").resolveAs(JavaArchive.class)); dependencies.addAll(resolver.artifact("org.rhq.helpers:perftest-support").resolveAs(JavaArchive.class));
+ // If we're running oracle we need to include the OJDBC driver because dbunit needs it. Note that we need + // add it explicitly even though it is a provided module used by the datasource. + if (!Boolean.valueOf(System.getProperty("rhq.skip.oracle"))) { + dependencies.addAll(resolver.artifact("com.oracle:ojdbc6:jar:" + System.getProperty("rhq.ojdbc.version")) + .resolveAs(JavaArchive.class)); + } + // Transitive deps required by the above and for some reason not sucked in. Note that // these require an explicit version. TODO (jshaughn): Can we make these transitive or // avoid the explicit version?
commit a33df9ca8700523e66d6443b4454977433330233 Author: Lukas Krejci lkrejci@redhat.com Date: Wed Dec 12 13:41:08 2012 +0100
Forgot to re-enable the now fixed and working JndiAccessTest in itests-2.
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/security/test/JndiAccessTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/security/test/JndiAccessTest.java index e831a2b..fabe6ae 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/security/test/JndiAccessTest.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/security/test/JndiAccessTest.java @@ -47,8 +47,7 @@ import org.rhq.enterprise.server.util.LookupUtil; * * @author Lukas Krejci */ -@Test(enabled = false) -// TODO JNDI: reenable after fixing secure jndi lookups +@Test public class JndiAccessTest extends AbstractEJB3Test {
public void testScriptCantOverrideSystemProperties() throws Exception {
commit 4a2e78668aae419f5f47bbc45c4f4ac7b7c339ac Author: Stefan Negrea snegrea@redhat.com Date: Wed Dec 12 00:17:32 2012 -0600
Update Cassandra plugin pom to include the dev profile for dev container deployments.
diff --git a/modules/plugins/cassandra/pom.xml b/modules/plugins/cassandra/pom.xml index ab61220..d8cfd68 100644 --- a/modules/plugins/cassandra/pom.xml +++ b/modules/plugins/cassandra/pom.xml @@ -13,12 +13,6 @@ <name>RHQ Cassandra Plugin</name> <description>An RHQ plugin for monitoring and managing a Cassandra cluster</description>
- <properties> - <rhq.rootDir>../../..</rhq.rootDir> - <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> - </properties> - <dependencies> <dependency> <groupId>commons-logging</groupId> @@ -156,62 +150,11 @@ </execution> </executions> </plugin> + <plugin> <artifactId>maven-antrun-plugin</artifactId> <executions> <execution> - <id>deploy</id> - <phase>package</phase> - <configuration> - <target> - <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}"/> - </target> - </configuration> - <goals> - <goal>run</goal> - </goals> - </execution> - <execution> - <id>deploy-jar-meta-inf</id> - <phase>package</phase> - <configuration> - <target> - <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> - </target> - </configuration> - <goals> - <goal>run</goal> - </goals> - </execution> - <execution> - <id>undeploy</id> - <phase>clean</phase> - <configuration> - <target> - <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar"/> - <echo>*** Deleting ${deployment.file}...</echo> - <delete file="${deployment.file}"/> - </target> - </configuration> - <goals> - <goal>run</goal> - </goals> - </execution> - - <execution> <phase>pre-integration-test</phase> <configuration> <target> @@ -224,9 +167,6 @@ <fileset dir="${settings.localRepository}/"> <include name="org/rhq/rhq-jmx-plugin/${project.version}/rhq-jmx-plugin-${project.version}.jar" /> </fileset> - <fileset dir="${rhq.deploymentDir}"> - <include name="${project.artifactId}-${project.version}.jar" /> - </fileset> <fileset dir="${project.build.directory}" includes="${project.artifactId}-${project.version}.jar" /> </copy>
@@ -290,4 +230,78 @@ </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}/${rhq.agentPluginDir}</rhq.deploymentDir> + </properties> + + <build> + <plugins> + <plugin> + <artifactId>maven-antrun-plugin</artifactId> + <executions> + <execution> + <id>deploy</id> + <phase>package</phase> + <configuration> + <target> + <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}"/> + </target> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + <execution> + <id>deploy-jar-meta-inf</id> + <phase>package</phase> + <configuration> + <target> + <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> + </target> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + <execution> + <id>undeploy</id> + <phase>clean</phase> + <configuration> + <target> + <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar"/> + <echo>*** Deleting ${deployment.file}...</echo> + <delete file="${deployment.file}"/> + </target> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> + </project>
commit 681e5d638ac4b5f1c8770cc34d56141aad6346ac Author: John Mazzitelli mazz@redhat.com Date: Tue Dec 11 15:49:31 2012 -0500
put the war in the new ear location
diff --git a/modules/enterprise/gui/rest-examples-war/pom.xml b/modules/enterprise/gui/rest-examples-war/pom.xml index e0d801f..1eb1ad2 100644 --- a/modules/enterprise/gui/rest-examples-war/pom.xml +++ b/modules/enterprise/gui/rest-examples-war/pom.xml @@ -57,7 +57,7 @@ <rhq.rootDir>../../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> <rhq.deploymentName>${project.build.finalName}.war</rhq.deploymentName> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/${rhq.deploymentName}</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.earDeployDir}/${rhq.deploymentName}</rhq.deploymentDir> </properties>
<build>
commit af5d45b9d4f18d13762ac7b90232e69522e5d91f Author: John Mazzitelli mazz@redhat.com Date: Tue Dec 11 15:42:13 2012 -0500
fix location where cassandra plugin goes in dev profile mode (though there is no dev profile declaration - this should be fixed also)
diff --git a/modules/plugins/cassandra/pom.xml b/modules/plugins/cassandra/pom.xml index a65384c..ab61220 100644 --- a/modules/plugins/cassandra/pom.xml +++ b/modules/plugins/cassandra/pom.xml @@ -16,7 +16,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/server/default/deploy/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties>
<dependencies>
commit e22bbe3464a5e36cafc3ba3a152b4ce8e4669a95 Author: John Mazzitelli mazz@redhat.com Date: Tue Dec 11 15:35:20 2012 -0500
trivial changes to generated props file
diff --git a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml index 47dd0d5..d84f8c4 100644 --- a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml +++ b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml @@ -345,8 +345,8 @@ # If you are using Oracle, comment out the Postgres settings and # uncomment the Oracle settings below, adjusting the values as appropriate. # NOTE: rhq.server.database.password is not to be set to the actual password -# but instead should be that actual password in encoded form as generated -# by the "rhq-installer.sh(.bat) --dbpassword=<your password>". +# but instead should be the password in encoded form as generated by: +# rhq-installer.sh(.bat) --dbpassword=<your password> #############################################################################
# PostgreSQL database @@ -567,7 +567,7 @@ rhq.sync.endpoint-address=false # persist content for well known binary file types like .ear, .war, .zip, .so, # etc. The server does however persist content for text files or any other # files that are not known binary types. -# rhq.server.drift.store-binary-content=${rhq.server.drift.store-binary-content} +#rhq.server.drift.store-binary-content=${rhq.server.drift.store-binary-content}
</echo>
commit 9f69c42dcd96046982b66022f92c5f00f660b416 Author: Heiko W. Rupp hwr@redhat.com Date: Tue Dec 11 17:54:04 2012 +0100
BZ 861491 - Choose a better display name and description for the 'promote' operation. (cherry-picked from e4203a2, BZ 860665)
diff --git a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml index 46b3084..ba4fe29 100644 --- a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml @@ -1114,9 +1114,9 @@ <c:simple-property name="path" default="deployment" readOnly="true"/> </plugin-configuration>
- <operation name="promote" displayName="Deploy to Server-Group" description="Deploy this deployment to a server group"> + <operation name="promote" displayName="Assign to Server-Group" description="Assigns this deployment to one or all server group(s)"> <parameters> - <c:simple-property name="server-group" required="true" description="Server group to deploy to" type="string"> + <c:simple-property name="server-group" required="true" description="Server group to assign to" type="string"> <c:property-options> <c:option value="__all" name="All"/> </c:property-options>
commit 6123c8974ddfd2ac9d44aefbc90668b846e823de Author: John Mazzitelli mazz@redhat.com Date: Tue Dec 11 11:00:30 2012 -0500
make the oracle module an optional dep in the installer to support those cases where we can't ship the Oracle JDBC driver jar.
diff --git a/modules/enterprise/server/installer/src/main/resources/module/main/module.xml b/modules/enterprise/server/installer/src/main/resources/module/main/module.xml index fcc5cc0..4358c6b 100644 --- a/modules/enterprise/server/installer/src/main/resources/module/main/module.xml +++ b/modules/enterprise/server/installer/src/main/resources/module/main/module.xml @@ -28,7 +28,7 @@ <module name="org.jboss.staxmapper"/> <module name="org.picketbox"/> <module name="org.rhq.postgres"/> - <module name="org.rhq.oracle"/> + <module name="org.rhq.oracle" optional="true" /> <module name="javax.api"/> </dependencies>
commit f7dcb1f2bc8e88e1febcb735f1a9a3c6caa6af15 Author: John Mazzitelli mazz@redhat.com Date: Tue Dec 11 10:32:47 2012 -0500
we dont use this now, but in case we bring it back, i'll fix this now
diff --git a/modules/enterprise/server/sars/agent-sar/src/main/resources/embedded-agent-configuration-overrides.properties b/modules/enterprise/server/sars/agent-sar/src/main/resources/embedded-agent-configuration-overrides.properties index 3bcc7d7..c14c614 100644 --- a/modules/enterprise/server/sars/agent-sar/src/main/resources/embedded-agent-configuration-overrides.properties +++ b/modules/enterprise/server/sars/agent-sar/src/main/resources/embedded-agent-configuration-overrides.properties @@ -11,7 +11,7 @@ rhq.communications.connector.bind-port=${rhq.server.embedded-agent.bind-port:261 # location where data files can be stored rhq.agent.data-directory=${jboss.server.data.dir}/embedded-agent # location of the plugins -rhq.agent.plugins.directory=${jboss.server.base.dir}/deployments/rhq.ear/rhq-downloads/rhq-plugins +rhq.agent.plugins.directory=${rhq.server.home}/modules/org/rhq/rhq-enterprise-server-startup-subsystem/main/deployments/rhq.ear/rhq-downloads/rhq-plugins # Client-side SSL Security Configuration (for sending messages to the server) rhq.agent.client.security.secure-socket-protocol=${rhq.communications.connector.security.secure-socket-protocol:TLS} rhq.agent.client.security.keystore.file=${rhq.communications.connector.security.keystore.file}
commit 2499c815bced188a19168d31451eaaaea41ed530 Author: John Mazzitelli mazz@redhat.com Date: Tue Dec 11 10:27:05 2012 -0500
fix default location for download files
diff --git a/modules/enterprise/server/sars/services-sar/src/main/resources/server-comm-configuration-overrides.properties b/modules/enterprise/server/sars/services-sar/src/main/resources/server-comm-configuration-overrides.properties index da5427b..7a407cc 100644 --- a/modules/enterprise/server/sars/services-sar/src/main/resources/server-comm-configuration-overrides.properties +++ b/modules/enterprise/server/sars/services-sar/src/main/resources/server-comm-configuration-overrides.properties @@ -1,5 +1,5 @@ # location of the plugin jars and other files agents can download directly from sever -rhq.server.agent-files-directory=${jboss.server.base.dir}/deployments/rhq.ear/rhq-downloads +rhq.server.agent-files-directory=${rhq.server.home}/modules/org/rhq/rhq-enterprise-server-startup-subsystem/main/deployments/rhq.ear/rhq-downloads # location where data files can be stored rhq.communications.data-directory=${jboss.server.data.dir} # global limit on number of concurrent incoming messages allowed
commit 58f8f8a2ef42f3ea624a0d122605917214ea8d96 Author: Jay Shaughnessy jshaughn@redhat.com Date: Mon Dec 10 16:09:52 2012 -0500
Domain itest changes - remove the -ds.xml files and perform datasource decl in the standalone.xml (via the pom), analogous now to the way it is done in the server itests. - beef up the error handling in AbstractEJB3Test __before/__afterMethods to more readily flag exceptions thrown in overrides. - similarly beef up domain test Before/After methods that don't leverage the overrides - remove the SetBigStringTryClob=true connection prop for oracle, trying to set it was causing us to hit https://issues.jboss.org/browse/AS7-4673 and it seems no longer necessary with oracle11 JDBC driver (http://docs.oracle.com/cd/E11882_01/java.112/e16548/oralob.htm#CHDGEIHF). - fix some domain tests that were manhandling the entitymanager
diff --git a/modules/core/domain/pom.xml b/modules/core/domain/pom.xml index 1c2d940..e874c08 100644 --- a/modules/core/domain/pom.xml +++ b/modules/core/domain/pom.xml @@ -318,6 +318,157 @@ <goal>run</goal> </goals> </execution> + + <execution> + <id>prepare Postgres datasource</id> + <phase>process-test-resources</phase> + <configuration> + <skip>${skip.postgres}</skip> + <target> + <property name="jboss.conf" location="${jboss.unzip.location}/standalone/configuration/standalone.xml" /> + <echo>Will now add test configuration datasource to JBossAS config file: ${jboss.conf}</echo> + <replace file="${jboss.conf}"> + + <replacefilter> + <replacetoken></datasource></replacetoken> + <replacevalue><![CDATA[ + </datasource> + <!-- FOR RHQ TESTING --> + <datasource jta="false" jndi-name="java:jboss/datasources/NoTxRHQDS" pool-name="NoTxRHQDS" enabled="true" use-java-context="true"> + <connection-url>${rhq.test.ds.connection-url}</connection-url> + <connection-property name="char.encoding">UTF-8</connection-property> + <driver>postgres</driver> + <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation> + <pool> + <min-pool-size>2</min-pool-size> + <max-pool-size>5</max-pool-size> + </pool> + <security> + <security-domain>RHQDSSecurityDomain</security-domain> + </security> + <validation> + <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker"/> + <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter"/> + </validation> + <timeout> + <blocking-timeout-millis>30000</blocking-timeout-millis> + <idle-timeout-minutes>15</idle-timeout-minutes> + </timeout> + <statement> + <prepared-statement-cache-size>75</prepared-statement-cache-size> + </statement> + </datasource> + <xa-datasource jta="true" jndi-name="java:jboss/datasources/RHQDS" pool-name="RHQDS" enabled="true" use-java-context="true"> + <xa-datasource-property name="DatabaseName">${rhq.test.ds.db-name}</xa-datasource-property> + <xa-datasource-property name="PortNumber">${rhq.test.ds.port}</xa-datasource-property> + <xa-datasource-property name="ServerName">${rhq.test.ds.server-name}</xa-datasource-property> + <driver>postgres</driver> + <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation> + <xa-pool> + <min-pool-size>5</min-pool-size> + <max-pool-size>50</max-pool-size> + </xa-pool> + <security> + <security-domain>RHQDSSecurityDomain</security-domain> + </security> + <validation> + <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker"/> + <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter"/> + </validation> + <timeout> + <blocking-timeout-millis>30000</blocking-timeout-millis> + <idle-timeout-minutes>15</idle-timeout-minutes> + </timeout> + <statement> + <prepared-statement-cache-size>75</prepared-statement-cache-size> + </statement> + </xa-datasource>]]></replacevalue> + </replacefilter> + + </replace> + + </target> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + + <execution> + <id>prepare Oracle datasource</id> + <phase>process-test-resources</phase> + <configuration> + <skip>${skip.oracle}</skip> + <target> + <property name="jboss.conf" location="${jboss.unzip.location}/standalone/configuration/standalone.xml" /> + <echo>Will now add test configuration datasource to JBossAS config file: ${jboss.conf}</echo> + <replace file="${jboss.conf}"> + + <replacefilter> + <replacetoken></datasource></replacetoken> + <replacevalue><![CDATA[ + </datasource> + <!-- FOR RHQ TESTING --> + <datasource jta="false" jndi-name="java:jboss/datasources/NoTxRHQDS" pool-name="NoTxRHQDS" enabled="true" use-java-context="true"> + <connection-url>${rhq.test.ds.connection-url}</connection-url> + <connection-property name="char.encoding">UTF-8</connection-property> + <driver>oracle</driver> + <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation> + <pool> + <min-pool-size>2</min-pool-size> + <max-pool-size>5</max-pool-size> + </pool> + <security> + <security-domain>RHQDSSecurityDomain</security-domain> + </security> + <validation> + <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker" /> + <stale-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker" /> + <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter" /> + </validation> + <timeout> + <blocking-timeout-millis>30000</blocking-timeout-millis> + <idle-timeout-minutes>15</idle-timeout-minutes> + </timeout> + <statement> + <prepared-statement-cache-size>75</prepared-statement-cache-size> + </statement> + </datasource> + <xa-datasource jta="true" jndi-name="java:jboss/datasources/RHQDS" pool-name="RHQDS" enabled="true" use-java-context="true"> + <xa-datasource-property name="URL">${rhq.test.ds.connection-url}</xa-datasource-property> + <driver>oracle</driver> + <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation> + <xa-pool> + <min-pool-size>5</min-pool-size> + <max-pool-size>50</max-pool-size> + </xa-pool> + <security> + <security-domain>RHQDSSecurityDomain</security-domain> + </security> + <validation> + <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker" /> + <stale-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker" /> + <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter" /> + </validation> + <timeout> + <blocking-timeout-millis>30000</blocking-timeout-millis> + <idle-timeout-minutes>15</idle-timeout-minutes> + </timeout> + <statement> + <prepared-statement-cache-size>75</prepared-statement-cache-size> + </statement> + </xa-datasource>]]></replacevalue> + </replacefilter> + + </replace> + + </target> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + </executions> </plugin>
@@ -513,6 +664,38 @@ </plugins> </build> </profile> + + <profile> + <id>postgres</id> + <activation> + <activeByDefault>true</activeByDefault> + </activation> + <properties> + <skip.postgres>false</skip.postgres> + <skip.oracle>true</skip.oracle> + </properties> + </profile> + + <profile> + <id>oracle</id> + <properties> + <skip.postgres>true</skip.postgres> + <skip.oracle>false</skip.oracle> + </properties> + </profile> + + <profile> + <id>itest.debug</id> + <activation> + <property> + <name>itest.debug</name> + </property> + </activation> + <properties> + <jboss.vm.args.debug>-Xrunjdwp:transport=dt_socket,address=8798,server=y,suspend=y</jboss.vm.args.debug> + </properties> + </profile> + </profiles>
diff --git a/modules/core/domain/src/test/java/org/rhq/core/domain/content/test/ContentSourceSyncResultsTest.java b/modules/core/domain/src/test/java/org/rhq/core/domain/content/test/ContentSourceSyncResultsTest.java index 9ed1b95..c906a1a 100644 --- a/modules/core/domain/src/test/java/org/rhq/core/domain/content/test/ContentSourceSyncResultsTest.java +++ b/modules/core/domain/src/test/java/org/rhq/core/domain/content/test/ContentSourceSyncResultsTest.java @@ -24,8 +24,6 @@ package org.rhq.core.domain.content.test;
import java.util.List;
-import javax.persistence.EntityManager; - import org.testng.annotations.Test;
import org.rhq.core.domain.content.Architecture; @@ -47,8 +45,6 @@ public class ContentSourceSyncResultsTest extends AbstractEJB3Test { public void testInsert() throws Exception { getTransactionManager().begin(); try { - EntityManager em = getEntityManager(); - ResourceType rt = new ResourceType("testCSSRResourceType", "testPlugin", ResourceCategory.PLATFORM, null); Resource resource = new Resource("testCSSRResource", "testCSSRResource", rt); resource.setUuid("uuid"); @@ -74,8 +70,6 @@ public class ContentSourceSyncResultsTest extends AbstractEJB3Test { em.persist(results); cs.addSyncResult(results); em.flush(); - //em.close(); - em = getEntityManager();
cs = em.find(ContentSource.class, cs.getId()); assert cs != null; @@ -100,8 +94,6 @@ public class ContentSourceSyncResultsTest extends AbstractEJB3Test { em.persist(results); cs.addSyncResult(results); em.flush(); - //em.close(); - em = getEntityManager();
cs = em.find(ContentSource.class, cs.getId()); assert cs != null; diff --git a/modules/core/domain/src/test/java/org/rhq/core/domain/content/test/ContentSourceTest.java b/modules/core/domain/src/test/java/org/rhq/core/domain/content/test/ContentSourceTest.java index 733e0eb..00234db 100644 --- a/modules/core/domain/src/test/java/org/rhq/core/domain/content/test/ContentSourceTest.java +++ b/modules/core/domain/src/test/java/org/rhq/core/domain/content/test/ContentSourceTest.java @@ -24,8 +24,6 @@ package org.rhq.core.domain.content.test;
import java.util.Random;
-import javax.persistence.EntityManager; - import org.testng.annotations.Test;
import org.rhq.core.domain.configuration.Configuration; @@ -46,7 +44,6 @@ public class ContentSourceTest extends AbstractEJB3Test { public void testInsert() throws Exception { getTransactionManager().begin(); try { - EntityManager em = getEntityManager();
ResourceType rt = new ResourceType("testCSResourceType", "testPlugin", ResourceCategory.PLATFORM, null); Resource resource = new Resource("testCSResource", "testCSResource", rt); @@ -71,8 +68,6 @@ public class ContentSourceTest extends AbstractEJB3Test { em.persist(cst); em.persist(cs); em.flush(); - //em.close(); - em = getEntityManager();
cs = em.find(ContentSource.class, cs.getId()); assert cs != null; @@ -93,8 +88,6 @@ public class ContentSourceTest extends AbstractEJB3Test { public void testNullSyncSchedule() throws Exception { getTransactionManager().begin(); try { - EntityManager em = getEntityManager(); - ResourceType rt = new ResourceType("testCSResourceType", "testPlugin", ResourceCategory.PLATFORM, null); Resource resource = new Resource("testCSResource", "testCSResource", rt); resource.setUuid("" + new Random().nextInt()); @@ -120,8 +113,6 @@ public class ContentSourceTest extends AbstractEJB3Test { em.persist(cst); em.persist(cs); em.flush(); - //em.close(); - em = getEntityManager();
cs = em.find(ContentSource.class, cs.getId()); assert cs != null; @@ -143,8 +134,6 @@ public class ContentSourceTest extends AbstractEJB3Test { // using empty strings to see that Oracle still behaves itself getTransactionManager().begin(); try { - EntityManager em = getEntityManager(); - ResourceType rt = new ResourceType("testCSResourceType", "testPlugin", ResourceCategory.PLATFORM, null); Resource resource = new Resource("testCSResource", "testCSResource", rt); resource.setUuid("" + new Random().nextInt()); @@ -170,8 +159,6 @@ public class ContentSourceTest extends AbstractEJB3Test { em.persist(cst); em.persist(cs); em.flush(); - //em.close(); - em = getEntityManager();
cs = em.find(ContentSource.class, cs.getId()); assert cs != null; diff --git a/modules/core/domain/src/test/java/org/rhq/core/domain/drift/DriftDataAccessTest.java b/modules/core/domain/src/test/java/org/rhq/core/domain/drift/DriftDataAccessTest.java index 7138416..083a756 100644 --- a/modules/core/domain/src/test/java/org/rhq/core/domain/drift/DriftDataAccessTest.java +++ b/modules/core/domain/src/test/java/org/rhq/core/domain/drift/DriftDataAccessTest.java @@ -38,7 +38,14 @@ public class DriftDataAccessTest extends AbstractEJB3Test { executeInTransaction(false, new TransactionCallback() { @Override public void execute() throws Exception { - purgeDB(); + try { + purgeDB(); + + } catch (Exception e) { + System.out.println("BEFORE METHOD FAILURE, TEST DID NOT RUN!!!"); + e.printStackTrace(); + throw e; + } } }); } diff --git a/modules/core/domain/src/test/java/org/rhq/core/domain/drift/DriftDefinitionTemplateTest.java b/modules/core/domain/src/test/java/org/rhq/core/domain/drift/DriftDefinitionTemplateTest.java index 9329ae6..49e4e26 100644 --- a/modules/core/domain/src/test/java/org/rhq/core/domain/drift/DriftDefinitionTemplateTest.java +++ b/modules/core/domain/src/test/java/org/rhq/core/domain/drift/DriftDefinitionTemplateTest.java @@ -52,9 +52,16 @@ public class DriftDefinitionTemplateTest extends DriftDataAccessTest { executeInTransaction(false, new TransactionCallback() { @Override public void execute() throws Exception { - purgeDB(); - createResourceType(); - em.persist(resourceType); + try { + purgeDB(); + createResourceType(); + em.persist(resourceType); + + } catch (Exception e) { + System.out.println("BEFORE METHOD FAILURE, TEST DID NOT RUN!!!"); + e.printStackTrace(); + throw e; + } } }); } diff --git a/modules/core/domain/src/test/java/org/rhq/core/domain/drift/JPADriftChangeSetTest.java b/modules/core/domain/src/test/java/org/rhq/core/domain/drift/JPADriftChangeSetTest.java index 9d5248f..2709158 100644 --- a/modules/core/domain/src/test/java/org/rhq/core/domain/drift/JPADriftChangeSetTest.java +++ b/modules/core/domain/src/test/java/org/rhq/core/domain/drift/JPADriftChangeSetTest.java @@ -64,18 +64,25 @@ public class JPADriftChangeSetTest extends DriftDataAccessTest { executeInTransaction(false, new TransactionCallback() { @Override public void execute() throws Exception { - purgeDB(); + try { + purgeDB();
- EntityManager em = getEntityManager(); + EntityManager em = getEntityManager(); + + resourceType = createResourceType(); + em.persist(resourceType);
- resourceType = createResourceType(); - em.persist(resourceType); + resource = createResource(resourceType);
- resource = createResource(resourceType); + definition = createDriftDefinition(); + resource.addDriftDefinition(definition); + getEntityManager().persist(resource);
- definition = createDriftDefinition(); - resource.addDriftDefinition(definition); - getEntityManager().persist(resource); + } catch (Exception e) { + System.out.println("BEFORE METHOD FAILURE, TEST DID NOT RUN!!!"); + e.printStackTrace(); + throw e; + } } }); } diff --git a/modules/core/domain/src/test/java/org/rhq/core/domain/operation/OperationHistoryTest.java b/modules/core/domain/src/test/java/org/rhq/core/domain/operation/OperationHistoryTest.java index ff9b96c..34837a1 100644 --- a/modules/core/domain/src/test/java/org/rhq/core/domain/operation/OperationHistoryTest.java +++ b/modules/core/domain/src/test/java/org/rhq/core/domain/operation/OperationHistoryTest.java @@ -24,7 +24,6 @@ package org.rhq.core.domain.operation;
import java.util.Random;
-import javax.persistence.EntityManager; import javax.persistence.EntityNotFoundException; import javax.persistence.Query;
@@ -65,12 +64,11 @@ public class OperationHistoryTest extends AbstractEJB3Test {
@Test(groups = "integration.ejb3") public void testUpdate() throws Exception { - EntityManager em = getEntityManager(); getTransactionManager().begin(); try { - ResourceOperationHistory r1 = createIndividualResourceHistory(em); - GroupOperationHistory g1 = createGroupResourceHistory(em); - ResourceOperationHistory r2 = createGroupIndividualResourceHistory(em, g1); + ResourceOperationHistory r1 = createIndividualResourceHistory(); + GroupOperationHistory g1 = createGroupResourceHistory(); + ResourceOperationHistory r2 = createGroupIndividualResourceHistory(g1);
Configuration results = new Configuration(); results.put(new PropertySimple("exitCode", "1")); @@ -134,10 +132,9 @@ public class OperationHistoryTest extends AbstractEJB3Test {
@Test(groups = "integration.ejb3") public void testCreate() throws Exception { - EntityManager em = getEntityManager(); getTransactionManager().begin(); try { - ResourceOperationHistory r1 = createIndividualResourceHistory(em); + ResourceOperationHistory r1 = createIndividualResourceHistory();
Thread.sleep(100); // without sleeping, test goes so fast that the getDuration() is saying 0 assert r1.getId() > 0; @@ -160,7 +157,7 @@ public class OperationHistoryTest extends AbstractEJB3Test { assert r1.getSubjectName().equals("user"); assert r1.getStatus() == OperationRequestStatus.INPROGRESS;
- GroupOperationHistory g1 = createGroupResourceHistory(em); + GroupOperationHistory g1 = createGroupResourceHistory();
Thread.sleep(100); // without sleeping, test goes so fast that the getDuration() is saying 0 assert g1.getId() > 0; @@ -178,7 +175,7 @@ public class OperationHistoryTest extends AbstractEJB3Test { assert g1.getStatus() == OperationRequestStatus.INPROGRESS;
// the individual resource history that was part of a group execution - ResourceOperationHistory r2 = createGroupIndividualResourceHistory(em, g1); + ResourceOperationHistory r2 = createGroupIndividualResourceHistory(g1);
Thread.sleep(100); // without sleeping, test goes so fast that the getDuration() is saying 0 assert r2.getId() > 0; @@ -205,28 +202,24 @@ public class OperationHistoryTest extends AbstractEJB3Test {
@Test(groups = "integration.ejb3") public void testQueryByJobId() throws Exception { - EntityManager em; ResourceOperationHistory r1; GroupOperationHistory g1; ResourceOperationHistory r2;
getTransactionManager().begin(); - em = getEntityManager();
try { - r1 = createIndividualResourceHistory(em); - g1 = createGroupResourceHistory(em); - r2 = createGroupIndividualResourceHistory(em, g1); + r1 = createIndividualResourceHistory(); + g1 = createGroupResourceHistory(); + r2 = createGroupIndividualResourceHistory(g1); getTransactionManager().commit(); - em.close(); + } catch (Throwable t) { getTransactionManager().rollback(); - em.close(); throw new Exception(t); }
getTransactionManager().begin(); - em = getEntityManager();
ResourceOperationHistory r1_dup; GroupOperationHistory g1_dup; @@ -270,10 +263,8 @@ public class OperationHistoryTest extends AbstractEJB3Test { assert r2_dup.getStatus().equals(r2.getStatus()); } finally { getTransactionManager().rollback(); - em.close();
getTransactionManager().begin(); - em = getEntityManager();
r1 = em.find(ResourceOperationHistory.class, r1.getId()); em.remove(r1); @@ -281,21 +272,18 @@ public class OperationHistoryTest extends AbstractEJB3Test { em.remove(g1); // this should cascade and delete r2
getTransactionManager().commit(); - em.close();
try { // make sure our cascading on remove worked getTransactionManager().begin(); - em = getEntityManager(); assert em.find(ResourceOperationHistory.class, r2.getId()) == null; } finally { getTransactionManager().rollback(); - em.close(); } } }
- private ResourceOperationHistory createGroupIndividualResourceHistory(EntityManager em, GroupOperationHistory g1) { + private ResourceOperationHistory createGroupIndividualResourceHistory(GroupOperationHistory g1) { ResourceOperationHistory r2 = new ResourceOperationHistory("job3" + System.currentTimeMillis(), "group3", "user", newOperation, null, newResource, g1); r2.setStartedTime(); @@ -303,14 +291,14 @@ public class OperationHistoryTest extends AbstractEJB3Test { return r2; }
- private GroupOperationHistory createGroupResourceHistory(EntityManager em) { + private GroupOperationHistory createGroupResourceHistory() { GroupOperationHistory g1 = new GroupOperationHistory("job2" + System.currentTimeMillis(), "group2", "user", newOperation, null, newGroup); em.persist(g1); return g1; }
- private ResourceOperationHistory createIndividualResourceHistory(EntityManager em) { + private ResourceOperationHistory createIndividualResourceHistory() { ResourceOperationHistory r1 = new ResourceOperationHistory("job1" + System.currentTimeMillis(), "group1", "user", newOperation, null, newResource, null); r1.setStartedTime(); @@ -320,37 +308,32 @@ public class OperationHistoryTest extends AbstractEJB3Test {
private Resource createNewResource() throws Exception { getTransactionManager().begin(); - EntityManager em = getEntityManager(); - Resource resource;
try { - try { - ResourceType resourceType = new ResourceType("plat" + System.currentTimeMillis(), "test", - ResourceCategory.PLATFORM, null); + ResourceType resourceType = new ResourceType("plat" + System.currentTimeMillis(), "test", + ResourceCategory.PLATFORM, null);
- OperationDefinition def = new OperationDefinition(resourceType, "testOp"); - def.setTimeout(1); - resourceType.addOperationDefinition(def); + OperationDefinition def = new OperationDefinition(resourceType, "testOp"); + def.setTimeout(1); + resourceType.addOperationDefinition(def);
- em.persist(resourceType); + em.persist(resourceType);
- resource = new Resource("key" + System.currentTimeMillis(), "name", resourceType); - resource.setUuid("" + new Random().nextInt()); - em.persist(resource); + resource = new Resource("key" + System.currentTimeMillis(), "name", resourceType); + resource.setUuid("" + new Random().nextInt()); + em.persist(resource);
- ResourceGroup group = new ResourceGroup("testgroupOH" + System.currentTimeMillis(), resourceType); - em.persist(group); - group.addExplicitResource(resource); - } catch (Exception e) { - System.out.println(e); - getTransactionManager().rollback(); - throw e; - } + ResourceGroup group = new ResourceGroup("testgroupOH" + System.currentTimeMillis(), resourceType); + em.persist(group); + group.addExplicitResource(resource);
getTransactionManager().commit(); - } finally { - em.close(); + + } catch (Exception e) { + System.out.println(e); + getTransactionManager().rollback(); + throw e; }
return resource; @@ -359,7 +342,7 @@ public class OperationHistoryTest extends AbstractEJB3Test { private void deleteNewResource(Resource resource) throws Exception { if (resource != null) { getTransactionManager().begin(); - EntityManager em = getEntityManager(); + try { ResourceType type = em.find(ResourceType.class, resource.getResourceType().getId()); Resource res = em.find(Resource.class, resource.getId()); @@ -382,8 +365,6 @@ public class OperationHistoryTest extends AbstractEJB3Test { }
throw e; - } finally { - em.close(); } } } diff --git a/modules/core/domain/src/test/java/org/rhq/core/domain/resource/test/ProblemResourceTest.java b/modules/core/domain/src/test/java/org/rhq/core/domain/resource/test/ProblemResourceTest.java index c836632..4d3c471 100644 --- a/modules/core/domain/src/test/java/org/rhq/core/domain/resource/test/ProblemResourceTest.java +++ b/modules/core/domain/src/test/java/org/rhq/core/domain/resource/test/ProblemResourceTest.java @@ -344,7 +344,6 @@ public class ProblemResourceTest extends AbstractEJB3Test { SystemException { entityManager.flush(); getTransactionManager().commit(); - entityManager.close(); }
private void begin() throws NotSupportedException, SystemException { diff --git a/modules/core/domain/src/test/java/org/rhq/core/domain/resource/test/ResourceErrorTest.java b/modules/core/domain/src/test/java/org/rhq/core/domain/resource/test/ResourceErrorTest.java index a6e2eba..ac73f49 100644 --- a/modules/core/domain/src/test/java/org/rhq/core/domain/resource/test/ResourceErrorTest.java +++ b/modules/core/domain/src/test/java/org/rhq/core/domain/resource/test/ResourceErrorTest.java @@ -25,7 +25,6 @@ package org.rhq.core.domain.resource.test; import java.util.List; import java.util.Random;
-import javax.persistence.EntityManager; import javax.persistence.Query;
import org.testng.annotations.Test; @@ -54,7 +53,6 @@ public class ResourceErrorTest extends AbstractEJB3Test {
public void testCreateErrors() throws Exception { getTransactionManager().begin(); - EntityManager em = getEntityManager();
try { ResourceError re; @@ -97,7 +95,6 @@ public class ResourceErrorTest extends AbstractEJB3Test { assert q.getResultList().size() == 2; } finally { getTransactionManager().rollback(); - em.close(); } }
@@ -108,7 +105,6 @@ public class ResourceErrorTest extends AbstractEJB3Test { List<ResourceError> errors;
getTransactionManager().begin(); - EntityManager em = getEntityManager();
try { q = em.createNamedQuery(ResourceError.QUERY_FIND_BY_RESOURCE_ID); @@ -141,34 +137,29 @@ public class ResourceErrorTest extends AbstractEJB3Test {
} finally { getTransactionManager().rollback(); - em.close(); } }
private Resource createNewResource() throws Exception { getTransactionManager().begin(); - EntityManager em = getEntityManager();
Resource resource;
try { - try { - ResourceType resourceType = new ResourceType("plat" + System.currentTimeMillis(), "test", - ResourceCategory.PLATFORM, null); - em.persist(resourceType); - resource = new Resource("key" + System.currentTimeMillis(), "name", resourceType); - resource.setUuid("" + new Random().nextInt()); - em.persist(resource); - System.out.println("Created resource with id " + resource.getId()); - } catch (Exception e) { - System.out.println(e); - getTransactionManager().rollback(); - throw e; - } + ResourceType resourceType = new ResourceType("plat" + System.currentTimeMillis(), "test", + ResourceCategory.PLATFORM, null); + em.persist(resourceType); + resource = new Resource("key" + System.currentTimeMillis(), "name", resourceType); + resource.setUuid("" + new Random().nextInt()); + em.persist(resource); + System.out.println("Created resource with id " + resource.getId());
getTransactionManager().commit(); - } finally { - em.close(); + + } catch (Exception e) { + System.out.println(e); + getTransactionManager().rollback(); + throw e; }
return resource; @@ -177,7 +168,7 @@ public class ResourceErrorTest extends AbstractEJB3Test { private void deleteNewResource(Resource resource) throws Exception { if (resource != null) { getTransactionManager().begin(); - EntityManager em = getEntityManager(); + try { ResourceType type = em.find(ResourceType.class, resource.getResourceType().getId()); Resource res = em.find(Resource.class, resource.getId()); @@ -197,8 +188,6 @@ public class ResourceErrorTest extends AbstractEJB3Test { }
throw e; - } finally { - em.close(); } } } diff --git a/modules/core/domain/src/test/java/org/rhq/core/domain/resource/test/ResourceGroupTest.java b/modules/core/domain/src/test/java/org/rhq/core/domain/resource/test/ResourceGroupTest.java index be2875d..60caec0 100644 --- a/modules/core/domain/src/test/java/org/rhq/core/domain/resource/test/ResourceGroupTest.java +++ b/modules/core/domain/src/test/java/org/rhq/core/domain/resource/test/ResourceGroupTest.java @@ -24,8 +24,6 @@ package org.rhq.core.domain.resource.test;
import java.util.Random;
-import javax.persistence.EntityManager; - import org.testng.annotations.Test;
import org.rhq.core.domain.measurement.Availability; @@ -80,11 +78,8 @@ public class ResourceGroupTest extends AbstractEJB3Test {
private Resource createNewResource() throws Exception { getTransactionManager().begin(); - EntityManager em = getEntityManager(); - Resource resource;
- try { try { ResourceType resourceType = new ResourceType("plat" + System.currentTimeMillis(), "test", ResourceCategory.PLATFORM, null); @@ -97,24 +92,22 @@ public class ResourceGroupTest extends AbstractEJB3Test { ResourceGroup group = new ResourceGroup("testgroupRG" + System.currentTimeMillis(), resourceType); em.persist(group); group.addExplicitResource(resource); + + getTransactionManager().commit(); + } catch (Exception e) { System.out.println(e); getTransactionManager().rollback(); throw e; }
- getTransactionManager().commit(); - } finally { - em.close(); - } - return resource; }
private void deleteNewResource(Resource resource) throws Exception { if (resource != null) { getTransactionManager().begin(); - EntityManager em = getEntityManager(); + try { ResourceType type = em.find(ResourceType.class, resource.getResourceType().getId()); Resource res = em.find(Resource.class, resource.getId()); @@ -137,8 +130,6 @@ public class ResourceGroupTest extends AbstractEJB3Test { }
throw e; - } finally { - em.close(); } } } diff --git a/modules/core/domain/src/test/java/org/rhq/core/domain/test/AbstractEJB3Test.java b/modules/core/domain/src/test/java/org/rhq/core/domain/test/AbstractEJB3Test.java index d0942b1..4eff131 100644 --- a/modules/core/domain/src/test/java/org/rhq/core/domain/test/AbstractEJB3Test.java +++ b/modules/core/domain/src/test/java/org/rhq/core/domain/test/AbstractEJB3Test.java @@ -1,6 +1,7 @@ package org.rhq.core.domain.test;
import java.io.File; +import java.lang.reflect.Method; import java.util.Collection; import java.util.Date; import java.util.HashSet; @@ -16,6 +17,7 @@ import javax.persistence.PersistenceContext; import javax.transaction.TransactionManager;
import org.testng.AssertJUnit; +import org.testng.ITestResult; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod;
@@ -58,23 +60,8 @@ public abstract class AbstractEJB3Test extends Arquillian { @Deployment protected static EnterpriseArchive getBaseDeployment() {
- // depending on the db in use, set up the necessary datasource - String dialect = System.getProperty("hibernate.dialect"); - if (dialect == null) { - System.out.println("!!! hibernate.dialect is not set! Assuming you want to test on postgres"); - dialect = "postgres"; - } - - String dataSourceXml; - if (dialect.toLowerCase().contains("postgres")) { - dataSourceXml = "jbossas-postgres-ds.xml"; - } else { - dataSourceXml = "jbossas-oracle-ds.xml"; - } - // Create the domain jar which will subsequently be packaged in the ear deployment JavaArchive ejbJar = ShrinkWrap.create(JavaArchive.class, "rhq-core-domain-ejb3.jar") // - .addAsManifestResource(dataSourceXml) // the datasource .addAsManifestResource("ejb-jar.xml") // the empty ejb jar descriptor .addAsManifestResource("test-persistence.xml", "persistence.xml") // the test persistence context .addAsManifestResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml") // add CDI injection (needed by arquillian injection) @@ -213,12 +200,20 @@ public abstract class AbstractEJB3Test extends Arquillian { * and {@link #inContainer()} call. */ @BeforeMethod - protected void __beforeMethod() throws Exception { + protected void __beforeMethod(Method method) throws Throwable { // Note that Arquillian calls the testng BeforeMethod twice (as of 1.0.2.Final, once // out of container and once in container. In general the expectation is to execute it // one time, and doing it in container allows for the expected injections and context. if (inContainer()) { - beforeMethod(); + try { + beforeMethod(); + + } catch (Throwable t) { + // Arquillian is eating these, make sure they show up in some way + System.out.println("BEFORE METHOD FAILURE, TEST DID NOT RUN!!! [" + method.getName() + "]"); + t.printStackTrace(); + throw t; + } } }
@@ -229,9 +224,18 @@ public abstract class AbstractEJB3Test extends Arquillian { * Instead, override {@link #afterMethod()}. */ @AfterMethod(alwaysRun = true) - protected void __afterMethod() throws Exception { - // currently no special handling necessary - afterMethod(); + protected void __afterMethod(ITestResult result, Method method) throws Throwable { + try { + if (inContainer()) { + afterMethod(); + } + } catch (Throwable t) { + System.out + .println("AFTER METHOD FAILURE, TEST CLEAN UP FAILED!!! MAY NEED TO CLEAN DB BEFORE RUNNING MORE TESTS! [" + + method.getName() + "]"); + t.printStackTrace(); + throw t; + } }
protected boolean inContainer() { diff --git a/modules/core/domain/src/test/resources/jbossas-oracle-ds.xml b/modules/core/domain/src/test/resources/jbossas-oracle-ds.xml deleted file mode 100644 index 8906dca..0000000 --- a/modules/core/domain/src/test/resources/jbossas-oracle-ds.xml +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<datasources xmlns="http://www.jboss.org/ironjacamar/schema" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.jboss.org/ironjacamar/schema http://docs.jboss.org/ironjacamar/schema/datasources_1_0.xsd%22%3E - - <xa-datasource jndi-name="java:jboss/datasources/RHQDS" pool-name="RHQDS" enabled="true" use-java-context="true"> - - <xa-datasource-property name="URL">${rhq.test.ds.connection-url}</xa-datasource-property> - <xa-datasource-property name="ConnectionProperties">SetBigStringTryClob=true</xa-datasource-property> - <driver>oracle</driver> - <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation> - <xa-pool> - <min-pool-size>5</min-pool-size> - <max-pool-size>50</max-pool-size> - <is-same-rm-override>false</is-same-rm-override> - <no-tx-separate-pools /> - </xa-pool> - <security> - <security-domain>RHQDSSecurityDomain</security-domain> - </security> - <validation> - <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker" /> - <stale-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker" /> - <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter" /> - </validation> - <timeout> - <blocking-timeout-millis>30000</blocking-timeout-millis> - <idle-timeout-minutes>15</idle-timeout-minutes> - </timeout> - <statement> - <prepared-statement-cache-size>75</prepared-statement-cache-size> - </statement> - </xa-datasource> - -</datasources> \ No newline at end of file diff --git a/modules/core/domain/src/test/resources/jbossas-postgres-ds.xml b/modules/core/domain/src/test/resources/jbossas-postgres-ds.xml deleted file mode 100644 index 23db62c..0000000 --- a/modules/core/domain/src/test/resources/jbossas-postgres-ds.xml +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<datasources - xmlns="http://www.jboss.org/ironjacamar/schema" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation=" - http://www.jboss.org/ironjacamar/schema - http://docs.jboss.org/ironjacamar/schema/datasources_1_0.xsd%22%3E - - <xa-datasource - jndi-name="java:jboss/datasources/RHQDS" - pool-name="RHQDS" - enabled="true" - use-java-context="true"> - - <xa-datasource-property name="DatabaseName">${rhq.test.ds.db-name}</xa-datasource-property> - <xa-datasource-property name="PortNumber">${rhq.test.ds.port}</xa-datasource-property> - <xa-datasource-property name="ServerName">${rhq.test.ds.server-name}</xa-datasource-property> - <driver>postgres</driver> - <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation> - <xa-pool> - <min-pool-size>5</min-pool-size> - <max-pool-size>50</max-pool-size> - </xa-pool> - <security> - <security-domain>RHQDSSecurityDomain</security-domain> - </security> - <validation> - <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker" /> - <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter" /> - </validation> - <timeout> - <blocking-timeout-millis>30000</blocking-timeout-millis> - <idle-timeout-minutes>15</idle-timeout-minutes> - </timeout> - <statement> - <prepared-statement-cache-size>75</prepared-statement-cache-size> - </statement> - </xa-datasource> - -</datasources> \ No newline at end of file diff --git a/modules/enterprise/server/itests-2/pom.xml b/modules/enterprise/server/itests-2/pom.xml index cc9c941..c0c420e 100644 --- a/modules/enterprise/server/itests-2/pom.xml +++ b/modules/enterprise/server/itests-2/pom.xml @@ -575,7 +575,6 @@ </datasource> <xa-datasource jta="true" jndi-name="java:jboss/datasources/RHQDS" pool-name="RHQDS" enabled="true" use-java-context="true"> <xa-datasource-property name="URL">${rhq.test.ds.connection-url}</xa-datasource-property> - <xa-datasource-property name="ConnectionProperties">SetBigStringTryClob=true</xa-datasource-property> <driver>oracle</driver> <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation> <xa-pool>
commit 2249a73ebf553242ca37276d8a9d4179e00050a8 Author: Lukas Krejci lkrejci@redhat.com Date: Mon Dec 10 18:23:57 2012 +0100
Code coverage support for Arquillian-based tests.
diff --git a/modules/core/arquillian-integration/container/src/test/resources/arquillian.xml b/modules/core/arquillian-integration/container/src/test/resources/arquillian.xml index 930603f..3bf9e46 100644 --- a/modules/core/arquillian-integration/container/src/test/resources/arquillian.xml +++ b/modules/core/arquillian-integration/container/src/test/resources/arquillian.xml @@ -26,4 +26,11 @@ </configuration> </container> </group> -</arquillian> \ No newline at end of file + + <!-- We actually have to exclude all the classes from instrumentation by Arquillian Jacoco extension, because our + Arquillian RHQ agent plugin extension only runs in-process with the test execution that does the Jacoco instrumentation, too. --> + <extension qualifier="jacoco"> + <property name="excludes">*</property> + </extension> + +</arquillian> diff --git a/modules/core/domain/src/test/resources/arquillian.xml b/modules/core/domain/src/test/resources/arquillian.xml index 55e8021..368ce23 100644 --- a/modules/core/domain/src/test/resources/arquillian.xml +++ b/modules/core/domain/src/test/resources/arquillian.xml @@ -23,4 +23,9 @@ <property name="jbossHome">${jboss.unzip.location}</property> </configuration> </container> + + <extension qualifier="jacoco"> + <property name="includes">org.rhq.*</property> + </extension> + </arquillian> diff --git a/modules/core/plugin-container-itest/src/test/resources/arquillian.xml b/modules/core/plugin-container-itest/src/test/resources/arquillian.xml index 964e07e..a2dd2f3 100644 --- a/modules/core/plugin-container-itest/src/test/resources/arquillian.xml +++ b/modules/core/plugin-container-itest/src/test/resources/arquillian.xml @@ -38,4 +38,10 @@ </container> </group>
-</arquillian> \ No newline at end of file + <!-- We actually have to exclude all the classes from instrumentation by Arquillian Jacoco extension, because our + Arquillian RHQ agent plugin extension only runs in-process with the test execution that does the Jacoco instrumentation, too. --> + <extension qualifier="jacoco"> + <property name="excludes">*</property> + </extension> + +</arquillian> diff --git a/modules/enterprise/server/itests-2/src/test/resources/arquillian.xml b/modules/enterprise/server/itests-2/src/test/resources/arquillian.xml index c1dcf1b..b32c647 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/arquillian.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/arquillian.xml @@ -15,6 +15,10 @@ <property name="deploymentClass">org.rhq.enterprise.server.test.AbstractEJB3Test</property> </extension>
+ <extension qualifier="jacoco"> + <property name="includes">org.rhq.*</property> + </extension> + <container qualifier="RHQAS7" default="true"> diff --git a/modules/integration-tests/jndi-access/jndi-access-test/src/test/resources/arquillian.xml b/modules/integration-tests/jndi-access/jndi-access-test/src/test/resources/arquillian.xml index da392c2..23502f1 100644 --- a/modules/integration-tests/jndi-access/jndi-access-test/src/test/resources/arquillian.xml +++ b/modules/integration-tests/jndi-access/jndi-access-test/src/test/resources/arquillian.xml @@ -9,5 +9,9 @@ <property name="javaVmArguments">-Xmx512m -XX:MaxPermSize=128m -Djava.security.manager -Djava.security.policy==${jboss.unzip.location}/security.policy -Djnp.port=${jnp.port}</property> </configuration> </container> + + <extension qualifier="jacoco"> + <property name="includes">org.rhq.*</property> + </extension>
-</arquillian> \ No newline at end of file +</arquillian> diff --git a/modules/plugins/jboss-as-5/src/test/resources/itest/arquillian.xml b/modules/plugins/jboss-as-5/src/test/resources/itest/arquillian.xml index 9ac2ece..8ae2d8c 100644 --- a/modules/plugins/jboss-as-5/src/test/resources/itest/arquillian.xml +++ b/modules/plugins/jboss-as-5/src/test/resources/itest/arquillian.xml @@ -15,4 +15,9 @@ </configuration> </container>
+ <!-- We actually have to exclude all the classes from instrumentation by Arquillian Jacoco extension, because our + Arquillian RHQ agent plugin extension only runs in-process with the test execution that does the Jacoco instrumentation, too. --> + <extension qualifier="jacoco"> + <property name="excludes">*</property> + </extension> </arquillian> diff --git a/modules/plugins/jboss-as-7/src/test/resources/itest/arquillian.xml b/modules/plugins/jboss-as-7/src/test/resources/itest/arquillian.xml index b88a367..0fec6c8 100644 --- a/modules/plugins/jboss-as-7/src/test/resources/itest/arquillian.xml +++ b/modules/plugins/jboss-as-7/src/test/resources/itest/arquillian.xml @@ -15,4 +15,9 @@ </configuration> </container>
+ <!-- We actually have to exclude all the classes from instrumentation by Arquillian Jacoco extension, because our + Arquillian RHQ agent plugin extension only runs in-process with the test execution that does the Jacoco instrumentation, too. --> + <extension qualifier="jacoco"> + <property name="excludes">*</property> + </extension> </arquillian> diff --git a/pom.xml b/pom.xml index afef562..a0f6cce 100644 --- a/pom.xml +++ b/pom.xml @@ -232,6 +232,7 @@ <intentional-api-changes-file>intentional-api-changes-since-${signature-check-base-version}.xml</intentional-api-changes-file>
<jacoco.version>0.6.0.201210061924</jacoco.version> + <jacoco-arquillian-extension.version>1.0.0.Alpha5</jacoco-arquillian-extension.version> </properties>
@@ -618,7 +619,18 @@ <scope>import</scope> </dependency>
- </dependencies> + <dependency> + <groupId>org.jboss.arquillian.extension</groupId> + <artifactId>arquillian-jacoco</artifactId> + <version>${jacoco-arquillian-extension.version}</version> + </dependency> + + <dependency> + <groupId>org.jacoco</groupId> + <artifactId>org.jacoco.core</artifactId> + <version>${jacoco.version}</version> + </dependency> + </dependencies>
</dependencyManagement>
@@ -1304,7 +1316,7 @@
<!-- This profile is the "opposite" of the code coverage profile and provides default values for properties that are set in the code-coverage profile - to kick of jacoco java agent. --> + to kick of jacoco java agent. --> <profile> <id>no-code-coverage</id> <activation> @@ -1326,6 +1338,21 @@ <name>code-coverage</name> </property> </activation> + + <dependencies> + <dependency> + <groupId>org.jboss.arquillian.extension</groupId> + <artifactId>arquillian-jacoco</artifactId> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.jacoco</groupId> + <artifactId>org.jacoco.core</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + <build> <plugins> <!-- This definition creates the 2 independent coverage reports -
commit 4021b2c0e0466a5e3e0ac31426340af0268909c2 Author: Lukas Krejci lkrejci@redhat.com Date: Mon Dec 10 13:51:50 2012 +0100
Removing the SecurityActions for obtaining a logger instance during class initialization.
The standard script permissions include a permission for that so no special code has to exist in the normal codebase.
diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/StandardScriptPermissions.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/StandardScriptPermissions.java index 3a7d046..184e08e 100644 --- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/StandardScriptPermissions.java +++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/StandardScriptPermissions.java @@ -23,12 +23,9 @@ import java.io.FilePermission; import java.io.SerializablePermission; import java.lang.reflect.ReflectPermission; import java.net.SocketPermission; -import java.security.CodeSource; import java.security.Permission; import java.security.PermissionCollection; import java.security.Permissions; -import java.security.ProtectionDomain; -import java.security.cert.Certificate; import java.util.Enumeration; import java.util.PropertyPermission; import java.util.logging.LoggingPermission; @@ -99,6 +96,7 @@ public class StandardScriptPermissions extends PermissionCollection { //we don't consider the scripts malevolent. add(new PrivateCredentialPermission("* * "*"", "read"));
+ //adding this so that new classes with loggers can be initialized. add(new LoggingPermission("control", null)); }
diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientFactory.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientFactory.java index 3b993a8..3bf4729 100644 --- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientFactory.java +++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientFactory.java @@ -24,8 +24,8 @@ import javassist.util.proxy.ProxyFactory; import javax.jws.WebParam;
import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory;
-import org.rhq.bindings.security.SecurityActions; import org.rhq.bindings.util.ConfigurationClassBuilder; import org.rhq.bindings.util.ResourceTypeFingerprint; import org.rhq.core.domain.resource.ResourceCreationDataType; @@ -42,7 +42,7 @@ public class ResourceClientFactory { public Class<?> iface; }
- private static final Log LOG = SecurityActions.getLog(ResourceClientFactory.class); + private static final Log LOG = LogFactory.getLog(ResourceClientFactory.class);
//keys are resource type ids private static HashMap<Integer, CacheRecord> CUSTOM_CLASS_CACHE = new HashMap<Integer, CacheRecord>(); diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java index 1b71678..7361fe8 100644 --- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java +++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java @@ -32,8 +32,8 @@ import java.util.Set; import javassist.util.proxy.MethodHandler;
import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory;
-import org.rhq.bindings.security.SecurityActions; import org.rhq.bindings.util.ConfigurationClassBuilder; import org.rhq.bindings.util.LazyLoadScenario; import org.rhq.bindings.util.ResourceTypeFingerprint; @@ -84,7 +84,7 @@ import org.rhq.enterprise.server.resource.ResourceTypeNotFoundException; */ public class ResourceClientProxy {
- private static final Log LOG = SecurityActions.getLog(ResourceClientProxy.class); + private static final Log LOG = LogFactory.getLog(ResourceClientProxy.class);
private ResourceClientFactory proxyFactory; private RhqFacade remoteClient; diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java index 4d33fb2..2a1f944 100644 --- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java +++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java @@ -28,10 +28,10 @@ import java.nio.charset.Charset; import java.util.List;
import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory;
import org.rhq.bindings.StandardBindings; import org.rhq.bindings.client.RhqFacade; -import org.rhq.bindings.security.SecurityActions; import org.rhq.core.domain.content.Repo; import org.rhq.core.domain.content.composite.PackageAndLatestVersionComposite; import org.rhq.core.domain.criteria.PackageCriteria; @@ -53,7 +53,7 @@ import org.rhq.enterprise.server.content.RepoManagerRemote; public class RepoScriptSourceProvider extends BaseRhqSchemeScriptSourceProvider implements StandardBindings.RhqFacadeChangeListener {
- private static final Log LOG = SecurityActions.getLog(RepoScriptSourceProvider.class); + private static final Log LOG = LogFactory.getLog(RepoScriptSourceProvider.class);
private static final String AUTHORITY = "repositories";
diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/security/SecurityActions.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/security/SecurityActions.java deleted file mode 100644 index cdde2ff..0000000 --- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/security/SecurityActions.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * RHQ Management Platform - * Copyright 2012, Red Hat Middleware LLC, and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -package org.rhq.bindings.security; - -import java.security.AccessController; -import java.security.PrivilegedAction; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * @author Lukas Krejci - * - */ -public class SecurityActions { - - private SecurityActions() { - - } - - public static Log getLog(final Class<?> cls) { - return AccessController.doPrivileged(new PrivilegedAction<Log>() { - @Override - public Log run() { - return LogFactory.getLog(cls); - }; - }); - } - - public static Log getLog(final String name) { - return AccessController.doPrivileged(new PrivilegedAction<Log>() { - @Override - public Log run() { - return LogFactory.getLog(name); - }; - }); - } -} diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/util/InterfaceSimplifier.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/util/InterfaceSimplifier.java index d2724d1..8ce7bc6 100644 --- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/util/InterfaceSimplifier.java +++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/util/InterfaceSimplifier.java @@ -52,8 +52,8 @@ import javassist.bytecode.annotation.ShortMemberValue; import javassist.bytecode.annotation.StringMemberValue;
import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory;
-import org.rhq.bindings.security.SecurityActions; import org.rhq.core.domain.auth.Subject;
/** @@ -64,7 +64,7 @@ import org.rhq.core.domain.auth.Subject; * @author Lukas Krejci */ public class InterfaceSimplifier { - private static final Log LOG = SecurityActions.getLog(InterfaceSimplifier.class); + private static final Log LOG = LogFactory.getLog(InterfaceSimplifier.class);
private InterfaceSimplifier() {
commit e04317bc66733a72b68444b8d7833106078afd66 Author: Lukas Krejci lkrejci@redhat.com Date: Mon Dec 10 13:20:44 2012 +0100
Removing the obsolete javaURLContextFactory from the server/jar. It was a left-over from a failed attempt at securing the JNDI look up in a saner way than we do now.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/interfaces/java/javaURLContextFactory.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/interfaces/java/javaURLContextFactory.java deleted file mode 100644 index fc4d02b..0000000 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/interfaces/java/javaURLContextFactory.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.rhq.enterprise.server.naming.interfaces.java; - -import java.util.Hashtable; - -import javax.naming.CompositeName; -import javax.naming.Context; -import javax.naming.Name; -import javax.naming.spi.ObjectFactory; - -import org.jboss.as.naming.NamingContext; - -import org.rhq.enterprise.server.AllowRhqServerInternalsAccessPermission; - -/** @deprecated this is not used after all */ -@Deprecated -public class javaURLContextFactory implements ObjectFactory { - - private static final AllowRhqServerInternalsAccessPermission PERM = new AllowRhqServerInternalsAccessPermission(); - - @Override - @SuppressWarnings("unchecked") - public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment) - throws Exception { - - SecurityManager sm = System.getSecurityManager(); - if (sm != null) { - sm.checkPermission(PERM); - } - - return new NamingContext(name != null ? name : new CompositeName(""), (Hashtable<String, Object>) environment); - } -}
commit 1cdbda29cabe38a9acf7057f5d1457f508fca27b Author: Thomas SEGISMONT tsegismo@redhat.com Date: Mon Dec 10 10:20:00 2012 +0100
Bug 858138 rhq-agent-env.sh gives example of bad su command
-l overrides -m behavior in RHQ_AGENT_START_COMMAND example
diff --git a/modules/enterprise/agent/src/etc/rhq-agent-env.sh b/modules/enterprise/agent/src/etc/rhq-agent-env.sh index c7a259e..4fa4311 100755 --- a/modules/enterprise/agent/src/etc/rhq-agent-env.sh +++ b/modules/enterprise/agent/src/etc/rhq-agent-env.sh @@ -156,8 +156,8 @@ # some special string manipulation to get the # agent script to start. See below for an # example of how to do this. -#RHQ_AGENT_START_COMMAND="su -m -l user -c '${RHQ_AGENT_HOME}/bin/rhq-agent.sh'" -#RHQ_AGENT_START_COMMAND="su -m -l user -c '$(echo ${RHQ_AGENT_HOME}|sed 's/ /\ /')/bin/rhq-agent.sh'" +#RHQ_AGENT_START_COMMAND="su -m user -c '${RHQ_AGENT_HOME}/bin/rhq-agent.sh'" +#RHQ_AGENT_START_COMMAND="su -m user -c '$(echo ${RHQ_AGENT_HOME}|sed 's/ /\ /')/bin/rhq-agent.sh'"
# RHQ_AGENT_PASSWORD_PROMPT - if "true", this indicates that the user # that is to run the agent must type the
commit e9c7ed2d9845308b549b437fc9bcd368ee44c04b Author: John Mazzitelli mazz@redhat.com Date: Fri Dec 7 15:07:30 2012 -0500
container-lib module went away
diff --git a/.classpath b/.classpath index b67aafb..d8e11f6 100644 --- a/.classpath +++ b/.classpath @@ -68,7 +68,6 @@ <classpathentry kind="src" path="modules/enterprise/server/safe-invoker/src/test/java"/> <classpathentry kind="src" path="modules/enterprise/server/startup-subsystem/src/main/java"/> <classpathentry kind="src" path="modules/enterprise/server/startup-subsystem/src/test/java"/> - <classpathentry kind="src" path="modules/enterprise/server/container-lib/src/main/java"/> <classpathentry kind="src" path="modules/enterprise/server/plugins/ant-bundle/src/main/java"/> <classpathentry kind="src" path="modules/enterprise/server/plugins/filetemplate-bundle/src/main/java"/> <classpathentry kind="src" path="modules/enterprise/server/plugins/alert-subject/src/main/java"/>
commit bdc8d78f4ee918c38bff6a6ce2c1ed12ff91977b Merge: 5d8fa1c dddf788 Author: John Mazzitelli mazz@redhat.com Date: Fri Dec 7 13:48:45 2012 -0500
Merge remote-tracking branch 'origin/master' into rhq-on-as7
Conflicts: modules/enterprise/pom.xml modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/security/test/JndiAccessTest.java modules/enterprise/server/jar/pom.xml modules/enterprise/server/pom.xml modules/pom.xml
diff --cc modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/security/test/JndiAccessTest.java index 5dcf8c3,fabe6ae..e831a2b --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/security/test/JndiAccessTest.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/security/test/JndiAccessTest.java @@@ -46,10 -47,24 +47,25 @@@ import org.rhq.enterprise.server.util.L * * @author Lukas Krejci */ -@Test +@Test(enabled = false) +// TODO JNDI: reenable after fixing secure jndi lookups public class JndiAccessTest extends AbstractEJB3Test {
+ public void testScriptCantOverrideSystemProperties() throws Exception { + Subject overlord = LookupUtil.getSubjectManager().getOverlord(); + + ScriptEngine engine = getEngine(overlord); + + try { + engine.eval("java.lang.System.setProperty('java.naming.factory.url.pkgs', 'counterfeit');"); + } catch (ScriptException e) { + Assert.assertTrue( + e.getMessage().contains( + "access denied ("java.util.PropertyPermission" "java.naming.factory.url.pkgs" "write")"), + "The script shouldn't have write access to the system properties."); + } + } + public void testEjbsAccessibleThroughPrivilegedCode() { LookupUtil.getSubjectManager().getOverlord(); }
commit 5d8fa1c9ac674c33f57c72c75c1b316d3454b645 Author: John Mazzitelli mazz@redhat.com Date: Fri Dec 7 13:41:35 2012 -0500
trivial comment change
diff --git a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml index 55aca3d..47dd0d5 100644 --- a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml +++ b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml @@ -598,7 +598,7 @@ rhq.sync.endpoint-address=false </copy> <echo>Putting a developer setting in rhq-server.properties to turn on/off strict agent update version checking</echo> <echo file="${project.build.outputDirectory}/bin/rhq-server.properties" append="true">rhq.server.agent-update.nonstrict-version-check=true</echo> - <echo>Add auto-installer to rhq-server.sh script so developers don't have to run the installer in a separate step</echo> + <echo>Add auto-installer to rhq-server scripts so developers don't have to run the installer in a separate step</echo> <replace file="${project.build.outputDirectory}/bin/rhq-server.sh"> <replacefilter> <replacetoken># START SERVER</replacetoken>
commit dc9c35393d9b7be9804be4755fe7d817a2e6fbde Author: John Mazzitelli mazz@redhat.com Date: Fri Dec 7 13:39:24 2012 -0500
give alittle luv to our brethern developers running on windows
diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-server.bat b/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-server.bat index f15298c..1811564 100644 --- a/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-server.bat +++ b/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-server.bat @@ -170,6 +170,7 @@ if defined RHQ_SERVER_RUN_AS set _WRAPPER_NTSERVICE_ACCOUNT="wrapper.ntservice.a if defined RHQ_SERVER_RUN_AS_ME set _WRAPPER_NTSERVICE_ACCOUNT="wrapper.ntservice.account=.%USERNAME%"
if /i "%1"=="console" ( + rem START SERVER "%RHQ_SERVER_WRAPPER_EXE_FILE_PATH%" -c "%RHQ_SERVER_WRAPPER_CONF_FILE_PATH%" "set.RHQ_SERVER_HOME=%RHQ_SERVER_HOME%" "set.RHQ_SERVER_INSTANCE_NAME=%RHQ_SERVER_INSTANCE_NAME%" "set.RHQ_SERVER_JAVA_EXE_FILE_PATH=%RHQ_SERVER_JAVA_EXE_FILE_PATH%" "set.RHQ_SERVER_OS_PLATFORM=%RHQ_SERVER_OS_PLATFORM%" "set.RHQ_SERVER_WRAPPER_LOG_DIR_PATH=%RHQ_SERVER_WRAPPER_LOG_DIR_PATH%" %_WRAPPER_NTSERVICE_ACCOUNT% %_DEBUG_OPTS% goto done ) diff --git a/modules/enterprise/server/appserver/src/main/dev-resources/bin/rhq-autoinstall.bat b/modules/enterprise/server/appserver/src/main/dev-resources/bin/rhq-autoinstall.bat new file mode 100644 index 0000000..b756b31 --- /dev/null +++ b/modules/enterprise/server/appserver/src/main/dev-resources/bin/rhq-autoinstall.bat @@ -0,0 +1,41 @@ +@echo off +setlocal + +set RHQ_SERVER_BIN_DIR_PATH=%~dp0 +if not defined RHQ_SERVER_HOME ( + cd "%RHQ_SERVER_BIN_DIR_PATH%.." +) else ( + cd "%RHQ_SERVER_HOME%" || ( + echo Cannot go to the RHQ_SERVER_HOME directory: %RHQ_SERVER_HOME% + exit /B 1 + ) +) +set RHQ_SERVER_HOME=%CD% +cd %RHQ_SERVER_HOME%\bin + +set _INSTALLER_SCRIPT=%RHQ_SERVER_HOME%\bin\rhq-installer.bat + +rem we are normally executed just before the server starts, so give it time to initialize +rem yes, this is a sleep of 5s, backwards compatible to XP +ping 127.0.0.1 -n 5 -w 1000 > nul + +for /L %%i in (1,1,5) do ( + echo Running Installer Now... + CALL "%_INSTALLER_SCRIPT%" + if ERRORLEVEL 2 ( + echo Installer failed - will try again in a few seconds + ping 127.0.0.1 -n 5 -w 1000 > nul + ) else ( + if ERRORLEVEL 1 ( + echo The installer has been disabled - please fix rhq-server.properties + goto :done + ) else ( + echo Installer finished + goto :done + ) + ) +) +echo Aborting installation - installer failed. + +:done +endlocal \ No newline at end of file diff --git a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml index 25a2916..55aca3d 100644 --- a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml +++ b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml @@ -605,6 +605,12 @@ rhq.sync.endpoint-address=false <replacevalue><![CDATA[export RHQ_SERVER_HOME; ${RHQ_SERVER_HOME}/bin/rhq-autoinstall.sh &]]></replacevalue> </replacefilter> </replace> + <replace file="${project.build.outputDirectory}/bin/rhq-server.bat"> + <replacefilter> + <replacetoken>rem START SERVER</replacetoken> + <replacevalue><![CDATA[start /B %RHQ_SERVER_HOME%\bin\rhq-autoinstall.bat]]></replacevalue> + </replacefilter> + </replace> </target>
<!-- The prepare-release target must be run AFTER the resources:resources goal has executed. -->
commit dddf7884e2a8bea735a4a68733edd778bd01b727 Author: Heiko W. Rupp hwr@redhat.com Date: Fri Dec 7 18:20:16 2012 +0100
BZ 885169 - explicitly prepend /rest/ as some browsers may misunderstand relative links.
diff --git a/modules/enterprise/server/jar/src/main/resources/rest_templates/index.ftl b/modules/enterprise/server/jar/src/main/resources/rest_templates/index.ftl index e135ce6..3ffdca3 100644 --- a/modules/enterprise/server/jar/src/main/resources/rest_templates/index.ftl +++ b/modules/enterprise/server/jar/src/main/resources/rest_templates/index.ftl @@ -35,7 +35,7 @@ mobile client (Android) of the API. <ul> <#list var as var> <li> - <a href="${var.href}">${var.rel}</a> + <a href="/rest/${var.href}">${var.rel}</a> </li> </#list> </ul>
commit 7ab6fc4ed78085304ea1a243758369c93ca1b1dc Author: Jay Shaughnessy jshaughn@redhat.com Date: Fri Dec 7 12:13:17 2012 -0500
API checker work for latest release, post rhq-on-as7 merge - Add latest intentional API changes files - Resolve some maven complaints - Add server/jar includes to check goal in pom
diff --git a/modules/core/domain/intentional-api-changes-since-4.5.1.xml b/modules/core/domain/intentional-api-changes-since-4.5.1.xml new file mode 100644 index 0000000..ff10f26 --- /dev/null +++ b/modules/core/domain/intentional-api-changes-since-4.5.1.xml @@ -0,0 +1,21 @@ +<?xml version="1.0"?> +<differences> + <difference> + <className>org/rhq/core/domain/configuration/definition/PropertyDefinitionMap</className> + <differenceType>7006</differenceType><!-- method return type changed --> + <method>java.util.List getPropertyDefinitions()</method> + <to>java.util.Map</to> + <justification> + We are reverting back to the previous signature for this method, correcting the prior change + that broke API compatibility. + </justification> + </difference> + <difference> + <className>org/rhq/core/domain/criteria/MeasurementScheduleCriteria</className> + <differenceType>6011</differenceType><!-- removed constant field --> + <field>SORT_FIELD_*</field> + <justification> + A few sort specifiers that were actually in error and if used would have produced a downstream error. + </justification> + </difference> +</differences> diff --git a/modules/enterprise/server/jar/intentional-api-changes-since-4.5.1.xml b/modules/enterprise/server/jar/intentional-api-changes-since-4.5.1.xml new file mode 100644 index 0000000..c7a95dd --- /dev/null +++ b/modules/enterprise/server/jar/intentional-api-changes-since-4.5.1.xml @@ -0,0 +1,24 @@ +<?xml version="1.0"?> +<differences> + <difference> + <className>**/WebservicesRemote</className> + <differenceType>8001</differenceType> <!-- class removed --> + <justification>Removed already deprecated web services in this release</justification> + </difference> + <difference> + <className>**/WebServiceTestRemote</className> + <differenceType>8001</differenceType> <!-- class removed --> + <justification>Removed already deprecated web services in this release</justification> + </difference> + <difference> + <className>**/RemoteWsInvocationHandler</className> + <differenceType>8001</differenceType> <!-- class removed --> + <justification>Removed already deprecated web services in this release</justification> + </difference> + <difference> + <className>**/ServerVersion</className> + <differenceType>8001</differenceType> <!-- class removed --> + <justification>Removed already deprecated web services in this release, this file was used for WS client-server + compatibility</justification> + </difference> +</differences> diff --git a/modules/enterprise/server/jar/pom.xml b/modules/enterprise/server/jar/pom.xml index f035ed6..44b0df4 100644 --- a/modules/enterprise/server/jar/pom.xml +++ b/modules/enterprise/server/jar/pom.xml @@ -1046,6 +1046,31 @@ </plugins> </build> </profile> + + <profile> + <id>signature-check</id> + <activation> + <property> + <name>signature-check-base-version</name> + </property> + </activation> + <build> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>clirr-maven-plugin</artifactId> + <version>${clirr.version}</version> + <configuration> + <includes> + <include>**/*Remote</include> + <include>**/ServerVersion</include> + </includes> + </configuration> + </plugin> + </plugins> + </build> + </profile> + </profiles>
<reporting> diff --git a/pom.xml b/pom.xml index 6af4a4b..35dc56f 100644 --- a/pom.xml +++ b/pom.xml @@ -226,7 +226,7 @@
<jacoco.version>0.6.0.201210061924</jacoco.version> </properties> - +
<dependencyManagement>
@@ -1646,6 +1646,7 @@ <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>clirr-maven-plugin</artifactId> + <version>${clirr.version}</version> <executions> <execution> <id>signature-check</id> @@ -1665,8 +1666,6 @@ <failOnError>true</failOnError> <failOnWarning>true</failOnWarning> <skip>${rhq.internal}</skip> - <!-- note that this is only available in clirr maven plugin 2.5, but internally we use a patched version for our CI builds. - Once new Clirr maven plugin is released, this will work for you, too. --> <ignoredDifferencesFile>${intentional-api-changes-file}</ignoredDifferencesFile> </configuration> </execution> @@ -1680,6 +1679,7 @@ <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>clirr-maven-plugin</artifactId> + <version>${clirr.version}</version> <configuration> <comparisonVersion>${signature-check-base-version}</comparisonVersion> <comparisonArtifacts>
commit 92c96c8dbb4a2d1c5cc6141c13faea1cb6e377c5 Author: Jay Shaughnessy jshaughn@redhat.com Date: Fri Dec 7 12:11:15 2012 -0500
API Checker detected a change in this constant, no reason not to make this an ObjectName at decl-time, I think.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CoreServerMBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CoreServerMBean.java index 1e4796f..c0a1254 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CoreServerMBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CoreServerMBean.java @@ -21,7 +21,10 @@ package org.rhq.enterprise.server.core; import java.io.File; import java.util.Date;
+import javax.management.ObjectName; + import org.rhq.core.domain.common.ProductInfo; +import org.rhq.core.util.ObjectNameFactory;
/** * An MBean that exposes various global attributes of the underlying AS Server (version, uptime, etc.). @@ -30,7 +33,7 @@ public interface CoreServerMBean { /** * The name of this MBean when deployed. */ - String OBJECT_NAME = "rhq:service=CoreServer"; + ObjectName OBJECT_NAME = ObjectNameFactory.create("rhq:service=CoreServer");
/** * Returns the version of the core RHQ server. 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 7b784fa..4a48e28 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 @@ -21,7 +21,6 @@ package org.rhq.enterprise.server.util; import java.lang.management.ManagementFactory;
import javax.management.MBeanServer; -import javax.management.MalformedObjectNameException; import javax.naming.InitialContext; import javax.naming.NamingException; import javax.persistence.EntityManager; @@ -585,13 +584,9 @@ public final class LookupUtil { }
public static CoreServerMBean getCoreServer() { - CoreServerMBean rhqServer; - try { - MBeanServer mbs = getJBossMBeanServer(); - rhqServer = (CoreServerMBean) MBeanProxyExt.create(CoreServerMBean.class, CoreServerMBean.OBJECT_NAME, mbs); - } catch (MalformedObjectNameException e) { - throw new RuntimeException(e); - } + MBeanServer mbs = getJBossMBeanServer(); + CoreServerMBean rhqServer = (CoreServerMBean) MBeanProxyExt.create(CoreServerMBean.class, + CoreServerMBean.OBJECT_NAME, mbs); return rhqServer; }
@@ -640,7 +635,8 @@ public final class LookupUtil { return "java:global/rhq/rhq-enterprise-server-ejb3/" + beanName + "!" + interfaceName; }
- private static <T> String getLocalJNDIName(@NotNull Class<? super T> beanClass) { + private static <T> String getLocalJNDIName(@NotNull + Class<? super T> beanClass) { return getLocalJNDIName(beanClass.getSimpleName(), beanClass.getName().replace("Bean", "Local")); }
commit 76b7542636c64e40b718b18b1c0a9c1e1031acb7 Author: Jay Shaughnessy jshaughn@redhat.com Date: Fri Dec 7 12:03:52 2012 -0500
Augeas plugin coding error I'm not sure what effect this change may have, but the code as written was clearly wrong and so I changed it.
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 5153145..55ffee5 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 @@ -51,7 +51,7 @@ public class DefaultAugeasTreeBuilder implements AugeasTreeBuilder {
AugeasTree tree; AugeasModuleConfig module = moduleConfig.getModuleByName(name); - if (lazy = true) + if (lazy) tree = new AugeasTreeLazy(component.getAugeas(), module); else tree = new AugeasTreeReal(component.getAugeas(), module);
commit c6def959b1e19c02e419647839e595460c9071d4 Author: John Mazzitelli mazz@redhat.com Date: Fri Dec 7 12:02:07 2012 -0500
check to see if the extension is there to know if the installer already ran, that's more foolproof than checking for the ear being deployed
diff --git a/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/CoreJBossASClient.java b/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/CoreJBossASClient.java index 09e1b84..e75a399 100644 --- a/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/CoreJBossASClient.java +++ b/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/CoreJBossASClient.java @@ -209,6 +209,17 @@ public class CoreJBossASClient extends JBossASClient { }
/** + * Returns true if the given extension is already in existence. + * + * @param name the name of the extension to check + * @return true if the extension already exists; false if not + * @throws Exception + */ + public boolean isExtension(String name) throws Exception { + return null != readResource(Address.root().add(EXTENSION, name)); + } + + /** * Adds a new subsystem to the core system. * * @param name the name of the new subsystem @@ -225,6 +236,17 @@ public class CoreJBossASClient extends JBossASClient { }
/** + * Returns true if the given subsystem is already in existence. + * + * @param name the name of the subsystem to check + * @return true if the subsystem already exists; false if not + * @throws Exception + */ + public boolean isSubsystem(String name) throws Exception { + return null != readResource(Address.root().add(SUBSYSTEM, name)); + } + + /** * Invokes the management "reload" operation which will shut down all the app server services and * restart them again. This is required for certain configuration changes to take effect. * This does not shutdown the JVM itself. diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java index 5b42094..589efca 100644 --- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java +++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java @@ -47,6 +47,8 @@ import org.rhq.enterprise.server.installer.ServerInstallUtil.SupportedDatabaseTy */ public class InstallerServiceImpl implements InstallerService {
+ private static final String RHQ_EXTENSION_NAME = "org.rhq.rhq-enterprise-server-startup-subsystem"; + private static final String RHQ_SUBSYSTEM_NAME = "rhq-startup"; private static final String EAR_NAME = "rhq.ear"; private static final String SYSPROP_PROPFILE = "rhq.server.properties-file";
@@ -204,6 +206,17 @@ public class InstallerServiceImpl implements InstallerService { if (isEarDeployed()) { return ""; // if the ear is deployed, we've already been fully installed } + + // its possible the ear is not yet deployed (during server init/startup, it won't show up) + // but our extension should always show up and its one of the last things our installer deploys. + // if this doesn't exist, our installation isn't done yet + if (isExtensionDeployed()) { + return ""; // installer has done all it could - just need to wait for the EAR to fully startup + } + + // in the future, if we can determine if any errors occurred during past installations, + // we can return that error message here. For now, just assume the installer is free to try to install. + return null; }
@@ -630,6 +643,18 @@ public class InstallerServiceImpl implements InstallerService { } }
+ private boolean isExtensionDeployed() throws Exception { + ModelControllerClient mcc = null; + try { + mcc = getModelControllerClient(); + final CoreJBossASClient client = new CoreJBossASClient(mcc); + boolean isDeployed = client.isExtension(RHQ_EXTENSION_NAME); + return isDeployed; + } finally { + safeClose(mcc); + } + } + private String getLogDir() throws Exception { ModelControllerClient mcc = null; try { @@ -920,7 +945,7 @@ public class InstallerServiceImpl implements InstallerService { mcc = getModelControllerClient(); CoreJBossASClient client = new CoreJBossASClient(mcc); log("Installing RHQ EAR startup subsystem extension"); - client.addExtension("org.rhq.rhq-enterprise-server-startup-subsystem"); + client.addExtension(RHQ_EXTENSION_NAME); } finally { safeClose(mcc); } @@ -932,7 +957,7 @@ public class InstallerServiceImpl implements InstallerService { mcc = getModelControllerClient(); CoreJBossASClient client = new CoreJBossASClient(mcc); log("Installing RHQ EAR subsystem"); - client.addSubsystem("rhq-startup"); + client.addSubsystem(RHQ_SUBSYSTEM_NAME); } finally { safeClose(mcc); }
commit 4c222409553e1e7d2d6331ff405a337abcca2bbd Author: Lukas Krejci lkrejci@redhat.com Date: Fri Dec 7 17:00:34 2012 +0100
Moving the JNDI security infrastructure to the server/jar and updating it to work with AS7.
* Got rid of container-lib as there were no other classes left there.
* The StartupBean server/jar now takes care of initializing this stuff instead of the custom MBean we used to use in the AS4-based container.
* Updated the tests to work with this new arrangement.
diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/StandardScriptPermissions.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/StandardScriptPermissions.java index 5822d44..3a7d046 100644 --- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/StandardScriptPermissions.java +++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/StandardScriptPermissions.java @@ -23,14 +23,19 @@ import java.io.FilePermission; import java.io.SerializablePermission; import java.lang.reflect.ReflectPermission; import java.net.SocketPermission; +import java.security.CodeSource; import java.security.Permission; import java.security.PermissionCollection; import java.security.Permissions; +import java.security.ProtectionDomain; +import java.security.cert.Certificate; import java.util.Enumeration; import java.util.PropertyPermission; +import java.util.logging.LoggingPermission;
import javax.management.MBeanPermission; import javax.management.ObjectName; +import javax.security.auth.PrivateCredentialPermission;
/** * @author Lukas Krejci @@ -58,13 +63,11 @@ public class StandardScriptPermissions extends PermissionCollection { //JVM defined runtime perms add(new RuntimePermission("createClassLoader")); add(new RuntimePermission("getClassLoader")); - add(new RuntimePermission("setContextClassLoader")); add(new RuntimePermission("getenv.*")); add(new RuntimePermission("getProtectionDomain")); add(new RuntimePermission("getFileSystemAttributes")); add(new RuntimePermission("readFileDescriptor")); add(new RuntimePermission("writeFileDescriptor")); - add(new RuntimePermission("loadLibrary.*")); add(new RuntimePermission("accessClassInPackage.*")); add(new RuntimePermission("defineClassInPackage.*")); add(new RuntimePermission("accessDeclaredMembers")); @@ -85,10 +88,18 @@ public class StandardScriptPermissions extends PermissionCollection {
add(new ReflectPermission("suppressAccessChecks"));
- //these 2 are required for server-side scripts to be able to + //these are required for server-side scripts to be able to //invoke remote EJBs. + add(new SerializablePermission("creator")); + add(new SerializablePermission("allowSerializationReflection")); add(new SerializablePermission("enableSubclassImplementation")); - add(new RuntimePermission("reflectionFactoryAccess")); + add(new RuntimePermission("reflectionFactoryAccess")); + + //by default allow the scripts access to any credentials of any user + //we don't consider the scripts malevolent. + add(new PrivateCredentialPermission("* * "*"", "read")); + + add(new LoggingPermission("control", null)); }
public void add(Permission permission) { diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientFactory.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientFactory.java index 74c0019..3b993a8 100644 --- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientFactory.java +++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientFactory.java @@ -9,11 +9,6 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Set;
-import javax.jws.WebParam; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - import javassist.CannotCompileException; import javassist.ClassPool; import javassist.CtClass; @@ -26,6 +21,11 @@ import javassist.bytecode.annotation.StringMemberValue; import javassist.util.proxy.MethodHandler; import javassist.util.proxy.ProxyFactory;
+import javax.jws.WebParam; + +import org.apache.commons.logging.Log; + +import org.rhq.bindings.security.SecurityActions; import org.rhq.bindings.util.ConfigurationClassBuilder; import org.rhq.bindings.util.ResourceTypeFingerprint; import org.rhq.core.domain.resource.ResourceCreationDataType; @@ -42,7 +42,7 @@ public class ResourceClientFactory { public Class<?> iface; }
- private static final Log LOG = LogFactory.getLog(ResourceClientFactory.class); + private static final Log LOG = SecurityActions.getLog(ResourceClientFactory.class);
//keys are resource type ids private static HashMap<Integer, CacheRecord> CUSTOM_CLASS_CACHE = new HashMap<Integer, CacheRecord>(); diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java index 7361fe8..1b71678 100644 --- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java +++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java @@ -32,8 +32,8 @@ import java.util.Set; import javassist.util.proxy.MethodHandler;
import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory;
+import org.rhq.bindings.security.SecurityActions; import org.rhq.bindings.util.ConfigurationClassBuilder; import org.rhq.bindings.util.LazyLoadScenario; import org.rhq.bindings.util.ResourceTypeFingerprint; @@ -84,7 +84,7 @@ import org.rhq.enterprise.server.resource.ResourceTypeNotFoundException; */ public class ResourceClientProxy {
- private static final Log LOG = LogFactory.getLog(ResourceClientProxy.class); + private static final Log LOG = SecurityActions.getLog(ResourceClientProxy.class);
private ResourceClientFactory proxyFactory; private RhqFacade remoteClient; diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java index 2a1f944..4d33fb2 100644 --- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java +++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java @@ -28,10 +28,10 @@ import java.nio.charset.Charset; import java.util.List;
import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory;
import org.rhq.bindings.StandardBindings; import org.rhq.bindings.client.RhqFacade; +import org.rhq.bindings.security.SecurityActions; import org.rhq.core.domain.content.Repo; import org.rhq.core.domain.content.composite.PackageAndLatestVersionComposite; import org.rhq.core.domain.criteria.PackageCriteria; @@ -53,7 +53,7 @@ import org.rhq.enterprise.server.content.RepoManagerRemote; public class RepoScriptSourceProvider extends BaseRhqSchemeScriptSourceProvider implements StandardBindings.RhqFacadeChangeListener {
- private static final Log LOG = LogFactory.getLog(RepoScriptSourceProvider.class); + private static final Log LOG = SecurityActions.getLog(RepoScriptSourceProvider.class);
private static final String AUTHORITY = "repositories";
diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/security/SecurityActions.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/security/SecurityActions.java new file mode 100644 index 0000000..cdde2ff --- /dev/null +++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/security/SecurityActions.java @@ -0,0 +1,56 @@ +/* + * RHQ Management Platform + * Copyright 2012, Red Hat Middleware LLC, and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +package org.rhq.bindings.security; + +import java.security.AccessController; +import java.security.PrivilegedAction; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * @author Lukas Krejci + * + */ +public class SecurityActions { + + private SecurityActions() { + + } + + public static Log getLog(final Class<?> cls) { + return AccessController.doPrivileged(new PrivilegedAction<Log>() { + @Override + public Log run() { + return LogFactory.getLog(cls); + }; + }); + } + + public static Log getLog(final String name) { + return AccessController.doPrivileged(new PrivilegedAction<Log>() { + @Override + public Log run() { + return LogFactory.getLog(name); + }; + }); + } +} diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/util/InterfaceSimplifier.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/util/InterfaceSimplifier.java index 8ce7bc6..d2724d1 100644 --- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/util/InterfaceSimplifier.java +++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/util/InterfaceSimplifier.java @@ -52,8 +52,8 @@ import javassist.bytecode.annotation.ShortMemberValue; import javassist.bytecode.annotation.StringMemberValue;
import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory;
+import org.rhq.bindings.security.SecurityActions; import org.rhq.core.domain.auth.Subject;
/** @@ -64,7 +64,7 @@ import org.rhq.core.domain.auth.Subject; * @author Lukas Krejci */ public class InterfaceSimplifier { - private static final Log LOG = LogFactory.getLog(InterfaceSimplifier.class); + private static final Log LOG = SecurityActions.getLog(InterfaceSimplifier.class);
private InterfaceSimplifier() {
diff --git a/modules/enterprise/pom.xml b/modules/enterprise/pom.xml index 4e935ec..a43fb1e 100644 --- a/modules/enterprise/pom.xml +++ b/modules/enterprise/pom.xml @@ -28,7 +28,6 @@ <module>comm</module> <module>agent</module> <module>agentupdate</module> - <module>server/container-lib</module> <module>server/xml-schemas</module> <module>server/jar</module> <module>server/safe-invoker</module> @@ -56,7 +55,6 @@ <module>comm</module> <module>agent</module> <module>agentupdate</module> - <module>server/container-lib</module> <module>server/xml-schemas</module> <module>server/jar</module> <module>server/safe-invoker</module> diff --git a/modules/enterprise/server/appserver/pom.xml b/modules/enterprise/server/appserver/pom.xml index 1ae6cdb..96babf8 100644 --- a/modules/enterprise/server/appserver/pom.xml +++ b/modules/enterprise/server/appserver/pom.xml @@ -25,14 +25,6 @@ <version>${project.version}</version> </dependency>
-<!-- - <dependency> - <groupId>org.rhq</groupId> - <artifactId>rhq-container-lib</artifactId> - <version>${project.version}</version> - </dependency> - --> - <!-- 3rd Party Deps -->
<dependency> diff --git a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml index 5922afb..9216787 100644 --- a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml +++ b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml @@ -167,10 +167,6 @@ <echo>Installing patched hibernate jar ...</echo> <copy file="${settings.localRepository}/hibernate/hibernate3/${hibernate3.version}/hibernate3-${hibernate3.version}.jar" tofile="${jboss.home}/server/default/lib/hibernate3.jar" verbose="true"/> - - <echo>Installing custom container library...</echo> - <copy file="${settings.localRepository}/org/rhq/rhq-container-lib/${rhq.version}/rhq-container-lib-${rhq.version}.jar" - tofile="${jboss.home}/server/default/lib/rhq-container-lib-${rhq.version}.jar" verbose="true"/> -->
<echo>Adding JDBC modules to ${jboss.modules.dir} ...</echo> diff --git a/modules/enterprise/server/client-api/pom.xml b/modules/enterprise/server/client-api/pom.xml index 08ef4a1..1459e31 100644 --- a/modules/enterprise/server/client-api/pom.xml +++ b/modules/enterprise/server/client-api/pom.xml @@ -16,13 +16,6 @@ <description>The implementation of the client API when accessing the server locally</description>
<dependencies> - <!-- - <dependency> - <groupId>org.rhq</groupId> - <artifactId>rhq-container-lib</artifactId> - <version>${project.version}</version> - </dependency> - --> <dependency> <groupId>org.rhq</groupId> <artifactId>rhq-enterprise-server</artifactId> diff --git a/modules/enterprise/server/container-lib/pom.xml b/modules/enterprise/server/container-lib/pom.xml deleted file mode 100644 index 05f8bd4..0000000 --- a/modules/enterprise/server/container-lib/pom.xml +++ /dev/null @@ -1,107 +0,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> - - <parent> - <groupId>org.rhq</groupId> - <artifactId>rhq-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> - <relativePath>../../../../pom.xml</relativePath> - </parent> - - <groupId>org.rhq</groupId> - <artifactId>rhq-container-lib</artifactId> - <packaging>jar</packaging> - - <name>RHQ Enterprise Container Library</name> - <description>A library of classes that will be deployed in the server container itself, above the main EAR</description> - - <dependencies> - - <dependency> - <groupId>org.jboss.jbossts</groupId> - <artifactId>jbossjts</artifactId> - <version>4.16.2.Final</version> - <scope>provided</scope> <!-- by JBossAS --> - </dependency> - - <dependency> - <groupId>org.jboss</groupId> - <artifactId>jboss-common-core</artifactId> - <scope>provided</scope> <!-- by JBossAS --> - </dependency> - - <dependency> - <groupId>jboss</groupId> - <artifactId>jbosssx</artifactId> - <version>4.2.3.GA</version> - <scope>provided</scope> <!-- by JBossAS --> - </dependency> - - <dependency> - <groupId>jboss</groupId> - <artifactId>jnpserver</artifactId> - <version>4.2.2.GA</version> - <scope>provided</scope> - </dependency> - </dependencies> - - <profiles> - - <profile> - <id>dev</id> - - <properties> - <rhq.rootDir>../../../..</rhq.rootDir> - <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/lib</rhq.deploymentDir> - </properties> - - <build> - <plugins> - - <plugin> - <artifactId>maven-antrun-plugin</artifactId> - <executions> - - <execution> - <id>deploy</id> - <phase>compile</phase> - <configuration> - <target> - <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}" /> - </target> - </configuration> - <goals> - <goal>run</goal> - </goals> - </execution> - - <execution> - <id>undeploy</id> - <phase>clean</phase> - <configuration> - <target> - <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" /> - <echo>*** Deleting ${deployment.file}...</echo> - <delete file="${deployment.file}" /> - </target> - </configuration> - <goals> - <goal>run</goal> - </goals> - </execution> - - </executions> - </plugin> - - </plugins> - </build> - </profile> - - </profiles> - -</project> diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/AccessCheckingInitialContextFactoryBuilder.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/AccessCheckingInitialContextFactoryBuilder.java deleted file mode 100644 index 1e35a4e..0000000 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/AccessCheckingInitialContextFactoryBuilder.java +++ /dev/null @@ -1,250 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2011 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.jndi; - -import java.net.InetAddress; -import java.net.NetworkInterface; -import java.net.SocketException; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.UnknownHostException; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Enumeration; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.Set; - -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.NamingException; -import javax.naming.directory.DirContext; -import javax.naming.event.EventContext; -import javax.naming.event.EventDirContext; -import javax.naming.ldap.LdapContext; -import javax.naming.spi.InitialContextFactory; -import javax.naming.spi.InitialContextFactoryBuilder; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import org.rhq.jndi.context.AccessCheckingContextDecorator; -import org.rhq.jndi.context.AccessCheckingContextDecoratorSetContext; -import org.rhq.jndi.context.ContextDecorator; -import org.rhq.jndi.context.URLPreferringContextDecoratorSetContext; -import org.rhq.jndi.util.DecoratorPicker; - -/** - * This initial context factory builder is installed early on during the RHQ server startup - * and is later on used for obtaining the {@link Context}s for all JNDI lookups in the - * RHQ server. - * <p> - * We use a custom initial context factory builder to prevent the potential malicious 3rd party - * code (like CLI alert scripts) from supplying custom environment variables to {@link InitialContext} - * that would modify the JNDI lookup to skip our security access checks. - * <p> - * By using a builder we effectively take control of the initial context creation process - * and are free to ignore whatever the script is trying to supply. - * <p> - * This builder makes sure to install the RHQ server's security access checks to whatever - * initial context that is configured by the standard environment variables - * ({@link Context#INITIAL_CONTEXT_FACTORY}, etc.) - * <p> - * This class is heavily inspired by the implementation of a similar builder in JBoss AS 7. - * - * @see AllowRhqServerInternalsAccessPermission - * - * @author Lukas Krejci - */ -public class AccessCheckingInitialContextFactoryBuilder implements InitialContextFactoryBuilder { - private static final Log LOG = LogFactory.getLog(AccessCheckingInitialContextFactoryBuilder.class); - - /** - * The list of JNDI name schemes that should be checked for security permissions - * (in addition to the names with no scheme). - * - * @see AccessCheckingContextDecorator - */ - private static final String[] CHECKED_SCHEMES = { "java" }; - - private static final Set<Class<? extends Context>> SUPPORTED_CONTEXT_INTERFACES; - - static { - SUPPORTED_CONTEXT_INTERFACES = new HashSet<Class<? extends Context>>(); - SUPPORTED_CONTEXT_INTERFACES.add(Context.class); - SUPPORTED_CONTEXT_INTERFACES.add(DirContext.class); - SUPPORTED_CONTEXT_INTERFACES.add(EventContext.class); - SUPPORTED_CONTEXT_INTERFACES.add(EventDirContext.class); - SUPPORTED_CONTEXT_INTERFACES.add(LdapContext.class); - } - - private static final Set<InetAddress> SERVER_BIND_IPS; - static { - SERVER_BIND_IPS = new HashSet<InetAddress>(); - - try { - String bindingAddressString = System.getProperty("jboss.bind.address"); - InetAddress bindingAddress = InetAddress.getByName(bindingAddressString); - - if (bindingAddress.isAnyLocalAddress()) { - Enumeration<NetworkInterface> ifaces = NetworkInterface.getNetworkInterfaces(); - while (ifaces.hasMoreElements()) { - NetworkInterface iface = ifaces.nextElement(); - SERVER_BIND_IPS.addAll(Collections.list(iface.getInetAddresses())); - } - } else { - SERVER_BIND_IPS.add(bindingAddress); - } - } catch (SocketException e) { - LOG.error("Could not obtain the list of local IPs", e); - } catch (UnknownHostException e) { - LOG.error("Failed to get the binding address of the RHQ server.", e); - } - } - - private static final int JNP_PORT = Integer.parseInt(System.getProperty("rhq.server.startup.namingservice.port", - "2099")); - - /** - * This is the default initial context factory that is returned when no other is - * configured using the environment variables. - * <p> - * It uses {@link NamingContextFactory} as the underlying mechanism - the same - * as the default configuration in JBoss 4. - */ - private static final InitialContextFactory DEFAULT_FACTORY = new InitialContextFactory() { - public Context getInitialContext(Hashtable<?, ?> environment) throws NamingException { - return null; // TODO: how to do this in AS7? createSecureWrapper(new NamingContextFactory(), environment).getInitialContext(environment); - } - }; - - /** - * Create a InitialContext factory. If the environment does not override the factory class it will use the - * default context factory. - * - * @param environment The environment - * @return An initial context factory - * @throws NamingException If an error occurs loading the factory class. - */ - public InitialContextFactory createInitialContextFactory(Hashtable<?, ?> environment) throws NamingException { - final String factoryClassName = (String) environment.get(Context.INITIAL_CONTEXT_FACTORY); - if (factoryClassName == null) { - if (LOG.isDebugEnabled()) { - LOG.debug("No " + Context.INITIAL_CONTEXT_FACTORY + " set. Using the default factory."); - } - return DEFAULT_FACTORY; - } - final ClassLoader classLoader = getContextClassLoader(); - try { - final Class<?> factoryClass = Class.forName(factoryClassName, true, classLoader); - InitialContextFactory configuredFactory = (InitialContextFactory) factoryClass.newInstance(); - return createSecureWrapper(configuredFactory, environment); - } catch (Exception e) { - throw new NamingException("Failed instantiate InitialContextFactory " + factoryClassName - + " from classloader " + classLoader); - } - } - - private ClassLoader getContextClassLoader() { - return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() { - public ClassLoader run() { - return Thread.currentThread().getContextClassLoader(); - } - }); - } - - private static InitialContextFactory - createSecureWrapper(InitialContextFactory factory, Hashtable<?, ?> environment) { - String providerUrl = (String) environment.get(Context.PROVIDER_URL); - - if (providerUrl == null) { - if (LOG.isTraceEnabled()) { - LOG.trace("Wrapping " + factory + " of class " + factory.getClass() + " in an access checking wrapper. No provider URL detected."); - } - return getAccessCheckingFactory(factory); - } else { - try { - URI uri = new URI(providerUrl); - InetAddress providerHost = InetAddress.getByName(uri.getHost()); - - //check if we are accessing the RHQ server through some remoting - //interface. - if (uri.getPort() == JNP_PORT && SERVER_BIND_IPS.contains(providerHost)) { - if (LOG.isTraceEnabled()) { - LOG.trace("Wrapping " + factory + " of class " + factory.getClass() + " in an access checking wrapper. The provider URL points to this server."); - } - return getAccessCheckingFactory(factory); - } else { - if (LOG.isTraceEnabled()) { - LOG.trace("Wrapping " + factory + " of class " + factory.getClass() + " in an URL preferring wrapper to enable remote connections."); - } - return getURLPreferringFactory(factory); - } - } catch (URISyntaxException e) { - if (LOG.isDebugEnabled()) { - LOG.debug("The " + Context.PROVIDER_URL - + " is not a valid URI. Falling back to using the access checking wrapper for the factory " - + factory + " of class " + factory.getClass() + ".", e); - } - return getAccessCheckingFactory(factory); - } catch (UnknownHostException e) { - //let the factory deal with the unknown host... - //this most probably shouldn't be secured because localhost addresses - //should be resolvable. - if (LOG.isDebugEnabled()) { - LOG.debug("The " + Context.PROVIDER_URL - + " is not resolvable. Falling back to using the URL preferring wrapper for the factory " - + factory + " of class " + factory.getClass() + ".", e); - } - return getURLPreferringFactory(factory); - } - } - } - - private static InitialContextFactory getAccessCheckingFactory(InitialContextFactory original) { - ArrayList<DecoratorPicker<Context, ContextDecorator>> pickers = new ArrayList<DecoratorPicker<Context,ContextDecorator>>(); - pickers.add(getURLPreferringDecoratorPicker()); - pickers.add(getAccessCheckingDecoratorPicker()); - - return new DecoratingInitialContextFactory(original, pickers); - } - - private static InitialContextFactory getURLPreferringFactory(InitialContextFactory original) { - ArrayList<DecoratorPicker<Context, ContextDecorator>> pickers = new ArrayList<DecoratorPicker<Context,ContextDecorator>>(); - pickers.add(getURLPreferringDecoratorPicker()); - - return new DecoratingInitialContextFactory(original, pickers); - } - - private static DecoratorPicker<Context, ContextDecorator> getAccessCheckingDecoratorPicker() { - DecoratorPicker<Context, ContextDecorator> ret = new DecoratorPicker<Context, ContextDecorator>(); - ret.setContext(new AccessCheckingContextDecoratorSetContext(SUPPORTED_CONTEXT_INTERFACES, CHECKED_SCHEMES)); - - return ret; - } - - private static DecoratorPicker<Context, ContextDecorator> getURLPreferringDecoratorPicker() { - DecoratorPicker<Context, ContextDecorator> ret = new DecoratorPicker<Context, ContextDecorator>(); - ret.setContext(new URLPreferringContextDecoratorSetContext(SUPPORTED_CONTEXT_INTERFACES)); - - return ret; - } -} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/AllowRhqServerInternalsAccessPermission.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/AllowRhqServerInternalsAccessPermission.java deleted file mode 100644 index aa807d6..0000000 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/AllowRhqServerInternalsAccessPermission.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2011 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.jndi; - -import java.security.BasicPermission; - -/** - * - * - * @author Lukas Krejci - */ -public class AllowRhqServerInternalsAccessPermission extends BasicPermission { - - private static final long serialVersionUID = 1L; - - public AllowRhqServerInternalsAccessPermission() { - super("org.rhq.allow.server.internals.access"); - } -} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/DecoratingInitialContextFactory.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/DecoratingInitialContextFactory.java deleted file mode 100644 index e0f1d84..0000000 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/DecoratingInitialContextFactory.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.jndi; - -import java.lang.reflect.Proxy; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.List; -import java.util.Set; - -import javax.naming.Context; -import javax.naming.NamingException; -import javax.naming.spi.InitialContextFactory; - -import org.rhq.jndi.context.ContextDecorator; -import org.rhq.jndi.util.DecoratorPicker; -import org.rhq.jndi.util.DecoratingInvocationHandler; - -/** - * This class implements an initial context factory that decorates the contexts - * returned from a "wrapped" initial factory passed to this class in the constructor. - * <p> - * The contexts returned from the wrapped initial factory are hidden behind a proxy - * that implements the intersection of interfaces from the <code>supportedContextInterfaces</code> - * constructor parameter and the actual interfaces the wrapped context implements. - * <p> - * The proxy method calls are handled using the {@link DecoratingInvocationHandler} which is initialized - * with the list of {@link DecoratorPicker pickers} that are used to intercept the method - * calls on the wrapped context. - * - * @see DecoratorPicker - * @see DecoratingInvocationHandler - * - * @author Lukas Krejci - */ -public class DecoratingInitialContextFactory implements InitialContextFactory { - - List<DecoratorPicker<Context, ContextDecorator>> pickers; - private InitialContextFactory factory; - private Set<Class<? extends Context>> supportedContextInterfaces; - - public DecoratingInitialContextFactory(InitialContextFactory factory, List<DecoratorPicker<Context, ContextDecorator>> decoratorPickers) { - this.factory = factory; - this.pickers = decoratorPickers; - this.supportedContextInterfaces = new HashSet<Class<? extends Context>>(); - for(DecoratorPicker<Context, ContextDecorator> picker : pickers) { - supportedContextInterfaces.addAll(picker.getContext().getSupportedInterfaces()); - } - } - - public Context getInitialContext(Hashtable<?, ?> environment) throws NamingException { - Context ctx = factory.getInitialContext(environment); - - Set<Class<?>> implementedIfaces = getAllImplementedInterfaces(ctx.getClass()); - Class<?>[] ii = new Class<?>[implementedIfaces.size()]; - implementedIfaces.toArray(ii); - - return (Context) Proxy.newProxyInstance(ctx.getClass().getClassLoader(), ii, new DecoratingInvocationHandler<Context, ContextDecorator>(pickers, ctx)); - } - - private Set<Class<?>> getAllImplementedInterfaces(Class<?> cls) { - HashSet<Class<?>> ret = new HashSet<Class<?>>(); - getAllImplementedInterfaces(cls, ret); - - ret.retainAll(supportedContextInterfaces); - - return ret; - } - - private static void getAllImplementedInterfaces(Class<?> cls, Set<Class<?>> output) { - Class<?>[] ifaces = cls.getInterfaces(); - - for (Class<?> iface : Arrays.asList(ifaces)) { - output.add(iface); - getAllImplementedInterfaces(iface, output); - } - - if (cls.getSuperclass() != null) { - getAllImplementedInterfaces(cls.getSuperclass(), output); - } - } - - @Override - public int hashCode() { - return factory.hashCode(); - } - - @Override - public boolean equals(Object o) { - return factory.equals(o); - } -} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingContextDecorator.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingContextDecorator.java deleted file mode 100644 index 8970b0a..0000000 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingContextDecorator.java +++ /dev/null @@ -1,264 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2011 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.jndi.context; - -import java.io.Serializable; -import java.util.Arrays; -import java.util.Hashtable; -import java.util.List; - -import javax.naming.Binding; -import javax.naming.Context; -import javax.naming.Name; -import javax.naming.NameClassPair; -import javax.naming.NameParser; -import javax.naming.NamingEnumeration; -import javax.naming.NamingException; - -import org.rhq.jndi.AllowRhqServerInternalsAccessPermission; - -/** - * This is the "meat" of the RHQ's secured JNDI access. This {@link Context} decorator - * applied security checks in each method (lookups, (un)bindings, etc). - * <p> - * The security check consists of checking if the current callstack has the {@link AllowRhqServerInternalsAccessPermission}. - * <p> - * This decorator applies the security check on any JNDI name without a scheme and - * on any name that has a scheme listed in the {@link #checkedSchemes} list supplied - * in the constructor. - * - * @author Lukas Krejci - */ -public class AccessCheckingContextDecorator implements Context, ContextDecorator, Serializable { - - private static final long serialVersionUID = 1L; - - private static final AllowRhqServerInternalsAccessPermission PERM = new AllowRhqServerInternalsAccessPermission(); - private Context original; - private List<String> checkedSchemes; - - public AccessCheckingContextDecorator(String... checkedSchemes) { - this.checkedSchemes = Arrays.asList(checkedSchemes); - } - - public AccessCheckingContextDecorator(Context original, String... checkedSchemes) { - this.original = original; - this.checkedSchemes = Arrays.asList(checkedSchemes); - } - - public void init(Context ctx) { - this.original = ctx; - } - - protected Context getOriginal() { - return original; - } - - protected static void check() { - SecurityManager sm = System.getSecurityManager(); - if (sm != null) sm.checkPermission(PERM); - } - - private void checkScheme(String scheme) { - if (scheme == null || checkedSchemes.contains(scheme)) { - check(); - } - } - - protected void check(String name) { - checkScheme(getURLScheme(name)); - } - - protected void check(Name name) { - if (name.size() == 0) { - check(); - } else { - String first = name.get(0); - checkScheme(getURLScheme(first)); - } - } - - public Object lookup(Name name) throws NamingException { - check(name); - return original.lookup(name); - } - - public Object lookup(String name) throws NamingException { - check(name); - return original.lookup(name); - } - - public void bind(Name name, Object obj) throws NamingException { - check(name); - original.bind(name, obj); - } - - public void bind(String name, Object obj) throws NamingException { - check(name); - original.bind(name, obj); - } - - public void rebind(Name name, Object obj) throws NamingException { - check(name); - original.rebind(name, obj); - } - - public void rebind(String name, Object obj) throws NamingException { - check(name); - original.rebind(name, obj); - } - - public void unbind(Name name) throws NamingException { - check(name); - original.unbind(name); - } - - public void unbind(String name) throws NamingException { - check(name); - original.unbind(name); - } - - public void rename(Name oldName, Name newName) throws NamingException { - check(oldName); - check(newName); - original.rename(oldName, newName); - } - - public void rename(String oldName, String newName) throws NamingException { - check(oldName); - check(newName); - original.rename(oldName, newName); - } - - public NamingEnumeration<NameClassPair> list(Name name) throws NamingException { - check(name); - return original.list(name); - } - - public NamingEnumeration<NameClassPair> list(String name) throws NamingException { - check(name); - return original.list(name); - } - - public NamingEnumeration<Binding> listBindings(Name name) throws NamingException { - check(name); - return original.listBindings(name); - } - - public NamingEnumeration<Binding> listBindings(String name) throws NamingException { - check(name); - return original.listBindings(name); - } - - public void destroySubcontext(Name name) throws NamingException { - check(name); - original.destroySubcontext(name); - } - - public void destroySubcontext(String name) throws NamingException { - check(name); - original.destroySubcontext(name); - } - - public Context createSubcontext(Name name) throws NamingException { - check(name); - return original.createSubcontext(name); - } - - public Context createSubcontext(String name) throws NamingException { - check(name); - return original.createSubcontext(name); - } - - public Object lookupLink(Name name) throws NamingException { - check(name); - return original.lookupLink(name); - } - - public Object lookupLink(String name) throws NamingException { - check(name); - return original.lookupLink(name); - } - - public NameParser getNameParser(Name name) throws NamingException { - check(name); - return original.getNameParser(name); - } - - public NameParser getNameParser(String name) throws NamingException { - check(name); - return original.getNameParser(name); - } - - public Name composeName(Name name, Name prefix) throws NamingException { - check(name); - return original.composeName(name, prefix); - } - - public String composeName(String name, String prefix) throws NamingException { - check(name); - return original.composeName(name, prefix); - } - - public Object addToEnvironment(String propName, Object propVal) throws NamingException { - check(); - return original.addToEnvironment(propName, propVal); - } - - public Object removeFromEnvironment(String propName) throws NamingException { - check(); - return original.removeFromEnvironment(propName); - } - - public Hashtable<?, ?> getEnvironment() throws NamingException { - check(); - return original.getEnvironment(); - } - - public void close() throws NamingException { - check(); - original.close(); - } - - public String getNameInNamespace() throws NamingException { - check(); - return original.getNameInNamespace(); - } - - //copied from InitialContext - private static String getURLScheme(String str) { - int colon_posn = str.indexOf(':'); - int slash_posn = str.indexOf('/'); - - if (colon_posn > 0 && (slash_posn == -1 || colon_posn < slash_posn)) - return str.substring(0, colon_posn); - return null; - } - - @Override - public int hashCode() { - return getOriginal() == null ? super.hashCode() : getOriginal().hashCode(); - } - - @Override - public boolean equals(Object o) { - return getOriginal() == null ? super.equals(o) : getOriginal().equals(o); - } -} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingContextDecoratorSetContext.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingContextDecoratorSetContext.java deleted file mode 100644 index 284fd0c..0000000 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingContextDecoratorSetContext.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.jndi.context; - -import java.lang.reflect.Constructor; -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; - -import javax.naming.Context; - -import org.rhq.jndi.util.DecoratorSetContext; - -/** - * - * - * @author Lukas Krejci - */ -public class AccessCheckingContextDecoratorSetContext implements DecoratorSetContext<Context, ContextDecorator> { - - private static final Set<Class<? extends ContextDecorator>> DECORATOR_CLASSES; - static { - HashSet<Class<? extends ContextDecorator>> tmp = new HashSet<Class<? extends ContextDecorator>>(); - tmp.add(AccessCheckingContextDecorator.class); - tmp.add(AccessCheckingDirContextDecorator.class); - tmp.add(AccessCheckingEventContextDecorator.class); - tmp.add(AccessCheckingEventDirContextDecorator.class); - tmp.add(AccessCheckingLdapContextDecorator.class); - - DECORATOR_CLASSES = Collections.unmodifiableSet(tmp); - } - - private Set<Class<? extends Context>> supportedInterfaces; - private String[] checkedSchemes; - - public AccessCheckingContextDecoratorSetContext(Set<Class<? extends Context>> supportedInterfaces, String... checkedSchemes) { - this.supportedInterfaces = supportedInterfaces; - this.checkedSchemes = checkedSchemes; - } - - public ContextDecorator instantiate(Class<? extends ContextDecorator> decoratorClass) throws Exception { - Constructor<? extends ContextDecorator> ctor = decoratorClass.getConstructor(String[].class); - - return ctor.newInstance((Object)checkedSchemes); - } - - public Set<Class<? extends Context>> getSupportedInterfaces() { - return supportedInterfaces; - } - - public Set<Class<? extends ContextDecorator>> getDecoratorClasses() { - return DECORATOR_CLASSES; - } - - public void init(ContextDecorator decorator, Context object) throws Exception { - decorator.init(object); - } -} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingDirContextDecorator.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingDirContextDecorator.java deleted file mode 100644 index 1614180..0000000 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingDirContextDecorator.java +++ /dev/null @@ -1,187 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.jndi.context; - -import javax.naming.Name; -import javax.naming.NamingEnumeration; -import javax.naming.NamingException; -import javax.naming.directory.Attributes; -import javax.naming.directory.DirContext; -import javax.naming.directory.ModificationItem; -import javax.naming.directory.SearchControls; -import javax.naming.directory.SearchResult; - -/** - * A decorator of {@link DirContext}. - * - * @author Lukas Krejci - */ -public class AccessCheckingDirContextDecorator extends AccessCheckingContextDecorator implements DirContext { - - private static final long serialVersionUID = 1L; - - public AccessCheckingDirContextDecorator(String... checkedSchemes) { - super(checkedSchemes); - } - - public AccessCheckingDirContextDecorator(DirContext original, String... checkedSchemes) { - super(original, checkedSchemes); - } - - @Override - protected DirContext getOriginal() { - return (DirContext) super.getOriginal(); - } - - public Attributes getAttributes(Name name) throws NamingException { - check(name); - return getOriginal().getAttributes(name); - } - - public Attributes getAttributes(String name) throws NamingException { - check(name); - return getOriginal().getAttributes(name); - } - - public Attributes getAttributes(Name name, String[] attrIds) throws NamingException { - check(name); - return getOriginal().getAttributes(name, attrIds); - } - - public Attributes getAttributes(String name, String[] attrIds) throws NamingException { - check(name); - return getOriginal().getAttributes(name, attrIds); - } - - public void modifyAttributes(Name name, int mod_op, Attributes attrs) throws NamingException { - check(name); - getOriginal().modifyAttributes(name, mod_op, attrs); - } - - public void modifyAttributes(String name, int mod_op, Attributes attrs) throws NamingException { - check(name); - getOriginal().modifyAttributes(name, mod_op, attrs); - } - - public void modifyAttributes(Name name, ModificationItem[] mods) throws NamingException { - check(name); - getOriginal().modifyAttributes(name, mods); - } - - public void modifyAttributes(String name, ModificationItem[] mods) throws NamingException { - check(name); - getOriginal().modifyAttributes(name, mods); - } - - public void bind(Name name, Object obj, Attributes attrs) throws NamingException { - check(name); - getOriginal().bind(name, obj, attrs); - } - - public void bind(String name, Object obj, Attributes attrs) throws NamingException { - check(name); - getOriginal().bind(name, obj, attrs); - } - - public void rebind(Name name, Object obj, Attributes attrs) throws NamingException { - check(name); - getOriginal().rebind(name, obj, attrs); - } - - public void rebind(String name, Object obj, Attributes attrs) throws NamingException { - check(name); - getOriginal().rebind(name, obj, attrs); - } - - public DirContext createSubcontext(Name name, Attributes attrs) throws NamingException { - check(name); - return getOriginal().createSubcontext(name, attrs); - } - - public DirContext createSubcontext(String name, Attributes attrs) throws NamingException { - check(name); - return getOriginal().createSubcontext(name, attrs); - } - - public DirContext getSchema(Name name) throws NamingException { - check(name); - return getOriginal().getSchema(name); - } - - public DirContext getSchema(String name) throws NamingException { - check(name); - return getOriginal().getSchema(name); - } - - public DirContext getSchemaClassDefinition(Name name) throws NamingException { - check(name); - return getOriginal().getSchemaClassDefinition(name); - } - - public DirContext getSchemaClassDefinition(String name) throws NamingException { - check(name); - return getOriginal().getSchema(name); - } - - public NamingEnumeration<SearchResult> - search(Name name, Attributes matchingAttributes, String[] attributesToReturn) throws NamingException { - check(name); - return getOriginal().search(name, matchingAttributes, attributesToReturn); - } - - public NamingEnumeration<SearchResult> search(String name, Attributes matchingAttributes, - String[] attributesToReturn) throws NamingException { - check(name); - return getOriginal().search(name, matchingAttributes, attributesToReturn); - } - - public NamingEnumeration<SearchResult> search(Name name, Attributes matchingAttributes) throws NamingException { - check(name); - return getOriginal().search(name, matchingAttributes); - } - - public NamingEnumeration<SearchResult> search(String name, Attributes matchingAttributes) throws NamingException { - check(name); - return getOriginal().search(name, matchingAttributes); - } - - public NamingEnumeration<SearchResult> search(Name name, String filter, SearchControls cons) throws NamingException { - check(name); - return getOriginal().search(name, filter, cons); - } - - public NamingEnumeration<SearchResult> search(String name, String filter, SearchControls cons) - throws NamingException { - check(name); - return getOriginal().search(name, filter, cons); - } - - public NamingEnumeration<SearchResult> - search(Name name, String filterExpr, Object[] filterArgs, SearchControls cons) throws NamingException { - check(name); - return getOriginal().search(name, filterExpr, filterArgs, cons); - } - - public NamingEnumeration<SearchResult> search(String name, String filterExpr, Object[] filterArgs, - SearchControls cons) throws NamingException { - check(name); - return getOriginal().search(name, filterExpr, filterArgs, cons); - } -} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingEventContextDecorator.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingEventContextDecorator.java deleted file mode 100644 index 67a9527..0000000 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingEventContextDecorator.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.jndi.context; - -import javax.naming.Name; -import javax.naming.NamingException; -import javax.naming.event.EventContext; -import javax.naming.event.NamingListener; - -/** - * - * - * @author Lukas Krejci - */ -public class AccessCheckingEventContextDecorator extends AccessCheckingContextDecorator implements EventContext { - - private static final long serialVersionUID = 1L; - - public AccessCheckingEventContextDecorator(String... checkedSchemes) { - super(checkedSchemes); - } - - public AccessCheckingEventContextDecorator(EventContext original, String... checkedSchemes) { - super(original, checkedSchemes); - } - - @Override - protected EventContext getOriginal() { - return (EventContext) super.getOriginal(); - } - - public void addNamingListener(Name target, int scope, NamingListener l) throws NamingException { - check(target); - getOriginal().addNamingListener(target, scope, l); - } - - public void addNamingListener(String target, int scope, NamingListener l) throws NamingException { - check(target); - getOriginal().addNamingListener(target, scope, l); - } - - public void removeNamingListener(NamingListener l) throws NamingException { - check(); - getOriginal().removeNamingListener(l); - } - - public boolean targetMustExist() throws NamingException { - check(); - return getOriginal().targetMustExist(); - } - -} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingEventDirContextDecorator.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingEventDirContextDecorator.java deleted file mode 100644 index ed7a848..0000000 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingEventDirContextDecorator.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.jndi.context; - -import javax.naming.Name; -import javax.naming.NamingException; -import javax.naming.directory.SearchControls; -import javax.naming.event.EventDirContext; -import javax.naming.event.NamingListener; - -/** - * - * - * @author Lukas Krejci - */ -public class AccessCheckingEventDirContextDecorator extends AccessCheckingDirContextDecorator implements - EventDirContext { - - private static final long serialVersionUID = 1L; - - public AccessCheckingEventDirContextDecorator(String... checkedSchemes) { - super(checkedSchemes); - } - - public AccessCheckingEventDirContextDecorator(EventDirContext original, String... checkedSchemes) { - super(original, checkedSchemes); - } - - @Override - protected EventDirContext getOriginal() { - return (EventDirContext) super.getOriginal(); - } - - public void addNamingListener(Name target, int scope, NamingListener l) throws NamingException { - check(target); - getOriginal().addNamingListener(target, scope, l); - } - - public void addNamingListener(String target, int scope, NamingListener l) throws NamingException { - check(target); - getOriginal().addNamingListener(target, scope, l); - } - - public void removeNamingListener(NamingListener l) throws NamingException { - check(); - getOriginal().removeNamingListener(l); - } - - public boolean targetMustExist() throws NamingException { - check(); - return getOriginal().targetMustExist(); - } - - public void addNamingListener(Name target, String filter, SearchControls ctls, NamingListener l) - throws NamingException { - check(target); - getOriginal().addNamingListener(target, filter, ctls, l); - } - - public void addNamingListener(String target, String filter, SearchControls ctls, NamingListener l) - throws NamingException { - check(target); - getOriginal().addNamingListener(target, filter, ctls, l); - } - - public void - addNamingListener(Name target, String filter, Object[] filterArgs, SearchControls ctls, NamingListener l) - throws NamingException { - check(target); - getOriginal().addNamingListener(target, filter, filterArgs, ctls, l); - } - - public void addNamingListener(String target, String filter, Object[] filterArgs, SearchControls ctls, - NamingListener l) throws NamingException { - check(target); - getOriginal().addNamingListener(target, filter, filterArgs, ctls, l); - } - -} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingLdapContextDecorator.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingLdapContextDecorator.java deleted file mode 100644 index e361db8..0000000 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingLdapContextDecorator.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.jndi.context; - -import javax.naming.NamingException; -import javax.naming.ldap.Control; -import javax.naming.ldap.ExtendedRequest; -import javax.naming.ldap.ExtendedResponse; -import javax.naming.ldap.LdapContext; - -/** - * - * - * @author Lukas Krejci - */ -public class AccessCheckingLdapContextDecorator extends AccessCheckingDirContextDecorator implements LdapContext { - - private static final long serialVersionUID = 1L; - - public AccessCheckingLdapContextDecorator(String... checkedSchemes) { - super(checkedSchemes); - } - - public AccessCheckingLdapContextDecorator(LdapContext original, String... checkedSchemes) { - super(original, checkedSchemes); - } - - @Override - protected LdapContext getOriginal() { - return (LdapContext) super.getOriginal(); - } - - public ExtendedResponse extendedOperation(ExtendedRequest request) throws NamingException { - check(); - return getOriginal().extendedOperation(request); - } - - public LdapContext newInstance(Control[] requestControls) throws NamingException { - check(); - return getOriginal().newInstance(requestControls); - } - - public void reconnect(Control[] connCtls) throws NamingException { - check(); - getOriginal().reconnect(connCtls); - } - - public Control[] getConnectControls() throws NamingException { - check(); - return getOriginal().getConnectControls(); - } - - public void setRequestControls(Control[] requestControls) throws NamingException { - check(); - getOriginal().setRequestControls(requestControls); - } - - public Control[] getRequestControls() throws NamingException { - check(); - return getOriginal().getRequestControls(); - } - - public Control[] getResponseControls() throws NamingException { - check(); - return getOriginal().getResponseControls(); - } - -} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/ContextDecorator.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/ContextDecorator.java deleted file mode 100644 index 5755ebd..0000000 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/ContextDecorator.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.jndi.context; - -import javax.naming.Context; -import javax.naming.NamingException; - -/** - * - * - * @author Lukas Krejci - */ -public interface ContextDecorator extends Context { - - void init(Context context) throws NamingException; -} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringContextDecorator.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringContextDecorator.java deleted file mode 100644 index 3f3a95d..0000000 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringContextDecorator.java +++ /dev/null @@ -1,222 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2011 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.jndi.context; - -import java.io.Serializable; -import java.util.Hashtable; - -import javax.naming.Binding; -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.Name; -import javax.naming.NameClassPair; -import javax.naming.NameParser; -import javax.naming.NamingEnumeration; -import javax.naming.NamingException; - -import org.rhq.jndi.AccessCheckingInitialContextFactoryBuilder; - -/** - * This is a wrapper class around another {@link Context} implementation that - * prefers to use an URL context for some operation if the JNDI name contains - * a scheme rather than the original. This is the behavior of {@link InitialContext} - * which we need to restore in the contexts created by the {@link AccessCheckingInitialContextFactoryBuilder} - * (which an {@link InitialContext} uses exclusively if the builder is set). - * <p> - * This is important because RHQ server has its own initial context factory - * builder that creates factories that in turn create contexts. If the default - * {@link InitialContext} implementation was used, we'd never be able to lookup - * scheme-based names because the default implementation of the {@link InitialContext} - * always uses the default context of the builder if one is installed no matter - * the scheme in the name. - * <p> - * The {@link AccessCheckingInitialContextFactoryBuilder} wraps the context returned - * by the factory in an instance of this class and thus is restoring the original - * intended behavior of the {@link InitialContext}. It looks at the name being looked - * up (bound or whatever) and prefers to use the URL context factories if the name - * contains the scheme (as does the {@link InitialContext} if no builder is installed). - * If the name doesn't contain a scheme, the provided default context factory is used to - * look up the name. - * - * @author Lukas Krejci - */ -public class URLPreferringContextDecorator implements Context, ContextDecorator, Serializable { - - private static final long serialVersionUID = 1L; - - private Context original; - - public URLPreferringContextDecorator() { - - } - - public URLPreferringContextDecorator(Context ctx) { - original = ctx; - } - - public void init(Context context) { - original = context; - } - - protected Context getOriginal() throws NamingException { - return original; - } - - protected Context getURLOrDefaultInitCtx(Name name) throws NamingException { - @SuppressWarnings("unchecked") - Context urlContext = URLPreferringContextDecoratorHelper.getURLContext(name, (Hashtable<Object, Object>) getEnvironment()); - return urlContext == null ? getOriginal() : urlContext; - } - - protected Context getURLOrDefaultInitCtx(String name) throws NamingException { - @SuppressWarnings("unchecked") - Context urlContext = URLPreferringContextDecoratorHelper.getURLContext(name, (Hashtable<Object, Object>) getEnvironment()); - return urlContext == null ? getOriginal() : urlContext; - } - - public Object lookup(Name name) throws NamingException { - return getURLOrDefaultInitCtx(name).lookup(name); - } - - public Object lookup(String name) throws NamingException { - return getURLOrDefaultInitCtx(name).lookup(name); - } - - public void bind(Name name, Object obj) throws NamingException { - getURLOrDefaultInitCtx(name).bind(name, obj); - } - - public void bind(String name, Object obj) throws NamingException { - getURLOrDefaultInitCtx(name).bind(name, obj); - } - - public void rebind(Name name, Object obj) throws NamingException { - getURLOrDefaultInitCtx(name).rebind(name, obj); - } - - public void rebind(String name, Object obj) throws NamingException { - getURLOrDefaultInitCtx(name).rebind(name, obj); - } - - public void unbind(Name name) throws NamingException { - getURLOrDefaultInitCtx(name).unbind(name); - } - - public void unbind(String name) throws NamingException { - getURLOrDefaultInitCtx(name).unbind(name); - } - - public void rename(Name oldName, Name newName) throws NamingException { - getURLOrDefaultInitCtx(oldName).rename(oldName, newName); - } - - public void rename(String oldName, String newName) throws NamingException { - getURLOrDefaultInitCtx(oldName).rename(oldName, newName); - } - - public NamingEnumeration<NameClassPair> list(Name name) throws NamingException { - return getURLOrDefaultInitCtx(name).list(name); - } - - public NamingEnumeration<NameClassPair> list(String name) throws NamingException { - return getURLOrDefaultInitCtx(name).list(name); - } - - public NamingEnumeration<Binding> listBindings(Name name) throws NamingException { - return getURLOrDefaultInitCtx(name).listBindings(name); - } - - public NamingEnumeration<Binding> listBindings(String name) throws NamingException { - return getURLOrDefaultInitCtx(name).listBindings(name); - } - - public void destroySubcontext(Name name) throws NamingException { - getURLOrDefaultInitCtx(name).destroySubcontext(name); - } - - public void destroySubcontext(String name) throws NamingException { - getURLOrDefaultInitCtx(name).destroySubcontext(name); - } - - public Context createSubcontext(Name name) throws NamingException { - return getURLOrDefaultInitCtx(name).createSubcontext(name); - } - - public Context createSubcontext(String name) throws NamingException { - return getURLOrDefaultInitCtx(name).createSubcontext(name); - } - - public Object lookupLink(Name name) throws NamingException { - return getURLOrDefaultInitCtx(name).lookupLink(name); - } - - public Object lookupLink(String name) throws NamingException { - return getURLOrDefaultInitCtx(name).lookupLink(name); - } - - public NameParser getNameParser(Name name) throws NamingException { - return getURLOrDefaultInitCtx(name).getNameParser(name); - } - - public NameParser getNameParser(String name) throws NamingException { - return getURLOrDefaultInitCtx(name).getNameParser(name); - } - - public Name composeName(Name name, Name prefix) throws NamingException { - return getOriginal().composeName(name, prefix); - } - - public String composeName(String name, String prefix) throws NamingException { - return getOriginal().composeName(name, prefix); - } - - public Object addToEnvironment(String propName, Object propVal) throws NamingException { - return getOriginal().addToEnvironment(propName, propVal); - } - - public Object removeFromEnvironment(String propName) throws NamingException { - return getOriginal().removeFromEnvironment(propName); - } - - public Hashtable<?, ?> getEnvironment() throws NamingException { - return getOriginal().getEnvironment(); - } - - public void close() throws NamingException { - if (getOriginal() != null) { - getOriginal().close(); - original = null; - } - } - - public String getNameInNamespace() throws NamingException { - return getOriginal().getNameInNamespace(); - } - - @Override - public int hashCode() { - return original == null ? super.hashCode() : original.hashCode(); - } - - @Override - public boolean equals(Object o) { - return original == null ? super.equals(o) : original.equals(o); - } -} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringContextDecoratorHelper.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringContextDecoratorHelper.java deleted file mode 100644 index 6e7debc..0000000 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringContextDecoratorHelper.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.jndi.context; - -import java.util.Hashtable; - -import javax.naming.Context; -import javax.naming.Name; -import javax.naming.NamingException; -import javax.naming.spi.NamingManager; - -/** - * - * - * @author Lukas Krejci - */ -public class URLPreferringContextDecoratorHelper { - - private URLPreferringContextDecoratorHelper() { - - } - - public static Context getURLContext(String name, Hashtable<Object, Object> env) throws NamingException { - String scheme = getURLScheme(name); - if (scheme != null) { - Context ctx = NamingManager.getURLContext(scheme, env); - if (ctx != null) { - return ctx; - } - } - - return null; - } - - public static Context getURLContext(Name name, Hashtable<Object, Object> env) throws NamingException { - if (name.size() > 0) { - String first = name.get(0); - String scheme = getURLScheme(first); - if (scheme != null) { - Context ctx = NamingManager.getURLContext(scheme, env); - if (ctx != null) { - return ctx; - } - } - } - - return null; - } - - //copied from InitialContext - private static String getURLScheme(String str) { - int colon_posn = str.indexOf(':'); - int slash_posn = str.indexOf('/'); - - if (colon_posn > 0 && (slash_posn == -1 || colon_posn < slash_posn)) - return str.substring(0, colon_posn); - return null; - } -} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringContextDecoratorSetContext.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringContextDecoratorSetContext.java deleted file mode 100644 index 828cd74..0000000 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringContextDecoratorSetContext.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.jndi.context; - -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; - -import javax.naming.Context; - -import org.rhq.jndi.util.DecoratorSetContext; - -/** - * - * - * @author Lukas Krejci - */ -public class URLPreferringContextDecoratorSetContext implements DecoratorSetContext<Context, ContextDecorator> { - - private static final Set<Class<? extends ContextDecorator>> DECORATOR_CLASSES; - static { - HashSet<Class<? extends ContextDecorator>> tmp = new HashSet<Class<? extends ContextDecorator>>(); - tmp.add(URLPreferringContextDecorator.class); - tmp.add(URLPreferringDirContextDecorator.class); - tmp.add(URLPreferringEventContextDecorator.class); - tmp.add(URLPreferringEventDirContextDecorator.class); - tmp.add(URLPreferringLdapContextDecorator.class); - - DECORATOR_CLASSES = Collections.unmodifiableSet(tmp); - } - - private Set<Class<? extends Context>> supportedInterfaces; - - public URLPreferringContextDecoratorSetContext(Set<Class<? extends Context>> supportedInterfaces) { - this.supportedInterfaces = supportedInterfaces; - } - - public Set<Class<? extends Context>> getSupportedInterfaces() { - return supportedInterfaces; - } - - public Set<Class<? extends ContextDecorator>> getDecoratorClasses() { - return DECORATOR_CLASSES; - } - - public ContextDecorator instantiate(Class<? extends ContextDecorator> decoratorClass) throws Exception { - return decoratorClass.newInstance(); - } - - public void init(ContextDecorator decorator, Context object) throws Exception { - decorator.init(object); - } - -} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringDirContextDecorator.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringDirContextDecorator.java deleted file mode 100644 index 6a49942..0000000 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringDirContextDecorator.java +++ /dev/null @@ -1,185 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.jndi.context; - -import javax.naming.Context; -import javax.naming.Name; -import javax.naming.NamingEnumeration; -import javax.naming.NamingException; -import javax.naming.NoInitialContextException; -import javax.naming.NotContextException; -import javax.naming.directory.Attributes; -import javax.naming.directory.DirContext; -import javax.naming.directory.ModificationItem; -import javax.naming.directory.SearchControls; -import javax.naming.directory.SearchResult; - -/** - * Akin to {@link URLPreferringContextDecorator} this class implements the similar logic - * for {@link DirContext}s. - * - * @author Lukas Krejci - */ -public class URLPreferringDirContextDecorator extends URLPreferringContextDecorator implements DirContext { - - private static final long serialVersionUID = 1L; - - public URLPreferringDirContextDecorator() { - super(null); - } - - public URLPreferringDirContextDecorator(DirContext ctx) { - super(ctx); - } - - protected DirContext checkAndCast(Context ctx) throws NamingException { - if (!(ctx instanceof DirContext)) { - if (ctx == null) { - throw new NoInitialContextException(); - } else { - throw new NotContextException( - "Not an instance of DirContext"); - } - } - - return (DirContext) ctx; - } - - @Override - protected DirContext getURLOrDefaultInitCtx(Name name) throws NamingException { - Context ctx = super.getURLOrDefaultInitCtx(name); - return checkAndCast(ctx); - } - - @Override - protected DirContext getURLOrDefaultInitCtx(String name) throws NamingException { - Context ctx = super.getURLOrDefaultInitCtx(name); - return checkAndCast(ctx); - } - - public Attributes getAttributes(Name name) throws NamingException { - return getURLOrDefaultInitCtx(name).getAttributes(name); - } - - public Attributes getAttributes(String name) throws NamingException { - return getURLOrDefaultInitCtx(name).getAttributes(name); - } - - public Attributes getAttributes(Name name, String[] attrIds) throws NamingException { - return getURLOrDefaultInitCtx(name).getAttributes(name, attrIds); - } - - public Attributes getAttributes(String name, String[] attrIds) throws NamingException { - return getURLOrDefaultInitCtx(name).getAttributes(name, attrIds); - } - - public void modifyAttributes(Name name, int mod_op, Attributes attrs) throws NamingException { - getURLOrDefaultInitCtx(name).modifyAttributes(name, mod_op, attrs); - } - - public void modifyAttributes(String name, int mod_op, Attributes attrs) throws NamingException { - getURLOrDefaultInitCtx(name).modifyAttributes(name, mod_op, attrs); - } - - public void modifyAttributes(Name name, ModificationItem[] mods) throws NamingException { - getURLOrDefaultInitCtx(name).modifyAttributes(name, mods); - } - - public void modifyAttributes(String name, ModificationItem[] mods) throws NamingException { - getURLOrDefaultInitCtx(name).modifyAttributes(name, mods); - } - - public void bind(Name name, Object obj, Attributes attrs) throws NamingException { - getURLOrDefaultInitCtx(name).bind(name, obj, attrs); - } - - public void bind(String name, Object obj, Attributes attrs) throws NamingException { - getURLOrDefaultInitCtx(name).bind(name, obj, attrs); - } - - public void rebind(Name name, Object obj, Attributes attrs) throws NamingException { - getURLOrDefaultInitCtx(name).rebind(name, obj, attrs); - } - - public void rebind(String name, Object obj, Attributes attrs) throws NamingException { - getURLOrDefaultInitCtx(name).rebind(name, obj, attrs); - } - - public DirContext createSubcontext(Name name, Attributes attrs) throws NamingException { - return getURLOrDefaultInitCtx(name).createSubcontext(name, attrs); - } - - public DirContext createSubcontext(String name, Attributes attrs) throws NamingException { - return getURLOrDefaultInitCtx(name).createSubcontext(name, attrs); - } - - public DirContext getSchema(Name name) throws NamingException { - return getURLOrDefaultInitCtx(name).getSchema(name); - } - - public DirContext getSchema(String name) throws NamingException { - return getURLOrDefaultInitCtx(name).getSchema(name); - } - - public DirContext getSchemaClassDefinition(Name name) throws NamingException { - return getURLOrDefaultInitCtx(name).getSchemaClassDefinition(name); - } - - public DirContext getSchemaClassDefinition(String name) throws NamingException { - return getURLOrDefaultInitCtx(name).getSchemaClassDefinition(name); - } - - public NamingEnumeration<SearchResult> - search(Name name, Attributes matchingAttributes, String[] attributesToReturn) throws NamingException { - return getURLOrDefaultInitCtx(name).search(name, matchingAttributes, attributesToReturn); - } - - public NamingEnumeration<SearchResult> search(String name, Attributes matchingAttributes, - String[] attributesToReturn) throws NamingException { - return getURLOrDefaultInitCtx(name).search(name, matchingAttributes, attributesToReturn); - } - - public NamingEnumeration<SearchResult> search(Name name, Attributes matchingAttributes) throws NamingException { - return getURLOrDefaultInitCtx(name).search(name, matchingAttributes); - } - - public NamingEnumeration<SearchResult> search(String name, Attributes matchingAttributes) throws NamingException { - return getURLOrDefaultInitCtx(name).search(name, matchingAttributes); - } - - public NamingEnumeration<SearchResult> search(Name name, String filter, SearchControls cons) throws NamingException { - return getURLOrDefaultInitCtx(name).search(name, filter, cons); - } - - public NamingEnumeration<SearchResult> search(String name, String filter, SearchControls cons) - throws NamingException { - return getURLOrDefaultInitCtx(name).search(name, filter, cons); - } - - public NamingEnumeration<SearchResult> - search(Name name, String filterExpr, Object[] filterArgs, SearchControls cons) throws NamingException { - return getURLOrDefaultInitCtx(name).search(name, filterExpr, filterArgs, cons); - } - - public NamingEnumeration<SearchResult> search(String name, String filterExpr, Object[] filterArgs, - SearchControls cons) throws NamingException { - return getURLOrDefaultInitCtx(name).search(name, filterExpr, filterArgs, cons); - } -} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringEventContextDecorator.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringEventContextDecorator.java deleted file mode 100644 index e3298a0..0000000 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringEventContextDecorator.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.jndi.context; - -import javax.naming.Context; -import javax.naming.Name; -import javax.naming.NamingException; -import javax.naming.NoInitialContextException; -import javax.naming.NotContextException; -import javax.naming.event.EventContext; -import javax.naming.event.NamingListener; - -/** - * - * - * @author Lukas Krejci - */ -public class URLPreferringEventContextDecorator extends URLPreferringContextDecorator implements EventContext { - - private static final long serialVersionUID = 1L; - - public URLPreferringEventContextDecorator() { - super(null); - } - - public URLPreferringEventContextDecorator(EventContext ctx) { - super(ctx); - } - - protected EventContext checkAndCast(Context ctx) throws NamingException { - if (!(ctx instanceof EventContext)) { - if (ctx == null) { - throw new NoInitialContextException(); - } else { - throw new NotContextException( - "Not an instance of EventContext"); - } - } - - return (EventContext) ctx; - } - - @Override - protected EventContext getOriginal() throws NamingException { - return checkAndCast(super.getOriginal()); - } - - public void addNamingListener(Name target, int scope, NamingListener l) throws NamingException { - getOriginal().addNamingListener(target, scope, l); - } - - public void addNamingListener(String target, int scope, NamingListener l) throws NamingException { - getOriginal().addNamingListener(target, scope, l); - } - - public void removeNamingListener(NamingListener l) throws NamingException { - getOriginal().removeNamingListener(l); - } - - public boolean targetMustExist() throws NamingException { - return getOriginal().targetMustExist(); - } - -} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringEventDirContextDecorator.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringEventDirContextDecorator.java deleted file mode 100644 index 4925297..0000000 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringEventDirContextDecorator.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.jndi.context; - -import javax.naming.Context; -import javax.naming.Name; -import javax.naming.NamingException; -import javax.naming.NoInitialContextException; -import javax.naming.NotContextException; -import javax.naming.directory.SearchControls; -import javax.naming.event.EventDirContext; -import javax.naming.event.NamingListener; - -/** - * - * - * @author Lukas Krejci - */ -public class URLPreferringEventDirContextDecorator extends URLPreferringDirContextDecorator implements EventDirContext { - - private static final long serialVersionUID = 1L; - - public URLPreferringEventDirContextDecorator() { - super(null); - } - - public URLPreferringEventDirContextDecorator(EventDirContext ctx) { - super(ctx); - } - - @Override - protected EventDirContext checkAndCast(Context ctx) throws NamingException { - if (!(ctx instanceof EventDirContext)) { - if (ctx == null) { - throw new NoInitialContextException(); - } else { - throw new NotContextException( - "Not an instance of EventDirContext"); - } - } - - return (EventDirContext) ctx; - } - - @Override - protected EventDirContext getOriginal() throws NamingException { - return checkAndCast(super.getOriginal()); - } - - public void addNamingListener(Name target, int scope, NamingListener l) throws NamingException { - getOriginal().addNamingListener(target, scope, l); - } - - public void addNamingListener(String target, int scope, NamingListener l) throws NamingException { - getOriginal().addNamingListener(target, scope, l); - } - - public void removeNamingListener(NamingListener l) throws NamingException { - getOriginal().removeNamingListener(l); - } - - public boolean targetMustExist() throws NamingException { - return getOriginal().targetMustExist(); - } - - public void addNamingListener(Name target, String filter, SearchControls ctls, NamingListener l) - throws NamingException { - getOriginal().addNamingListener(target, filter, ctls, l); - } - - public void addNamingListener(String target, String filter, SearchControls ctls, NamingListener l) - throws NamingException { - getOriginal().addNamingListener(target, filter, ctls, l); - } - - public void - addNamingListener(Name target, String filter, Object[] filterArgs, SearchControls ctls, NamingListener l) - throws NamingException { - getOriginal().addNamingListener(target, filter, filterArgs, ctls, l); - } - - public void addNamingListener(String target, String filter, Object[] filterArgs, SearchControls ctls, - NamingListener l) throws NamingException { - getOriginal().addNamingListener(target, filter, filterArgs, ctls, l); - } - -} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringLdapContextDecorator.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringLdapContextDecorator.java deleted file mode 100644 index c74df39..0000000 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringLdapContextDecorator.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.jndi.context; - -import javax.naming.Context; -import javax.naming.NamingException; -import javax.naming.NoInitialContextException; -import javax.naming.NotContextException; -import javax.naming.ldap.Control; -import javax.naming.ldap.ExtendedRequest; -import javax.naming.ldap.ExtendedResponse; -import javax.naming.ldap.LdapContext; - -/** - * - * - * @author Lukas Krejci - */ -public class URLPreferringLdapContextDecorator extends URLPreferringDirContextDecorator implements LdapContext { - - private static final long serialVersionUID = 1L; - - public URLPreferringLdapContextDecorator() { - super(null); - } - - public URLPreferringLdapContextDecorator(LdapContext original) { - super(original); - } - - @Override - protected LdapContext checkAndCast(Context ctx) throws NamingException { - if (!(ctx instanceof LdapContext)) { - if (ctx == null) { - throw new NoInitialContextException(); - } else { - throw new NotContextException("Not an instance of LdapContext"); - } - } - - return (LdapContext) ctx; - } - - @Override - protected LdapContext getOriginal() throws NamingException { - return checkAndCast(super.getOriginal()); - } - - public ExtendedResponse extendedOperation(ExtendedRequest request) throws NamingException { - return getOriginal().extendedOperation(request); - } - - public LdapContext newInstance(Control[] requestControls) throws NamingException { - return new URLPreferringLdapContextDecorator(getOriginal().newInstance(requestControls)); - } - - public void reconnect(Control[] connCtls) throws NamingException { - getOriginal().reconnect(connCtls); - } - - public Control[] getConnectControls() throws NamingException { - return getOriginal().getConnectControls(); - } - - public void setRequestControls(Control[] requestControls) throws NamingException { - getOriginal().setRequestControls(requestControls); - } - - public Control[] getRequestControls() throws NamingException { - return getOriginal().getRequestControls(); - } - - public Control[] getResponseControls() throws NamingException { - return getOriginal().getResponseControls(); - } - -} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/mbean/AccessCheckingInitialContextFactoryBuilderInstaller.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/mbean/AccessCheckingInitialContextFactoryBuilderInstaller.java deleted file mode 100644 index a1ccb4f..0000000 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/mbean/AccessCheckingInitialContextFactoryBuilderInstaller.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2011 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.jndi.mbean; - -import javax.naming.spi.NamingManager; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import org.rhq.jndi.AccessCheckingInitialContextFactoryBuilder; - -/** - * - * - * @author Lukas Krejci - */ -public class AccessCheckingInitialContextFactoryBuilderInstaller implements AccessCheckingInitialContextFactoryBuilderInstallerMBean { - private static final Log LOG = LogFactory.getLog(AccessCheckingInitialContextFactoryBuilderInstaller.class); - - public void start() throws Exception { - LOG.info("Installing RHQ's access permission checking initial context factory builder"); - - NamingManager.setInitialContextFactoryBuilder(new AccessCheckingInitialContextFactoryBuilder()); - } - - public void stop() throws Exception { - } -} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/mbean/AccessCheckingInitialContextFactoryBuilderInstallerMBean.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/mbean/AccessCheckingInitialContextFactoryBuilderInstallerMBean.java deleted file mode 100644 index 87d19ab..0000000 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/mbean/AccessCheckingInitialContextFactoryBuilderInstallerMBean.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2011 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.jndi.mbean; - -/** - * - * - * @author Lukas Krejci - */ -public interface AccessCheckingInitialContextFactoryBuilderInstallerMBean { - - void start() throws Exception; - - void stop() throws Exception; -} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/util/DecoratingInvocationHandler.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/util/DecoratingInvocationHandler.java deleted file mode 100644 index 1bfa7ac..0000000 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/util/DecoratingInvocationHandler.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.jndi.util; - -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.List; - -public class DecoratingInvocationHandler<Type, Decorator extends Type> implements InvocationHandler { - - private final List<DecoratorPicker<Type, Decorator>> pickers; - private Type object; - - public DecoratingInvocationHandler(List<DecoratorPicker<Type, Decorator>> pickers, Type object) { - this.pickers = pickers; - this.object = object; - } - - public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { - Type target = object; - Class<?> methodClass = method.getDeclaringClass(); - - for(DecoratorPicker<Type, Decorator> picker : pickers) { - target = picker.decorate(target, methodClass); - } - - try { - return method.invoke(target, args); - } catch (InvocationTargetException e) { - if (e.getCause() != null) { - throw e.getCause(); - } else { - throw e; - } - } - } -} \ No newline at end of file diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/util/DecoratorPicker.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/util/DecoratorPicker.java deleted file mode 100644 index 017d29f..0000000 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/util/DecoratorPicker.java +++ /dev/null @@ -1,195 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.jndi.util; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -/** - * Given as set of decorators extending given type, this class can pick - * the most appropriate set of decorators for a class or a method call. - * <p> - * To configure the decorator, one has to provide a {@link DecoratorSetContext} that - * is then used to obtain the list of - * {@link DecoratorSetContext#getSupportedInterfaces() supported interfaces}, which are - * all the interfaces that should be used for decorator resolution (i.e. all other interfaces - * that a class might implement are ignored during decorator resolution), the list of - * {@link DecoratorSetContext#getDecoratorClasses() decorator classes}, which is a list - * of decorators the picker can choose from and is also used to instantiate and initialize - * the decorators. - * - * @author Lukas Krejci - */ -public class DecoratorPicker<Type, Decorator extends Type> { - - private DecoratorSetContext<Type, Decorator> context; - - public DecoratorSetContext<Type, Decorator> getContext() { - return context; - } - - public void setContext(DecoratorSetContext<Type, Decorator> decoratorSetContext) { - this.context = decoratorSetContext; - } - - /** - * Returns a set of decorators applicable for given method. The set is established based - * on the declaring class of the method. - * - * @param method the method to inspect - * @return the set of decorators that can be used to wrap a method call - * @throws Exception - */ - public Set<Decorator> getDecoratorsForMethod(Method method) throws Exception { - return getDecoratorsForClass_Private(method.getDeclaringClass()); - } - - /** - * Returns a set of decorators that can be used on instances of given class. - * @param cls the class to inspect - * @return - * @throws Exception - */ - public Set<Decorator> getDecoratorsForClass(Class<? extends Type> cls) throws Exception { - return getDecoratorsForClass_Private(cls); - } - - /** - * This method first establishes the set of decorators to use based on the class of the supplied - * object and then chains the decorators (in arbitrary order) with the supplied object at the - * "root" of the chain. - * <p> - * If a method is then called on the returned object, the methods of all the decorators are called - * in chain (each supposedly calling the next) and finally, at the end of the chain, the method on - * the original object (the one supplied to this method) is called. - * <p> - * Note that the above is only an intended behavior and actually depends on the implementation of - * the decorators that are resposinble for the chaining. Each decorator is initialized - * (@{link {@link DecoratorSetContext#init(Object, Object)} which should set it up for such chaining. - * - * @param object - * @return - * @throws Exception - */ - public Type decorate(Type object) throws Exception { - Set<Decorator> decs = getDecoratorsForClass_Private(object.getClass()); - Type ret = object; - for(Decorator d : decs) { - context.init(d, ret); - ret = d; - } - - return ret; - } - - /** - * Similar to {@link #decorate(Object)} but instead of the class of the object itself, - * uses the significantSuperClass as the basis for the decorator resolution. - * <p> - * This is important, because if the object implements two mutually incompatible sub-interfaces of <code>Type</code>, - * the chained decorators might fail to execute a method later on if the decorator depends on the upper part - * of the chain to implement certain sub-interface of <code>Type</code>. - * - * @param object the object to wrap in decorators - * @param significantSuperClass the class to base the decorator resolution on - * @return - * @throws Exception - */ - public Type decorate(Type object, Class<?> significantSuperClass) throws Exception { - Set<Decorator> decs = getDecoratorsForClass_Private(significantSuperClass); - Type ret = object; - for(Decorator d : decs) { - context.init(d, ret); - ret = d; - } - - return ret; - } - - private Set<Decorator> getDecoratorsForClass_Private(Class<?> cls) throws Exception { - Set<Class<? extends Type>> ifaces = getNearestApplicableInterfaces(cls); - - HashSet<Decorator> ret = new HashSet<Decorator>(); - - for (Class<? extends Type> iface : ifaces) { - for (Class<? extends Decorator> decClass : getMatch(iface)) { - ret.add(context.instantiate(decClass)); - } - } - - return ret; - } - - private Set<Class<? extends Type>> getNearestApplicableInterfaces(Class<?> cls) { - List<Class<? extends Type>> ifaces = new ArrayList<Class<? extends Type>>(getAllApplicableInterfaces(cls)); - - //now compact the set to only contain the most concrete interfaces - - Iterator<Class<? extends Type>> it = ifaces.iterator(); - while (it.hasNext()) { - Class<? extends Type> c = it.next(); - - for (int i = 0; i < ifaces.size(); ++i) { - Class<? extends Type> nextC = ifaces.get(i); - if (!c.equals(nextC) && c.isAssignableFrom(nextC)) { - it.remove(); - break; - } - } - } - - return new HashSet<Class<? extends Type>>(ifaces); - } - - private Set<Class<? extends Type>> getAllApplicableInterfaces(Class<?> cls) { - Set<Class<? extends Type>> ifaces = new HashSet<Class<? extends Type>>(); - - for (Class<? extends Type> iface : context.getSupportedInterfaces()) { - if (iface.isAssignableFrom(cls)) { - ifaces.add(iface); - } - } - - if (ifaces.isEmpty()) { - throw new IllegalArgumentException("Class " + cls - + " doesn't implement any of the applicable interfaces. Cannot find decorators for it."); - } - - return ifaces; - } - - private Set<Class<? extends Decorator>> getMatch(Class<?> targetIface) { - - Set<Class<? extends Decorator>> ret = new HashSet<Class<? extends Decorator>>(); - - for (Class<? extends Decorator> cls : context.getDecoratorClasses()) { - if (Arrays.asList(cls.getInterfaces()).contains(targetIface)) { - ret.add(cls); - } - } - - return ret; - } -} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/util/DecoratorSetContext.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/util/DecoratorSetContext.java deleted file mode 100644 index d7b1676..0000000 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/util/DecoratorSetContext.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.jndi.util; - -import java.util.Set; - -/** - * Implementations of this interface provide a context to the {@link DecoratorPicker}. - * - * @author Lukas Krejci - */ -public interface DecoratorSetContext<Type, Decorator> { - - /** - * @return the set of interfaces that the decorators are able support. - * Usually this should be just a union of all interfaces the decorators implement - * but can be trimmed down. - */ - Set<Class<? extends Type>> getSupportedInterfaces(); - - /** - * @return the set of all decorator classes in this set - */ - Set<Class<? extends Decorator>> getDecoratorClasses(); - - /** - * Instantiates a new decorator of given class. - * @param decoratorClass - * @return - * @throws Exception - */ - Decorator instantiate(Class<? extends Decorator> decoratorClass) throws Exception; - - /** - * Initializes the decorator to decorate given object. - * - * @param decorator - * @param object - * @throws Exception on error - */ - void init(Decorator decorator, Type object) throws Exception; -} diff --git a/modules/enterprise/server/container-lib/src/test/java/org/rhq/jndi/context/DecoratingInvocationHandlerTest.java b/modules/enterprise/server/container-lib/src/test/java/org/rhq/jndi/context/DecoratingInvocationHandlerTest.java deleted file mode 100644 index 45ba114..0000000 --- a/modules/enterprise/server/container-lib/src/test/java/org/rhq/jndi/context/DecoratingInvocationHandlerTest.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.jndi.context; - -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.Properties; -import java.util.Set; - -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.Name; -import javax.naming.NamingException; -import javax.naming.directory.DirContext; -import javax.naming.event.EventContext; -import javax.naming.event.NamingListener; -import javax.naming.spi.InitialContextFactory; -import javax.naming.spi.NamingManager; - -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import org.rhq.jndi.AccessCheckingInitialContextFactoryBuilder; - -/** - * - * - * @author Lukas Krejci - */ -@Test -public class DecoratingInvocationHandlerTest { - private static final Set<String> INVOKED_METHODS = new HashSet<String>(); - - private static final InvocationHandler NOTE_TAKING_HANDLER = new InvocationHandler() { - - public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { - INVOKED_METHODS.add(method.getName()); - - if ("hashCode".equals(method.getName())) { - return 0; - } else if ("equals".equals(method.getName())) { - return false; - } - - return null; - } - }; - - private static Class<?>[] CONTEXT_INTERFACES; - - public static class Factory implements InitialContextFactory { - public Context getInitialContext(Hashtable<?, ?> environment) - throws NamingException { - - return (Context) Proxy.newProxyInstance(DecoratingInvocationHandlerTest.class.getClassLoader(), CONTEXT_INTERFACES, NOTE_TAKING_HANDLER); - } - } - - private static class DummyInitialEventContext extends InitialContext implements EventContext { - - /** - * @param environment - * @throws NamingException - */ - public DummyInitialEventContext(Hashtable<?, ?> environment) throws NamingException { - super(environment); - } - - public void addNamingListener(Name target, int scope, NamingListener l) throws NamingException { - ((EventContext)getURLOrDefaultInitCtx(target)).addNamingListener(target, scope, l); - } - - public void addNamingListener(String target, int scope, NamingListener l) throws NamingException { - ((EventContext)getURLOrDefaultInitCtx(target)).addNamingListener(target, scope, l); - } - - public void removeNamingListener(NamingListener l) throws NamingException { - ((EventContext)getDefaultInitCtx()).removeNamingListener(l); - } - - public boolean targetMustExist() throws NamingException { - return ((EventContext)getDefaultInitCtx()).targetMustExist(); - } - - - } - - @BeforeClass - public void setBuilder() throws Exception { - NamingManager.setInitialContextFactoryBuilder(new AccessCheckingInitialContextFactoryBuilder()); - } - - public void testSimpleDispatch() throws Exception { - INVOKED_METHODS.clear(); - Properties env = new Properties(); - env.put(Context.INITIAL_CONTEXT_FACTORY, Factory.class.getName()); - - CONTEXT_INTERFACES = new Class<?>[] { Context.class }; - - InitialContext ctx = new InitialContext(env); - - ctx.lookup("asdf"); - - assert INVOKED_METHODS.contains("lookup") : "The lookup doesn't seem to have propagated to the actual context to be used."; - } - - public void testMultiInterfaceDispatch() throws Exception { - INVOKED_METHODS.clear(); - Properties env = new Properties(); - env.put(Context.INITIAL_CONTEXT_FACTORY, Factory.class.getName()); - - CONTEXT_INTERFACES = new Class<?>[] { EventContext.class, DirContext.class }; - - InitialContext ctx = new InitialContext(env); - - ctx.lookup("asdf"); - - DummyInitialEventContext ectx = new DummyInitialEventContext(env); - - ectx.addNamingListener("hodiny", 0, null); - - assert INVOKED_METHODS.contains("lookup") : "The lookup doesn't seem to have propagated to the actual context to be used."; - assert INVOKED_METHODS.contains("addNamingListener") : "The addNamingListener doesn't seem to have propagated to the actual context to be used."; - } -} diff --git a/modules/enterprise/server/container-lib/src/test/java/org/rhq/jndi/context/DecoratorPickerTest.java b/modules/enterprise/server/container-lib/src/test/java/org/rhq/jndi/context/DecoratorPickerTest.java deleted file mode 100644 index e2d7429..0000000 --- a/modules/enterprise/server/container-lib/src/test/java/org/rhq/jndi/context/DecoratorPickerTest.java +++ /dev/null @@ -1,180 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.jndi.context; - -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; - -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -import javax.naming.Context; -import javax.naming.directory.DirContext; -import javax.naming.event.EventContext; -import javax.naming.ldap.LdapContext; - -import org.testng.annotations.Test; - -import org.rhq.jndi.util.DecoratorPicker; -import org.rhq.jndi.util.DecoratorSetContext; - -/** - * @author Lukas Krejci - */ -@Test -public class DecoratorPickerTest { - - private static final InvocationHandler DUMMY_HANDLER = new InvocationHandler() { - - public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { - if ("hashCode".equals(method.getName())) { - return 0; - } else if ("equals".equals(method.getName())) { - return false; - } - - return null; - } - }; - - private static final Class<?> TEST_OBJECT_CLASS1 = createProxyClass(Context.class); - private static final Class<?> TEST_OBJECT_CLASS2 = createProxyClass(DirContext.class); - private static final Class<?> TEST_OBJECT_CLASS3 = createProxyClass(LdapContext.class); - private static final Class<?> TEST_OBJECT_CLASS4 = createProxyClass(LdapContext.class, EventContext.class); - private static final Class<?> DECORATOR_CLASS1 = createProxyClass(Context.class); - private static final Class<?> DECORATOR_CLASS2 = createProxyClass(EventContext.class); - private static final Class<?> DECORATOR_CLASS3 = createProxyClass(LdapContext.class); - private static final Class<?> DECORATOR_CLASS4 = createProxyClass(DirContext.class); - - public void testSimpleDecoratorIdentifiedByClass() throws Exception { - DecoratorPicker<Object, Object> picker = createTestPicker(); - - Set<Object> contextDecorators = picker.getDecoratorsForClass(TEST_OBJECT_CLASS1); - assertEquals(contextDecorators.size(), 1, "Expected exactly one decorator for Context class"); - assertEquals(contextDecorators.iterator().next().getClass().getInterfaces()[0], Context.class); - } - - public void testSuperClassDecoratorHasPrecedenceOverSubClassDecorator() throws Exception { - DecoratorPicker<Object, Object> picker = createTestPicker(); - - //this tests that the LdapContext isn't returned even though it subclasses the DirContext - Set<Object> contextDecorators = picker.getDecoratorsForClass(TEST_OBJECT_CLASS2); - assertEquals(contextDecorators.size(), 1, "Expected exactly one decorator for DirContext class"); - assertEquals(contextDecorators.iterator().next().getClass().getInterfaces()[0], DirContext.class); - } - - public void testSubClassDecoratorCorrectlyIdentified() throws Exception { - DecoratorPicker<Object, Object> picker = createTestPicker(); - - Set<Object> contextDecorators = picker.getDecoratorsForClass(TEST_OBJECT_CLASS3); - assertEquals(contextDecorators.size(), 1, "Expected exactly one decorator for LdapContext class"); - assertEquals(contextDecorators.iterator().next().getClass().getInterfaces()[0], LdapContext.class); - } - - public void testMultipleDecoratorsDetectable() throws Exception { - DecoratorPicker<Object, Object> picker = createTestPicker(); - - Set<Object> decorators = picker.getDecoratorsForClass(TEST_OBJECT_CLASS4); - assertEquals(decorators.size(), 2, - "Exactly 2 decorators should have been found for a class implementing 2 interfaces."); - - boolean ldapContextDecoratorFound = false; - boolean eventContextDecoratorFound = false; - - for (Object d : decorators) { - if (LdapContext.class.isAssignableFrom(d.getClass())) { - ldapContextDecoratorFound = true; - continue; //just to make sure that somehow the decorator doesn't implement both - } - if (EventContext.class.isAssignableFrom(d.getClass())) { - eventContextDecoratorFound = true; - } - } - - assertTrue(ldapContextDecoratorFound && eventContextDecoratorFound, - "The found decorators don't implement the desired interfaces."); - } - - public void testDecoratorsIdentifiedByMethod() throws Exception { - DecoratorPicker<Object, Object> picker = createTestPicker(); - - Set<Object> decorators = - picker.getDecoratorsForMethod(LdapContext.class.getMethod("getConnectControls", (Class<?>[]) null)); - assertEquals(decorators.size(), 1, - "Expected exactly one decorator for method 'getConnectControls()' from LdapContext class"); - assertEquals(decorators.iterator().next().getClass().getInterfaces()[0], LdapContext.class); - } - - public void testMethodFromSubclassMatchesSubclassDecorator() throws Exception { - DecoratorPicker<Object, Object> picker = createTestPicker(); - - //this is a method from the DirContext but we're asking for it from a class - //that implements also an LdapContext - //The LdapContext decorator also inherits from the DirContext decorator - //(by the virtue of LdapContext interface inheriting from the DirContext) - //The picker should therefore match the LdapContext decorator because its - //the "closest" one to the actual class. - Set<Object> decorators = - picker.getDecoratorsForMethod(TEST_OBJECT_CLASS3.getMethod("getSchemaClassDefinition", - new Class<?>[] { String.class })); - assertEquals(decorators.size(), 1, - "Expected exactly one decorator for method 'getSchemaClassDefinition(String)' from LdapContext class"); - assertEquals(decorators.iterator().next().getClass().getInterfaces()[0], LdapContext.class); - } - - private static Class<?> createProxyClass(Class<?>... ifaces) { - return Proxy.getProxyClass(DecoratorPickerTest.class.getClassLoader(), ifaces); - } - - private static DecoratorPicker<Object, Object> createTestPicker() { - DecoratorPicker<Object, Object> picker = new DecoratorPicker<Object, Object>(); - - DecoratorSetContext<Object, Object> decSet = new DecoratorSetContext<Object, Object>() { - - public Object instantiate(Class<? extends Object> decoratorClass) throws Exception { - Constructor<? extends Object> ctor = decoratorClass.getConstructor(InvocationHandler.class); - return ctor.newInstance(DUMMY_HANDLER); - } - - public void init(Object decorator, Object object) throws Exception { - } - - @SuppressWarnings("unchecked") - public Set<Class<? extends Object>> getSupportedInterfaces() { - return new HashSet<Class<? extends Object>>(Arrays.asList(Context.class, EventContext.class, - LdapContext.class, DirContext.class)); - } - - @SuppressWarnings("unchecked") - public Set<Class<? extends Object>> getDecoratorClasses() { - return new HashSet<Class<? extends Object>>(Arrays.asList(DECORATOR_CLASS1, DECORATOR_CLASS2, DECORATOR_CLASS3, DECORATOR_CLASS4)); - } - }; - - picker.setContext(decSet); - - return picker; - } -} diff --git a/modules/enterprise/server/ear/pom.xml b/modules/enterprise/server/ear/pom.xml index 596b91c..9f7df36 100644 --- a/modules/enterprise/server/ear/pom.xml +++ b/modules/enterprise/server/ear/pom.xml @@ -125,10 +125,6 @@ <exclusions> <exclusion> <groupId>${project.groupId}</groupId> - <artifactId>rhq-container-lib</artifactId> - </exclusion> - <exclusion> - <groupId>${project.groupId}</groupId> <artifactId>rhq-enterprise-server</artifactId> </exclusion> </exclusions> diff --git a/modules/enterprise/server/ear/src/main/application/META-INF/jboss-deployment-structure.xml b/modules/enterprise/server/ear/src/main/application/META-INF/jboss-deployment-structure.xml index 8c4ad54..f3d48d1 100644 --- a/modules/enterprise/server/ear/src/main/application/META-INF/jboss-deployment-structure.xml +++ b/modules/enterprise/server/ear/src/main/application/META-INF/jboss-deployment-structure.xml @@ -16,6 +16,7 @@ <module name="org.dom4j" export="true" /> <!-- rhq ejb jar module declares this with runtime/provided scope --> <module name="javax.mail.api" export="true" /> <!-- for sending email notifications --> <module name="org.picketbox" export="true" /> <!-- for obfuscating passwords --> + <module name="org.jboss.as.naming" export="true" /> </dependencies> </deployment>
@@ -37,6 +38,8 @@ <module name="org.jboss.msc" export="true" /> <module name="org.jboss.as.controller" export="true" /> <module name="org.jboss.as.server" export="true" /> + <module name="org.jboss.modules" export="true" /> + <module name="org.jboss.as.naming" export="true" /> </dependencies> </sub-deployment>
diff --git a/modules/enterprise/server/itests-2/pom.xml b/modules/enterprise/server/itests-2/pom.xml index 1b50266..cc9c941 100644 --- a/modules/enterprise/server/itests-2/pom.xml +++ b/modules/enterprise/server/itests-2/pom.xml @@ -23,7 +23,7 @@ <properties> <jboss.zip>${settings.localRepository}/org/jboss/as/jboss-as-dist/${jboss.version}/jboss-as-dist-${jboss.version}.zip</jboss.zip> <jboss.unzip.location>${basedir}/target/jboss-as-${jboss.version}</jboss.unzip.location> - <jboss.vm.args>-Xmx700m -XX:MaxPermSize=200m</jboss.vm.args> + <jboss.vm.args>-Xmx700m -XX:MaxPermSize=200m -Djava.security.manager -Djava.security.policy==${jboss.unzip.location}/security.policy</jboss.vm.args> <jboss.vm.args.debug></jboss.vm.args.debug> <!-- -Ditest.debug can override this, see below --> </properties>
@@ -223,7 +223,13 @@ <echo>Unzipping JBossAS ${jboss.version} found at ${jboss.zip}</echo> <unzip src="${jboss.zip}" dest="${jboss.unzip.location}/.." /> <echo>JBossAS ${jboss.version} should now be at: ${jboss.unzip.location}</echo> - <property name="jboss.conf" location="${jboss.unzip.location}/standalone/configuration/standalone.xml" /> + + <echo>Copying security policy to JBossAS</echo> + <copy file="${project.build.directory}/test-classes/security.policy" tofile="${jboss.unzip.location}/security.policy"/> + + <property + name="jboss.conf" + location="${jboss.unzip.location}/standalone/configuration/standalone.xml" /> <echo>Will now add test configuration to JBossAS config file: ${jboss.conf}</echo> <replace file="${jboss.conf}">
@@ -653,7 +659,6 @@ <skipTests>${skipTests}</skipTests> <excludes> <!-- NOTE: PERF GROUP AND SOME CLASSES EXCLUDED (SEE BZ 874696) --> - <exclude>**/JndiAccessTest.java</exclude> <exclude>**/LdapGroupManagerBeanTest.java</exclude> <exclude>**/SynchronizationManagerBeanTest.java</exclude> <exclude>org/rhq/**/performance/**/*.java</exclude> diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/security/test/JndiAccessTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/security/test/JndiAccessTest.java index 274e94f..fabe6ae 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/security/test/JndiAccessTest.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/security/test/JndiAccessTest.java @@ -24,6 +24,7 @@ import java.io.PrintWriter; import java.security.PermissionCollection; import java.util.Collections;
+import javax.naming.Context; import javax.script.ScriptEngine; import javax.script.ScriptException;
@@ -37,10 +38,9 @@ import org.rhq.bindings.util.PackageFinder; import org.rhq.core.domain.auth.Subject; import org.rhq.enterprise.client.LocalClient; import org.rhq.enterprise.server.RHQConstants; -import org.rhq.enterprise.server.auth.SubjectManagerBean; +import org.rhq.enterprise.server.system.SystemManagerBean; import org.rhq.enterprise.server.test.AbstractEJB3Test; import org.rhq.enterprise.server.util.LookupUtil; -import org.rhq.jndi.AllowRhqServerInternalsAccessPermission;
/** * @@ -50,6 +50,21 @@ import org.rhq.jndi.AllowRhqServerInternalsAccessPermission; @Test public class JndiAccessTest extends AbstractEJB3Test {
+ public void testScriptCantOverrideSystemProperties() throws Exception { + Subject overlord = LookupUtil.getSubjectManager().getOverlord(); + + ScriptEngine engine = getEngine(overlord); + + try { + engine.eval("java.lang.System.setProperty('java.naming.factory.url.pkgs', 'counterfeit');"); + } catch (ScriptException e) { + Assert.assertTrue( + e.getMessage().contains( + "access denied ("java.util.PropertyPermission" "java.naming.factory.url.pkgs" "write")"), + "The script shouldn't have write access to the system properties."); + } + } + public void testEjbsAccessibleThroughPrivilegedCode() { LookupUtil.getSubjectManager().getOverlord(); } @@ -67,14 +82,18 @@ public class JndiAccessTest extends AbstractEJB3Test {
ScriptEngine engine = getEngine(overlord);
- String jndiName = "java:global/rhq/rhq-enterprise-server-ejb3/" + SubjectManagerBean.class.getSimpleName() - + "!" + SubjectManagerBean.class.getName().replace("Bean", "Local"); + String jndiName = "java:global/rhq/rhq-enterprise-server-ejb3/" + + SystemManagerBean.class.getSimpleName() + + "!" + + SystemManagerBean.class.getName().replace("Bean", "Local");
try { engine.eval("" + "var ctx = new javax.naming.InitialContext();\n" - + "var subjectManager = ctx.lookup('" + jndiName + "');\n" - + "subjectManager.getOverlord();"); + + "var systemManager = ctx.lookup('" + + jndiName + + "');\n" + + "systemManager.isDebugModeEnabled();");
Assert.fail("The script shouldn't have been able to call local SLSB method."); } catch (ScriptException e) { @@ -82,19 +101,51 @@ public class JndiAccessTest extends AbstractEJB3Test { } }
+ public void testLocalEjbsInaccessibleThroughJndiLookupWithCustomUrlPackages() throws ScriptException, IOException { + Subject overlord = LookupUtil.getSubjectManager().getOverlord(); + + ScriptEngine engine = getEngine(overlord); + + String jndiName = "java:global/rhq/rhq-enterprise-server-ejb3/" + + SystemManagerBean.class.getSimpleName() + + "!" + + SystemManagerBean.class.getName().replace("Bean", "Local"); + + try { + engine.eval("" + + "var env = new java.util.Hashtable();\n" + + "env.put('" + + Context.URL_PKG_PREFIXES + + "', 'org.jboss.as.naming.interfaces');\n" + + "var ctx = new javax.naming.InitialContext(env);\n" + + "var systemManager = ctx.lookup('" + + jndiName + + "');\n" + + "systemManager.isDebugModeEnabled();"); + + Assert.fail("The script shouldn't have been able to call local SLSB method."); + } catch (ScriptException e) { + checkIsDesiredSecurityException(e); + } + } + public void testRemoteEjbsInaccessibleThroughJndiLookup() throws ScriptException, IOException { Subject overlord = LookupUtil.getSubjectManager().getOverlord();
ScriptEngine engine = getEngine(overlord);
- String jndiName = "java:global/rhq/rhq-enterprise-server-ejb3/" + SubjectManagerBean.class.getSimpleName() - + "!" + SubjectManagerBean.class.getName().replace("Bean", "Remote"); + String jndiName = "java:global/rhq/rhq-enterprise-server-ejb3/" + + SystemManagerBean.class.getSimpleName() + + "!" + + SystemManagerBean.class.getName().replace("Bean", "Remote");
try { engine.eval("" + "var ctx = new javax.naming.InitialContext();\n" - + "var subjectManager = ctx.lookup('" + jndiName + "');\n" - + "subjectManager.getSubjectByName('rhqadmin');"); + + "var systemManager = ctx.lookup('" + + jndiName + + "');\n" + + "systemManager.getSystemSettings(subject);");
Assert.fail("The script shouldn't have been able to call remote SLSB method directly."); } catch (ScriptException e) { @@ -198,7 +249,29 @@ public class JndiAccessTest extends AbstractEJB3Test { checkIsNotASecurityException(e); } } - + + //THIS IS A NEW REQUIREMENT THAT DOESN'T CURRENTLY WORK... + // public void testInitialContextFactoryBuilderNotReplaceableUsingScripts() throws Exception { + // Subject overlord = LookupUtil.getSubjectManager().getOverlord(); + // + // ScriptEngine engine = getEngine(overlord); + // + // try { + // engine.eval("" + // + "var mgrCls = java.lang.Class.forName('javax.naming.spi.NamingManager');\n" + // + "var fld = mgrCls.getDeclaredField('initctx_factory_builder');\n" + // + "fld.setAccessible(true);\n" + // + "fld.set(null, null);\n"); + // + // Assert.fail("It should not be possible to use reflection to reset the initial context factory builder."); + // } catch (ScriptException e) { + // checkIsDesiredSecurityException(e); + // } finally { + // //restore the default behavior + // NamingHack.bruteForceInitialContextFactoryBuilder(); + // } + // } + private ScriptEngine getEngine(Subject subject) throws ScriptException, IOException { StandardBindings bindings = new StandardBindings(new PrintWriter(System.out), new LocalClient(subject));
@@ -210,15 +283,25 @@ public class JndiAccessTest extends AbstractEJB3Test {
private static void checkIsDesiredSecurityException(ScriptException e) { String message = e.getMessage(); - String permissionTrace = AllowRhqServerInternalsAccessPermission.class.getName(); + String permissionTrace = "org.rhq.allow.server.internals.access";
- Assert.assertTrue(message.contains(permissionTrace), "The script exception doesn't seem to be caused by the AllowRhqServerInternalsAccessPermission security exception. " + message); + if (!message.contains(permissionTrace)) { + Assert + .fail( + "The script exception doesn't seem to be caused by the AllowRhqServerInternalsAccessPermission security exception. ", + e); + } }
private static void checkIsNotASecurityException(ScriptException e) { String message = e.getMessage(); - String permissionTrace = AllowRhqServerInternalsAccessPermission.class.getName(); + String permissionTrace = "org.rhq.allow.server.internals.access";
- Assert.assertFalse(message.contains(permissionTrace), "The script exception does seem to be caused by the AllowRhqServerInternalsAccessPermission security exception although it shouldn't. " + message); + if (message.contains(permissionTrace)) { + Assert + .fail( + "The script exception does seem to be caused by the AllowRhqServerInternalsAccessPermission security exception although it shouldn't. ", + e); + } } } diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java index f1ba91f..f27a5ba 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java @@ -39,6 +39,7 @@ import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ArchivePaths; import org.jboss.shrinkwrap.api.Filters; import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.asset.ClassAsset; import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.exporter.ZipExporter; import org.jboss.shrinkwrap.api.spec.EnterpriseArchive; @@ -308,6 +309,13 @@ public abstract class AbstractEJB3Test extends Arquillian { testEar.delete(ArchivePaths .create("/rhq-enterprise-server-ejb3.jar/org/rhq/enterprise/server/core/ShutdownListener.class"));
+ //replace the above startup beans with stripped down versions + testEar.add(new ClassAsset(StrippedDownStartupBean.class), ArchivePaths + .create("/rhq-enterprise-server-ejb3.jar/org/rhq/enterprise/server/test/StrippedDownStartupBean.class")); + testEar.add(new ClassAsset(StrippedDownStartupBeanPreparation.class), ArchivePaths + .create("/rhq-enterprise-server-ejb3.jar/org/rhq/enterprise/server/test/" + + "StrippedDownStartupBeanPreparation.class")); + // add the test classes to the deployment testEar.addAsLibrary(testClassesJar);
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/StrippedDownStartupBean.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/StrippedDownStartupBean.java new file mode 100644 index 0000000..bfe9f32 --- /dev/null +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/StrippedDownStartupBean.java @@ -0,0 +1,45 @@ +/* + * RHQ Management Platform + * Copyright 2012, Red Hat Middleware LLC, and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +package org.rhq.enterprise.server.test; + +import javax.ejb.Singleton; +import javax.ejb.TransactionAttribute; +import javax.ejb.TransactionAttributeType; + +import org.rhq.enterprise.server.core.StartupBean; +import org.rhq.enterprise.server.naming.NamingHack; + +/** + * This is a replacement for the fullblown {@link StartupBean} of the actual RHQ server. + * @author Lukas Krejci + */ +@Singleton +public class StrippedDownStartupBean { + + @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) + public void secureNaming() { + NamingHack.bruteForceInitialContextFactoryBuilder(); + } + + public void init() { + secureNaming(); + } +} diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/StrippedDownStartupBeanPreparation.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/StrippedDownStartupBeanPreparation.java new file mode 100644 index 0000000..e32d8a4 --- /dev/null +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/StrippedDownStartupBeanPreparation.java @@ -0,0 +1,75 @@ +/* + * RHQ Management Platform + * Copyright 2012, Red Hat Middleware LLC, and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +package org.rhq.enterprise.server.test; + +import javax.annotation.PostConstruct; +import javax.annotation.Resource; +import javax.ejb.EJB; +import javax.ejb.Singleton; +import javax.ejb.Startup; +import javax.ejb.Timeout; +import javax.ejb.TimerConfig; +import javax.ejb.TimerService; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * This startup singleton EJB is here to work around bug AS7-5530 and to + * schedule the real StartupBean's work in a delayed fashion (this is to allow + * AS7 to complete its deployment work before we do our work). + * + * See https://issues.jboss.org/browse/AS7-5530 + * + * This version is a replacement for the original code (identical) code that uses the StrippedDownStartupBean instead + * of the fullblown original. + */ +@Singleton +@Startup +public class StrippedDownStartupBeanPreparation { + private Log log = LogFactory.getLog(this.getClass()); + + @EJB + private StrippedDownStartupBean startupBean; + + @Resource + private TimerService timerService; // needed to schedule our startup bean init call + + @PostConstruct + public void initWithTransactionBecauseAS75530() throws RuntimeException { + log.info("Scheduling the initialization of the testing RHQ deployment"); + timerService.createSingleActionTimer(1, new TimerConfig(null, false)); // call StartupBean in 1ms + } + + @Timeout + public void initializeServer() throws RuntimeException { + try { + log.info("Initializing the testing RHQ deployment"); + this.startupBean.init(); + } catch (Throwable t) { + // do NOT allow exceptions to bubble out of our method because then + // the EJB container would simply re-trigger the timer and call us again + // and we don't want to keep failing over and over filling the logs + // in an infinite loop. + log.fatal("The server failed to start up properly", t); + } + } +} diff --git a/modules/enterprise/server/itests-2/src/test/resources/security.policy b/modules/enterprise/server/itests-2/src/test/resources/security.policy new file mode 100644 index 0000000..8860b47 --- /dev/null +++ b/modules/enterprise/server/itests-2/src/test/resources/security.policy @@ -0,0 +1,10 @@ +// We need the SecurityManager installed to enable sandboxing of CLI scripts +// but we don't define any other security measures on the RHQ server itself. +// +// Granting all permissions allows us to run the RHQ server as if no security +// manager was in place (which is assumed by default by JBoss AS) but be able +// to use it when we need it for our own purposes. + +grant { + permission java.security.AllPermission; +}; diff --git a/modules/enterprise/server/jar/pom.xml b/modules/enterprise/server/jar/pom.xml index 87674b0..f035ed6 100644 --- a/modules/enterprise/server/jar/pom.xml +++ b/modules/enterprise/server/jar/pom.xml @@ -88,12 +88,6 @@ </dependency>
<dependency> - <groupId>org.rhq</groupId> - <artifactId>rhq-container-lib</artifactId> - <version>${project.version}</version> - </dependency> - - <dependency> <groupId>com.googlecode.java-diff-utils</groupId> <artifactId>diffutils</artifactId> <version>1.2.1</version> @@ -108,10 +102,14 @@ <dependency> <groupId>org.jboss.as</groupId> <artifactId>jboss-as-server</artifactId> - <version>${jboss.version}</version> <scope>provided</scope> <!-- provided by AS7 --> </dependency>
+ <dependency> + <groupId>org.jboss.as</groupId> + <artifactId>jboss-as-naming</artifactId> + <scope>provided</scope> <!-- provided by AS7 --> + </dependency>
<!--================ Test Deps ================-->
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/AllowRhqServerInternalsAccessPermission.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/AllowRhqServerInternalsAccessPermission.java new file mode 100644 index 0000000..d448049 --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/AllowRhqServerInternalsAccessPermission.java @@ -0,0 +1,36 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2011 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; + +import java.security.BasicPermission; + +/** + * + * + * @author Lukas Krejci + */ +public class AllowRhqServerInternalsAccessPermission extends BasicPermission { + + private static final long serialVersionUID = 1L; + + public AllowRhqServerInternalsAccessPermission() { + super("org.rhq.allow.server.internals.access"); + } +} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SessionManager.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SessionManager.java index ecf2f6f..8819cab 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SessionManager.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SessionManager.java @@ -25,8 +25,8 @@ import java.util.Map; import java.util.Random;
import org.rhq.core.domain.auth.Subject; +import org.rhq.enterprise.server.AllowRhqServerInternalsAccessPermission; import org.rhq.enterprise.server.util.LookupUtil; -import org.rhq.jndi.AllowRhqServerInternalsAccessPermission;
/** * This is the JON Server's own session ID generator. It is outside any container-provided session mechanism. Its sole diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java index a5a38d3..f48c228 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java @@ -69,6 +69,7 @@ import org.rhq.enterprise.server.cloud.instance.ServerManagerLocal; import org.rhq.enterprise.server.cloud.instance.SyncEndpointAddressException; import org.rhq.enterprise.server.core.comm.ServerCommunicationsServiceUtil; import org.rhq.enterprise.server.core.plugin.PluginDeploymentScannerMBean; +import org.rhq.enterprise.server.naming.NamingHack; import org.rhq.enterprise.server.plugin.pc.MasterServerPluginContainer; import org.rhq.enterprise.server.plugin.pc.ServerPluginServiceMBean; import org.rhq.enterprise.server.resource.ResourceTypeManagerLocal; @@ -138,6 +139,16 @@ public class StartupBean { private DataSource dataSource;
/** + * Modifies the naming subsystem to be able to check for Java security permissions on JNDI lookup. + * <p> + * Made public so that this can be reused in tests. + */ + @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) + public void secureNaming() { + NamingHack.bruteForceInitialContextFactoryBuilder(); + } + + /** * Performs the final RHQ Server initialization work that needs to talk place. EJBs are available in this method. * * @throws RuntimeException @@ -145,6 +156,8 @@ public class StartupBean { //@PostConstruct // when AS7-5530 is fixed, uncomment this and remove class StartupBeanToWorkaroundAS7_5530 @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) public void init() throws RuntimeException { + secureNaming(); + initialized = false;
log.info("All business tier deployments are complete - finishing the startup..."); @@ -824,5 +837,4 @@ public class StartupBean { + ") Server started."); log.info("--------------------------------------------------"); // 50 dashes } - } diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/AccessCheckingInitialContextFactoryBuilder.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/AccessCheckingInitialContextFactoryBuilder.java new file mode 100644 index 0000000..9681014 --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/AccessCheckingInitialContextFactoryBuilder.java @@ -0,0 +1,295 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2011 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.naming; + +import java.net.InetAddress; +import java.net.NetworkInterface; +import java.net.SocketException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.UnknownHostException; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.util.ArrayList; +import java.util.Collections; +import java.util.EnumMap; +import java.util.Enumeration; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.Set; + +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NamingException; +import javax.naming.directory.DirContext; +import javax.naming.event.EventContext; +import javax.naming.event.EventDirContext; +import javax.naming.ldap.LdapContext; +import javax.naming.spi.InitialContextFactory; +import javax.naming.spi.InitialContextFactoryBuilder; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import org.rhq.enterprise.server.AllowRhqServerInternalsAccessPermission; +import org.rhq.enterprise.server.naming.context.AccessCheckingContextDecorator; +import org.rhq.enterprise.server.naming.context.AccessCheckingContextDecoratorSetContext; +import org.rhq.enterprise.server.naming.context.ContextDecorator; +import org.rhq.enterprise.server.naming.context.URLPreferringContextDecoratorSetContext; +import org.rhq.enterprise.server.naming.util.DecoratorPicker; + +/** + * This initial context factory builder is installed early on during the RHQ server startup + * and is later on used for obtaining the {@link Context}s for all JNDI lookups in the + * RHQ server. + * <p> + * We use a custom initial context factory builder to prevent the potential malicious 3rd party + * code (like CLI alert scripts) from supplying custom environment variables to {@link InitialContext} + * that would modify the JNDI lookup to skip our security access checks. + * <p> + * By using a builder we effectively take control of the initial context creation process + * and are free to ignore whatever the script is trying to supply. + * <p> + * This builder makes sure to install the RHQ server's security access checks to whatever + * initial context that is configured by the standard environment variables + * ({@link Context#INITIAL_CONTEXT_FACTORY}, etc.) + * + * @see AllowRhqServerInternalsAccessPermission + * + * @author Lukas Krejci + */ +public class AccessCheckingInitialContextFactoryBuilder implements InitialContextFactoryBuilder { + private static final Log LOG = LogFactory.getLog(AccessCheckingInitialContextFactoryBuilder.class); + + /** + * The list of JNDI name schemes that should be checked for security permissions + * (in addition to the names with no scheme). + * + * @see AccessCheckingContextDecorator + */ + private static final String[] CHECKED_SCHEMES = { "java" }; + + private static final Set<Class<? extends Context>> SUPPORTED_CONTEXT_INTERFACES; + + static { + SUPPORTED_CONTEXT_INTERFACES = new HashSet<Class<? extends Context>>(); + SUPPORTED_CONTEXT_INTERFACES.add(Context.class); + SUPPORTED_CONTEXT_INTERFACES.add(DirContext.class); + SUPPORTED_CONTEXT_INTERFACES.add(EventContext.class); + SUPPORTED_CONTEXT_INTERFACES.add(EventDirContext.class); + SUPPORTED_CONTEXT_INTERFACES.add(LdapContext.class); + } + + private static final Set<InetAddress> SERVER_BIND_IPS; + static { + SERVER_BIND_IPS = new HashSet<InetAddress>(); + + try { + String bindingAddressString = System.getProperty("jboss.bind.address"); + InetAddress bindingAddress = InetAddress.getByName(bindingAddressString); + + if (bindingAddress.isAnyLocalAddress()) { + Enumeration<NetworkInterface> ifaces = NetworkInterface.getNetworkInterfaces(); + while (ifaces.hasMoreElements()) { + NetworkInterface iface = ifaces.nextElement(); + SERVER_BIND_IPS.addAll(Collections.list(iface.getInetAddresses())); + } + } else { + SERVER_BIND_IPS.add(bindingAddress); + } + } catch (SocketException e) { + LOG.error("Could not obtain the list of local IPs", e); + } catch (UnknownHostException e) { + LOG.error("Failed to get the binding address of the RHQ server.", e); + } + } + + //TODO this most probably no longer applies because AS7 doesn't use JNP for JNDI + private static final int JNP_PORT = Integer.parseInt(System.getProperty("rhq.server.startup.namingservice.port", + "2099")); + + private static InitialContextFactory getJbossDefaultInitialContextFactory() throws NamingException { + try { + Class<?> cls = Class.forName("org.jboss.as.naming.InitialContextFactory"); + return (InitialContextFactory) cls.newInstance(); + } catch (Exception e) { + NamingException ne = new NamingException( + "Failed to obtain the default initial context factory from JBoss AS."); + ne.initCause(e); + + throw ne; + } + } + + private enum FactoryType { + ACCESS_CHECKING { + + @Override + public InitialContextFactory wrap(InitialContextFactory factory) { + ArrayList<DecoratorPicker<Context, ContextDecorator>> pickers = new ArrayList<DecoratorPicker<Context, ContextDecorator>>(); + pickers.add(getURLPreferringDecoratorPicker()); + pickers.add(getAccessCheckingDecoratorPicker()); + + return new DecoratingInitialContextFactory(factory, pickers); + } + }, + URL_PREFERRING { + + @Override + public InitialContextFactory wrap(InitialContextFactory factory) { + ArrayList<DecoratorPicker<Context, ContextDecorator>> pickers = new ArrayList<DecoratorPicker<Context, ContextDecorator>>(); + pickers.add(getURLPreferringDecoratorPicker()); + + return new DecoratingInitialContextFactory(factory, pickers); + } + }; + + public abstract InitialContextFactory wrap(InitialContextFactory factory); + + public static FactoryType detect(Hashtable<?, ?> environment) { + String providerUrl = (String) environment.get(Context.PROVIDER_URL); + + if (providerUrl == null) { + return ACCESS_CHECKING; + } else { + try { + URI uri = new URI(providerUrl); + InetAddress providerHost = InetAddress.getByName(uri.getHost()); + + //check if we are accessing the RHQ server through some remoting + //interface. + if (uri.getPort() == JNP_PORT && SERVER_BIND_IPS.contains(providerHost)) { + return ACCESS_CHECKING; + } else { + return URL_PREFERRING; + } + } catch (URISyntaxException e) { + if (LOG.isDebugEnabled()) { + LOG.debug("The " + + Context.PROVIDER_URL + + " is not a valid URI. Falling back to using the access checking wrapper.", e); + } + return ACCESS_CHECKING; + } catch (UnknownHostException e) { + //let the factory deal with the unknown host... + //this most probably shouldn't be secured because localhost addresses + //should be resolvable. + if (LOG.isDebugEnabled()) { + LOG.debug("The " + + Context.PROVIDER_URL + + " is not resolvable. Falling back to using the URL preferring wrapper.", e); + } + return URL_PREFERRING; + } + } + } + + private static DecoratorPicker<Context, ContextDecorator> getAccessCheckingDecoratorPicker() { + DecoratorPicker<Context, ContextDecorator> ret = new DecoratorPicker<Context, ContextDecorator>(); + ret.setContext(new AccessCheckingContextDecoratorSetContext(SUPPORTED_CONTEXT_INTERFACES, CHECKED_SCHEMES)); + + return ret; + } + + private static DecoratorPicker<Context, ContextDecorator> getURLPreferringDecoratorPicker() { + DecoratorPicker<Context, ContextDecorator> ret = new DecoratorPicker<Context, ContextDecorator>(); + ret.setContext(new URLPreferringContextDecoratorSetContext(SUPPORTED_CONTEXT_INTERFACES)); + + return ret; + } + } + + private final EnumMap<FactoryType, InitialContextFactory> typeDefaults = new EnumMap<FactoryType, InitialContextFactory>( + FactoryType.class); + + private final String defaultFactoryClassName; + + /** + * @param defaultFactory the default factory to use if none can be deduced from the environment. If null, an attempt + * is made to obtain the default InitialContextFactory of JBoss AS (which may fail depending on the classloading + * "situation"). + * + * @throws NamingException + */ + public AccessCheckingInitialContextFactoryBuilder(InitialContextFactory defaultFactory) throws NamingException { + if (defaultFactory == null) { + defaultFactory = getJbossDefaultInitialContextFactory(); + } + + defaultFactoryClassName = defaultFactory.getClass().getName(); + + for (FactoryType ft : FactoryType.values()) { + typeDefaults.put(ft, ft.wrap(defaultFactory)); + } + } + + /** + * This is the default initial context factory that is returned when no other is + * configured using the environment variables. + * <p> + * It uses {@link NamingContextFactory} as the underlying mechanism - the same + * as the default configuration in JBoss 4. + */ + private final InitialContextFactory defaultFactory = new InitialContextFactory() { + public Context getInitialContext(Hashtable<?, ?> environment) throws NamingException { + return typeDefaults.get(FactoryType.detect(environment)).getInitialContext( + environment); + } + }; + + /** + * Create a InitialContext factory. If the environment does not override the factory class it will use the + * default context factory. + * + * @param environment The environment + * @return An initial context factory + * @throws NamingException If an error occurs loading the factory class. + */ + public InitialContextFactory createInitialContextFactory(Hashtable<?, ?> environment) throws NamingException { + final String factoryClassName = (String) environment.get(Context.INITIAL_CONTEXT_FACTORY); + if (factoryClassName == null || factoryClassName.equals(defaultFactoryClassName)) { + if (LOG.isDebugEnabled()) { + LOG.debug("No " + Context.INITIAL_CONTEXT_FACTORY + " set. Using the default factory."); + } + return defaultFactory; + } + final ClassLoader classLoader = getContextClassLoader(); + try { + final Class<?> factoryClass = Class.forName(factoryClassName, true, classLoader); + InitialContextFactory configuredFactory = (InitialContextFactory) factoryClass.newInstance(); + return FactoryType.detect(environment).wrap(configuredFactory); + } catch (Exception e) { + NamingException ne = new NamingException("Failed instantiate InitialContextFactory " + + factoryClassName + + " from classloader " + + classLoader); + ne.initCause(e); + + throw ne; + } + } + + private ClassLoader getContextClassLoader() { + return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() { + public ClassLoader run() { + return Thread.currentThread().getContextClassLoader(); + } + }); + } +} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/DecoratingInitialContextFactory.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/DecoratingInitialContextFactory.java new file mode 100644 index 0000000..602a68c --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/DecoratingInitialContextFactory.java @@ -0,0 +1,110 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.naming; + +import java.lang.reflect.Proxy; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.List; +import java.util.Set; + +import javax.naming.Context; +import javax.naming.NamingException; +import javax.naming.spi.InitialContextFactory; + +import org.rhq.enterprise.server.naming.context.ContextDecorator; +import org.rhq.enterprise.server.naming.util.DecoratingInvocationHandler; +import org.rhq.enterprise.server.naming.util.DecoratorPicker; + +/** + * This class implements an initial context factory that decorates the contexts + * returned from a "wrapped" initial factory passed to this class in the constructor. + * <p> + * The contexts returned from the wrapped initial factory are hidden behind a proxy + * that implements the intersection of interfaces from the <code>supportedContextInterfaces</code> + * constructor parameter and the actual interfaces the wrapped context implements. + * <p> + * The proxy method calls are handled using the {@link DecoratingInvocationHandler} which is initialized + * with the list of {@link DecoratorPicker pickers} that are used to intercept the method + * calls on the wrapped context. + * + * @see DecoratorPicker + * @see DecoratingInvocationHandler + * + * @author Lukas Krejci + */ +public class DecoratingInitialContextFactory implements InitialContextFactory { + + List<DecoratorPicker<Context, ContextDecorator>> pickers; + private InitialContextFactory factory; + private Set<Class<? extends Context>> supportedContextInterfaces; + + public DecoratingInitialContextFactory(InitialContextFactory factory, List<DecoratorPicker<Context, ContextDecorator>> decoratorPickers) { + this.factory = factory; + this.pickers = decoratorPickers; + this.supportedContextInterfaces = new HashSet<Class<? extends Context>>(); + for(DecoratorPicker<Context, ContextDecorator> picker : pickers) { + supportedContextInterfaces.addAll(picker.getContext().getSupportedInterfaces()); + } + } + + public Context getInitialContext(Hashtable<?, ?> environment) throws NamingException { + Context ctx = factory.getInitialContext(environment); + + Set<Class<?>> implementedIfaces = getAllImplementedInterfaces(ctx.getClass()); + Class<?>[] ii = new Class<?>[implementedIfaces.size()]; + implementedIfaces.toArray(ii); + + return (Context) Proxy.newProxyInstance(ctx.getClass().getClassLoader(), ii, new DecoratingInvocationHandler<Context, ContextDecorator>(pickers, ctx)); + } + + private Set<Class<?>> getAllImplementedInterfaces(Class<?> cls) { + HashSet<Class<?>> ret = new HashSet<Class<?>>(); + getAllImplementedInterfaces(cls, ret); + + ret.retainAll(supportedContextInterfaces); + + return ret; + } + + private static void getAllImplementedInterfaces(Class<?> cls, Set<Class<?>> output) { + Class<?>[] ifaces = cls.getInterfaces(); + + for (Class<?> iface : Arrays.asList(ifaces)) { + output.add(iface); + getAllImplementedInterfaces(iface, output); + } + + if (cls.getSuperclass() != null) { + getAllImplementedInterfaces(cls.getSuperclass(), output); + } + } + + @Override + public int hashCode() { + return factory.hashCode(); + } + + @Override + public boolean equals(Object o) { + return factory.equals(o); + } +} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/NamingHack.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/NamingHack.java new file mode 100644 index 0000000..f21322f --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/NamingHack.java @@ -0,0 +1,103 @@ +/* + * RHQ Management Platform + * Copyright 2012, Red Hat Middleware LLC, and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +package org.rhq.enterprise.server.naming; + +import java.lang.reflect.Field; +import java.util.Hashtable; + +import javax.naming.spi.InitialContextFactory; +import javax.naming.spi.InitialContextFactoryBuilder; +import javax.naming.spi.NamingManager; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * @author Lukas Krejci + */ +public class NamingHack { + + private static final Log LOG = LogFactory.getLog(NamingHack.class); + + //in case this method is called multiple times, which can happen during the tests, + //remember the builder encountered the first time... + private static InitialContextFactoryBuilder originalBuilder; + + public static void bruteForceInitialContextFactoryBuilder() { + LOG.info("Modifying the naming subsystem to enable secure execution of scripts inside the server..."); + + //it is important to synchronize on the NamingManager class because the get/setInitialContextFactoryBuilder + //methods in that class are static synchronized. By holding the lock on the NamingManager class we prevent + //any other thread to check for the initial context factory builder (and therefore de-facto do any JNDI lookup). + synchronized (NamingManager.class) { + + if (NamingManager.hasInitialContextFactoryBuilder()) { + //if anyone ever changes the implementation of the NamingManager, we will break here... + //but as of now, we have no other option but to do this and wait for + //https://issues.jboss.org/browse/AS7-6109 to be resolved and incorporated into our underlying container + + try { + Field f = NamingManager.class.getDeclaredField("initctx_factory_builder"); + f.setAccessible(true); + + if (originalBuilder == null) { + originalBuilder = (InitialContextFactoryBuilder) f.get(null); + } + + f.set(null, null); + } catch (Exception e) { + LOG.error( + "Failed to install a custom initial context factory builder. RHQ installation is unsecure!", e); + + return; + } + } + + try { + InitialContextFactory defaultFactory = null; + if (originalBuilder != null) { + defaultFactory = originalBuilder + .createInitialContextFactory(new Hashtable<String, String>()); + } + + NamingManager.setInitialContextFactoryBuilder(new AccessCheckingInitialContextFactoryBuilder( + defaultFactory)); + } catch (Exception e) { + LOG.error("Failed to install a custom initial context factory builder. RHQ installation is unsecure!", + e); + + if (originalBuilder != null) { + if (LOG.isDebugEnabled()) { + LOG.debug("Trying to restore the original initial context factory builder: " + originalBuilder); + } + + try { + NamingManager.setInitialContextFactoryBuilder(originalBuilder); + } catch (Exception e2) { + LOG.error("Failed to restore the original initial context factory builder. The JNDI lookup may" + + " not function properly from this point on...", e2); + } + } + } + } + } + +} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingContextDecorator.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingContextDecorator.java new file mode 100644 index 0000000..0697003 --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingContextDecorator.java @@ -0,0 +1,264 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2011 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.naming.context; + +import java.io.Serializable; +import java.util.Arrays; +import java.util.Hashtable; +import java.util.List; + +import javax.naming.Binding; +import javax.naming.Context; +import javax.naming.Name; +import javax.naming.NameClassPair; +import javax.naming.NameParser; +import javax.naming.NamingEnumeration; +import javax.naming.NamingException; + +import org.rhq.enterprise.server.AllowRhqServerInternalsAccessPermission; + +/** + * This is the "meat" of the RHQ's secured JNDI access. This {@link Context} decorator + * applied security checks in each method (lookups, (un)bindings, etc). + * <p> + * The security check consists of checking if the current callstack has the {@link AllowRhqServerInternalsAccessPermission}. + * <p> + * This decorator applies the security check on any JNDI name without a scheme and + * on any name that has a scheme listed in the {@link #checkedSchemes} list supplied + * in the constructor. + * + * @author Lukas Krejci + */ +public class AccessCheckingContextDecorator implements Context, ContextDecorator, Serializable { + + private static final long serialVersionUID = 1L; + + private static final AllowRhqServerInternalsAccessPermission PERM = new AllowRhqServerInternalsAccessPermission(); + private Context original; + private List<String> checkedSchemes; + + public AccessCheckingContextDecorator(String... checkedSchemes) { + this.checkedSchemes = Arrays.asList(checkedSchemes); + } + + public AccessCheckingContextDecorator(Context original, String... checkedSchemes) { + this.original = original; + this.checkedSchemes = Arrays.asList(checkedSchemes); + } + + public void init(Context ctx) { + this.original = ctx; + } + + protected Context getOriginal() { + return original; + } + + protected static void check() { + SecurityManager sm = System.getSecurityManager(); + if (sm != null) sm.checkPermission(PERM); + } + + private void checkScheme(String scheme) { + if (scheme == null || checkedSchemes.contains(scheme)) { + check(); + } + } + + protected void check(String name) { + checkScheme(getURLScheme(name)); + } + + protected void check(Name name) { + if (name.size() == 0) { + check(); + } else { + String first = name.get(0); + checkScheme(getURLScheme(first)); + } + } + + public Object lookup(Name name) throws NamingException { + check(name); + return original.lookup(name); + } + + public Object lookup(String name) throws NamingException { + check(name); + return original.lookup(name); + } + + public void bind(Name name, Object obj) throws NamingException { + check(name); + original.bind(name, obj); + } + + public void bind(String name, Object obj) throws NamingException { + check(name); + original.bind(name, obj); + } + + public void rebind(Name name, Object obj) throws NamingException { + check(name); + original.rebind(name, obj); + } + + public void rebind(String name, Object obj) throws NamingException { + check(name); + original.rebind(name, obj); + } + + public void unbind(Name name) throws NamingException { + check(name); + original.unbind(name); + } + + public void unbind(String name) throws NamingException { + check(name); + original.unbind(name); + } + + public void rename(Name oldName, Name newName) throws NamingException { + check(oldName); + check(newName); + original.rename(oldName, newName); + } + + public void rename(String oldName, String newName) throws NamingException { + check(oldName); + check(newName); + original.rename(oldName, newName); + } + + public NamingEnumeration<NameClassPair> list(Name name) throws NamingException { + check(name); + return original.list(name); + } + + public NamingEnumeration<NameClassPair> list(String name) throws NamingException { + check(name); + return original.list(name); + } + + public NamingEnumeration<Binding> listBindings(Name name) throws NamingException { + check(name); + return original.listBindings(name); + } + + public NamingEnumeration<Binding> listBindings(String name) throws NamingException { + check(name); + return original.listBindings(name); + } + + public void destroySubcontext(Name name) throws NamingException { + check(name); + original.destroySubcontext(name); + } + + public void destroySubcontext(String name) throws NamingException { + check(name); + original.destroySubcontext(name); + } + + public Context createSubcontext(Name name) throws NamingException { + check(name); + return original.createSubcontext(name); + } + + public Context createSubcontext(String name) throws NamingException { + check(name); + return original.createSubcontext(name); + } + + public Object lookupLink(Name name) throws NamingException { + check(name); + return original.lookupLink(name); + } + + public Object lookupLink(String name) throws NamingException { + check(name); + return original.lookupLink(name); + } + + public NameParser getNameParser(Name name) throws NamingException { + check(name); + return original.getNameParser(name); + } + + public NameParser getNameParser(String name) throws NamingException { + check(name); + return original.getNameParser(name); + } + + public Name composeName(Name name, Name prefix) throws NamingException { + check(name); + return original.composeName(name, prefix); + } + + public String composeName(String name, String prefix) throws NamingException { + check(name); + return original.composeName(name, prefix); + } + + public Object addToEnvironment(String propName, Object propVal) throws NamingException { + check(); + return original.addToEnvironment(propName, propVal); + } + + public Object removeFromEnvironment(String propName) throws NamingException { + check(); + return original.removeFromEnvironment(propName); + } + + public Hashtable<?, ?> getEnvironment() throws NamingException { + check(); + return original.getEnvironment(); + } + + public void close() throws NamingException { + check(); + original.close(); + } + + public String getNameInNamespace() throws NamingException { + check(); + return original.getNameInNamespace(); + } + + //copied from InitialContext + private static String getURLScheme(String str) { + int colon_posn = str.indexOf(':'); + int slash_posn = str.indexOf('/'); + + if (colon_posn > 0 && (slash_posn == -1 || colon_posn < slash_posn)) + return str.substring(0, colon_posn); + return null; + } + + @Override + public int hashCode() { + return getOriginal() == null ? super.hashCode() : getOriginal().hashCode(); + } + + @Override + public boolean equals(Object o) { + return getOriginal() == null ? super.equals(o) : getOriginal().equals(o); + } +} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingContextDecoratorSetContext.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingContextDecoratorSetContext.java new file mode 100644 index 0000000..2e0e790 --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingContextDecoratorSetContext.java @@ -0,0 +1,75 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.naming.context; + +import java.lang.reflect.Constructor; +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + +import javax.naming.Context; + +import org.rhq.enterprise.server.naming.util.DecoratorSetContext; + +/** + * + * + * @author Lukas Krejci + */ +public class AccessCheckingContextDecoratorSetContext implements DecoratorSetContext<Context, ContextDecorator> { + + private static final Set<Class<? extends ContextDecorator>> DECORATOR_CLASSES; + static { + HashSet<Class<? extends ContextDecorator>> tmp = new HashSet<Class<? extends ContextDecorator>>(); + tmp.add(AccessCheckingContextDecorator.class); + tmp.add(AccessCheckingDirContextDecorator.class); + tmp.add(AccessCheckingEventContextDecorator.class); + tmp.add(AccessCheckingEventDirContextDecorator.class); + tmp.add(AccessCheckingLdapContextDecorator.class); + + DECORATOR_CLASSES = Collections.unmodifiableSet(tmp); + } + + private Set<Class<? extends Context>> supportedInterfaces; + private String[] checkedSchemes; + + public AccessCheckingContextDecoratorSetContext(Set<Class<? extends Context>> supportedInterfaces, String... checkedSchemes) { + this.supportedInterfaces = supportedInterfaces; + this.checkedSchemes = checkedSchemes; + } + + public ContextDecorator instantiate(Class<? extends ContextDecorator> decoratorClass) throws Exception { + Constructor<? extends ContextDecorator> ctor = decoratorClass.getConstructor(String[].class); + + return ctor.newInstance((Object)checkedSchemes); + } + + public Set<Class<? extends Context>> getSupportedInterfaces() { + return supportedInterfaces; + } + + public Set<Class<? extends ContextDecorator>> getDecoratorClasses() { + return DECORATOR_CLASSES; + } + + public void init(ContextDecorator decorator, Context object) throws Exception { + decorator.init(object); + } +} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingDirContextDecorator.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingDirContextDecorator.java new file mode 100644 index 0000000..602cc02 --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingDirContextDecorator.java @@ -0,0 +1,187 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.naming.context; + +import javax.naming.Name; +import javax.naming.NamingEnumeration; +import javax.naming.NamingException; +import javax.naming.directory.Attributes; +import javax.naming.directory.DirContext; +import javax.naming.directory.ModificationItem; +import javax.naming.directory.SearchControls; +import javax.naming.directory.SearchResult; + +/** + * A decorator of {@link DirContext}. + * + * @author Lukas Krejci + */ +public class AccessCheckingDirContextDecorator extends AccessCheckingContextDecorator implements DirContext { + + private static final long serialVersionUID = 1L; + + public AccessCheckingDirContextDecorator(String... checkedSchemes) { + super(checkedSchemes); + } + + public AccessCheckingDirContextDecorator(DirContext original, String... checkedSchemes) { + super(original, checkedSchemes); + } + + @Override + protected DirContext getOriginal() { + return (DirContext) super.getOriginal(); + } + + public Attributes getAttributes(Name name) throws NamingException { + check(name); + return getOriginal().getAttributes(name); + } + + public Attributes getAttributes(String name) throws NamingException { + check(name); + return getOriginal().getAttributes(name); + } + + public Attributes getAttributes(Name name, String[] attrIds) throws NamingException { + check(name); + return getOriginal().getAttributes(name, attrIds); + } + + public Attributes getAttributes(String name, String[] attrIds) throws NamingException { + check(name); + return getOriginal().getAttributes(name, attrIds); + } + + public void modifyAttributes(Name name, int mod_op, Attributes attrs) throws NamingException { + check(name); + getOriginal().modifyAttributes(name, mod_op, attrs); + } + + public void modifyAttributes(String name, int mod_op, Attributes attrs) throws NamingException { + check(name); + getOriginal().modifyAttributes(name, mod_op, attrs); + } + + public void modifyAttributes(Name name, ModificationItem[] mods) throws NamingException { + check(name); + getOriginal().modifyAttributes(name, mods); + } + + public void modifyAttributes(String name, ModificationItem[] mods) throws NamingException { + check(name); + getOriginal().modifyAttributes(name, mods); + } + + public void bind(Name name, Object obj, Attributes attrs) throws NamingException { + check(name); + getOriginal().bind(name, obj, attrs); + } + + public void bind(String name, Object obj, Attributes attrs) throws NamingException { + check(name); + getOriginal().bind(name, obj, attrs); + } + + public void rebind(Name name, Object obj, Attributes attrs) throws NamingException { + check(name); + getOriginal().rebind(name, obj, attrs); + } + + public void rebind(String name, Object obj, Attributes attrs) throws NamingException { + check(name); + getOriginal().rebind(name, obj, attrs); + } + + public DirContext createSubcontext(Name name, Attributes attrs) throws NamingException { + check(name); + return getOriginal().createSubcontext(name, attrs); + } + + public DirContext createSubcontext(String name, Attributes attrs) throws NamingException { + check(name); + return getOriginal().createSubcontext(name, attrs); + } + + public DirContext getSchema(Name name) throws NamingException { + check(name); + return getOriginal().getSchema(name); + } + + public DirContext getSchema(String name) throws NamingException { + check(name); + return getOriginal().getSchema(name); + } + + public DirContext getSchemaClassDefinition(Name name) throws NamingException { + check(name); + return getOriginal().getSchemaClassDefinition(name); + } + + public DirContext getSchemaClassDefinition(String name) throws NamingException { + check(name); + return getOriginal().getSchema(name); + } + + public NamingEnumeration<SearchResult> + search(Name name, Attributes matchingAttributes, String[] attributesToReturn) throws NamingException { + check(name); + return getOriginal().search(name, matchingAttributes, attributesToReturn); + } + + public NamingEnumeration<SearchResult> search(String name, Attributes matchingAttributes, + String[] attributesToReturn) throws NamingException { + check(name); + return getOriginal().search(name, matchingAttributes, attributesToReturn); + } + + public NamingEnumeration<SearchResult> search(Name name, Attributes matchingAttributes) throws NamingException { + check(name); + return getOriginal().search(name, matchingAttributes); + } + + public NamingEnumeration<SearchResult> search(String name, Attributes matchingAttributes) throws NamingException { + check(name); + return getOriginal().search(name, matchingAttributes); + } + + public NamingEnumeration<SearchResult> search(Name name, String filter, SearchControls cons) throws NamingException { + check(name); + return getOriginal().search(name, filter, cons); + } + + public NamingEnumeration<SearchResult> search(String name, String filter, SearchControls cons) + throws NamingException { + check(name); + return getOriginal().search(name, filter, cons); + } + + public NamingEnumeration<SearchResult> + search(Name name, String filterExpr, Object[] filterArgs, SearchControls cons) throws NamingException { + check(name); + return getOriginal().search(name, filterExpr, filterArgs, cons); + } + + public NamingEnumeration<SearchResult> search(String name, String filterExpr, Object[] filterArgs, + SearchControls cons) throws NamingException { + check(name); + return getOriginal().search(name, filterExpr, filterArgs, cons); + } +} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingEventContextDecorator.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingEventContextDecorator.java new file mode 100644 index 0000000..b6f314d --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingEventContextDecorator.java @@ -0,0 +1,69 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.naming.context; + +import javax.naming.Name; +import javax.naming.NamingException; +import javax.naming.event.EventContext; +import javax.naming.event.NamingListener; + +/** + * + * + * @author Lukas Krejci + */ +public class AccessCheckingEventContextDecorator extends AccessCheckingContextDecorator implements EventContext { + + private static final long serialVersionUID = 1L; + + public AccessCheckingEventContextDecorator(String... checkedSchemes) { + super(checkedSchemes); + } + + public AccessCheckingEventContextDecorator(EventContext original, String... checkedSchemes) { + super(original, checkedSchemes); + } + + @Override + protected EventContext getOriginal() { + return (EventContext) super.getOriginal(); + } + + public void addNamingListener(Name target, int scope, NamingListener l) throws NamingException { + check(target); + getOriginal().addNamingListener(target, scope, l); + } + + public void addNamingListener(String target, int scope, NamingListener l) throws NamingException { + check(target); + getOriginal().addNamingListener(target, scope, l); + } + + public void removeNamingListener(NamingListener l) throws NamingException { + check(); + getOriginal().removeNamingListener(l); + } + + public boolean targetMustExist() throws NamingException { + check(); + return getOriginal().targetMustExist(); + } + +} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingEventDirContextDecorator.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingEventDirContextDecorator.java new file mode 100644 index 0000000..f28c29c --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingEventDirContextDecorator.java @@ -0,0 +1,96 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.naming.context; + +import javax.naming.Name; +import javax.naming.NamingException; +import javax.naming.directory.SearchControls; +import javax.naming.event.EventDirContext; +import javax.naming.event.NamingListener; + +/** + * + * + * @author Lukas Krejci + */ +public class AccessCheckingEventDirContextDecorator extends AccessCheckingDirContextDecorator implements + EventDirContext { + + private static final long serialVersionUID = 1L; + + public AccessCheckingEventDirContextDecorator(String... checkedSchemes) { + super(checkedSchemes); + } + + public AccessCheckingEventDirContextDecorator(EventDirContext original, String... checkedSchemes) { + super(original, checkedSchemes); + } + + @Override + protected EventDirContext getOriginal() { + return (EventDirContext) super.getOriginal(); + } + + public void addNamingListener(Name target, int scope, NamingListener l) throws NamingException { + check(target); + getOriginal().addNamingListener(target, scope, l); + } + + public void addNamingListener(String target, int scope, NamingListener l) throws NamingException { + check(target); + getOriginal().addNamingListener(target, scope, l); + } + + public void removeNamingListener(NamingListener l) throws NamingException { + check(); + getOriginal().removeNamingListener(l); + } + + public boolean targetMustExist() throws NamingException { + check(); + return getOriginal().targetMustExist(); + } + + public void addNamingListener(Name target, String filter, SearchControls ctls, NamingListener l) + throws NamingException { + check(target); + getOriginal().addNamingListener(target, filter, ctls, l); + } + + public void addNamingListener(String target, String filter, SearchControls ctls, NamingListener l) + throws NamingException { + check(target); + getOriginal().addNamingListener(target, filter, ctls, l); + } + + public void + addNamingListener(Name target, String filter, Object[] filterArgs, SearchControls ctls, NamingListener l) + throws NamingException { + check(target); + getOriginal().addNamingListener(target, filter, filterArgs, ctls, l); + } + + public void addNamingListener(String target, String filter, Object[] filterArgs, SearchControls ctls, + NamingListener l) throws NamingException { + check(target); + getOriginal().addNamingListener(target, filter, filterArgs, ctls, l); + } + +} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingLdapContextDecorator.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingLdapContextDecorator.java new file mode 100644 index 0000000..2c6036f --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingLdapContextDecorator.java @@ -0,0 +1,85 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.naming.context; + +import javax.naming.NamingException; +import javax.naming.ldap.Control; +import javax.naming.ldap.ExtendedRequest; +import javax.naming.ldap.ExtendedResponse; +import javax.naming.ldap.LdapContext; + +/** + * + * + * @author Lukas Krejci + */ +public class AccessCheckingLdapContextDecorator extends AccessCheckingDirContextDecorator implements LdapContext { + + private static final long serialVersionUID = 1L; + + public AccessCheckingLdapContextDecorator(String... checkedSchemes) { + super(checkedSchemes); + } + + public AccessCheckingLdapContextDecorator(LdapContext original, String... checkedSchemes) { + super(original, checkedSchemes); + } + + @Override + protected LdapContext getOriginal() { + return (LdapContext) super.getOriginal(); + } + + public ExtendedResponse extendedOperation(ExtendedRequest request) throws NamingException { + check(); + return getOriginal().extendedOperation(request); + } + + public LdapContext newInstance(Control[] requestControls) throws NamingException { + check(); + return getOriginal().newInstance(requestControls); + } + + public void reconnect(Control[] connCtls) throws NamingException { + check(); + getOriginal().reconnect(connCtls); + } + + public Control[] getConnectControls() throws NamingException { + check(); + return getOriginal().getConnectControls(); + } + + public void setRequestControls(Control[] requestControls) throws NamingException { + check(); + getOriginal().setRequestControls(requestControls); + } + + public Control[] getRequestControls() throws NamingException { + check(); + return getOriginal().getRequestControls(); + } + + public Control[] getResponseControls() throws NamingException { + check(); + return getOriginal().getResponseControls(); + } + +} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/ContextDecorator.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/ContextDecorator.java new file mode 100644 index 0000000..0781b9b --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/ContextDecorator.java @@ -0,0 +1,33 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.naming.context; + +import javax.naming.Context; +import javax.naming.NamingException; + +/** + * + * + * @author Lukas Krejci + */ +public interface ContextDecorator extends Context { + + void init(Context context) throws NamingException; +} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringContextDecorator.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringContextDecorator.java new file mode 100644 index 0000000..62fc86b --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringContextDecorator.java @@ -0,0 +1,222 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2011 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.naming.context; + +import java.io.Serializable; +import java.util.Hashtable; + +import javax.naming.Binding; +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.Name; +import javax.naming.NameClassPair; +import javax.naming.NameParser; +import javax.naming.NamingEnumeration; +import javax.naming.NamingException; + +import org.rhq.enterprise.server.naming.AccessCheckingInitialContextFactoryBuilder; + +/** + * This is a wrapper class around another {@link Context} implementation that + * prefers to use an URL context for some operation if the JNDI name contains + * a scheme rather than the original. This is the behavior of {@link InitialContext} + * which we need to restore in the contexts created by the {@link AccessCheckingInitialContextFactoryBuilder} + * (which an {@link InitialContext} uses exclusively if the builder is set). + * <p> + * This is important because RHQ server has its own initial context factory + * builder that creates factories that in turn create contexts. If the default + * {@link InitialContext} implementation was used, we'd never be able to lookup + * scheme-based names because the default implementation of the {@link InitialContext} + * always uses the default context of the builder if one is installed no matter + * the scheme in the name. + * <p> + * The {@link AccessCheckingInitialContextFactoryBuilder} wraps the context returned + * by the factory in an instance of this class and thus is restoring the original + * intended behavior of the {@link InitialContext}. It looks at the name being looked + * up (bound or whatever) and prefers to use the URL context factories if the name + * contains the scheme (as does the {@link InitialContext} if no builder is installed). + * If the name doesn't contain a scheme, the provided default context factory is used to + * look up the name. + * + * @author Lukas Krejci + */ +public class URLPreferringContextDecorator implements Context, ContextDecorator, Serializable { + + private static final long serialVersionUID = 1L; + + private Context original; + + public URLPreferringContextDecorator() { + + } + + public URLPreferringContextDecorator(Context ctx) { + original = ctx; + } + + public void init(Context context) { + original = context; + } + + protected Context getOriginal() throws NamingException { + return original; + } + + protected Context getURLOrDefaultInitCtx(Name name) throws NamingException { + @SuppressWarnings("unchecked") + Context urlContext = URLPreferringContextDecoratorHelper.getURLContext(name, (Hashtable<Object, Object>) getEnvironment()); + return urlContext == null ? getOriginal() : urlContext; + } + + protected Context getURLOrDefaultInitCtx(String name) throws NamingException { + @SuppressWarnings("unchecked") + Context urlContext = URLPreferringContextDecoratorHelper.getURLContext(name, (Hashtable<Object, Object>) getEnvironment()); + return urlContext == null ? getOriginal() : urlContext; + } + + public Object lookup(Name name) throws NamingException { + return getURLOrDefaultInitCtx(name).lookup(name); + } + + public Object lookup(String name) throws NamingException { + return getURLOrDefaultInitCtx(name).lookup(name); + } + + public void bind(Name name, Object obj) throws NamingException { + getURLOrDefaultInitCtx(name).bind(name, obj); + } + + public void bind(String name, Object obj) throws NamingException { + getURLOrDefaultInitCtx(name).bind(name, obj); + } + + public void rebind(Name name, Object obj) throws NamingException { + getURLOrDefaultInitCtx(name).rebind(name, obj); + } + + public void rebind(String name, Object obj) throws NamingException { + getURLOrDefaultInitCtx(name).rebind(name, obj); + } + + public void unbind(Name name) throws NamingException { + getURLOrDefaultInitCtx(name).unbind(name); + } + + public void unbind(String name) throws NamingException { + getURLOrDefaultInitCtx(name).unbind(name); + } + + public void rename(Name oldName, Name newName) throws NamingException { + getURLOrDefaultInitCtx(oldName).rename(oldName, newName); + } + + public void rename(String oldName, String newName) throws NamingException { + getURLOrDefaultInitCtx(oldName).rename(oldName, newName); + } + + public NamingEnumeration<NameClassPair> list(Name name) throws NamingException { + return getURLOrDefaultInitCtx(name).list(name); + } + + public NamingEnumeration<NameClassPair> list(String name) throws NamingException { + return getURLOrDefaultInitCtx(name).list(name); + } + + public NamingEnumeration<Binding> listBindings(Name name) throws NamingException { + return getURLOrDefaultInitCtx(name).listBindings(name); + } + + public NamingEnumeration<Binding> listBindings(String name) throws NamingException { + return getURLOrDefaultInitCtx(name).listBindings(name); + } + + public void destroySubcontext(Name name) throws NamingException { + getURLOrDefaultInitCtx(name).destroySubcontext(name); + } + + public void destroySubcontext(String name) throws NamingException { + getURLOrDefaultInitCtx(name).destroySubcontext(name); + } + + public Context createSubcontext(Name name) throws NamingException { + return getURLOrDefaultInitCtx(name).createSubcontext(name); + } + + public Context createSubcontext(String name) throws NamingException { + return getURLOrDefaultInitCtx(name).createSubcontext(name); + } + + public Object lookupLink(Name name) throws NamingException { + return getURLOrDefaultInitCtx(name).lookupLink(name); + } + + public Object lookupLink(String name) throws NamingException { + return getURLOrDefaultInitCtx(name).lookupLink(name); + } + + public NameParser getNameParser(Name name) throws NamingException { + return getURLOrDefaultInitCtx(name).getNameParser(name); + } + + public NameParser getNameParser(String name) throws NamingException { + return getURLOrDefaultInitCtx(name).getNameParser(name); + } + + public Name composeName(Name name, Name prefix) throws NamingException { + return getOriginal().composeName(name, prefix); + } + + public String composeName(String name, String prefix) throws NamingException { + return getOriginal().composeName(name, prefix); + } + + public Object addToEnvironment(String propName, Object propVal) throws NamingException { + return getOriginal().addToEnvironment(propName, propVal); + } + + public Object removeFromEnvironment(String propName) throws NamingException { + return getOriginal().removeFromEnvironment(propName); + } + + public Hashtable<?, ?> getEnvironment() throws NamingException { + return getOriginal().getEnvironment(); + } + + public void close() throws NamingException { + if (getOriginal() != null) { + getOriginal().close(); + original = null; + } + } + + public String getNameInNamespace() throws NamingException { + return getOriginal().getNameInNamespace(); + } + + @Override + public int hashCode() { + return original == null ? super.hashCode() : original.hashCode(); + } + + @Override + public boolean equals(Object o) { + return original == null ? super.equals(o) : original.equals(o); + } +} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringContextDecoratorHelper.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringContextDecoratorHelper.java new file mode 100644 index 0000000..306446d --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringContextDecoratorHelper.java @@ -0,0 +1,76 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.naming.context; + +import java.util.Hashtable; + +import javax.naming.Context; +import javax.naming.Name; +import javax.naming.NamingException; +import javax.naming.spi.NamingManager; + +/** + * + * + * @author Lukas Krejci + */ +public class URLPreferringContextDecoratorHelper { + + private URLPreferringContextDecoratorHelper() { + + } + + public static Context getURLContext(String name, Hashtable<Object, Object> env) throws NamingException { + String scheme = getURLScheme(name); + if (scheme != null) { + Context ctx = NamingManager.getURLContext(scheme, env); + if (ctx != null) { + return ctx; + } + } + + return null; + } + + public static Context getURLContext(Name name, Hashtable<Object, Object> env) throws NamingException { + if (name.size() > 0) { + String first = name.get(0); + String scheme = getURLScheme(first); + if (scheme != null) { + Context ctx = NamingManager.getURLContext(scheme, env); + if (ctx != null) { + return ctx; + } + } + } + + return null; + } + + //copied from InitialContext + private static String getURLScheme(String str) { + int colon_posn = str.indexOf(':'); + int slash_posn = str.indexOf('/'); + + if (colon_posn > 0 && (slash_posn == -1 || colon_posn < slash_posn)) + return str.substring(0, colon_posn); + return null; + } +} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringContextDecoratorSetContext.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringContextDecoratorSetContext.java new file mode 100644 index 0000000..ded552c --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringContextDecoratorSetContext.java @@ -0,0 +1,71 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.naming.context; + +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + +import javax.naming.Context; + +import org.rhq.enterprise.server.naming.util.DecoratorSetContext; + +/** + * + * + * @author Lukas Krejci + */ +public class URLPreferringContextDecoratorSetContext implements DecoratorSetContext<Context, ContextDecorator> { + + private static final Set<Class<? extends ContextDecorator>> DECORATOR_CLASSES; + static { + HashSet<Class<? extends ContextDecorator>> tmp = new HashSet<Class<? extends ContextDecorator>>(); + tmp.add(URLPreferringContextDecorator.class); + tmp.add(URLPreferringDirContextDecorator.class); + tmp.add(URLPreferringEventContextDecorator.class); + tmp.add(URLPreferringEventDirContextDecorator.class); + tmp.add(URLPreferringLdapContextDecorator.class); + + DECORATOR_CLASSES = Collections.unmodifiableSet(tmp); + } + + private Set<Class<? extends Context>> supportedInterfaces; + + public URLPreferringContextDecoratorSetContext(Set<Class<? extends Context>> supportedInterfaces) { + this.supportedInterfaces = supportedInterfaces; + } + + public Set<Class<? extends Context>> getSupportedInterfaces() { + return supportedInterfaces; + } + + public Set<Class<? extends ContextDecorator>> getDecoratorClasses() { + return DECORATOR_CLASSES; + } + + public ContextDecorator instantiate(Class<? extends ContextDecorator> decoratorClass) throws Exception { + return decoratorClass.newInstance(); + } + + public void init(ContextDecorator decorator, Context object) throws Exception { + decorator.init(object); + } + +} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringDirContextDecorator.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringDirContextDecorator.java new file mode 100644 index 0000000..6c695f4 --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringDirContextDecorator.java @@ -0,0 +1,185 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.naming.context; + +import javax.naming.Context; +import javax.naming.Name; +import javax.naming.NamingEnumeration; +import javax.naming.NamingException; +import javax.naming.NoInitialContextException; +import javax.naming.NotContextException; +import javax.naming.directory.Attributes; +import javax.naming.directory.DirContext; +import javax.naming.directory.ModificationItem; +import javax.naming.directory.SearchControls; +import javax.naming.directory.SearchResult; + +/** + * Akin to {@link URLPreferringContextDecorator} this class implements the similar logic + * for {@link DirContext}s. + * + * @author Lukas Krejci + */ +public class URLPreferringDirContextDecorator extends URLPreferringContextDecorator implements DirContext { + + private static final long serialVersionUID = 1L; + + public URLPreferringDirContextDecorator() { + super(null); + } + + public URLPreferringDirContextDecorator(DirContext ctx) { + super(ctx); + } + + protected DirContext checkAndCast(Context ctx) throws NamingException { + if (!(ctx instanceof DirContext)) { + if (ctx == null) { + throw new NoInitialContextException(); + } else { + throw new NotContextException( + "Not an instance of DirContext"); + } + } + + return (DirContext) ctx; + } + + @Override + protected DirContext getURLOrDefaultInitCtx(Name name) throws NamingException { + Context ctx = super.getURLOrDefaultInitCtx(name); + return checkAndCast(ctx); + } + + @Override + protected DirContext getURLOrDefaultInitCtx(String name) throws NamingException { + Context ctx = super.getURLOrDefaultInitCtx(name); + return checkAndCast(ctx); + } + + public Attributes getAttributes(Name name) throws NamingException { + return getURLOrDefaultInitCtx(name).getAttributes(name); + } + + public Attributes getAttributes(String name) throws NamingException { + return getURLOrDefaultInitCtx(name).getAttributes(name); + } + + public Attributes getAttributes(Name name, String[] attrIds) throws NamingException { + return getURLOrDefaultInitCtx(name).getAttributes(name, attrIds); + } + + public Attributes getAttributes(String name, String[] attrIds) throws NamingException { + return getURLOrDefaultInitCtx(name).getAttributes(name, attrIds); + } + + public void modifyAttributes(Name name, int mod_op, Attributes attrs) throws NamingException { + getURLOrDefaultInitCtx(name).modifyAttributes(name, mod_op, attrs); + } + + public void modifyAttributes(String name, int mod_op, Attributes attrs) throws NamingException { + getURLOrDefaultInitCtx(name).modifyAttributes(name, mod_op, attrs); + } + + public void modifyAttributes(Name name, ModificationItem[] mods) throws NamingException { + getURLOrDefaultInitCtx(name).modifyAttributes(name, mods); + } + + public void modifyAttributes(String name, ModificationItem[] mods) throws NamingException { + getURLOrDefaultInitCtx(name).modifyAttributes(name, mods); + } + + public void bind(Name name, Object obj, Attributes attrs) throws NamingException { + getURLOrDefaultInitCtx(name).bind(name, obj, attrs); + } + + public void bind(String name, Object obj, Attributes attrs) throws NamingException { + getURLOrDefaultInitCtx(name).bind(name, obj, attrs); + } + + public void rebind(Name name, Object obj, Attributes attrs) throws NamingException { + getURLOrDefaultInitCtx(name).rebind(name, obj, attrs); + } + + public void rebind(String name, Object obj, Attributes attrs) throws NamingException { + getURLOrDefaultInitCtx(name).rebind(name, obj, attrs); + } + + public DirContext createSubcontext(Name name, Attributes attrs) throws NamingException { + return getURLOrDefaultInitCtx(name).createSubcontext(name, attrs); + } + + public DirContext createSubcontext(String name, Attributes attrs) throws NamingException { + return getURLOrDefaultInitCtx(name).createSubcontext(name, attrs); + } + + public DirContext getSchema(Name name) throws NamingException { + return getURLOrDefaultInitCtx(name).getSchema(name); + } + + public DirContext getSchema(String name) throws NamingException { + return getURLOrDefaultInitCtx(name).getSchema(name); + } + + public DirContext getSchemaClassDefinition(Name name) throws NamingException { + return getURLOrDefaultInitCtx(name).getSchemaClassDefinition(name); + } + + public DirContext getSchemaClassDefinition(String name) throws NamingException { + return getURLOrDefaultInitCtx(name).getSchemaClassDefinition(name); + } + + public NamingEnumeration<SearchResult> + search(Name name, Attributes matchingAttributes, String[] attributesToReturn) throws NamingException { + return getURLOrDefaultInitCtx(name).search(name, matchingAttributes, attributesToReturn); + } + + public NamingEnumeration<SearchResult> search(String name, Attributes matchingAttributes, + String[] attributesToReturn) throws NamingException { + return getURLOrDefaultInitCtx(name).search(name, matchingAttributes, attributesToReturn); + } + + public NamingEnumeration<SearchResult> search(Name name, Attributes matchingAttributes) throws NamingException { + return getURLOrDefaultInitCtx(name).search(name, matchingAttributes); + } + + public NamingEnumeration<SearchResult> search(String name, Attributes matchingAttributes) throws NamingException { + return getURLOrDefaultInitCtx(name).search(name, matchingAttributes); + } + + public NamingEnumeration<SearchResult> search(Name name, String filter, SearchControls cons) throws NamingException { + return getURLOrDefaultInitCtx(name).search(name, filter, cons); + } + + public NamingEnumeration<SearchResult> search(String name, String filter, SearchControls cons) + throws NamingException { + return getURLOrDefaultInitCtx(name).search(name, filter, cons); + } + + public NamingEnumeration<SearchResult> + search(Name name, String filterExpr, Object[] filterArgs, SearchControls cons) throws NamingException { + return getURLOrDefaultInitCtx(name).search(name, filterExpr, filterArgs, cons); + } + + public NamingEnumeration<SearchResult> search(String name, String filterExpr, Object[] filterArgs, + SearchControls cons) throws NamingException { + return getURLOrDefaultInitCtx(name).search(name, filterExpr, filterArgs, cons); + } +} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringEventContextDecorator.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringEventContextDecorator.java new file mode 100644 index 0000000..30e9ed2 --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringEventContextDecorator.java @@ -0,0 +1,81 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.naming.context; + +import javax.naming.Context; +import javax.naming.Name; +import javax.naming.NamingException; +import javax.naming.NoInitialContextException; +import javax.naming.NotContextException; +import javax.naming.event.EventContext; +import javax.naming.event.NamingListener; + +/** + * + * + * @author Lukas Krejci + */ +public class URLPreferringEventContextDecorator extends URLPreferringContextDecorator implements EventContext { + + private static final long serialVersionUID = 1L; + + public URLPreferringEventContextDecorator() { + super(null); + } + + public URLPreferringEventContextDecorator(EventContext ctx) { + super(ctx); + } + + protected EventContext checkAndCast(Context ctx) throws NamingException { + if (!(ctx instanceof EventContext)) { + if (ctx == null) { + throw new NoInitialContextException(); + } else { + throw new NotContextException( + "Not an instance of EventContext"); + } + } + + return (EventContext) ctx; + } + + @Override + protected EventContext getOriginal() throws NamingException { + return checkAndCast(super.getOriginal()); + } + + public void addNamingListener(Name target, int scope, NamingListener l) throws NamingException { + getOriginal().addNamingListener(target, scope, l); + } + + public void addNamingListener(String target, int scope, NamingListener l) throws NamingException { + getOriginal().addNamingListener(target, scope, l); + } + + public void removeNamingListener(NamingListener l) throws NamingException { + getOriginal().removeNamingListener(l); + } + + public boolean targetMustExist() throws NamingException { + return getOriginal().targetMustExist(); + } + +} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringEventDirContextDecorator.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringEventDirContextDecorator.java new file mode 100644 index 0000000..e9a3614 --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringEventDirContextDecorator.java @@ -0,0 +1,104 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.naming.context; + +import javax.naming.Context; +import javax.naming.Name; +import javax.naming.NamingException; +import javax.naming.NoInitialContextException; +import javax.naming.NotContextException; +import javax.naming.directory.SearchControls; +import javax.naming.event.EventDirContext; +import javax.naming.event.NamingListener; + +/** + * + * + * @author Lukas Krejci + */ +public class URLPreferringEventDirContextDecorator extends URLPreferringDirContextDecorator implements EventDirContext { + + private static final long serialVersionUID = 1L; + + public URLPreferringEventDirContextDecorator() { + super(null); + } + + public URLPreferringEventDirContextDecorator(EventDirContext ctx) { + super(ctx); + } + + @Override + protected EventDirContext checkAndCast(Context ctx) throws NamingException { + if (!(ctx instanceof EventDirContext)) { + if (ctx == null) { + throw new NoInitialContextException(); + } else { + throw new NotContextException( + "Not an instance of EventDirContext"); + } + } + + return (EventDirContext) ctx; + } + + @Override + protected EventDirContext getOriginal() throws NamingException { + return checkAndCast(super.getOriginal()); + } + + public void addNamingListener(Name target, int scope, NamingListener l) throws NamingException { + getOriginal().addNamingListener(target, scope, l); + } + + public void addNamingListener(String target, int scope, NamingListener l) throws NamingException { + getOriginal().addNamingListener(target, scope, l); + } + + public void removeNamingListener(NamingListener l) throws NamingException { + getOriginal().removeNamingListener(l); + } + + public boolean targetMustExist() throws NamingException { + return getOriginal().targetMustExist(); + } + + public void addNamingListener(Name target, String filter, SearchControls ctls, NamingListener l) + throws NamingException { + getOriginal().addNamingListener(target, filter, ctls, l); + } + + public void addNamingListener(String target, String filter, SearchControls ctls, NamingListener l) + throws NamingException { + getOriginal().addNamingListener(target, filter, ctls, l); + } + + public void + addNamingListener(Name target, String filter, Object[] filterArgs, SearchControls ctls, NamingListener l) + throws NamingException { + getOriginal().addNamingListener(target, filter, filterArgs, ctls, l); + } + + public void addNamingListener(String target, String filter, Object[] filterArgs, SearchControls ctls, + NamingListener l) throws NamingException { + getOriginal().addNamingListener(target, filter, filterArgs, ctls, l); + } + +} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringLdapContextDecorator.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringLdapContextDecorator.java new file mode 100644 index 0000000..93965df --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringLdapContextDecorator.java @@ -0,0 +1,94 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.naming.context; + +import javax.naming.Context; +import javax.naming.NamingException; +import javax.naming.NoInitialContextException; +import javax.naming.NotContextException; +import javax.naming.ldap.Control; +import javax.naming.ldap.ExtendedRequest; +import javax.naming.ldap.ExtendedResponse; +import javax.naming.ldap.LdapContext; + +/** + * + * + * @author Lukas Krejci + */ +public class URLPreferringLdapContextDecorator extends URLPreferringDirContextDecorator implements LdapContext { + + private static final long serialVersionUID = 1L; + + public URLPreferringLdapContextDecorator() { + super(null); + } + + public URLPreferringLdapContextDecorator(LdapContext original) { + super(original); + } + + @Override + protected LdapContext checkAndCast(Context ctx) throws NamingException { + if (!(ctx instanceof LdapContext)) { + if (ctx == null) { + throw new NoInitialContextException(); + } else { + throw new NotContextException("Not an instance of LdapContext"); + } + } + + return (LdapContext) ctx; + } + + @Override + protected LdapContext getOriginal() throws NamingException { + return checkAndCast(super.getOriginal()); + } + + public ExtendedResponse extendedOperation(ExtendedRequest request) throws NamingException { + return getOriginal().extendedOperation(request); + } + + public LdapContext newInstance(Control[] requestControls) throws NamingException { + return new URLPreferringLdapContextDecorator(getOriginal().newInstance(requestControls)); + } + + public void reconnect(Control[] connCtls) throws NamingException { + getOriginal().reconnect(connCtls); + } + + public Control[] getConnectControls() throws NamingException { + return getOriginal().getConnectControls(); + } + + public void setRequestControls(Control[] requestControls) throws NamingException { + getOriginal().setRequestControls(requestControls); + } + + public Control[] getRequestControls() throws NamingException { + return getOriginal().getRequestControls(); + } + + public Control[] getResponseControls() throws NamingException { + return getOriginal().getResponseControls(); + } + +} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/interfaces/java/javaURLContextFactory.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/interfaces/java/javaURLContextFactory.java new file mode 100644 index 0000000..fc4d02b --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/interfaces/java/javaURLContextFactory.java @@ -0,0 +1,32 @@ +package org.rhq.enterprise.server.naming.interfaces.java; + +import java.util.Hashtable; + +import javax.naming.CompositeName; +import javax.naming.Context; +import javax.naming.Name; +import javax.naming.spi.ObjectFactory; + +import org.jboss.as.naming.NamingContext; + +import org.rhq.enterprise.server.AllowRhqServerInternalsAccessPermission; + +/** @deprecated this is not used after all */ +@Deprecated +public class javaURLContextFactory implements ObjectFactory { + + private static final AllowRhqServerInternalsAccessPermission PERM = new AllowRhqServerInternalsAccessPermission(); + + @Override + @SuppressWarnings("unchecked") + public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment) + throws Exception { + + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + sm.checkPermission(PERM); + } + + return new NamingContext(name != null ? name : new CompositeName(""), (Hashtable<String, Object>) environment); + } +} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/util/DecoratingInvocationHandler.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/util/DecoratingInvocationHandler.java new file mode 100644 index 0000000..cda3a98 --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/util/DecoratingInvocationHandler.java @@ -0,0 +1,55 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.naming.util; + +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.List; + +public class DecoratingInvocationHandler<Type, Decorator extends Type> implements InvocationHandler { + + private final List<DecoratorPicker<Type, Decorator>> pickers; + private Type object; + + public DecoratingInvocationHandler(List<DecoratorPicker<Type, Decorator>> pickers, Type object) { + this.pickers = pickers; + this.object = object; + } + + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + Type target = object; + Class<?> methodClass = method.getDeclaringClass(); + + for(DecoratorPicker<Type, Decorator> picker : pickers) { + target = picker.decorate(target, methodClass); + } + + try { + return method.invoke(target, args); + } catch (InvocationTargetException e) { + if (e.getCause() != null) { + throw e.getCause(); + } else { + throw e; + } + } + } +} \ No newline at end of file diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/util/DecoratorPicker.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/util/DecoratorPicker.java new file mode 100644 index 0000000..12add1c --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/util/DecoratorPicker.java @@ -0,0 +1,195 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.naming.util; + +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +/** + * Given as set of decorators extending given type, this class can pick + * the most appropriate set of decorators for a class or a method call. + * <p> + * To configure the decorator, one has to provide a {@link DecoratorSetContext} that + * is then used to obtain the list of + * {@link DecoratorSetContext#getSupportedInterfaces() supported interfaces}, which are + * all the interfaces that should be used for decorator resolution (i.e. all other interfaces + * that a class might implement are ignored during decorator resolution), the list of + * {@link DecoratorSetContext#getDecoratorClasses() decorator classes}, which is a list + * of decorators the picker can choose from and is also used to instantiate and initialize + * the decorators. + * + * @author Lukas Krejci + */ +public class DecoratorPicker<Type, Decorator extends Type> { + + private DecoratorSetContext<Type, Decorator> context; + + public DecoratorSetContext<Type, Decorator> getContext() { + return context; + } + + public void setContext(DecoratorSetContext<Type, Decorator> decoratorSetContext) { + this.context = decoratorSetContext; + } + + /** + * Returns a set of decorators applicable for given method. The set is established based + * on the declaring class of the method. + * + * @param method the method to inspect + * @return the set of decorators that can be used to wrap a method call + * @throws Exception + */ + public Set<Decorator> getDecoratorsForMethod(Method method) throws Exception { + return getDecoratorsForClass_Private(method.getDeclaringClass()); + } + + /** + * Returns a set of decorators that can be used on instances of given class. + * @param cls the class to inspect + * @return + * @throws Exception + */ + public Set<Decorator> getDecoratorsForClass(Class<? extends Type> cls) throws Exception { + return getDecoratorsForClass_Private(cls); + } + + /** + * This method first establishes the set of decorators to use based on the class of the supplied + * object and then chains the decorators (in arbitrary order) with the supplied object at the + * "root" of the chain. + * <p> + * If a method is then called on the returned object, the methods of all the decorators are called + * in chain (each supposedly calling the next) and finally, at the end of the chain, the method on + * the original object (the one supplied to this method) is called. + * <p> + * Note that the above is only an intended behavior and actually depends on the implementation of + * the decorators that are resposinble for the chaining. Each decorator is initialized + * (@{link {@link DecoratorSetContext#init(Object, Object)} which should set it up for such chaining. + * + * @param object + * @return + * @throws Exception + */ + public Type decorate(Type object) throws Exception { + Set<Decorator> decs = getDecoratorsForClass_Private(object.getClass()); + Type ret = object; + for(Decorator d : decs) { + context.init(d, ret); + ret = d; + } + + return ret; + } + + /** + * Similar to {@link #decorate(Object)} but instead of the class of the object itself, + * uses the significantSuperClass as the basis for the decorator resolution. + * <p> + * This is important, because if the object implements two mutually incompatible sub-interfaces of <code>Type</code>, + * the chained decorators might fail to execute a method later on if the decorator depends on the upper part + * of the chain to implement certain sub-interface of <code>Type</code>. + * + * @param object the object to wrap in decorators + * @param significantSuperClass the class to base the decorator resolution on + * @return + * @throws Exception + */ + public Type decorate(Type object, Class<?> significantSuperClass) throws Exception { + Set<Decorator> decs = getDecoratorsForClass_Private(significantSuperClass); + Type ret = object; + for(Decorator d : decs) { + context.init(d, ret); + ret = d; + } + + return ret; + } + + private Set<Decorator> getDecoratorsForClass_Private(Class<?> cls) throws Exception { + Set<Class<? extends Type>> ifaces = getNearestApplicableInterfaces(cls); + + HashSet<Decorator> ret = new HashSet<Decorator>(); + + for (Class<? extends Type> iface : ifaces) { + for (Class<? extends Decorator> decClass : getMatch(iface)) { + ret.add(context.instantiate(decClass)); + } + } + + return ret; + } + + private Set<Class<? extends Type>> getNearestApplicableInterfaces(Class<?> cls) { + List<Class<? extends Type>> ifaces = new ArrayList<Class<? extends Type>>(getAllApplicableInterfaces(cls)); + + //now compact the set to only contain the most concrete interfaces + + Iterator<Class<? extends Type>> it = ifaces.iterator(); + while (it.hasNext()) { + Class<? extends Type> c = it.next(); + + for (int i = 0; i < ifaces.size(); ++i) { + Class<? extends Type> nextC = ifaces.get(i); + if (!c.equals(nextC) && c.isAssignableFrom(nextC)) { + it.remove(); + break; + } + } + } + + return new HashSet<Class<? extends Type>>(ifaces); + } + + private Set<Class<? extends Type>> getAllApplicableInterfaces(Class<?> cls) { + Set<Class<? extends Type>> ifaces = new HashSet<Class<? extends Type>>(); + + for (Class<? extends Type> iface : context.getSupportedInterfaces()) { + if (iface.isAssignableFrom(cls)) { + ifaces.add(iface); + } + } + + if (ifaces.isEmpty()) { + throw new IllegalArgumentException("Class " + cls + + " doesn't implement any of the applicable interfaces. Cannot find decorators for it."); + } + + return ifaces; + } + + private Set<Class<? extends Decorator>> getMatch(Class<?> targetIface) { + + Set<Class<? extends Decorator>> ret = new HashSet<Class<? extends Decorator>>(); + + for (Class<? extends Decorator> cls : context.getDecoratorClasses()) { + if (Arrays.asList(cls.getInterfaces()).contains(targetIface)) { + ret.add(cls); + } + } + + return ret; + } +} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/util/DecoratorSetContext.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/util/DecoratorSetContext.java new file mode 100644 index 0000000..4916a2d --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/util/DecoratorSetContext.java @@ -0,0 +1,59 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.naming.util; + +import java.util.Set; + +/** + * Implementations of this interface provide a context to the {@link DecoratorPicker}. + * + * @author Lukas Krejci + */ +public interface DecoratorSetContext<Type, Decorator> { + + /** + * @return the set of interfaces that the decorators are able support. + * Usually this should be just a union of all interfaces the decorators implement + * but can be trimmed down. + */ + Set<Class<? extends Type>> getSupportedInterfaces(); + + /** + * @return the set of all decorator classes in this set + */ + Set<Class<? extends Decorator>> getDecoratorClasses(); + + /** + * Instantiates a new decorator of given class. + * @param decoratorClass + * @return + * @throws Exception + */ + Decorator instantiate(Class<? extends Decorator> decoratorClass) throws Exception; + + /** + * Initializes the decorator to decorate given object. + * + * @param decorator + * @param object + * @throws Exception on error + */ + void init(Decorator decorator, Type object) throws Exception; +} diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/naming/DecoratingInvocationHandlerTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/naming/DecoratingInvocationHandlerTest.java new file mode 100644 index 0000000..c92cc42 --- /dev/null +++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/naming/DecoratingInvocationHandlerTest.java @@ -0,0 +1,144 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.naming; + +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.Properties; +import java.util.Set; + +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.Name; +import javax.naming.NamingException; +import javax.naming.directory.DirContext; +import javax.naming.event.EventContext; +import javax.naming.event.NamingListener; +import javax.naming.spi.InitialContextFactory; +import javax.naming.spi.NamingManager; + +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +/** + * + * + * @author Lukas Krejci + */ +@Test +public class DecoratingInvocationHandlerTest { + private static final Set<String> INVOKED_METHODS = new HashSet<String>(); + + private static final InvocationHandler NOTE_TAKING_HANDLER = new InvocationHandler() { + + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + INVOKED_METHODS.add(method.getName()); + + if ("hashCode".equals(method.getName())) { + return 0; + } else if ("equals".equals(method.getName())) { + return false; + } + + return null; + } + }; + + private static Class<?>[] CONTEXT_INTERFACES; + + public static class Factory implements InitialContextFactory { + public Context getInitialContext(Hashtable<?, ?> environment) + throws NamingException { + + return (Context) Proxy.newProxyInstance(DecoratingInvocationHandlerTest.class.getClassLoader(), CONTEXT_INTERFACES, NOTE_TAKING_HANDLER); + } + } + + private static class DummyInitialEventContext extends InitialContext implements EventContext { + + /** + * @param environment + * @throws NamingException + */ + public DummyInitialEventContext(Hashtable<?, ?> environment) throws NamingException { + super(environment); + } + + public void addNamingListener(Name target, int scope, NamingListener l) throws NamingException { + ((EventContext)getURLOrDefaultInitCtx(target)).addNamingListener(target, scope, l); + } + + public void addNamingListener(String target, int scope, NamingListener l) throws NamingException { + ((EventContext)getURLOrDefaultInitCtx(target)).addNamingListener(target, scope, l); + } + + public void removeNamingListener(NamingListener l) throws NamingException { + ((EventContext)getDefaultInitCtx()).removeNamingListener(l); + } + + public boolean targetMustExist() throws NamingException { + return ((EventContext)getDefaultInitCtx()).targetMustExist(); + } + + + } + + @BeforeClass + public void setBuilder() throws Exception { + NamingManager.setInitialContextFactoryBuilder(new AccessCheckingInitialContextFactoryBuilder( + new org.jboss.as.naming.InitialContextFactory())); + } + + public void testSimpleDispatch() throws Exception { + INVOKED_METHODS.clear(); + Properties env = new Properties(); + env.put(Context.INITIAL_CONTEXT_FACTORY, Factory.class.getName()); + + CONTEXT_INTERFACES = new Class<?>[] { Context.class }; + + InitialContext ctx = new InitialContext(env); + + ctx.lookup("asdf"); + + assert INVOKED_METHODS.contains("lookup") : "The lookup doesn't seem to have propagated to the actual context to be used."; + } + + public void testMultiInterfaceDispatch() throws Exception { + INVOKED_METHODS.clear(); + Properties env = new Properties(); + env.put(Context.INITIAL_CONTEXT_FACTORY, Factory.class.getName()); + + CONTEXT_INTERFACES = new Class<?>[] { EventContext.class, DirContext.class }; + + InitialContext ctx = new InitialContext(env); + + ctx.lookup("asdf"); + + DummyInitialEventContext ectx = new DummyInitialEventContext(env); + + ectx.addNamingListener("hodiny", 0, null); + + assert INVOKED_METHODS.contains("lookup") : "The lookup doesn't seem to have propagated to the actual context to be used."; + assert INVOKED_METHODS.contains("addNamingListener") : "The addNamingListener doesn't seem to have propagated to the actual context to be used."; + } +} diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/naming/DecoratorPickerTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/naming/DecoratorPickerTest.java new file mode 100644 index 0000000..6a0892f --- /dev/null +++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/naming/DecoratorPickerTest.java @@ -0,0 +1,180 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.naming; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertTrue; + +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +import javax.naming.Context; +import javax.naming.directory.DirContext; +import javax.naming.event.EventContext; +import javax.naming.ldap.LdapContext; + +import org.testng.annotations.Test; + +import org.rhq.enterprise.server.naming.util.DecoratorPicker; +import org.rhq.enterprise.server.naming.util.DecoratorSetContext; + +/** + * @author Lukas Krejci + */ +@Test +public class DecoratorPickerTest { + + private static final InvocationHandler DUMMY_HANDLER = new InvocationHandler() { + + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + if ("hashCode".equals(method.getName())) { + return 0; + } else if ("equals".equals(method.getName())) { + return false; + } + + return null; + } + }; + + private static final Class<?> TEST_OBJECT_CLASS1 = createProxyClass(Context.class); + private static final Class<?> TEST_OBJECT_CLASS2 = createProxyClass(DirContext.class); + private static final Class<?> TEST_OBJECT_CLASS3 = createProxyClass(LdapContext.class); + private static final Class<?> TEST_OBJECT_CLASS4 = createProxyClass(LdapContext.class, EventContext.class); + private static final Class<?> DECORATOR_CLASS1 = createProxyClass(Context.class); + private static final Class<?> DECORATOR_CLASS2 = createProxyClass(EventContext.class); + private static final Class<?> DECORATOR_CLASS3 = createProxyClass(LdapContext.class); + private static final Class<?> DECORATOR_CLASS4 = createProxyClass(DirContext.class); + + public void testSimpleDecoratorIdentifiedByClass() throws Exception { + DecoratorPicker<Object, Object> picker = createTestPicker(); + + Set<Object> contextDecorators = picker.getDecoratorsForClass(TEST_OBJECT_CLASS1); + assertEquals(contextDecorators.size(), 1, "Expected exactly one decorator for Context class"); + assertEquals(contextDecorators.iterator().next().getClass().getInterfaces()[0], Context.class); + } + + public void testSuperClassDecoratorHasPrecedenceOverSubClassDecorator() throws Exception { + DecoratorPicker<Object, Object> picker = createTestPicker(); + + //this tests that the LdapContext isn't returned even though it subclasses the DirContext + Set<Object> contextDecorators = picker.getDecoratorsForClass(TEST_OBJECT_CLASS2); + assertEquals(contextDecorators.size(), 1, "Expected exactly one decorator for DirContext class"); + assertEquals(contextDecorators.iterator().next().getClass().getInterfaces()[0], DirContext.class); + } + + public void testSubClassDecoratorCorrectlyIdentified() throws Exception { + DecoratorPicker<Object, Object> picker = createTestPicker(); + + Set<Object> contextDecorators = picker.getDecoratorsForClass(TEST_OBJECT_CLASS3); + assertEquals(contextDecorators.size(), 1, "Expected exactly one decorator for LdapContext class"); + assertEquals(contextDecorators.iterator().next().getClass().getInterfaces()[0], LdapContext.class); + } + + public void testMultipleDecoratorsDetectable() throws Exception { + DecoratorPicker<Object, Object> picker = createTestPicker(); + + Set<Object> decorators = picker.getDecoratorsForClass(TEST_OBJECT_CLASS4); + assertEquals(decorators.size(), 2, + "Exactly 2 decorators should have been found for a class implementing 2 interfaces."); + + boolean ldapContextDecoratorFound = false; + boolean eventContextDecoratorFound = false; + + for (Object d : decorators) { + if (LdapContext.class.isAssignableFrom(d.getClass())) { + ldapContextDecoratorFound = true; + continue; //just to make sure that somehow the decorator doesn't implement both + } + if (EventContext.class.isAssignableFrom(d.getClass())) { + eventContextDecoratorFound = true; + } + } + + assertTrue(ldapContextDecoratorFound && eventContextDecoratorFound, + "The found decorators don't implement the desired interfaces."); + } + + public void testDecoratorsIdentifiedByMethod() throws Exception { + DecoratorPicker<Object, Object> picker = createTestPicker(); + + Set<Object> decorators = + picker.getDecoratorsForMethod(LdapContext.class.getMethod("getConnectControls", (Class<?>[]) null)); + assertEquals(decorators.size(), 1, + "Expected exactly one decorator for method 'getConnectControls()' from LdapContext class"); + assertEquals(decorators.iterator().next().getClass().getInterfaces()[0], LdapContext.class); + } + + public void testMethodFromSubclassMatchesSubclassDecorator() throws Exception { + DecoratorPicker<Object, Object> picker = createTestPicker(); + + //this is a method from the DirContext but we're asking for it from a class + //that implements also an LdapContext + //The LdapContext decorator also inherits from the DirContext decorator + //(by the virtue of LdapContext interface inheriting from the DirContext) + //The picker should therefore match the LdapContext decorator because its + //the "closest" one to the actual class. + Set<Object> decorators = + picker.getDecoratorsForMethod(TEST_OBJECT_CLASS3.getMethod("getSchemaClassDefinition", + new Class<?>[] { String.class })); + assertEquals(decorators.size(), 1, + "Expected exactly one decorator for method 'getSchemaClassDefinition(String)' from LdapContext class"); + assertEquals(decorators.iterator().next().getClass().getInterfaces()[0], LdapContext.class); + } + + private static Class<?> createProxyClass(Class<?>... ifaces) { + return Proxy.getProxyClass(DecoratorPickerTest.class.getClassLoader(), ifaces); + } + + private static DecoratorPicker<Object, Object> createTestPicker() { + DecoratorPicker<Object, Object> picker = new DecoratorPicker<Object, Object>(); + + DecoratorSetContext<Object, Object> decSet = new DecoratorSetContext<Object, Object>() { + + public Object instantiate(Class<? extends Object> decoratorClass) throws Exception { + Constructor<? extends Object> ctor = decoratorClass.getConstructor(InvocationHandler.class); + return ctor.newInstance(DUMMY_HANDLER); + } + + public void init(Object decorator, Object object) throws Exception { + } + + @SuppressWarnings("unchecked") + public Set<Class<? extends Object>> getSupportedInterfaces() { + return new HashSet<Class<? extends Object>>(Arrays.asList(Context.class, EventContext.class, + LdapContext.class, DirContext.class)); + } + + @SuppressWarnings("unchecked") + public Set<Class<? extends Object>> getDecoratorClasses() { + return new HashSet<Class<? extends Object>>(Arrays.asList(DECORATOR_CLASS1, DECORATOR_CLASS2, DECORATOR_CLASS3, DECORATOR_CLASS4)); + } + }; + + picker.setContext(decSet); + + return picker; + } +} diff --git a/modules/enterprise/server/pom.xml b/modules/enterprise/server/pom.xml index db001bd..614647b 100644 --- a/modules/enterprise/server/pom.xml +++ b/modules/enterprise/server/pom.xml @@ -25,7 +25,6 @@ </activation> <modules> <module>xml-schemas</module> - <module>container-lib</module> <module>jar</module> <module>sars</module> <module>plugins</module> @@ -46,7 +45,6 @@ </activation> <modules> <module>xml-schemas</module> - <module>container-lib</module> <module>jar</module> <module>safe-invoker</module> </modules> diff --git a/modules/integration-tests/jndi-access/jndi-access-test/src/test/java/org/rhq/jndi/test/JndiAccessTest.java b/modules/integration-tests/jndi-access/jndi-access-test/src/test/java/org/rhq/jndi/test/JndiAccessTest.java index 05c59b6..46d211c 100644 --- a/modules/integration-tests/jndi-access/jndi-access-test/src/test/java/org/rhq/jndi/test/JndiAccessTest.java +++ b/modules/integration-tests/jndi-access/jndi-access-test/src/test/java/org/rhq/jndi/test/JndiAccessTest.java @@ -45,9 +45,9 @@ import org.rhq.bindings.StandardScriptPermissions; import org.rhq.bindings.util.PackageFinder; import org.rhq.core.domain.auth.Subject; import org.rhq.enterprise.client.LocalClient; +import org.rhq.enterprise.server.AllowRhqServerInternalsAccessPermission; import org.rhq.enterprise.server.test.AbstractEJB3Test; import org.rhq.enterprise.server.util.LookupUtil; -import org.rhq.jndi.AllowRhqServerInternalsAccessPermission; import org.rhq.test.PortScout;
/** diff --git a/modules/pom.xml b/modules/pom.xml index e40d89a..d1745b2 100644 --- a/modules/pom.xml +++ b/modules/pom.xml @@ -163,7 +163,6 @@ <module>enterprise/comm</module>
<!-- These are needed for the JNDI intergration tests --> - <module>enterprise/server/container-lib</module> <module>enterprise/server/xml-schemas</module> <module>enterprise/server/safe-invoker</module> <module>enterprise/server/jar</module>
commit 4a0fb0b560f1ab18a3860baff457c3369b694568 Author: Stefan Negrea snegrea@redhat.com Date: Fri Dec 7 10:19:02 2012 -0600
Add back Cassandra plugin specific .classpath updates.
diff --git a/.classpath b/.classpath index 996b0fc..33fd1d0 100644 --- a/.classpath +++ b/.classpath @@ -179,6 +179,8 @@ <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"/> + <classpathentry kind="src" path="modules/plugins/cassandra/src/main/java"/> + <classpathentry kind="src" path="modules/plugins/cassandra/src/test/java"/> <classpathentry excluding="**" kind="src" path="modules/enterprise/comm/src/test/resources"/> <classpathentry excluding="**" kind="src" path="modules/enterprise/agent/src/main/resources"/> <classpathentry excluding="**" kind="src" path="modules/enterprise/agent/src/test/resources"/> @@ -334,5 +336,7 @@ <classpathentry exported="true" kind="var" path="M2_REPO/com/wordnik/swagger-annotations_2.9.1/1.1.1-SNAPSHOT/swagger-annotations_2.9.1-1.1.1-20121031.024335-6.jar"/> <classpathentry exported="true" kind="var" path="JDK_HOME/lib/tools.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/joda-time/joda-time/2.1/joda-time-2.1.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/apache/cassandra/cassandra-thrift/1.1.5/cassandra-thrift-1.1.5.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/hectorclient/hector-core/1.1-1/hector-core-1.1-1.jar"/> <classpathentry kind="output" path="eclipse-classes"/> </classpath>
commit e73273e9c1ef2b902ccc4e967d6ae96343088405 Merge: 6239ffc 471c4af Author: John Mazzitelli mazz@redhat.com Date: Fri Dec 7 09:30:09 2012 -0500
Merge remote-tracking branch 'origin/master' into rhq-on-as7
Conflicts: .classpath modules/enterprise/server/ear/pom.xml
commit 471c4af38dd02a614acd06881e2b40e7a4b3829a Author: John Mazzitelli mazz@redhat.com Date: Fri Dec 7 09:23:32 2012 -0500
revert to the last known copy that is correct - stefan, put back your cassandra stuff in here
diff --git a/.classpath b/.classpath index 029ef7c..996b0fc 100644 --- a/.classpath +++ b/.classpath @@ -1,6 +1,15 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="modules/common/ant-bundle/src/main/java"/> + <classpathentry kind="src" path="modules/enterprise/server/jar/src/test/java"/> + <classpathentry kind="src" path="modules/enterprise/server/itests-2/src/test/java"/> + <classpathentry kind="src" path="modules/enterprise/scripting/javascript/src/main/java"/> + <classpathentry kind="src" path="modules/enterprise/scripting/python/src/main/java"/> + <classpathentry kind="src" path="modules/enterprise/scripting/python/src/test/java"/> + <classpathentry kind="src" path="modules/enterprise/scripting/javascript/src/test/java"/> + <classpathentry kind="src" path="modules/enterprise/gui/installer/src/test/java"/> + <classpathentry kind="src" path="modules/common/jboss-as-dmr-client/src/test/java"/> + <classpathentry kind="src" path="modules/common/jboss-as-dmr-client/src/main/java"/> <classpathentry kind="src" path="modules/enterprise/scripting/api/src/main/java"/> <classpathentry kind="src" path="modules/cli-tests/src/main/java"/> <classpathentry kind="src" path="modules/helpers/jeeGen/src/main/java"/> @@ -40,8 +49,6 @@ <classpathentry kind="src" path="modules/enterprise/server/xml-schemas/src/test/java"/> <classpathentry kind="src" path="modules/enterprise/server/xml-schemas/target/generated-sources/xjc"/> <classpathentry kind="src" path="modules/enterprise/server/jar/src/main/java"/> - <classpathentry kind="src" path="modules/enterprise/server/jar/src/test/java"/> - <classpathentry kind="src" path="modules/enterprise/server/jar/src/main/filtered-sources/java"/> <classpathentry kind="src" path="modules/enterprise/server/jar/target/generated-sources/antlr3"/> <classpathentry kind="src" path="modules/enterprise/binding/src/main/java"/> <classpathentry kind="src" path="modules/enterprise/binding/src/test/java"/> @@ -49,8 +56,8 @@ <classpathentry kind="src" path="modules/enterprise/gui/coregui/target/generated-sources/gwt"/> <classpathentry kind="src" path="modules/enterprise/gui/portal-war/src/main/java"/> <classpathentry kind="src" path="modules/enterprise/gui/portal-war/src/test/java"/> - <classpathentry kind="src" path="modules/enterprise/gui/installer-war/src/main/java"/> - <classpathentry kind="src" path="modules/enterprise/gui/base-perspective-jar/src/main/java"/> + <classpathentry kind="src" path="modules/enterprise/gui/installer/src/main/java"/> + <classpathentry kind="src" path="modules/enterprise/gui/installer/target/generated-sources/gwt"/> <classpathentry kind="src" path="modules/enterprise/gui/content_http-war/src/main/java"/> <classpathentry kind="src" path="modules/enterprise/server/client-api/src/main/java"/> <classpathentry kind="src" path="modules/enterprise/remoting/client-api/src/main/java"/> @@ -59,6 +66,8 @@ <classpathentry kind="src" path="modules/enterprise/server/sars/agent-sar/src/main/java"/> <classpathentry kind="src" path="modules/enterprise/server/safe-invoker/src/main/java"/> <classpathentry kind="src" path="modules/enterprise/server/safe-invoker/src/test/java"/> + <classpathentry kind="src" path="modules/enterprise/server/startup-subsystem/src/main/java"/> + <classpathentry kind="src" path="modules/enterprise/server/startup-subsystem/src/test/java"/> <classpathentry kind="src" path="modules/enterprise/server/container-lib/src/main/java"/> <classpathentry kind="src" path="modules/enterprise/server/plugins/ant-bundle/src/main/java"/> <classpathentry kind="src" path="modules/enterprise/server/plugins/filetemplate-bundle/src/main/java"/> @@ -164,7 +173,6 @@ <classpathentry kind="src" path="modules/core/arquillian-integration/container/src/test/java"/> <classpathentry kind="src" path="modules/core/arquillian-integration/archive/src/main/java"/> <classpathentry kind="src" path="modules/core/arquillian-integration/container/src/main/java"/> - <classpathentry kind="src" path="modules/enterprise/server/itests/src/test/java"/> <classpathentry kind="src" path="modules/test-utils/src/main/java"/> <classpathentry kind="src" path="modules/integration-tests/mod_cluster-plugin-test/src/test/java"/> <classpathentry kind="src" path="etc/samples/skeleton-plugin/src/main/java"/> @@ -174,14 +182,11 @@ <classpathentry excluding="**" kind="src" path="modules/enterprise/comm/src/test/resources"/> <classpathentry excluding="**" kind="src" path="modules/enterprise/agent/src/main/resources"/> <classpathentry excluding="**" kind="src" path="modules/enterprise/agent/src/test/resources"/> - <classpathentry kind="src" path="modules/plugins/cassandra/src/main/java"/> - <classpathentry kind="src" path="modules/plugins/cassandra/src/test/java"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/integration/jboss-profileservice-spi/5.1.0.SP1/jboss-profileservice-spi-5.1.0.SP1.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/man/jboss-managed/2.1.1.GA/jboss-managed-2.1.1.GA.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/man/jboss-metatype/2.1.1.GA/jboss-metatype-2.1.1.GA.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/apache/commons/commons-io/1.3.2/commons-io-1.3.2.jar" sourcepath="/M2_REPO/commons-io/commons-io/1.3.1/commons-io-1.3.1-sources.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/com/sun/xml/bind/jaxb-impl/2.1.9/jaxb-impl-2.1.9.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/com/sun/xml/bind/jaxb-impl/2.2.4/jaxb-impl-2.2.4.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/i18nlog/i18nlog/1.0.10/i18nlog-1.0.10.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/gnu-getopt/getopt/1.0.13/getopt-1.0.13.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/commons-httpclient/commons-httpclient/3.0.1/commons-httpclient-3.0.1.jar"/> @@ -205,17 +210,14 @@ <classpathentry exported="true" kind="var" path="M2_REPO/tomcat/catalina/5.5.20/catalina-5.5.20.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/taglibs/standard/1.1.2/standard-1.1.2.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/jboss/jboss-common/1.2.1.GA/jboss-common-1.2.1.GA.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/jboss-common-core/2.2.17.GA/jboss-common-core-2.2.17.GA.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/javax/servlet/jstl/1.1.2/jstl-1.1.2.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/struts-menu/struts-menu/2.3/struts-menu-2.3.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/junit/junit/3.8.2/junit-3.8.2.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/apache/velocity/velocity/1.5/velocity-1.5.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/xalan/xalan/2.5.1/xalan-2.5.1.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/javax/xml/bind/jaxb-api/2.2.3/jaxb-api-2.2.3.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/javax/xml/bind/jsr173_api/1.0/jsr173_api-1.0.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/jboss/jboss-embeddable-ejb3/jboss-ejb3-all/1.0.0.Alpha9/jboss-ejb3-all-1.0.0.Alpha9.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/jboss/jbpm/3.1.1/jbpm-3.1.1.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/jboss/jboss-embeddable-ejb3/hibernate-all/1.0.0.Alpha9/hibernate-all-1.0.0.Alpha9.jar" sourcepath="/M2_REPO/hibernate/hibernate3/3.2.r14201-2/hibernate3-3.2.r14201-2.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/jetbrains/annotations/7.0.2/annotations-7.0.2.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/apache/ant/ant-launcher/1.8.0/ant-launcher-1.8.0.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/cglib/cglib-nodep/2.1_3/cglib-nodep-2.1_3.jar"/> @@ -227,31 +229,25 @@ <classpathentry exported="true" kind="var" path="M2_REPO/com/sun/facelets/jsf-facelets/1.1.15.B1/jsf-facelets-1.1.15.B1.jar" sourcepath="/M2_REPO/com/sun/facelets/jsf-facelets/1.1.15.B1/jsf-facelets-1.1.15.B1-sources.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/mc4j/org-mc4j-ems/1.3/org-mc4j-ems-1.3.jar" sourcepath="/M2_REPO/mc4j/org-mc4j-ems/1.3/org-mc4j-ems-1.3-sources.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/opensymphony/quartz/quartz/1.6.5/quartz-1.6.5.jar" sourcepath="/M2_REPO/org/opensymphony/quartz/quartz/1.6.5/quartz-1.6.5-sources.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/javax/mail/mail/1.4/mail-1.4.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/javax/mail/mail/1.4.4/mail-1.4.4.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/commons-fileupload/commons-fileupload/1.2/commons-fileupload-1.2.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/richfaces/framework/richfaces-api/3.3.3.Final/richfaces-api-3.3.3.Final.jar" sourcepath="/M2_REPO/org/richfaces/framework/richfaces-api/3.1.3.GA/richfaces-api-3.1.3.GA-sources.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/richfaces/framework/richfaces-impl/3.3.3.Final/richfaces-impl-3.3.3.Final.jar" sourcepath="/M2_REPO/org/richfaces/framework/richfaces-impl/3.3.0.GA/richfaces-impl-3.3.0.GA-sources.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/richfaces/ui/richfaces-ui/3.3.3.Final/richfaces-ui-3.3.3.Final.jar" sourcepath="/M2_REPO/org/richfaces/ui/richfaces-ui/3.3.0.GA/richfaces-ui-3.3.0.GA-sources.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/postgresql/postgresql/9.1-901.jdbc4/postgresql-9.1-901.jdbc4.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/postgresql/postgresql/9.1-902.jdbc4/postgresql-9.1-902.jdbc4.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/jboss/jboss-cache/1.4.1.SP9/jboss-cache-1.4.1.SP9.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/hyperic/sigar/1.6.5.132-3/sigar-1.6.5.132-3.jar" sourcepath="/M2_REPO/org/hyperic/sigar/1.6.5.132-3/sigar-1.6.5.132-3-sources.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/transaction/jboss-jta/4.2.3.SP5/jboss-jta-4.2.3.SP5.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/transaction/jboss-jts-common/4.2.3.SP5/jboss-jts-common-4.2.3.SP5.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/jbossws-spi/1.1.1.GA/jbossws-spi-1.1.1.GA.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/jbossws/jbossws-native-core/3.1.1.GA/jbossws-native-core-3.1.1.GA.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/hyperic/sigar/1.6.5.132-3/sigar-1.6.5.132-3.jar" sourcepath="/M2_REPO/org/hyperic/sigar/1.6.3.82/sigar-1.6.3.82-sources.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/jbossts/jbossjts/4.16.2.Final/jbossjts-4.16.2.Final.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/apache/maven/maven-project/2.0.8/maven-project-2.0.8.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/apache/maven/maven-plugin-api/2.0.8/maven-plugin-api-2.0.8.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/codehaus/swizzle/swizzle-confluence/1.6.1/swizzle-confluence-1.6.1.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/jvnet/inflector/0.7.0/inflector-0.7.0.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/net/augeas/augeas/0.0.2/augeas-0.0.2.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/json/json/20080701/json-20080701.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/json/json/20090211/json-20090211.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/net/java/dev/jna/jna/3.2.5/jna-3.2.5.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/freemarker/freemarker/2.3.11/freemarker-2.3.11.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/seam/jboss-seam/2.1.0.SP1/jboss-seam-2.1.0.SP1.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/seam/jboss-seam-ui/2.1.0.SP1/jboss-seam-ui-2.1.0.SP1.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/hibernate/hibernate3/3.2.r14201-2/hibernate3-3.2.r14201-2.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/jline/jline/0.9.94/jline-0.9.94.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/javassist/javassist/3.9.0.GA/javassist-3.9.0.GA.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/javassist/javassist/3.12.1.GA/javassist-3.12.1.GA.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/net/sf/opencsv/opencsv/1.8/opencsv-1.8.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/commons-digester/commons-digester/1.8.1/commons-digester-1.8.1.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/commons-codec/commons-codec/1.4/commons-codec-1.4.jar"/> @@ -264,8 +260,8 @@ <classpathentry exported="true" kind="var" path="M2_REPO/jboss/web/jbossweb/2.0.1.GA/jbossweb-2.0.1.GA.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/libvirt/libvirt/0.4.1/libvirt-0.4.1.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/fedorahosted/cobbler/cobbler4j/0.1/cobbler4j-0.1.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/com/google/gwt/gwt-user/2.4.0/gwt-user-2.4.0.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/com/google/gwt/gwt-dev/2.4.0/gwt-dev-2.4.0.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/com/google/gwt/gwt-user/2.5.0/gwt-user-2.5.0.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/com/google/gwt/gwt-dev/2.5.0/gwt-dev-2.5.0.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/com/smartgwt/smartgwt/3.0/smartgwt-3.0.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/com/googlecode/gflot/gflot/2.4.2/gflot-2.4.2.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/com/jcraft/jsch/0.1.29/jsch-0.1.29.jar"/> @@ -282,35 +278,61 @@ <classpathentry exported="true" kind="var" path="M2_REPO/org/mongodb/mongo-java-driver/2.6.5/mongo-java-driver-2.6.5.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/com/googlecode/java-diff-utils/diffutils/1.2.1/diffutils-1.2.1.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/com/google/code/morphia/morphia/0.99/morphia-0.99.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/resteasy/resteasy-links/2.3.3.Final/resteasy-links-2.3.3.Final.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/resteasy/resteasy-jaxrs/2.3.3.Final/resteasy-jaxrs-2.3.3.Final.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/resteasy/resteasy-jackson-provider/2.3.3.Final/resteasy-jackson-provider-2.3.3.Final.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/resteasy/jaxrs-api/2.3.3.Final/jaxrs-api-2.3.3.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/hibernate/hibernate-annotations/3.5.6-Final/hibernate-annotations-3.5.6-Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/hibernate/hibernate-core/4.0.1.Final/hibernate-core-4.0.1.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/hibernate/hibernate-entitymanager/4.0.1.Final/hibernate-entitymanager-4.0.1.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/hibernate/hibernate-validator/4.2.0.Final/hibernate-validator-4.2.0.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/hibernate/javax/persistence/hibernate-jpa-2.0-api/1.0.1.Final/hibernate-jpa-2.0-api-1.0.1.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/infinispan/infinispan-core/5.1.2.FINAL/infinispan-core-5.1.2.FINAL.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/spec/javax/servlet/jboss-servlet-api_3.0_spec/1.0.1.Final/jboss-servlet-api_3.0_spec-1.0.1.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/msc/jboss-msc/1.0.2.GA/jboss-msc-1.0.2.GA.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/jboss-dmr/1.1.1.Final/jboss-dmr-1.1.1.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/as/jboss-as-naming/7.1.1.Final/jboss-as-naming-7.1.1.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/as/jboss-as-server/7.1.1.Final/jboss-as-server-7.1.1.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/staxmapper/1.1.0.Final/staxmapper-1.1.0.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/modules/jboss-modules/1.1.1.GA/jboss-modules-1.1.1.GA.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/as/jboss-as-subsystem-test/7.1.1.Final/jboss-as-subsystem-test-7.1.1.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/as/jboss-as-controller/7.1.1.Final/jboss-as-controller-7.1.1.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/as/jboss-as-controller-client/7.1.1.Final/jboss-as-controller-client-7.1.1.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/resteasy/resteasy-links/2.3.4.Final/resteasy-links-2.3.4.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/resteasy/resteasy-jaxrs/2.3.4.Final/resteasy-jaxrs-2.3.4.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/resteasy/resteasy-jackson-provider/2.3.4.Final/resteasy-jackson-provider-2.3.4.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/resteasy/jaxrs-api/2.3.4.Final/jaxrs-api-2.3.4.Final.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/sasl/jboss-sasl/1.0.0.Final/jboss-sasl-1.0.0.Final.jar"/> - <classpathentry exported="true" kind="var" path="JDK_HOME/lib/tools.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/mockito/mockito-all/1.9.0/mockito-all-1.9.0.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/powermock/powermock-api-mockito/1.4.11/powermock-api-mockito-1.4.11.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/powermock/powermock-core/1.4.11/powermock-core-1.4.11.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/powermock/powermock-api-support/1.4.11/powermock-api-support-1.4.11.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/powermock/powermock-module-testng-common/1.4.11/powermock-module-testng-common-1.4.11.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/powermock/powermock-module-testng/1.4.11/powermock-module-testng-1.4.11.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/powermock/powermock-api-mockito/1.4.12/powermock-api-mockito-1.4.12.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/powermock/powermock-core/1.4.12/powermock-core-1.4.12.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/powermock/powermock-api-support/1.4.12/powermock-api-support-1.4.12.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/powermock/powermock-module-testng-common/1.4.12/powermock-module-testng-common-1.4.12.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/powermock/powermock-module-testng/1.4.12/powermock-module-testng-1.4.12.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/liquibase/liquibase-core/2.0.3/liquibase-core-2.0.3.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/shrinkwrap/shrinkwrap-impl-base/1.0.0/shrinkwrap-impl-base-1.0.0.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/shrinkwrap/shrinkwrap-api/1.0.0/shrinkwrap-api-1.0.0.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/shrinkwrap/shrinkwrap-spi/1.0.0/shrinkwrap-spi-1.0.0.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/shrinkwrap/descriptors/shrinkwrap-descriptors-api-base/2.0.0-alpha-2/shrinkwrap-descriptors-api-base-2.0.0-alpha-2.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/shrinkwrap/resolver/shrinkwrap-resolver-api/1.0.0-beta-6/shrinkwrap-resolver-api-1.0.0-beta-6.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/shrinkwrap/resolver/shrinkwrap-resolver-api-maven/1.0.0-beta-6/shrinkwrap-resolver-api-maven-1.0.0-beta-6.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/arquillian/test/arquillian-test-spi/1.0.0.Final/arquillian-test-spi-1.0.0.Final.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/arquillian/test/arquillian-test-api/1.0.0.Final/arquillian-test-api-1.0.0.Final.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/arquillian/core/arquillian-core-spi/1.0.0.Final/arquillian-core-spi-1.0.0.Final.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/arquillian/core/arquillian-core-api/1.0.0.Final/arquillian-core-api-1.0.0.Final.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/arquillian/container/arquillian-container-spi/1.0.0.Final/arquillian-container-spi-1.0.0.Final.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/arquillian/container/arquillian-container-test-api/1.0.0.Final/arquillian-container-test-api-1.0.0.Final.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/arquillian/testng/arquillian-testng-core/1.0.0.Final/arquillian-testng-core-1.0.0.Final.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/com/wordnik/swagger-annotations_2.9.1/1.1-SNAPSHOT/swagger-annotations_2.9.1-1.1-20120531.064118-1.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/shrinkwrap/shrinkwrap-impl-base/1.0.1/shrinkwrap-impl-base-1.0.1.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/shrinkwrap/shrinkwrap-api/1.0.1/shrinkwrap-api-1.0.1.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/shrinkwrap/shrinkwrap-spi/1.0.1/shrinkwrap-spi-1.0.1.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/shrinkwrap/descriptors/shrinkwrap-descriptors-api-base/2.0.0-alpha-3/shrinkwrap-descriptors-api-base-2.0.0-alpha-3.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/shrinkwrap/resolver/shrinkwrap-resolver-api/1.0.0-beta-7/shrinkwrap-resolver-api-1.0.0-beta-7.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/shrinkwrap/resolver/shrinkwrap-resolver-api-maven/1.0.0-beta-7/shrinkwrap-resolver-api-maven-1.0.0-beta-7.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/arquillian/test/arquillian-test-spi/1.0.2.Final/arquillian-test-spi-1.0.2.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/arquillian/test/arquillian-test-api/1.0.2.Final/arquillian-test-api-1.0.2.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/arquillian/core/arquillian-core-spi/1.0.2.Final/arquillian-core-spi-1.0.2.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/arquillian/core/arquillian-core-api/1.0.2.Final/arquillian-core-api-1.0.2.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/arquillian/container/arquillian-container-spi/1.0.2.Final/arquillian-container-spi-1.0.2.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/arquillian/container/arquillian-container-test-api/1.0.2.Final/arquillian-container-test-api-1.0.2.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/arquillian/config/arquillian-config-api/1.0.2.Final/arquillian-config-api-1.0.2.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/arquillian/container/arquillian-container-test-impl-base/1.0.2.Final/arquillian-container-test-impl-base-1.0.2.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/arquillian/testng/arquillian-testng-core/1.0.2.Final/arquillian-testng-core-1.0.2.Final.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/byteman/byteman/1.2.1/byteman-1.2.1.jar"/> - <classpathentry kind="var" path="M2_REPO/org/apache/cassandra/cassandra-thrift/1.1.5/cassandra-thrift-1.1.5.jar"/> - <classpathentry kind="var" path="M2_REPO/org/hectorclient/hector-core/1.1-1/hector-core-1.1-1.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/ejb3/jboss-ejb3-ext-api/2.0.0/jboss-ejb3-ext-api-2.0.0.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/spec/javax/ejb/jboss-ejb-api_3.1_spec/1.0.2.Final/jboss-ejb-api_3.1_spec-1.0.2.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/spec/javax/jms/jboss-jms-api_1.1_spec/1.0.0.Final/jboss-jms-api_1.1_spec-1.0.0.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/spec/javax/interceptor/jboss-interceptors-api_1.1_spec/1.0.0.Final/jboss-interceptors-api_1.1_spec-1.0.0.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/spec/javax/transaction/jboss-transaction-api_1.1_spec/1.0.0.Final/jboss-transaction-api_1.1_spec-1.0.0.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/remotingjmx/remoting-jmx/1.0.2.Final/remoting-jmx-1.0.2.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/mozilla/rhino/1.7R4/rhino-1.7R4.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/picketbox/picketbox/4.0.7.Final/picketbox-4.0.7.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/python/jython-standalone/2.5.2/jython-standalone-2.5.2.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/com/wordnik/swagger-annotations_2.9.1/1.1.1-SNAPSHOT/swagger-annotations_2.9.1-1.1.1-20121031.024335-6.jar"/> + <classpathentry exported="true" kind="var" path="JDK_HOME/lib/tools.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/joda-time/joda-time/2.1/joda-time-2.1.jar"/> <classpathentry kind="output" path="eclipse-classes"/> </classpath>
commit 7c1d4d80cf05b33754df033f3e4ada89896f65c0 Author: Heiko W. Rupp hwr@redhat.com Date: Fri Dec 7 10:25:34 2012 +0100
Refactor the REST API to drop the /1/ in the URI. * move to EJB 3.1 local SLSB * separate the examples into their own war file
diff --git a/modules/enterprise/gui/pom.xml b/modules/enterprise/gui/pom.xml index e6e5807..8e0c2c4 100644 --- a/modules/enterprise/gui/pom.xml +++ b/modules/enterprise/gui/pom.xml @@ -32,6 +32,7 @@ <module>content_http-war</module> <module>coregui</module> <module>rest-war</module> + <module>rest-examples-war</module> </modules> </profile>
diff --git a/modules/enterprise/gui/rest-examples-war/pom.xml b/modules/enterprise/gui/rest-examples-war/pom.xml new file mode 100644 index 0000000..e0d801f --- /dev/null +++ b/modules/enterprise/gui/rest-examples-war/pom.xml @@ -0,0 +1,133 @@ +<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%22%3E + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.rhq</groupId> + <artifactId>rhq-parent</artifactId> + <version>4.6.0-SNAPSHOT</version> + <relativePath>../../../../pom.xml</relativePath> + </parent> + + <groupId>org.rhq</groupId> + <artifactId>rhq-rest-examples</artifactId> + <packaging>war</packaging> + + <name>RHQ REST interface examples</name> + <description>RHQ Rest interface for the RHQ server (Examples)</description> + + <build> + <finalName>rhq-rest-examples</finalName> + + <plugins> + + <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> + <directory>${basedir}/src/main/webapp</directory> + </resource> + </webResources> + </configuration> + </plugin> + + </plugins> + + </build> + + + <profiles> + + <profile> + <id>dev</id> + + <properties> + <rhq.rootDir>../../../..</rhq.rootDir> + <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> + <rhq.deploymentName>${project.build.finalName}.war</rhq.deploymentName> + <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/${rhq.deploymentName}</rhq.deploymentDir> + </properties> + + <build> + <plugins> + + <plugin> + <artifactId>maven-antrun-plugin</artifactId> + <executions> + + <execution> + <id>deploy-classes</id> + <phase>compile</phase> + <configuration> + <target> + <property name="classes.dir" location="${rhq.deploymentDir}/WEB-INF/classes" /> + <echo>*** Copying updated files from target/classes to ${classes.dir}...</echo> + <copy todir="${classes.dir}" verbose="${rhq.verbose}"> + <fileset dir="target/classes" /> + </copy> + <property name="deployment.dir" location="${rhq.deploymentDir}" /> + <echo>*** Copying updated files from src${file.separator}main${file.separator}webapp${file.separator} to ${deployment.dir}${file.separator}...</echo> + <copy todir="${deployment.dir}" verbose="${rhq.verbose}"> + <fileset dir="${basedir}/src/main/webapp" /> + </copy> + <!-- TODO: Also copy the files from src/main/webapp-filtered/, and then filter them ourselves. --> + </target> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + + <execution> + <id>deploy</id> + <phase>package</phase> + <configuration> + <target> + <property name="deployment.dir" location="${rhq.deploymentDir}" /> + <echo>*** Copying updated files from target${file.separator}${project.build.finalName}${file.separator} to ${deployment.dir}${file.separator}...</echo> + <copy todir="${deployment.dir}" verbose="${rhq.verbose}"> + <fileset dir="${basedir}/target/${project.build.finalName}" /> + </copy> + </target> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + + <execution> + <id>undeploy</id> + <phase>clean</phase> + <configuration> + <target> + <property name="deployment.dir" location="${rhq.deploymentDir}" /> + <echo>*** Deleting ${deployment.dir}${file.separator}...</echo> + <delete dir="${deployment.dir}" /> + </target> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + + </executions> + </plugin> + + </plugins> + </build> + </profile> + </profiles> + +</project> diff --git a/modules/enterprise/gui/rest-examples-war/src/main/webapp/WEB-INF/jboss-web.xml b/modules/enterprise/gui/rest-examples-war/src/main/webapp/WEB-INF/jboss-web.xml new file mode 100644 index 0000000..319b990 --- /dev/null +++ b/modules/enterprise/gui/rest-examples-war/src/main/webapp/WEB-INF/jboss-web.xml @@ -0,0 +1,5 @@ +<?xml version="1.0"?> + +<jboss-web> + <security-domain>RHQRESTSecurityDomain</security-domain> +</jboss-web> diff --git a/modules/enterprise/gui/rest-examples-war/src/main/webapp/WEB-INF/web.xml b/modules/enterprise/gui/rest-examples-war/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..fb75d94 --- /dev/null +++ b/modules/enterprise/gui/rest-examples-war/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,27 @@ +<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd%22%3E + + <display-name>RHQ Rest interface examples</display-name> + + <security-constraint> + <web-resource-collection> + <web-resource-name>REST</web-resource-name> + <url-pattern>/*</url-pattern> + </web-resource-collection> + <auth-constraint> + <role-name>all</role-name> + </auth-constraint> + </security-constraint> + + <login-config> + <auth-method>BASIC</auth-method> + <realm-name>RHQ REST</realm-name> + </login-config> + + <security-role> + <description>This is valid for all principals, as we do internal checks</description> + <role-name>all</role-name> + </security-role> + +</web-app> diff --git a/modules/enterprise/gui/rest-examples-war/src/main/webapp/bars_simple.html b/modules/enterprise/gui/rest-examples-war/src/main/webapp/bars_simple.html new file mode 100644 index 0000000..ba6f1de --- /dev/null +++ b/modules/enterprise/gui/rest-examples-war/src/main/webapp/bars_simple.html @@ -0,0 +1,131 @@ +<!DOCTYPE html> +<html> + <head> + <title>Bar Chart</title> + <script type="text/javascript" src="js/d3.js"></script> + <script type="text/javascript" src="js/jquery.js"></script> + <style type="text/css"> + +body { + font: 10px sans-serif; +} + +svg { + shape-rendering: crispEdges; +} + + </style> + </head> + <body> + <h1 id="resId">Resource</h1> + <h2 id="header">Schedule</h2> + <script type="text/javascript"> + + // Get the platforms and then the first one + $.getJSON('/rest/resource/platforms.json', function (json) { + var res = json[0]; + var rid = res.resourceId; + $("#resId").text("Resource " + rid + " (" + res.resourceName + ")"); + + // Now get the metrical schedules of the platform + $.getJSON("/rest/resource/"+rid+"/schedules.json?type=metric", function (json2) { + + // Take the first + var schId = json2[0].scheduleId; + $("#header").text("Schedule " + schId + " (" + json2[0].scheduleName + ")"); + + // And call d3 graphing on it + d3.json( + '/rest/metric/data/'+schId+'.json', + function (jsondata) { + + // create the chart here with + // the returned data + + var points = jsondata.dataPoints; + var min = jsondata.min; + var max = jsondata.max; + + var data = points.map(function(d) { + var t = d.value - min; + if (t<0) + t=0; + return t; + }); + + var w = 430, + h = 630, + x = d3.scale.linear().domain([0, max-min]).range([0, w]), + y = d3.scale.ordinal().domain(d3.range(data.length)).rangeBands([0, h], .2); + + var vis = d3.select("body") + .append("svg:svg") + .attr("width", w + 40) + .attr("height", h + 20) + .append("svg:g") + .attr("transform", "translate(20,0)"); + + var bars = vis.selectAll("g.bar") + .data(data) + .enter().append("svg:g") + .attr("class", "bar") + .attr("transform", function(d, i) { return "translate(0," + y(i) + ")"; }); + + bars.append("svg:rect") + .attr("fill", "steelblue") + .attr("width", x) + .attr("height", y.rangeBand()); + + bars.append("svg:text") + .attr("x", x) + .attr("y", y.rangeBand() / 2) + .attr("dx", -6) + .attr("dy", ".35em") + .attr("fill", "white") + .attr("text-anchor", "end") + .text(x.tickFormat(100)); + + bars.append("svg:text") + .attr("x", 0) + .attr("y", y.rangeBand() / 2) + .attr("dx", -6) + .attr("dy", ".35em") + .attr("text-anchor", "end") + .text(function(d, i) { return String.fromCharCode(65 + i); }); + + var rules = vis.selectAll("g.rule") + .data(x.ticks(10)) + .enter().append("svg:g") + .attr("class", "rule") + .attr("transform", function(d) { return "translate(" + x(d) + ",0)"; }); + + rules.append("svg:line") + .attr("y1", h) + .attr("y2", h + 6) + .attr("stroke", "black"); + + rules.append("svg:line") + .attr("y1", 0) + .attr("y2", h) + .attr("stroke", "white") + .attr("stroke-opacity", .3); + + rules.append("svg:text") + .attr("y", h + 9) + .attr("dy", ".71em") + .attr("text-anchor", "middle") + .text(x.tickFormat(10)); + + vis.append("svg:line") + .attr("y1", 0) + .attr("y2", h) + .attr("stroke", "black"); + + }); + + }) + }) + + </script> + </body> +</html> diff --git a/modules/enterprise/gui/rest-examples-war/src/main/webapp/index.html b/modules/enterprise/gui/rest-examples-war/src/main/webapp/index.html new file mode 100644 index 0000000..e42628a --- /dev/null +++ b/modules/enterprise/gui/rest-examples-war/src/main/webapp/index.html @@ -0,0 +1,40 @@ +<html> +<body> +<h2>RHQ Rest API</h2> +<strong>Please note: the API is not stable at this point. Do not rely on it.</strong><br/> + +Join us in making it great by providing feedback and contributions of code and examples +that use the api. +See also <a href="http://rhq-project.org/display/RHQ/Design-REST">the RHQ wiki</a> on REST. +Check out the <a href="https://github.com/rhq-project/samples/tree/master/rest-api">RHQ samples project</a> +for samples in various programming languages and +<a href="https://github.com/pilhuhn/RHQpocket">RHQpocket</a> as an example of a +mobile client (Android) of the API. +<ul> + <li><a href="resource/platforms.html">Platforms</a></li> + <li><a href="group/">Groups</a></li> + <li><a href="group/definitions">Group Definitions</a></li> + <li><a href="alert/">Alerts</a></li> + <li><a href="status.html">System status</a> </li> + <li><a href="user/favorites/resource">Favorite resources</a></li> + <li><a href="operation/history">Operation histories</a></li> +</ul> +<hr/> +<h2>Misc examples (using <a href="https://github.com/mbostock/d3">D3.js</a>)</h2> +Those examples use the powerful D3 library and are rendering the graphs in SVG. +They expect some resources and schedules being present from an initial import with +an empty database (meaning resource ids and schedule ids starting at 10001). +<ul> + <li><a href="/rest-examples/bars_simple.html">Display avg metrics as bars</a></li> + <li><a href="/rest-examples/stacked1.html">Metrics as stacked bars</a> in SVG</li> + <li><a href="/rest-examples/stacked3.html">Metrics as stacked bars</a> in pure HTML + (a little) CSS</li> + <li><a href="/rest-examples/stacked2.html">Metrics as rects using stacked bars from above</a></li> + <li><a href="/rest-examples/whisker.html">Whisker chart 1</a></li> + <li><a href="/rest-examples/whisker2.html">Multiple Whisker charts</a></li> + <li><a href="/rest-examples/tree.html">Resource tree</a></li> + <li><a href="/rest-examples/raw_graph.html">7 days of raw metrics as dot- or line- chart</a></li> + <li><a href="/rest-examples/raw_graph7.html">7 days of raw metrics as dot- or line- chart - comparing daily values</a></li> + +</ul> +</body> +</html> diff --git a/modules/enterprise/gui/rest-examples-war/src/main/webapp/js/d3.behavior.js b/modules/enterprise/gui/rest-examples-war/src/main/webapp/js/d3.behavior.js new file mode 100755 index 0000000..8c67949 --- /dev/null +++ b/modules/enterprise/gui/rest-examples-war/src/main/webapp/js/d3.behavior.js @@ -0,0 +1,198 @@ +(function(){d3.behavior = {}; +// TODO unbind zoom behavior? +// TODO unbind listener? +d3.behavior.zoom = function() { + var xyz = [0, 0, 0], + event = d3.dispatch("zoom"); + + function zoom() { + this + .on("mousedown.zoom", mousedown) + .on("mousewheel.zoom", mousewheel) + .on("DOMMouseScroll.zoom", dblclick) + .on("dblclick.zoom", dblclick) + .on("touchstart.zoom", touchstart); + + d3.select(window) + .on("mousemove.zoom", d3_behavior_zoomMousemove) + .on("mouseup.zoom", d3_behavior_zoomMouseup) + .on("touchmove.zoom", d3_behavior_zoomTouchmove) + .on("touchend.zoom", d3_behavior_zoomTouchup); + } + + // snapshot the local context for subsequent dispatch + function start() { + d3_behavior_zoomXyz = xyz; + d3_behavior_zoomDispatch = event.zoom.dispatch; + d3_behavior_zoomTarget = this; + d3_behavior_zoomArguments = arguments; + } + + function mousedown() { + start.apply(this, arguments); + d3_behavior_zoomPanning = d3_behavior_zoomLocation(d3.svg.mouse(d3_behavior_zoomTarget)); + d3.event.preventDefault(); + window.focus(); + } + + // store starting mouse location + function mousewheel() { + start.apply(this, arguments); + if (!d3_behavior_zoomZooming) d3_behavior_zoomZooming = d3_behavior_zoomLocation(d3.svg.mouse(d3_behavior_zoomTarget)); + d3_behavior_zoomTo(d3_behavior_zoomDelta() + xyz[2], d3.svg.mouse(d3_behavior_zoomTarget), d3_behavior_zoomZooming); + } + + function dblclick() { + start.apply(this, arguments); + var mouse = d3.svg.mouse(d3_behavior_zoomTarget); + d3_behavior_zoomTo(d3.event.shiftKey ? Math.ceil(xyz[2] - 1) : Math.floor(xyz[2] + 1), mouse, d3_behavior_zoomLocation(mouse)); + } + + // doubletap detection + function touchstart() { + start.apply(this, arguments); + var touches = d3_behavior_zoomTouchup(), + touch, + now = Date.now(); + if ((touches.length === 1) && (now - d3_behavior_zoomLast < 300)) { + d3_behavior_zoomTo(1 + Math.floor(xyz[2]), touch = touches[0], d3_behavior_zoomLocations[touch.identifier]); + } + d3_behavior_zoomLast = now; + } + + zoom.on = function(type, listener) { + event[type].add(listener); + return zoom; + }; + + return zoom; +}; + +var d3_behavior_zoomDiv, + d3_behavior_zoomPanning, + d3_behavior_zoomZooming, + d3_behavior_zoomLocations = {}, // identifier -> location + d3_behavior_zoomLast = 0, + d3_behavior_zoomXyz, + d3_behavior_zoomDispatch, + d3_behavior_zoomTarget, + d3_behavior_zoomArguments; + +function d3_behavior_zoomLocation(point) { + return [ + point[0] - d3_behavior_zoomXyz[0], + point[1] - d3_behavior_zoomXyz[1], + d3_behavior_zoomXyz[2] + ]; +} + +// detect the pixels that would be scrolled by this wheel event +function d3_behavior_zoomDelta() { + + // mousewheel events are totally broken! + // https://bugs.webkit.org/show_bug.cgi?id=40441 + // not only that, but Chrome and Safari differ in re. to acceleration! + if (!d3_behavior_zoomDiv) { + d3_behavior_zoomDiv = d3.select("body").append("div") + .style("visibility", "hidden") + .style("top", 0) + .style("height", 0) + .style("width", 0) + .style("overflow-y", "scroll") + .append("div") + .style("height", "2000px") + .node().parentNode; + } + + var e = d3.event, delta; + try { + d3_behavior_zoomDiv.scrollTop = 1000; + d3_behavior_zoomDiv.dispatchEvent(e); + delta = 1000 - d3_behavior_zoomDiv.scrollTop; + } catch (error) { + delta = e.wheelDelta || -e.detail; + } + + return delta * .005; +} + +// Note: Since we don't rotate, it's possible for the touches to become +// slightly detached from their original positions. Thus, we recompute the +// touch points on touchend as well as touchstart! +function d3_behavior_zoomTouchup() { + var touches = d3.svg.touches(d3_behavior_zoomTarget), + i = -1, + n = touches.length, + touch; + while (++i < n) d3_behavior_zoomLocations[(touch = touches[i]).identifier] = d3_behavior_zoomLocation(touch); + return touches; +} + +function d3_behavior_zoomTouchmove() { + var touches = d3.svg.touches(d3_behavior_zoomTarget); + switch (touches.length) { + + // single-touch pan + case 1: { + var touch = touches[0]; + d3_behavior_zoomTo(d3_behavior_zoomXyz[2], touch, d3_behavior_zoomLocations[touch.identifier]); + break; + } + + // double-touch pan + zoom + case 2: { + var p0 = touches[0], + p1 = touches[1], + p2 = [(p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2], + l0 = d3_behavior_zoomLocations[p0.identifier], + l1 = d3_behavior_zoomLocations[p1.identifier], + l2 = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2, l0[2]]; + d3_behavior_zoomTo(Math.log(d3.event.scale) / Math.LN2 + l0[2], p2, l2); + break; + } + } +} + +function d3_behavior_zoomMousemove() { + d3_behavior_zoomZooming = null; + if (d3_behavior_zoomPanning) d3_behavior_zoomTo(d3_behavior_zoomXyz[2], d3.svg.mouse(d3_behavior_zoomTarget), d3_behavior_zoomPanning); +} + +function d3_behavior_zoomMouseup() { + if (d3_behavior_zoomPanning) { + d3_behavior_zoomMousemove(); + d3_behavior_zoomPanning = null; + } +} + +function d3_behavior_zoomTo(z, x0, x1) { + var K = Math.pow(2, (d3_behavior_zoomXyz[2] = z) - x1[2]), + x = d3_behavior_zoomXyz[0] = x0[0] - K * x1[0], + y = d3_behavior_zoomXyz[1] = x0[1] - K * x1[1], + o = d3.event, // Events can be reentrant (e.g., focus). + k = Math.pow(2, z); + + d3.event = { + scale: k, + translate: [x, y], + transform: function(sx, sy) { + if (sx) transform(sx, x); + if (sy) transform(sy, y); + } + }; + + function transform(scale, o) { + var domain = scale.__domain || (scale.__domain = scale.domain()), + range = scale.range().map(function(v) { return (v - o) / k; }); + scale.domain(domain).domain(range.map(scale.invert)); + } + + try { + d3_behavior_zoomDispatch.apply(d3_behavior_zoomTarget, d3_behavior_zoomArguments); + } finally { + d3.event = o; + } + + o.preventDefault(); +} +})(); diff --git a/modules/enterprise/gui/rest-examples-war/src/main/webapp/js/d3.chart.js b/modules/enterprise/gui/rest-examples-war/src/main/webapp/js/d3.chart.js new file mode 100755 index 0000000..281d007 --- /dev/null +++ b/modules/enterprise/gui/rest-examples-war/src/main/webapp/js/d3.chart.js @@ -0,0 +1,984 @@ +(function(){d3.chart = {}; +// Inspired by http://informationandvisualization.de/blog/box-plot +d3.chart.box = function() { + var width = 1, + height = 1, + duration = 0, + domain = null, + value = Number, + whiskers = d3_chart_boxWhiskers, + quartiles = d3_chart_boxQuartiles, + tickFormat = null; + + // For each small multiple… + function box(g) { + g.each(function(d, i) { + d = d.map(value).sort(d3.ascending); + var g = d3.select(this), + n = d.length, + min = d[0], + max = d[n - 1]; + + // Compute quartiles. Must return exactly 3 elements. + var quartileData = d.quartiles = quartiles(d); + + // Compute whiskers. Must return exactly 2 elements, or null. + var whiskerIndices = whiskers && whiskers.call(this, d, i), + whiskerData = whiskerIndices && whiskerIndices.map(function(i) { return d[i]; }); + + // Compute outliers. If no whiskers are specified, all data are "outliers". + // We compute the outliers as indices, so that we can join across transitions! + var outlierIndices = whiskerIndices + ? d3.range(0, whiskerIndices[0]).concat(d3.range(whiskerIndices[1] + 1, n)) + : d3.range(n); + + // Compute the new x-scale. + var x1 = d3.scale.linear() + .domain(domain && domain.call(this, d, i) || [min, max]) + .range([height, 0]); + + // Retrieve the old x-scale, if this is an update. + var x0 = this.__chart__ || d3.scale.linear() + .domain([0, Infinity]) + .range(x1.range()); + + // Stash the new scale. + this.__chart__ = x1; + + // Note: the box, median, and box tick elements are fixed in number, + // so we only have to handle enter and update. In contrast, the outliers + // and other elements are variable, so we need to exit them! Variable + // elements also fade in and out. + + // Update center line: the vertical line spanning the whiskers. + var center = g.selectAll("line.center") + .data(whiskerData ? [whiskerData] : []); + + center.enter().insert("svg:line", "rect") + .attr("class", "center") + .attr("x1", width / 2) + .attr("y1", function(d) { return x0(d[0]); }) + .attr("x2", width / 2) + .attr("y2", function(d) { return x0(d[1]); }) + .style("opacity", 1e-6) + .transition() + .duration(duration) + .style("opacity", 1) + .attr("y1", function(d) { return x1(d[0]); }) + .attr("y2", function(d) { return x1(d[1]); }); + + center.transition() + .duration(duration) + .style("opacity", 1) + .attr("y1", function(d) { return x1(d[0]); }) + .attr("y2", function(d) { return x1(d[1]); }); + + center.exit().transition() + .duration(duration) + .style("opacity", 1e-6) + .attr("y1", function(d) { return x1(d[0]); }) + .attr("y2", function(d) { return x1(d[1]); }) + .remove(); + + // Update innerquartile box. + var box = g.selectAll("rect.box") + .data([quartileData]); + + box.enter().append("svg:rect") + .attr("class", "box") + .attr("x", 0) + .attr("y", function(d) { return x0(d[2]); }) + .attr("width", width) + .attr("height", function(d) { return x0(d[0]) - x0(d[2]); }) + .transition() + .duration(duration) + .attr("y", function(d) { return x1(d[2]); }) + .attr("height", function(d) { return x1(d[0]) - x1(d[2]); }); + + box.transition() + .duration(duration) + .attr("y", function(d) { return x1(d[2]); }) + .attr("height", function(d) { return x1(d[0]) - x1(d[2]); }); + + // Update median line. + var medianLine = g.selectAll("line.median") + .data([quartileData[1]]); + + medianLine.enter().append("svg:line") + .attr("class", "median") + .attr("x1", 0) + .attr("y1", x0) + .attr("x2", width) + .attr("y2", x0) + .transition() + .duration(duration) + .attr("y1", x1) + .attr("y2", x1); + + medianLine.transition() + .duration(duration) + .attr("y1", x1) + .attr("y2", x1); + + // Update whiskers. + var whisker = g.selectAll("line.whisker") + .data(whiskerData || []); + + whisker.enter().insert("svg:line", "circle, text") + .attr("class", "whisker") + .attr("x1", 0) + .attr("y1", x0) + .attr("x2", width) + .attr("y2", x0) + .style("opacity", 1e-6) + .transition() + .duration(duration) + .attr("y1", x1) + .attr("y2", x1) + .style("opacity", 1); + + whisker.transition() + .duration(duration) + .attr("y1", x1) + .attr("y2", x1) + .style("opacity", 1); + + whisker.exit().transition() + .duration(duration) + .attr("y1", x1) + .attr("y2", x1) + .style("opacity", 1e-6) + .remove(); + + // Update outliers. + var outlier = g.selectAll("circle.outlier") + .data(outlierIndices, Number); + + outlier.enter().insert("svg:circle", "text") + .attr("class", "outlier") + .attr("r", 5) + .attr("cx", width / 2) + .attr("cy", function(i) { return x0(d[i]); }) + .style("opacity", 1e-6) + .transition() + .duration(duration) + .attr("cy", function(i) { return x1(d[i]); }) + .style("opacity", 1); + + outlier.transition() + .duration(duration) + .attr("cy", function(i) { return x1(d[i]); }) + .style("opacity", 1); + + outlier.exit().transition() + .duration(duration) + .attr("cy", function(i) { return x1(d[i]); }) + .style("opacity", 1e-6) + .remove(); + + // Compute the tick format. + var format = tickFormat || x1.tickFormat(8); + + // Update box ticks. + var boxTick = g.selectAll("text.box") + .data(quartileData); + + boxTick.enter().append("svg:text") + .attr("class", "box") + .attr("dy", ".3em") + .attr("dx", function(d, i) { return i & 1 ? 6 : -6 }) + .attr("x", function(d, i) { return i & 1 ? width : 0 }) + .attr("y", x0) + .attr("text-anchor", function(d, i) { return i & 1 ? "start" : "end"; }) + .text(format) + .transition() + .duration(duration) + .attr("y", x1); + + boxTick.transition() + .duration(duration) + .text(format) + .attr("y", x1); + + // Update whisker ticks. These are handled separately from the box + // ticks because they may or may not exist, and we want don't want + // to join box ticks pre-transition with whisker ticks post-. + var whiskerTick = g.selectAll("text.whisker") + .data(whiskerData || []); + + whiskerTick.enter().append("svg:text") + .attr("class", "whisker") + .attr("dy", ".3em") + .attr("dx", 6) + .attr("x", width) + .attr("y", x0) + .text(format) + .style("opacity", 1e-6) + .transition() + .duration(duration) + .attr("y", x1) + .style("opacity", 1); + + whiskerTick.transition() + .duration(duration) + .text(format) + .attr("y", x1) + .style("opacity", 1); + + whiskerTick.exit().transition() + .duration(duration) + .attr("y", x1) + .style("opacity", 1e-6) + .remove(); + }); + d3.timer.flush(); + } + + box.width = function(x) { + if (!arguments.length) return width; + width = x; + return box; + }; + + box.height = function(x) { + if (!arguments.length) return height; + height = x; + return box; + }; + + box.tickFormat = function(x) { + if (!arguments.length) return tickFormat; + tickFormat = x; + return box; + }; + + box.duration = function(x) { + if (!arguments.length) return duration; + duration = x; + return box; + }; + + box.domain = function(x) { + if (!arguments.length) return domain; + domain = x == null ? x : d3.functor(x); + return box; + }; + + box.value = function(x) { + if (!arguments.length) return value; + value = x; + return box; + }; + + box.whiskers = function(x) { + if (!arguments.length) return whiskers; + whiskers = x; + return box; + }; + + box.quartiles = function(x) { + if (!arguments.length) return quartiles; + quartiles = x; + return box; + }; + + return box; +}; + +function d3_chart_boxWhiskers(d) { + return [0, d.length - 1]; +} + +function d3_chart_boxQuartiles(d) { + return [ + d3.quantile(d, .25), + d3.quantile(d, .5), + d3.quantile(d, .75) + ]; +} +// Chart design based on the recommendations of Stephen Few. Implementation +// based on the work of Clint Ivy, Jamie Love, and Jason Davies. +// http://projects.instantcognition.com/protovis/bulletchart/ +d3.chart.bullet = function() { + var orient = "left", // TODO top & bottom + reverse = false, + duration = 0, + ranges = d3_chart_bulletRanges, + markers = d3_chart_bulletMarkers, + measures = d3_chart_bulletMeasures, + width = 380, + height = 30, + tickFormat = null; + + // For each small multiple… + function bullet(g) { + g.each(function(d, i) { + var rangez = ranges.call(this, d, i).slice().sort(d3.descending), + markerz = markers.call(this, d, i).slice().sort(d3.descending), + measurez = measures.call(this, d, i).slice().sort(d3.descending), + g = d3.select(this); + + // Compute the new x-scale. + var x1 = d3.scale.linear() + .domain([0, Math.max(rangez[0], markerz[0], measurez[0])]) + .range(reverse ? [width, 0] : [0, width]); + + // Retrieve the old x-scale, if this is an update. + var x0 = this.__chart__ || d3.scale.linear() + .domain([0, Infinity]) + .range(x1.range()); + + // Stash the new scale. + this.__chart__ = x1; + + // Derive width-scales from the x-scales. + var w0 = d3_chart_bulletWidth(x0), + w1 = d3_chart_bulletWidth(x1); + + // Update the range rects. + var range = g.selectAll("rect.range") + .data(rangez); + + range.enter().append("svg:rect") + .attr("class", function(d, i) { return "range s" + i; }) + .attr("width", w0) + .attr("height", height) + .attr("x", reverse ? x0 : 0) + .transition() + .duration(duration) + .attr("width", w1) + .attr("x", reverse ? x1 : 0); + + range.transition() + .duration(duration) + .attr("x", reverse ? x1 : 0) + .attr("width", w1) + .attr("height", height); + + // Update the measure rects. + var measure = g.selectAll("rect.measure") + .data(measurez); + + measure.enter().append("svg:rect") + .attr("class", function(d, i) { return "measure s" + i; }) + .attr("width", w0) + .attr("height", height / 3) + .attr("x", reverse ? x0 : 0) + .attr("y", height / 3) + .transition() + .duration(duration) + .attr("width", w1) + .attr("x", reverse ? x1 : 0); + + measure.transition() + .duration(duration) + .attr("width", w1) + .attr("height", height / 3) + .attr("x", reverse ? x1 : 0) + .attr("y", height / 3); + + // Update the marker lines. + var marker = g.selectAll("line.marker") + .data(markerz); + + marker.enter().append("svg:line") + .attr("class", "marker") + .attr("x1", x0) + .attr("x2", x0) + .attr("y1", height / 6) + .attr("y2", height * 5 / 6) + .transition() + .duration(duration) + .attr("x1", x1) + .attr("x2", x1); + + marker.transition() + .duration(duration) + .attr("x1", x1) + .attr("x2", x1) + .attr("y1", height / 6) + .attr("y2", height * 5 / 6); + + // Compute the tick format. + var format = tickFormat || x1.tickFormat(8); + + // Update the tick groups. + var tick = g.selectAll("g.tick") + .data(x1.ticks(8), function(d) { + return this.textContent || format(d); + }); + + // Initialize the ticks with the old scale, x0. + var tickEnter = tick.enter().append("svg:g") + .attr("class", "tick") + .attr("transform", d3_chart_bulletTranslate(x0)) + .style("opacity", 1e-6); + + tickEnter.append("svg:line") + .attr("y1", height) + .attr("y2", height * 7 / 6); + + tickEnter.append("svg:text") + .attr("text-anchor", "middle") + .attr("dy", "1em") + .attr("y", height * 7 / 6) + .text(format); + + // Transition the entering ticks to the new scale, x1. + tickEnter.transition() + .duration(duration) + .attr("transform", d3_chart_bulletTranslate(x1)) + .style("opacity", 1); + + // Transition the updating ticks to the new scale, x1. + var tickUpdate = tick.transition() + .duration(duration) + .attr("transform", d3_chart_bulletTranslate(x1)) + .style("opacity", 1); + + tickUpdate.select("line") + .attr("y1", height) + .attr("y2", height * 7 / 6); + + tickUpdate.select("text") + .attr("y", height * 7 / 6); + + // Transition the exiting ticks to the new scale, x1. + tick.exit().transition() + .duration(duration) + .attr("transform", d3_chart_bulletTranslate(x1)) + .style("opacity", 1e-6) + .remove(); + }); + d3.timer.flush(); + } + + // left, right, top, bottom + bullet.orient = function(x) { + if (!arguments.length) return orient; + orient = x; + reverse = orient == "right" || orient == "bottom"; + return bullet; + }; + + // ranges (bad, satisfactory, good) + bullet.ranges = function(x) { + if (!arguments.length) return ranges; + ranges = x; + return bullet; + }; + + // markers (previous, goal) + bullet.markers = function(x) { + if (!arguments.length) return markers; + markers = x; + return bullet; + }; + + // measures (actual, forecast) + bullet.measures = function(x) { + if (!arguments.length) return measures; + measures = x; + return bullet; + }; + + bullet.width = function(x) { + if (!arguments.length) return width; + width = x; + return bullet; + }; + + bullet.height = function(x) { + if (!arguments.length) return height; + height = x; + return bullet; + }; + + bullet.tickFormat = function(x) { + if (!arguments.length) return tickFormat; + tickFormat = x; + return bullet; + }; + + bullet.duration = function(x) { + if (!arguments.length) return duration; + duration = x; + return bullet; + }; + + return bullet; +}; + +function d3_chart_bulletRanges(d) { + return d.ranges; +} + +function d3_chart_bulletMarkers(d) { + return d.markers; +} + +function d3_chart_bulletMeasures(d) { + return d.measures; +} + +function d3_chart_bulletTranslate(x) { + return function(d) { + return "translate(" + x(d) + ",0)"; + }; +} + +function d3_chart_bulletWidth(x) { + var x0 = x(0); + return function(d) { + return Math.abs(x(d) - x0); + }; +} +// Implements a horizon layout, which is a variation of a single-series +// area chart where the area is folded into multiple bands. Color is used to +// encode band, allowing the size of the chart to be reduced significantly +// without impeding readability. This layout algorithm is based on the work of +// J. Heer, N. Kong and M. Agrawala in "Sizing the Horizon: The Effects of Chart +// Size and Layering on the Graphical Perception of Time Series Visualizations", +// CHI 2009. http://hci.stanford.edu/publications/2009/heer-horizon-chi09.pdf +d3.chart.horizon = function() { + var bands = 1, // between 1 and 5, typically + mode = "offset", // or mirror + interpolate = "linear", // or basis, monotone, step-before, etc. + x = d3_chart_horizonX, + y = d3_chart_horizonY, + w = 960, + h = 40, + duration = 0; + + var color = d3.scale.linear() + .domain([-1, 0, 1]) + .range(["#d62728", "#fff", "#1f77b4"]); + + // For each small multiple… + function horizon(g) { + g.each(function(d, i) { + var g = d3.select(this), + n = 2 * bands + 1, + xMin = Infinity, + xMax = -Infinity, + yMax = -Infinity, + x0, // old x-scale + y0, // old y-scale + id; // unique id for paths + + // Compute x- and y-values along with extents. + var data = d.map(function(d, i) { + var xv = x.call(this, d, i), + yv = y.call(this, d, i); + if (xv < xMin) xMin = xv; + if (xv > xMax) xMax = xv; + if (-yv > yMax) yMax = -yv; + if (yv > yMax) yMax = yv; + return [xv, yv]; + }); + + // Compute the new x- and y-scales. + var x1 = d3.scale.linear().domain([xMin, xMax]).range([0, w]), + y1 = d3.scale.linear().domain([0, yMax]).range([0, h * bands]); + + // Retrieve the old scales, if this is an update. + if (this.__chart__) { + x0 = this.__chart__.x; + y0 = this.__chart__.y; + id = this.__chart__.id; + } else { + x0 = d3.scale.linear().domain([0, Infinity]).range(x1.range()); + y0 = d3.scale.linear().domain([0, Infinity]).range(y1.range()); + id = ++d3_chart_horizonId; + } + + // We'll use a defs to store the area path and the clip path. + var defs = g.selectAll("defs") + .data([data]); + + var defsEnter = defs.enter().append("svg:defs"); + + // The clip path is a simple rect. + defsEnter.append("svg:clipPath") + .attr("id", "d3_chart_horizon_clip" + id) + .append("svg:rect") + .attr("width", w) + .attr("height", h); + + defs.select("rect").transition() + .duration(duration) + .attr("width", w) + .attr("height", h); + + // The area path is rendered with our resuable d3.svg.area. + defsEnter.append("svg:path") + .attr("id", "d3_chart_horizon_path" + id) + .attr("d", d3_chart_horizonArea + .interpolate(interpolate) + .x(function(d) { return x0(d[0]); }) + .y0(h * bands) + .y1(function(d) { return h * bands - y0(d[1]); })) + .transition() + .duration(duration) + .attr("d", d3_chart_horizonArea + .x(function(d) { return x1(d[0]); }) + .y1(function(d) { return h * bands - y1(d[1]); })); + + defs.select("path").transition() + .duration(duration) + .attr("d", d3_chart_horizonArea); + + // We'll use a container to clip all horizon layers at once. + g.selectAll("g") + .data([null]) + .enter().append("svg:g") + .attr("clip-path", "url(#d3_chart_horizon_clip" + id + ")"); + + // Define the transform function based on the mode. + var transform = mode == "offset" + ? function(d) { return "translate(0," + (d + (d < 0) - bands) * h + ")"; } + : function(d) { return (d < 0 ? "scale(1,-1)" : "") + "translate(0," + (d - bands) * h + ")"; }; + + // Instantiate each copy of the path with different transforms. + var u = g.select("g").selectAll("use") + .data(d3.range(-1, -bands - 1, -1).concat(d3.range(1, bands + 1)), Number); + + // TODO don't fudge the enter transition + u.enter().append("svg:use") + .attr("xlink:href", "#d3_chart_horizon_path" + id) + .attr("transform", function(d) { return transform(d + (d > 0 ? 1 : -1)); }) + .style("fill", color) + .transition() + .duration(duration) + .attr("transform", transform); + + u.transition() + .duration(duration) + .attr("transform", transform) + .style("fill", color); + + u.exit().transition() + .duration(duration) + .attr("transform", transform) + .remove(); + + // Stash the new scales. + this.__chart__ = {x: x1, y: y1, id: id}; + }); + d3.timer.flush(); + } + + horizon.duration = function(x) { + if (!arguments.length) return duration; + duration = +x; + return horizon; + }; + + horizon.bands = function(x) { + if (!arguments.length) return bands; + bands = +x; + color.domain([-bands, 0, bands]); + return horizon; + }; + + horizon.mode = function(x) { + if (!arguments.length) return mode; + mode = x + ""; + return horizon; + }; + + horizon.colors = function(x) { + if (!arguments.length) return color.range(); + color.range(x); + return horizon; + }; + + horizon.interpolate = function(x) { + if (!arguments.length) return interpolate; + interpolate = x + ""; + return horizon; + }; + + horizon.x = function(z) { + if (!arguments.length) return x; + x = z; + return horizon; + }; + + horizon.y = function(z) { + if (!arguments.length) return y; + y = z; + return horizon; + }; + + horizon.width = function(x) { + if (!arguments.length) return w; + w = +x; + return horizon; + }; + + horizon.height = function(x) { + if (!arguments.length) return h; + h = +x; + return horizon; + }; + + return horizon; +}; + +var d3_chart_horizonArea = d3.svg.area(), + d3_chart_horizonId = 0; + +function d3_chart_horizonX(d) { + return d[0]; +} + +function d3_chart_horizonY(d) { + return d[1]; +} +// Based on http://vis.stanford.edu/protovis/ex/qqplot.html +d3.chart.qq = function() { + var width = 1, + height = 1, + duration = 0, + domain = null, + tickFormat = null, + n = 100, + x = d3_chart_qqX, + y = d3_chart_qqY; + + // For each small multiple… + function qq(g) { + g.each(function(d, i) { + var g = d3.select(this), + qx = d3_chart_qqQuantiles(n, x.call(this, d, i)), + qy = d3_chart_qqQuantiles(n, y.call(this, d, i)), + xd = domain && domain.call(this, d, i) || [d3.min(qx), d3.max(qx)], // new x-domain + yd = domain && domain.call(this, d, i) || [d3.min(qy), d3.max(qy)], // new y-domain + x0, // old x-scale + y0; // old y-scale + + // Compute the new x-scale. + var x1 = d3.scale.linear() + .domain(xd) + .range([0, width]); + + // Compute the new y-scale. + var y1 = d3.scale.linear() + .domain(yd) + .range([height, 0]); + + // Retrieve the old scales, if this is an update. + if (this.__chart__) { + x0 = this.__chart__.x; + y0 = this.__chart__.y; + } else { + x0 = d3.scale.linear().domain([0, Infinity]).range(x1.range()); + y0 = d3.scale.linear().domain([0, Infinity]).range(y1.range()); + } + + // Stash the new scales. + this.__chart__ = {x: x1, y: y1}; + + // Update diagonal line. + var diagonal = g.selectAll("line.diagonal") + .data([null]); + + diagonal.enter().append("svg:line") + .attr("class", "diagonal") + .attr("x1", x1(yd[0])) + .attr("y1", y1(xd[0])) + .attr("x2", x1(yd[1])) + .attr("y2", y1(xd[1])); + + diagonal.transition() + .duration(duration) + .attr("x1", x1(yd[0])) + .attr("y1", y1(xd[0])) + .attr("x2", x1(yd[1])) + .attr("y2", y1(xd[1])); + + // Update quantile plots. + var circle = g.selectAll("circle") + .data(d3.range(n).map(function(i) { + return {x: qx[i], y: qy[i]}; + })); + + circle.enter().append("svg:circle") + .attr("class", "quantile") + .attr("r", 4.5) + .attr("cx", function(d) { return x0(d.x); }) + .attr("cy", function(d) { return y0(d.y); }) + .style("opacity", 1e-6) + .transition() + .duration(duration) + .attr("cx", function(d) { return x1(d.x); }) + .attr("cy", function(d) { return y1(d.y); }) + .style("opacity", 1); + + circle.transition() + .duration(duration) + .attr("cx", function(d) { return x1(d.x); }) + .attr("cy", function(d) { return y1(d.y); }) + .style("opacity", 1); + + circle.exit().transition() + .duration(duration) + .attr("cx", function(d) { return x1(d.x); }) + .attr("cy", function(d) { return y1(d.y); }) + .style("opacity", 1e-6) + .remove(); + + var xformat = tickFormat || x1.tickFormat(4), + yformat = tickFormat || y1.tickFormat(4), + tx = function(d) { return "translate(" + x1(d) + "," + height + ")"; }, + ty = function(d) { return "translate(0," + y1(d) + ")"; }; + + // Update x-ticks. + var xtick = g.selectAll("g.x.tick") + .data(x1.ticks(4), function(d) { + return this.textContent || xformat(d); + }); + + var xtickEnter = xtick.enter().append("svg:g") + .attr("class", "x tick") + .attr("transform", function(d) { return "translate(" + x0(d) + "," + height + ")"; }) + .style("opacity", 1e-6); + + xtickEnter.append("svg:line") + .attr("y1", 0) + .attr("y2", -6); + + xtickEnter.append("svg:text") + .attr("text-anchor", "middle") + .attr("dy", "1em") + .text(xformat); + + // Transition the entering ticks to the new scale, x1. + xtickEnter.transition() + .duration(duration) + .attr("transform", tx) + .style("opacity", 1); + + // Transition the updating ticks to the new scale, x1. + xtick.transition() + .duration(duration) + .attr("transform", tx) + .style("opacity", 1); + + // Transition the exiting ticks to the new scale, x1. + xtick.exit().transition() + .duration(duration) + .attr("transform", tx) + .style("opacity", 1e-6) + .remove(); + + // Update ticks. + var ytick = g.selectAll("g.y.tick") + .data(y1.ticks(4), function(d) { + return this.textContent || yformat(d); + }); + + var ytickEnter = ytick.enter().append("svg:g") + .attr("class", "y tick") + .attr("transform", function(d) { return "translate(0," + y0(d) + ")"; }) + .style("opacity", 1e-6); + + ytickEnter.append("svg:line") + .attr("x1", 0) + .attr("x2", 6); + + ytickEnter.append("svg:text") + .attr("text-anchor", "end") + .attr("dx", "-.5em") + .attr("dy", ".3em") + .text(yformat); + + // Transition the entering ticks to the new scale, y1. + ytickEnter.transition() + .duration(duration) + .attr("transform", ty) + .style("opacity", 1); + + // Transition the updating ticks to the new scale, y1. + ytick.transition() + .duration(duration) + .attr("transform", ty) + .style("opacity", 1); + + // Transition the exiting ticks to the new scale, y1. + ytick.exit().transition() + .duration(duration) + .attr("transform", ty) + .style("opacity", 1e-6) + .remove(); + }); + } + + qq.width = function(x) { + if (!arguments.length) return width; + width = x; + return qq; + }; + + qq.height = function(x) { + if (!arguments.length) return height; + height = x; + return qq; + }; + + qq.duration = function(x) { + if (!arguments.length) return duration; + duration = x; + return qq; + }; + + qq.domain = function(x) { + if (!arguments.length) return domain; + domain = x == null ? x : d3.functor(x); + return qq; + }; + + qq.count = function(z) { + if (!arguments.length) return n; + n = z; + return qq; + }; + + qq.x = function(z) { + if (!arguments.length) return x; + x = z; + return qq; + }; + + qq.y = function(z) { + if (!arguments.length) return y; + y = z; + return qq; + }; + + qq.tickFormat = function(x) { + if (!arguments.length) return tickFormat; + tickFormat = x; + return qq; + }; + + return qq; +}; + +function d3_chart_qqQuantiles(n, values) { + var m = values.length - 1; + values = values.slice().sort(d3.ascending); + return d3.range(n).map(function(i) { + return values[~~(i * m / n)]; + }); +} + +function d3_chart_qqX(d) { + return d.x; +} + +function d3_chart_qqY(d) { + return d.y; +} +})(); diff --git a/modules/enterprise/gui/rest-examples-war/src/main/webapp/js/d3.csv.js b/modules/enterprise/gui/rest-examples-war/src/main/webapp/js/d3.csv.js new file mode 100644 index 0000000..7565b83 --- /dev/null +++ b/modules/enterprise/gui/rest-examples-war/src/main/webapp/js/d3.csv.js @@ -0,0 +1,92 @@ +(function(){d3.csv = function(url, callback) { + d3.text(url, "text/csv", function(text) { + callback(text && d3.csv.parse(text)); + }); +}; +d3.csv.parse = function(text) { + var header; + return d3.csv.parseRows(text, function(row, i) { + if (i) { + var o = {}, j = -1, m = header.length; + while (++j < m) o[header[j]] = row[j]; + return o; + } else { + header = row; + return null; + } + }); +}; + +d3.csv.parseRows = function(text, f) { + var EOL = {}, // sentinel value for end-of-line + EOF = {}, // sentinel value for end-of-file + rows = [], // output rows + re = /\r\n|[,\r\n]/g, // field separator regex + n = 0, // the current line number + t, // the current token + eol; // is the current token followed by EOL? + + re.lastIndex = 0; // work-around bug in FF 3.6 + + /** @private Returns the next token. */ + function token() { + if (re.lastIndex >= text.length) return EOF; // special case: end of file + if (eol) { eol = false; return EOL; } // special case: end of line + + // special case: quotes + var j = re.lastIndex; + if (text.charCodeAt(j) === 34) { + var i = j; + while (i++ < text.length) { + if (text.charCodeAt(i) === 34) { + if (text.charCodeAt(i + 1) !== 34) break; + i++; + } + } + re.lastIndex = i + 2; + var c = text.charCodeAt(i + 1); + if (c === 13) { + eol = true; + if (text.charCodeAt(i + 2) === 10) re.lastIndex++; + } else if (c === 10) { + eol = true; + } + return text.substring(j + 1, i).replace(/""/g, """); + } + + // common case + var m = re.exec(text); + if (m) { + eol = m[0].charCodeAt(0) !== 44; + return text.substring(j, m.index); + } + re.lastIndex = text.length; + return text.substring(j); + } + + while ((t = token()) !== EOF) { + var a = []; + while ((t !== EOL) && (t !== EOF)) { + a.push(t); + t = token(); + } + if (f && !(a = f(a, n++))) continue; + rows.push(a); + } + + return rows; +}; +d3.csv.format = function(rows) { + return rows.map(d3_csv_formatRow).join("\n"); +}; + +function d3_csv_formatRow(row) { + return row.map(d3_csv_formatValue).join(","); +} + +function d3_csv_formatValue(text) { + return /[",\n]/.test(text) + ? """ + text.replace(/"/g, """") + """ + : text; +} +})(); diff --git a/modules/enterprise/gui/rest-examples-war/src/main/webapp/js/d3.geo.js b/modules/enterprise/gui/rest-examples-war/src/main/webapp/js/d3.geo.js new file mode 100644 index 0000000..2b40252 --- /dev/null +++ b/modules/enterprise/gui/rest-examples-war/src/main/webapp/js/d3.geo.js @@ -0,0 +1,938 @@ +(function(){d3.geo = {}; + +var d3_geo_radians = Math.PI / 180; +// TODO clip input coordinates on opposite hemisphere +d3.geo.azimuthal = function() { + var mode = "orthographic", // or stereographic, gnomonic, equidistant or equalarea + origin, + scale = 200, + translate = [480, 250], + x0, + y0, + cy0, + sy0; + + function azimuthal(coordinates) { + var x1 = coordinates[0] * d3_geo_radians - x0, + y1 = coordinates[1] * d3_geo_radians, + cx1 = Math.cos(x1), + sx1 = Math.sin(x1), + cy1 = Math.cos(y1), + sy1 = Math.sin(y1), + cc = mode !== "orthographic" ? sy0 * sy1 + cy0 * cy1 * cx1 : null, + c, + k = mode === "stereographic" ? 1 / (1 + cc) + : mode === "gnomonic" ? 1 / cc + : mode === "equidistant" ? (c = Math.acos(cc), c ? c / Math.sin(c) : 0) + : mode === "equalarea" ? Math.sqrt(2 / (1 + cc)) + : 1, + x = k * cy1 * sx1, + y = k * (sy0 * cy1 * cx1 - cy0 * sy1); + return [ + scale * x + translate[0], + scale * y + translate[1] + ]; + } + + azimuthal.invert = function(coordinates) { + var x = (coordinates[0] - translate[0]) / scale, + y = (coordinates[1] - translate[1]) / scale, + p = Math.sqrt(x * x + y * y), + c = mode === "stereographic" ? 2 * Math.atan(p) + : mode === "gnomonic" ? Math.atan(p) + : mode === "equidistant" ? p + : mode === "equalarea" ? 2 * Math.asin(.5 * p) + : Math.asin(p), + sc = Math.sin(c), + cc = Math.cos(c); + return [ + (x0 + Math.atan2(x * sc, p * cy0 * cc + y * sy0 * sc)) / d3_geo_radians, + Math.asin(cc * sy0 - (p ? (y * sc * cy0) / p : 0)) / d3_geo_radians + ]; + }; + + azimuthal.mode = function(x) { + if (!arguments.length) return mode; + mode = x + ""; + return azimuthal; + }; + + azimuthal.origin = function(x) { + if (!arguments.length) return origin; + origin = x; + x0 = origin[0] * d3_geo_radians; + y0 = origin[1] * d3_geo_radians; + cy0 = Math.cos(y0); + sy0 = Math.sin(y0); + return azimuthal; + }; + + azimuthal.scale = function(x) { + if (!arguments.length) return scale; + scale = +x; + return azimuthal; + }; + + azimuthal.translate = function(x) { + if (!arguments.length) return translate; + translate = [+x[0], +x[1]]; + return azimuthal; + }; + + return azimuthal.origin([0, 0]); +}; +// Derived from Tom Carden's Albers implementation for Protovis. +// http://gist.github.com/476238 +// http://mathworld.wolfram.com/AlbersEqual-AreaConicProjection.html + +d3.geo.albers = function() { + var origin = [-98, 38], + parallels = [29.5, 45.5], + scale = 1000, + translate = [480, 250], + lng0, // d3_geo_radians * origin[0] + n, + C, + p0; + + function albers(coordinates) { + var t = n * (d3_geo_radians * coordinates[0] - lng0), + p = Math.sqrt(C - 2 * n * Math.sin(d3_geo_radians * coordinates[1])) / n; + return [ + scale * p * Math.sin(t) + translate[0], + scale * (p * Math.cos(t) - p0) + translate[1] + ]; + } + + albers.invert = function(coordinates) { + var x = (coordinates[0] - translate[0]) / scale, + y = (coordinates[1] - translate[1]) / scale, + p0y = p0 + y, + t = Math.atan2(x, p0y), + p = Math.sqrt(x * x + p0y * p0y); + return [ + (lng0 + t / n) / d3_geo_radians, + Math.asin((C - p * p * n * n) / (2 * n)) / d3_geo_radians + ]; + }; + + function reload() { + var phi1 = d3_geo_radians * parallels[0], + phi2 = d3_geo_radians * parallels[1], + lat0 = d3_geo_radians * origin[1], + s = Math.sin(phi1), + c = Math.cos(phi1); + lng0 = d3_geo_radians * origin[0]; + n = .5 * (s + Math.sin(phi2)); + C = c * c + 2 * n * s; + p0 = Math.sqrt(C - 2 * n * Math.sin(lat0)) / n; + return albers; + } + + albers.origin = function(x) { + if (!arguments.length) return origin; + origin = [+x[0], +x[1]]; + return reload(); + }; + + albers.parallels = function(x) { + if (!arguments.length) return parallels; + parallels = [+x[0], +x[1]]; + return reload(); + }; + + albers.scale = function(x) { + if (!arguments.length) return scale; + scale = +x; + return albers; + }; + + albers.translate = function(x) { + if (!arguments.length) return translate; + translate = [+x[0], +x[1]]; + return albers; + }; + + return reload(); +}; + +// A composite projection for the United States, 960x500. The set of standard +// parallels for each region comes from USGS, which is published here: +// http://egsc.usgs.gov/isb/pubs/MapProjections/projections.html#albers +// TODO allow the composite projection to be rescaled? +d3.geo.albersUsa = function() { + var lower48 = d3.geo.albers(); + + var alaska = d3.geo.albers() + .origin([-160, 60]) + .parallels([55, 65]); + + var hawaii = d3.geo.albers() + .origin([-160, 20]) + .parallels([8, 18]); + + var puertoRico = d3.geo.albers() + .origin([-60, 10]) + .parallels([8, 18]); + + function albersUsa(coordinates) { + var lon = coordinates[0], + lat = coordinates[1]; + return (lat > 50 ? alaska + : lon < -140 ? hawaii + : lat < 21 ? puertoRico + : lower48)(coordinates); + } + + albersUsa.scale = function(x) { + if (!arguments.length) return lower48.scale(); + lower48.scale(x); + alaska.scale(x * .6); + hawaii.scale(x); + puertoRico.scale(x * 1.5); + return albersUsa.translate(lower48.translate()); + }; + + albersUsa.translate = function(x) { + if (!arguments.length) return lower48.translate(); + var dz = lower48.scale() / 1000, + dx = x[0], + dy = x[1]; + lower48.translate(x); + alaska.translate([dx - 400 * dz, dy + 170 * dz]); + hawaii.translate([dx - 190 * dz, dy + 200 * dz]); + puertoRico.translate([dx + 580 * dz, dy + 430 * dz]); + return albersUsa; + }; + + return albersUsa.scale(lower48.scale()); +}; +d3.geo.bonne = function() { + var scale = 200, + translate = [480, 250], + x0, // origin longitude in radians + y0, // origin latitude in radians + y1, // parallel latitude in radians + c1; // cot(y1) + + function bonne(coordinates) { + var x = coordinates[0] * d3_geo_radians - x0, + y = coordinates[1] * d3_geo_radians - y0; + if (y1) { + var p = c1 + y1 - y, E = x * Math.cos(y) / p; + x = p * Math.sin(E); + y = p * Math.cos(E) - c1; + } else { + x *= Math.cos(y); + y *= -1; + } + return [ + scale * x + translate[0], + scale * y + translate[1] + ]; + } + + bonne.invert = function(coordinates) { + var x = (coordinates[0] - translate[0]) / scale, + y = (coordinates[1] - translate[1]) / scale; + if (y1) { + var c = c1 + y, p = Math.sqrt(x * x + c * c); + y = c1 + y1 - p; + x = x0 + p * Math.atan2(x, c) / Math.cos(y); + } else { + y *= -1; + x /= Math.cos(y); + } + return [ + x / d3_geo_radians, + y / d3_geo_radians + ]; + }; + + // 90° for Werner, 0° for Sinusoidal + bonne.parallel = function(x) { + if (!arguments.length) return y1 / d3_geo_radians; + c1 = 1 / Math.tan(y1 = x * d3_geo_radians); + return bonne; + }; + + bonne.origin = function(x) { + if (!arguments.length) return [x0 / d3_geo_radians, y0 / d3_geo_radians]; + x0 = x[0] * d3_geo_radians; + y0 = x[1] * d3_geo_radians; + return bonne; + }; + + bonne.scale = function(x) { + if (!arguments.length) return scale; + scale = +x; + return bonne; + }; + + bonne.translate = function(x) { + if (!arguments.length) return translate; + translate = [+x[0], +x[1]]; + return bonne; + }; + + return bonne.origin([0, 0]).parallel(45); +}; +d3.geo.equirectangular = function() { + var scale = 500, + translate = [480, 250]; + + function equirectangular(coordinates) { + var x = coordinates[0] / 360, + y = -coordinates[1] / 360; + return [ + scale * x + translate[0], + scale * y + translate[1] + ]; + } + + equirectangular.invert = function(coordinates) { + var x = (coordinates[0] - translate[0]) / scale, + y = (coordinates[1] - translate[1]) / scale; + return [ + 360 * x, + -360 * y + ]; + }; + + equirectangular.scale = function(x) { + if (!arguments.length) return scale; + scale = +x; + return equirectangular; + }; + + equirectangular.translate = function(x) { + if (!arguments.length) return translate; + translate = [+x[0], +x[1]]; + return equirectangular; + }; + + return equirectangular; +}; +d3.geo.mercator = function() { + var scale = 500, + translate = [480, 250]; + + function mercator(coordinates) { + var x = coordinates[0] / 360, + y = -(Math.log(Math.tan(Math.PI / 4 + coordinates[1] * d3_geo_radians / 2)) / d3_geo_radians) / 360; + return [ + scale * x + translate[0], + scale * Math.max(-.5, Math.min(.5, y)) + translate[1] + ]; + } + + mercator.invert = function(coordinates) { + var x = (coordinates[0] - translate[0]) / scale, + y = (coordinates[1] - translate[1]) / scale; + return [ + 360 * x, + 2 * Math.atan(Math.exp(-360 * y * d3_geo_radians)) / d3_geo_radians - 90 + ]; + }; + + mercator.scale = function(x) { + if (!arguments.length) return scale; + scale = +x; + return mercator; + }; + + mercator.translate = function(x) { + if (!arguments.length) return translate; + translate = [+x[0], +x[1]]; + return mercator; + }; + + return mercator; +}; +function d3_geo_type(types, defaultValue) { + return function(object) { + return object && object.type in types ? types[object.type](object) : defaultValue; + }; +} +/** + * Returns a function that, given a GeoJSON object (e.g., a feature), returns + * the corresponding SVG path. The function can be customized by overriding the + * projection. Point features are mapped to circles with a default radius of + * 4.5px; the radius can be specified either as a constant or a function that + * is evaluated per object. + */ +d3.geo.path = function() { + var pointRadius = 4.5, + pointCircle = d3_path_circle(pointRadius), + projection = d3.geo.albersUsa(); + + function path(d, i) { + if (typeof pointRadius === "function") { + pointCircle = d3_path_circle(pointRadius.apply(this, arguments)); + } + return pathType(d) || null; + } + + function project(coordinates) { + return projection(coordinates).join(","); + } + + var pathType = d3_geo_type({ + + FeatureCollection: function(o) { + var path = [], + features = o.features, + i = -1, // features.index + n = features.length; + while (++i < n) path.push(pathType(features[i].geometry)); + return path.join(""); + }, + + Feature: function(o) { + return pathType(o.geometry); + }, + + Point: function(o) { + return "M" + project(o.coordinates) + pointCircle; + }, + + MultiPoint: function(o) { + var path = [], + coordinates = o.coordinates, + i = -1, // coordinates.index + n = coordinates.length; + while (++i < n) path.push("M", project(coordinates[i]), pointCircle); + return path.join(""); + }, + + LineString: function(o) { + var path = ["M"], + coordinates = o.coordinates, + i = -1, // coordinates.index + n = coordinates.length; + while (++i < n) path.push(project(coordinates[i]), "L"); + path.pop(); + return path.join(""); + }, + + MultiLineString: function(o) { + var path = [], + coordinates = o.coordinates, + i = -1, // coordinates.index + n = coordinates.length, + subcoordinates, // coordinates[i] + j, // subcoordinates.index + m; // subcoordinates.length + while (++i < n) { + subcoordinates = coordinates[i]; + j = -1; + m = subcoordinates.length; + path.push("M"); + while (++j < m) path.push(project(subcoordinates[j]), "L"); + path.pop(); + } + return path.join(""); + }, + + Polygon: function(o) { + var path = [], + coordinates = o.coordinates, + i = -1, // coordinates.index + n = coordinates.length, + subcoordinates, // coordinates[i] + j, // subcoordinates.index + m; // subcoordinates.length + while (++i < n) { + subcoordinates = coordinates[i]; + j = -1; + if ((m = subcoordinates.length - 1) > 0) { + path.push("M"); + while (++j < m) path.push(project(subcoordinates[j]), "L"); + path[path.length - 1] = "Z"; + } + } + return path.join(""); + }, + + MultiPolygon: function(o) { + var path = [], + coordinates = o.coordinates, + i = -1, // coordinates index + n = coordinates.length, + subcoordinates, // coordinates[i] + j, // subcoordinates index + m, // subcoordinates.length + subsubcoordinates, // subcoordinates[j] + k, // subsubcoordinates index + p; // subsubcoordinates.length + while (++i < n) { + subcoordinates = coordinates[i]; + j = -1; + m = subcoordinates.length; + while (++j < m) { + subsubcoordinates = subcoordinates[j]; + k = -1; + if ((p = subsubcoordinates.length - 1) > 0) { + path.push("M"); + while (++k < p) path.push(project(subsubcoordinates[k]), "L"); + path[path.length - 1] = "Z"; + } + } + } + return path.join(""); + }, + + GeometryCollection: function(o) { + var path = [], + geometries = o.geometries, + i = -1, // geometries index + n = geometries.length; + while (++i < n) path.push(pathType(geometries[i])); + return path.join(""); + } + + }); + + var areaType = path.area = d3_geo_type({ + + FeatureCollection: function(o) { + var area = 0, + features = o.features, + i = -1, // features.index + n = features.length; + while (++i < n) area += areaType(features[i]); + return area; + }, + + Feature: function(o) { + return areaType(o.geometry); + }, + + Polygon: function(o) { + return polygonArea(o.coordinates); + }, + + MultiPolygon: function(o) { + var sum = 0, + coordinates = o.coordinates, + i = -1, // coordinates index + n = coordinates.length; + while (++i < n) sum += polygonArea(coordinates[i]); + return sum; + }, + + GeometryCollection: function(o) { + var sum = 0, + geometries = o.geometries, + i = -1, // geometries index + n = geometries.length; + while (++i < n) sum += areaType(geometries[i]); + return sum; + } + + }, 0); + + function polygonArea(coordinates) { + var sum = area(coordinates[0]), // exterior ring + i = 0, // coordinates.index + n = coordinates.length; + while (++i < n) sum -= area(coordinates[i]); // holes + return sum; + } + + function polygonCentroid(coordinates) { + var polygon = d3.geom.polygon(coordinates[0].map(projection)), // exterior ring + area = polygon.area(), + centroid = polygon.centroid(area < 0 ? (area *= -1, 1) : -1), + x = centroid[0], + y = centroid[1], + z = area, + i = 0, // coordinates index + n = coordinates.length; + while (++i < n) { + polygon = d3.geom.polygon(coordinates[i].map(projection)); // holes + area = polygon.area(); + centroid = polygon.centroid(area < 0 ? (area *= -1, 1) : -1); + x -= centroid[0]; + y -= centroid[1]; + z -= area; + } + return [x, y, 6 * z]; // weighted centroid + } + + var centroidType = path.centroid = d3_geo_type({ + + // TODO FeatureCollection + // TODO Point + // TODO MultiPoint + // TODO LineString + // TODO MultiLineString + // TODO GeometryCollection + + Feature: function(o) { + return centroidType(o.geometry); + }, + + Polygon: function(o) { + var centroid = polygonCentroid(o.coordinates); + return [centroid[0] / centroid[2], centroid[1] / centroid[2]]; + }, + + MultiPolygon: function(o) { + var area = 0, + coordinates = o.coordinates, + centroid, + x = 0, + y = 0, + z = 0, + i = -1, // coordinates index + n = coordinates.length; + while (++i < n) { + centroid = polygonCentroid(coordinates[i]); + x += centroid[0]; + y += centroid[1]; + z += centroid[2]; + } + return [x / z, y / z]; + } + + }); + + function area(coordinates) { + return Math.abs(d3.geom.polygon(coordinates.map(projection)).area()); + } + + path.projection = function(x) { + projection = x; + return path; + }; + + path.pointRadius = function(x) { + if (typeof x === "function") pointRadius = x; + else { + pointRadius = +x; + pointCircle = d3_path_circle(pointRadius); + } + return path; + }; + + return path; +}; + +function d3_path_circle(radius) { + return "m0," + radius + + "a" + radius + "," + radius + " 0 1,1 0," + (-2 * radius) + + "a" + radius + "," + radius + " 0 1,1 0," + (+2 * radius) + + "z"; +} +/** + * Given a GeoJSON object, returns the corresponding bounding box. The bounding + * box is represented by a two-dimensional array: [[left, bottom], [right, + * top]], where left is the minimum longitude, bottom is the minimum latitude, + * right is maximum longitude, and top is the maximum latitude. + */ +d3.geo.bounds = function(feature) { + var left = Infinity, + bottom = Infinity, + right = -Infinity, + top = -Infinity; + d3_geo_bounds(feature, function(x, y) { + if (x < left) left = x; + if (x > right) right = x; + if (y < bottom) bottom = y; + if (y > top) top = y; + }); + return [[left, bottom], [right, top]]; +}; + +function d3_geo_bounds(o, f) { + if (o.type in d3_geo_boundsTypes) d3_geo_boundsTypes[o.type](o, f); +} + +var d3_geo_boundsTypes = { + Feature: d3_geo_boundsFeature, + FeatureCollection: d3_geo_boundsFeatureCollection, + GeometryCollection: d3_geo_boundsGeometryCollection, + LineString: d3_geo_boundsLineString, + MultiLineString: d3_geo_boundsMultiLineString, + MultiPoint: d3_geo_boundsLineString, + MultiPolygon: d3_geo_boundsMultiPolygon, + Point: d3_geo_boundsPoint, + Polygon: d3_geo_boundsPolygon +}; + +function d3_geo_boundsFeature(o, f) { + d3_geo_bounds(o.geometry, f); +} + +function d3_geo_boundsFeatureCollection(o, f) { + for (var a = o.features, i = 0, n = a.length; i < n; i++) { + d3_geo_bounds(a[i].geometry, f); + } +} + +function d3_geo_boundsGeometryCollection(o, f) { + for (var a = o.geometries, i = 0, n = a.length; i < n; i++) { + d3_geo_bounds(a[i], f); + } +} + +function d3_geo_boundsLineString(o, f) { + for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) { + f.apply(null, a[i]); + } +} + +function d3_geo_boundsMultiLineString(o, f) { + for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) { + for (var b = a[i], j = 0, m = b.length; j < m; j++) { + f.apply(null, b[j]); + } + } +} + +function d3_geo_boundsMultiPolygon(o, f) { + for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) { + for (var b = a[i][0], j = 0, m = b.length; j < m; j++) { + f.apply(null, b[j]); + } + } +} + +function d3_geo_boundsPoint(o, f) { + f.apply(null, o.coordinates); +} + +function d3_geo_boundsPolygon(o, f) { + for (var a = o.coordinates[0], i = 0, n = a.length; i < n; i++) { + f.apply(null, a[i]); + } +} +// TODO breakAtDateLine? + +d3.geo.circle = function() { + var origin = [0, 0], + degrees = 90 - 1e-2, + radians = degrees * d3_geo_radians, + arc = d3.geo.greatArc().target(Object); + + function circle() { + // TODO render a circle as a Polygon + } + + function visible(point) { + return arc.distance(point) < radians; + } + + circle.clip = function(d) { + arc.source(typeof origin === "function" ? origin.apply(this, arguments) : origin); + return clipType(d); + }; + + var clipType = d3_geo_type({ + + FeatureCollection: function(o) { + var features = o.features.map(clipType).filter(Object); + return features && (o = Object.create(o), o.features = features, o); + }, + + Feature: function(o) { + var geometry = clipType(o.geometry); + return geometry && (o = Object.create(o), o.geometry = geometry, o); + }, + + Point: function(o) { + return visible(o.coordinates) && o; + }, + + MultiPoint: function(o) { + var coordinates = o.coordinates.filter(visible); + return coordinates.length && { + type: o.type, + coordinates: coordinates + }; + }, + + LineString: function(o) { + var coordinates = clip(o.coordinates); + return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o); + }, + + MultiLineString: function(o) { + var coordinates = o.coordinates.map(clip).filter(function(d) { return d.length; }); + return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o); + }, + + Polygon: function(o) { + var coordinates = o.coordinates.map(clip); + return coordinates[0].length && (o = Object.create(o), o.coordinates = coordinates, o); + }, + + MultiPolygon: function(o) { + var coordinates = o.coordinates.map(function(d) { return d.map(clip); }).filter(function(d) { return d[0].length; }); + return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o); + }, + + GeometryCollection: function(o) { + var geometries = o.geometries.map(clipType).filter(Object); + return geometries.length && (o = Object.create(o), o.geometries = geometries, o); + } + + }); + + function clip(coordinates) { + var i = -1, + n = coordinates.length, + clipped = [], + p0, + p1, + p2, + d0, + d1; + + while (++i < n) { + d1 = arc.distance(p2 = coordinates[i]); + if (d1 < radians) { + if (p1) clipped.push(d3_geo_greatArcInterpolate(p1, p2)((d0 - radians) / (d0 - d1))); + clipped.push(p2); + p0 = p1 = null; + } else { + p1 = p2; + if (!p0 && clipped.length) { + clipped.push(d3_geo_greatArcInterpolate(clipped[clipped.length - 1], p1)((radians - d0) / (d1 - d0))); + p0 = p1; + } + } + d0 = d1; + } + + if (p1 && clipped.length) { + d1 = arc.distance(p2 = clipped[0]); + clipped.push(d3_geo_greatArcInterpolate(p1, p2)((d0 - radians) / (d0 - d1))); + } + + return resample(clipped); + } + + // Resample coordinates, creating great arcs between each. + function resample(coordinates) { + var i = 0, + n = coordinates.length, + j, + m, + resampled = n ? [coordinates[0]] : coordinates, + resamples, + origin = arc.source(); + + while (++i < n) { + resamples = arc.source(coordinates[i - 1])(coordinates[i]).coordinates; + for (j = 0, m = resamples.length; ++j < m;) resampled.push(resamples[j]); + } + + arc.source(origin); + return resampled; + } + + circle.origin = function(x) { + if (!arguments.length) return origin; + origin = x; + return circle; + }; + + circle.angle = function(x) { + if (!arguments.length) return degrees; + radians = (degrees = +x) * d3_geo_radians; + return circle; + }; + + // Precision is specified in degrees. + circle.precision = function(x) { + if (!arguments.length) return arc.precision(); + arc.precision(x); + return circle; + }; + + return circle; +} +d3.geo.greatArc = function() { + var source = d3_geo_greatArcSource, + target = d3_geo_greatArcTarget, + precision = 6 * d3_geo_radians; + + function greatArc() { + var a = typeof source === "function" ? source.apply(this, arguments) : source, + b = typeof target === "function" ? target.apply(this, arguments) : target, + i = d3_geo_greatArcInterpolate(a, b), + dt = precision / i.d, + t = 0, + coordinates = [a]; + while ((t += dt) < 1) coordinates.push(i(t)); + coordinates.push(b); + return { + type: "LineString", + coordinates: coordinates + }; + } + + // Length returned in radians; multiply by radius for distance. + greatArc.distance = function() { + var a = typeof source === "function" ? source.apply(this, arguments) : source, + b = typeof target === "function" ? target.apply(this, arguments) : target; + return d3_geo_greatArcInterpolate(a, b).d; + }; + + greatArc.source = function(x) { + if (!arguments.length) return source; + source = x; + return greatArc; + }; + + greatArc.target = function(x) { + if (!arguments.length) return target; + target = x; + return greatArc; + }; + + // Precision is specified in degrees. + greatArc.precision = function(x) { + if (!arguments.length) return precision / d3_geo_radians; + precision = x * d3_geo_radians; + return greatArc; + }; + + return greatArc; +}; + +function d3_geo_greatArcSource(d) { + return d.source; +} + +function d3_geo_greatArcTarget(d) { + return d.target; +} + +function d3_geo_greatArcInterpolate(a, b) { + var x0 = a[0] * d3_geo_radians, cx0 = Math.cos(x0), sx0 = Math.sin(x0), + y0 = a[1] * d3_geo_radians, cy0 = Math.cos(y0), sy0 = Math.sin(y0), + x1 = b[0] * d3_geo_radians, cx1 = Math.cos(x1), sx1 = Math.sin(x1), + y1 = b[1] * d3_geo_radians, cy1 = Math.cos(y1), sy1 = Math.sin(y1), + d = interpolate.d = Math.acos(Math.max(-1, Math.min(1, sy0 * sy1 + cy0 * cy1 * Math.cos(x1 - x0)))), + sd = Math.sin(d); + + // From http://williams.best.vwh.net/avform.htm#Intermediate + function interpolate(t) { + var A = Math.sin(d - (t *= d)) / sd, + B = Math.sin(t) / sd, + x = A * cy0 * cx0 + B * cy1 * cx1, + y = A * cy0 * sx0 + B * cy1 * sx1, + z = A * sy0 + B * sy1; + return [ + Math.atan2(y, x) / d3_geo_radians, + Math.atan2(z, Math.sqrt(x * x + y * y)) / d3_geo_radians + ]; + } + + return interpolate; +} +d3.geo.greatCircle = d3.geo.circle; +})(); diff --git a/modules/enterprise/gui/rest-examples-war/src/main/webapp/js/d3.geom.js b/modules/enterprise/gui/rest-examples-war/src/main/webapp/js/d3.geom.js new file mode 100644 index 0000000..d860c2b --- /dev/null +++ b/modules/enterprise/gui/rest-examples-war/src/main/webapp/js/d3.geom.js @@ -0,0 +1,835 @@ +(function(){d3.geom = {}; +/** + * Computes a contour for a given input grid function using the <a + * href="http://en.wikipedia.org/wiki/Marching_squares%22%3Emarching + * squares</a> algorithm. Returns the contour polygon as an array of points. + * + * @param grid a two-input function(x, y) that returns true for values + * inside the contour and false for values outside the contour. + * @param start an optional starting point [x, y] on the grid. + * @returns polygon [[x1, y1], [x2, y2], …] + */ +d3.geom.contour = function(grid, start) { + var s = start || d3_geom_contourStart(grid), // starting point + c = [], // contour polygon + x = s[0], // current x position + y = s[1], // current y position + dx = 0, // next x direction + dy = 0, // next y direction + pdx = NaN, // previous x direction + pdy = NaN, // previous y direction + i = 0; + + do { + // determine marching squares index + i = 0; + if (grid(x-1, y-1)) i += 1; + if (grid(x, y-1)) i += 2; + if (grid(x-1, y )) i += 4; + if (grid(x, y )) i += 8; + + // determine next direction + if (i === 6) { + dx = pdy === -1 ? -1 : 1; + dy = 0; + } else if (i === 9) { + dx = 0; + dy = pdx === 1 ? -1 : 1; + } else { + dx = d3_geom_contourDx[i]; + dy = d3_geom_contourDy[i]; + } + + // update contour polygon + if (dx != pdx && dy != pdy) { + c.push([x, y]); + pdx = dx; + pdy = dy; + } + + x += dx; + y += dy; + } while (s[0] != x || s[1] != y); + + return c; +}; + +// lookup tables for marching directions +var d3_geom_contourDx = [1, 0, 1, 1,-1, 0,-1, 1,0, 0,0,0,-1, 0,-1,NaN], + d3_geom_contourDy = [0,-1, 0, 0, 0,-1, 0, 0,1,-1,1,1, 0,-1, 0,NaN]; + +function d3_geom_contourStart(grid) { + var x = 0, + y = 0; + + // search for a starting point; begin at origin + // and proceed along outward-expanding diagonals + while (true) { + if (grid(x,y)) { + return [x,y]; + } + if (x === 0) { + x = y + 1; + y = 0; + } else { + x = x - 1; + y = y + 1; + } + } +} +/** + * Computes the 2D convex hull of a set of points using Graham's scanning + * algorithm. The algorithm has been implemented as described in Cormen, + * Leiserson, and Rivest's Introduction to Algorithms. The running time of + * this algorithm is O(n log n), where n is the number of input points. + * + * @param vertices [[x1, y1], [x2, y2], …] + * @returns polygon [[x1, y1], [x2, y2], …] + */ +d3.geom.hull = function(vertices) { + if (vertices.length < 3) return []; + + var len = vertices.length, + plen = len - 1, + points = [], + stack = [], + i, j, h = 0, x1, y1, x2, y2, u, v, a, sp; + + // find the starting ref point: leftmost point with the minimum y coord + for (i=1; i<len; ++i) { + if (vertices[i][1] < vertices[h][1]) { + h = i; + } else if (vertices[i][1] == vertices[h][1]) { + h = (vertices[i][0] < vertices[h][0] ? i : h); + } + } + + // calculate polar angles from ref point and sort + for (i=0; i<len; ++i) { + if (i === h) continue; + y1 = vertices[i][1] - vertices[h][1]; + x1 = vertices[i][0] - vertices[h][0]; + points.push({angle: Math.atan2(y1, x1), index: i}); + } + points.sort(function(a, b) { return a.angle - b.angle; }); + + // toss out duplicate angles + a = points[0].angle; + v = points[0].index; + u = 0; + for (i=1; i<plen; ++i) { + j = points[i].index; + if (a == points[i].angle) { + // keep angle for point most distant from the reference + x1 = vertices[v][0] - vertices[h][0]; + y1 = vertices[v][1] - vertices[h][1]; + x2 = vertices[j][0] - vertices[h][0]; + y2 = vertices[j][1] - vertices[h][1]; + if ((x1*x1 + y1*y1) >= (x2*x2 + y2*y2)) { + points[i].index = -1; + } else { + points[u].index = -1; + a = points[i].angle; + u = i; + v = j; + } + } else { + a = points[i].angle; + u = i; + v = j; + } + } + + // initialize the stack + stack.push(h); + for (i=0, j=0; i<2; ++j) { + if (points[j].index !== -1) { + stack.push(points[j].index); + i++; + } + } + sp = stack.length; + + // do graham's scan + for (; j<plen; ++j) { + if (points[j].index === -1) continue; // skip tossed out points + while (!d3_geom_hullCCW(stack[sp-2], stack[sp-1], points[j].index, vertices)) { + --sp; + } + stack[sp++] = points[j].index; + } + + // construct the hull + var poly = []; + for (i=0; i<sp; ++i) { + poly.push(vertices[stack[i]]); + } + return poly; +} + +// are three points in counter-clockwise order? +function d3_geom_hullCCW(i1, i2, i3, v) { + var t, a, b, c, d, e, f; + t = v[i1]; a = t[0]; b = t[1]; + t = v[i2]; c = t[0]; d = t[1]; + t = v[i3]; e = t[0]; f = t[1]; + return ((f-b)*(c-a) - (d-b)*(e-a)) > 0; +} +// Note: requires coordinates to be counterclockwise and convex! +d3.geom.polygon = function(coordinates) { + + coordinates.area = function() { + var i = 0, + n = coordinates.length, + a = coordinates[n - 1][0] * coordinates[0][1], + b = coordinates[n - 1][1] * coordinates[0][0]; + while (++i < n) { + a += coordinates[i - 1][0] * coordinates[i][1]; + b += coordinates[i - 1][1] * coordinates[i][0]; + } + return (b - a) * .5; + }; + + coordinates.centroid = function(k) { + var i = -1, + n = coordinates.length - 1, + x = 0, + y = 0, + a, + b, + c; + if (!arguments.length) k = -1 / (6 * coordinates.area()); + while (++i < n) { + a = coordinates[i]; + b = coordinates[i + 1]; + c = a[0] * b[1] - b[0] * a[1]; + x += (a[0] + b[0]) * c; + y += (a[1] + b[1]) * c; + } + return [x * k, y * k]; + }; + + // The Sutherland-Hodgman clipping algorithm. + coordinates.clip = function(subject) { + var input, + i = -1, + n = coordinates.length, + j, + m, + a = coordinates[n - 1], + b, + c, + d; + while (++i < n) { + input = subject.slice(); + subject.length = 0; + b = coordinates[i]; + c = input[(m = input.length) - 1]; + j = -1; + while (++j < m) { + d = input[j]; + if (d3_geom_polygonInside(d, a, b)) { + if (!d3_geom_polygonInside(c, a, b)) { + subject.push(d3_geom_polygonIntersect(c, d, a, b)); + } + subject.push(d); + } else if (d3_geom_polygonInside(c, a, b)) { + subject.push(d3_geom_polygonIntersect(c, d, a, b)); + } + c = d; + } + a = b; + } + return subject; + }; + + return coordinates; +}; + +function d3_geom_polygonInside(p, a, b) { + return (b[0] - a[0]) * (p[1] - a[1]) < (b[1] - a[1]) * (p[0] - a[0]); +} + +// Intersect two infinite lines cd and ab. +function d3_geom_polygonIntersect(c, d, a, b) { + var x1 = c[0], x2 = d[0], x3 = a[0], x4 = b[0], + y1 = c[1], y2 = d[1], y3 = a[1], y4 = b[1], + x13 = x1 - x3, + x21 = x2 - x1, + x43 = x4 - x3, + y13 = y1 - y3, + y21 = y2 - y1, + y43 = y4 - y3, + ua = (x43 * y13 - y43 * x13) / (y43 * x21 - x43 * y21); + return [x1 + ua * x21, y1 + ua * y21]; +} +// Adapted from Nicolas Garcia Belmonte's JIT implementation: +// http://blog.thejit.org/2010/02/12/voronoi-tessellation/ +// http://blog.thejit.org/assets/voronoijs/voronoi.js +// See lib/jit/LICENSE for details. + +// Notes: +// +// This implementation does not clip the returned polygons, so if you want to +// clip them to a particular shape you will need to do that either in SVG or by +// post-processing with d3.geom.polygon's clip method. +// +// If any vertices are coincident or have NaN positions, the behavior of this +// method is undefined. Most likely invalid polygons will be returned. You +// should filter invalid points, and consolidate coincident points, before +// computing the tessellation. + +/** + * @param vertices [[x1, y1], [x2, y2], …] + * @returns polygons [[[x1, y1], [x2, y2], …], …] + */ +d3.geom.voronoi = function(vertices) { + var polygons = vertices.map(function() { return []; }); + + d3_voronoi_tessellate(vertices, function(e) { + var s1, + s2, + x1, + x2, + y1, + y2; + if (e.a === 1 && e.b >= 0) { + s1 = e.ep.r; + s2 = e.ep.l; + } else { + s1 = e.ep.l; + s2 = e.ep.r; + } + if (e.a === 1) { + y1 = s1 ? s1.y : -1e6; + x1 = e.c - e.b * y1; + y2 = s2 ? s2.y : 1e6; + x2 = e.c - e.b * y2; + } else { + x1 = s1 ? s1.x : -1e6; + y1 = e.c - e.a * x1; + x2 = s2 ? s2.x : 1e6; + y2 = e.c - e.a * x2; + } + var v1 = [x1, y1], + v2 = [x2, y2]; + polygons[e.region.l.index].push(v1, v2); + polygons[e.region.r.index].push(v1, v2); + }); + + // Reconnect the polygon segments into counterclockwise loops. + return polygons.map(function(polygon, i) { + var cx = vertices[i][0], + cy = vertices[i][1]; + polygon.forEach(function(v) { + v.angle = Math.atan2(v[0] - cx, v[1] - cy); + }); + return polygon.sort(function(a, b) { + return a.angle - b.angle; + }).filter(function(d, i) { + return !i || (d.angle - polygon[i - 1].angle > 1e-10); + }); + }); +}; + +var d3_voronoi_opposite = {"l": "r", "r": "l"}; + +function d3_voronoi_tessellate(vertices, callback) { + + var Sites = { + list: vertices + .map(function(v, i) { + return { + index: i, + x: v[0], + y: v[1] + }; + }) + .sort(function(a, b) { + return a.y < b.y ? -1 + : a.y > b.y ? 1 + : a.x < b.x ? -1 + : a.x > b.x ? 1 + : 0; + }), + bottomSite: null + }; + + var EdgeList = { + list: [], + leftEnd: null, + rightEnd: null, + + init: function() { + EdgeList.leftEnd = EdgeList.createHalfEdge(null, "l"); + EdgeList.rightEnd = EdgeList.createHalfEdge(null, "l"); + EdgeList.leftEnd.r = EdgeList.rightEnd; + EdgeList.rightEnd.l = EdgeList.leftEnd; + EdgeList.list.unshift(EdgeList.leftEnd, EdgeList.rightEnd); + }, + + createHalfEdge: function(edge, side) { + return { + edge: edge, + side: side, + vertex: null, + "l": null, + "r": null + }; + }, + + insert: function(lb, he) { + he.l = lb; + he.r = lb.r; + lb.r.l = he; + lb.r = he; + }, + + leftBound: function(p) { + var he = EdgeList.leftEnd; + do { + he = he.r; + } while (he != EdgeList.rightEnd && Geom.rightOf(he, p)); + he = he.l; + return he; + }, + + del: function(he) { + he.l.r = he.r; + he.r.l = he.l; + he.edge = null; + }, + + right: function(he) { + return he.r; + }, + + left: function(he) { + return he.l; + }, + + leftRegion: function(he) { + return he.edge == null + ? Sites.bottomSite + : he.edge.region[he.side]; + }, + + rightRegion: function(he) { + return he.edge == null + ? Sites.bottomSite + : he.edge.region[d3_voronoi_opposite[he.side]]; + } + }; + + var Geom = { + + bisect: function(s1, s2) { + var newEdge = { + region: {"l": s1, "r": s2}, + ep: {"l": null, "r": null} + }; + + var dx = s2.x - s1.x, + dy = s2.y - s1.y, + adx = dx > 0 ? dx : -dx, + ady = dy > 0 ? dy : -dy; + + newEdge.c = s1.x * dx + s1.y * dy + + (dx * dx + dy * dy) * .5; + + if (adx > ady) { + newEdge.a = 1; + newEdge.b = dy / dx; + newEdge.c /= dx; + } else { + newEdge.b = 1; + newEdge.a = dx / dy; + newEdge.c /= dy; + } + + return newEdge; + }, + + intersect: function(el1, el2) { + var e1 = el1.edge, + e2 = el2.edge; + if (!e1 || !e2 || (e1.region.r == e2.region.r)) { + return null; + } + var d = (e1.a * e2.b) - (e1.b * e2.a); + if (Math.abs(d) < 1e-10) { + return null; + } + var xint = (e1.c * e2.b - e2.c * e1.b) / d, + yint = (e2.c * e1.a - e1.c * e2.a) / d, + e1r = e1.region.r, + e2r = e2.region.r, + el, + e; + if ((e1r.y < e2r.y) || + (e1r.y == e2r.y && e1r.x < e2r.x)) { + el = el1; + e = e1; + } else { + el = el2; + e = e2; + } + var rightOfSite = (xint >= e.region.r.x); + if ((rightOfSite && (el.side === "l")) || + (!rightOfSite && (el.side === "r"))) { + return null; + } + return { + x: xint, + y: yint + }; + }, + + rightOf: function(he, p) { + var e = he.edge, + topsite = e.region.r, + rightOfSite = (p.x > topsite.x); + + if (rightOfSite && (he.side === "l")) { + return 1; + } + if (!rightOfSite && (he.side === "r")) { + return 0; + } + if (e.a === 1) { + var dyp = p.y - topsite.y, + dxp = p.x - topsite.x, + fast = 0, + above = 0; + + if ((!rightOfSite && (e.b < 0)) || + (rightOfSite && (e.b >= 0))) { + above = fast = (dyp >= e.b * dxp); + } else { + above = ((p.x + p.y * e.b) > e.c); + if (e.b < 0) { + above = !above; + } + if (!above) { + fast = 1; + } + } + if (!fast) { + var dxs = topsite.x - e.region.l.x; + above = (e.b * (dxp * dxp - dyp * dyp)) < + (dxs * dyp * (1 + 2 * dxp / dxs + e.b * e.b)); + + if (e.b < 0) { + above = !above; + } + } + } else /* e.b == 1 */ { + var yl = e.c - e.a * p.x, + t1 = p.y - yl, + t2 = p.x - topsite.x, + t3 = yl - topsite.y; + + above = (t1 * t1) > (t2 * t2 + t3 * t3); + } + return he.side === "l" ? above : !above; + }, + + endPoint: function(edge, side, site) { + edge.ep[side] = site; + if (!edge.ep[d3_voronoi_opposite[side]]) return; + callback(edge); + }, + + distance: function(s, t) { + var dx = s.x - t.x, + dy = s.y - t.y; + return Math.sqrt(dx * dx + dy * dy); + } + }; + + var EventQueue = { + list: [], + + insert: function(he, site, offset) { + he.vertex = site; + he.ystar = site.y + offset; + for (var i=0, list=EventQueue.list, l=list.length; i<l; i++) { + var next = list[i]; + if (he.ystar > next.ystar || + (he.ystar == next.ystar && + site.x > next.vertex.x)) { + continue; + } else { + break; + } + } + list.splice(i, 0, he); + }, + + del: function(he) { + for (var i=0, ls=EventQueue.list, l=ls.length; i<l && (ls[i] != he); ++i) {} + ls.splice(i, 1); + }, + + empty: function() { return EventQueue.list.length === 0; }, + + nextEvent: function(he) { + for (var i=0, ls=EventQueue.list, l=ls.length; i<l; ++i) { + if (ls[i] == he) return ls[i+1]; + } + return null; + }, + + min: function() { + var elem = EventQueue.list[0]; + return { + x: elem.vertex.x, + y: elem.ystar + }; + }, + + extractMin: function() { + return EventQueue.list.shift(); + } + }; + + EdgeList.init(); + Sites.bottomSite = Sites.list.shift(); + + var newSite = Sites.list.shift(), newIntStar; + var lbnd, rbnd, llbnd, rrbnd, bisector; + var bot, top, temp, p, v; + var e, pm; + + while (true) { + if (!EventQueue.empty()) { + newIntStar = EventQueue.min(); + } + if (newSite && (EventQueue.empty() + || newSite.y < newIntStar.y + || (newSite.y == newIntStar.y + && newSite.x < newIntStar.x))) { //new site is smallest + lbnd = EdgeList.leftBound(newSite); + rbnd = EdgeList.right(lbnd); + bot = EdgeList.rightRegion(lbnd); + e = Geom.bisect(bot, newSite); + bisector = EdgeList.createHalfEdge(e, "l"); + EdgeList.insert(lbnd, bisector); + p = Geom.intersect(lbnd, bisector); + if (p) { + EventQueue.del(lbnd); + EventQueue.insert(lbnd, p, Geom.distance(p, newSite)); + } + lbnd = bisector; + bisector = EdgeList.createHalfEdge(e, "r"); + EdgeList.insert(lbnd, bisector); + p = Geom.intersect(bisector, rbnd); + if (p) { + EventQueue.insert(bisector, p, Geom.distance(p, newSite)); + } + newSite = Sites.list.shift(); + } else if (!EventQueue.empty()) { //intersection is smallest + lbnd = EventQueue.extractMin(); + llbnd = EdgeList.left(lbnd); + rbnd = EdgeList.right(lbnd); + rrbnd = EdgeList.right(rbnd); + bot = EdgeList.leftRegion(lbnd); + top = EdgeList.rightRegion(rbnd); + v = lbnd.vertex; + Geom.endPoint(lbnd.edge, lbnd.side, v); + Geom.endPoint(rbnd.edge, rbnd.side, v); + EdgeList.del(lbnd); + EventQueue.del(rbnd); + EdgeList.del(rbnd); + pm = "l"; + if (bot.y > top.y) { + temp = bot; + bot = top; + top = temp; + pm = "r"; + } + e = Geom.bisect(bot, top); + bisector = EdgeList.createHalfEdge(e, pm); + EdgeList.insert(llbnd, bisector); + Geom.endPoint(e, d3_voronoi_opposite[pm], v); + p = Geom.intersect(llbnd, bisector); + if (p) { + EventQueue.del(llbnd); + EventQueue.insert(llbnd, p, Geom.distance(p, bot)); + } + p = Geom.intersect(bisector, rrbnd); + if (p) { + EventQueue.insert(bisector, p, Geom.distance(p, bot)); + } + } else { + break; + } + }//end while + + for (lbnd = EdgeList.right(EdgeList.leftEnd); + lbnd != EdgeList.rightEnd; + lbnd = EdgeList.right(lbnd)) { + callback(lbnd.edge); + } +} +/** +* @param vertices [[x1, y1], [x2, y2], …] +* @returns triangles [[[x1, y1], [x2, y2], [x3, y3]], …] + */ +d3.geom.delaunay = function(vertices) { + var edges = vertices.map(function() { return []; }), + triangles = []; + + // Use the Voronoi tessellation to determine Delaunay edges. + d3_voronoi_tessellate(vertices, function(e) { + edges[e.region.l.index].push(vertices[e.region.r.index]); + }); + + // Reconnect the edges into counterclockwise triangles. + edges.forEach(function(edge, i) { + var v = vertices[i], + cx = v[0], + cy = v[1]; + edge.forEach(function(v) { + v.angle = Math.atan2(v[0] - cx, v[1] - cy); + }); + edge.sort(function(a, b) { + return a.angle - b.angle; + }); + for (var j = 0, m = edge.length - 1; j < m; j++) { + triangles.push([v, edge[j], edge[j + 1]]); + } + }); + + return triangles; +}; +// Constructs a new quadtree for the specified array of points. A quadtree is a +// two-dimensional recursive spatial subdivision. This implementation uses +// square partitions, dividing each square into four equally-sized squares. Each +// point exists in a unique node; if multiple points are in the same position, +// some points may be stored on internal nodes rather than leaf nodes. Quadtrees +// can be used to accelerate various spatial operations, such as the Barnes-Hut +// approximation for computing n-body forces, or collision detection. +d3.geom.quadtree = function(points, x1, y1, x2, y2) { + var p, + i = -1, + n = points.length; + + // Type conversion for deprecated API. + if (n && isNaN(points[0].x)) points = points.map(d3_geom_quadtreePoint); + + // Allow bounds to be specified explicitly. + if (arguments.length < 5) { + if (arguments.length === 3) { + y2 = x2 = y1; + y1 = x1; + } else { + x1 = y1 = Infinity; + x2 = y2 = -Infinity; + + // Compute bounds. + while (++i < n) { + p = points[i]; + if (p.x < x1) x1 = p.x; + if (p.y < y1) y1 = p.y; + if (p.x > x2) x2 = p.x; + if (p.y > y2) y2 = p.y; + } + + // Squarify the bounds. + var dx = x2 - x1, + dy = y2 - y1; + if (dx > dy) y2 = y1 + dx; + else x2 = x1 + dy; + } + } + + // Recursively inserts the specified point p at the node n or one of its + // descendants. The bounds are defined by [x1, x2] and [y1, y2]. + function insert(n, p, x1, y1, x2, y2) { + if (isNaN(p.x) || isNaN(p.y)) return; // ignore invalid points + if (n.leaf) { + var v = n.point; + if (v) { + // If the point at this leaf node is at the same position as the new + // point we are adding, we leave the point associated with the + // internal node while adding the new point to a child node. This + // avoids infinite recursion. + if ((Math.abs(v.x - p.x) + Math.abs(v.y - p.y)) < .01) { + insertChild(n, p, x1, y1, x2, y2); + } else { + n.point = null; + insertChild(n, v, x1, y1, x2, y2); + insertChild(n, p, x1, y1, x2, y2); + } + } else { + n.point = p; + } + } else { + insertChild(n, p, x1, y1, x2, y2); + } + } + + // Recursively inserts the specified point p into a descendant of node n. The + // bounds are defined by [x1, x2] and [y1, y2]. + function insertChild(n, p, x1, y1, x2, y2) { + // Compute the split point, and the quadrant in which to insert p. + var sx = (x1 + x2) * .5, + sy = (y1 + y2) * .5, + right = p.x >= sx, + bottom = p.y >= sy, + i = (bottom << 1) + right; + + // Recursively insert into the child node. + n.leaf = false; + n = n.nodes[i] || (n.nodes[i] = d3_geom_quadtreeNode()); + + // Update the bounds as we recurse. + if (right) x1 = sx; else x2 = sx; + if (bottom) y1 = sy; else y2 = sy; + insert(n, p, x1, y1, x2, y2); + } + + // Create the root node. + var root = d3_geom_quadtreeNode(); + + root.add = function(p) { + insert(root, p, x1, y1, x2, y2); + }; + + root.visit = function(f) { + d3_geom_quadtreeVisit(f, root, x1, y1, x2, y2); + }; + + // Insert all points. + points.forEach(root.add); + return root; +}; + +function d3_geom_quadtreeNode() { + return { + leaf: true, + nodes: [], + point: null + }; +} + +function d3_geom_quadtreeVisit(f, node, x1, y1, x2, y2) { + if (!f(node, x1, y1, x2, y2)) { + var sx = (x1 + x2) * .5, + sy = (y1 + y2) * .5, + children = node.nodes; + if (children[0]) d3_geom_quadtreeVisit(f, children[0], x1, y1, sx, sy); + if (children[1]) d3_geom_quadtreeVisit(f, children[1], sx, y1, x2, sy); + if (children[2]) d3_geom_quadtreeVisit(f, children[2], x1, sy, sx, y2); + if (children[3]) d3_geom_quadtreeVisit(f, children[3], sx, sy, x2, y2); + } +} + +function d3_geom_quadtreePoint(p) { + return { + x: p[0], + y: p[1] + }; +} +})(); diff --git a/modules/enterprise/gui/rest-examples-war/src/main/webapp/js/d3.js b/modules/enterprise/gui/rest-examples-war/src/main/webapp/js/d3.js new file mode 100755 index 0000000..77ee372 --- /dev/null +++ b/modules/enterprise/gui/rest-examples-war/src/main/webapp/js/d3.js @@ -0,0 +1,4695 @@ +(function(){if (!Date.now) Date.now = function() { + return +new Date; +}; +try { + document.createElement("div").style.setProperty("opacity", 0, ""); +} catch (error) { + var d3_style_prototype = CSSStyleDeclaration.prototype, + d3_style_setProperty = d3_style_prototype.setProperty; + d3_style_prototype.setProperty = function(name, value, priority) { + d3_style_setProperty.call(this, name, value + "", priority); + }; +} +d3 = {version: "2.7.1"}; // semver +var d3_array = d3_arraySlice; // conversion for NodeLists + +function d3_arrayCopy(pseudoarray) { + var i = -1, n = pseudoarray.length, array = []; + while (++i < n) array.push(pseudoarray[i]); + return array; +} + +function d3_arraySlice(pseudoarray) { + return Array.prototype.slice.call(pseudoarray); +} + +try { + d3_array(document.documentElement.childNodes)[0].nodeType; +} catch(e) { + d3_array = d3_arrayCopy; +} + +var d3_arraySubclass = [].__proto__? + +// Until ECMAScript supports array subclassing, prototype injection works well. +function(array, prototype) { + array.__proto__ = prototype; +}: + +// And if your browser doesn't support __proto__, we'll use direct extension. +function(array, prototype) { + for (var property in prototype) array[property] = prototype[property]; +}; +function d3_this() { + return this; +} +d3.functor = function(v) { + return typeof v === "function" ? v : function() { return v; }; +}; +// Copies a variable number of methods from source to target. +d3.rebind = function(target, source) { + var i = 1, n = arguments.length, method; + while (++i < n) target[method = arguments[i]] = d3_rebind(target, source, source[method]); + return target; +}; + +// Method is assumed to be a standard D3 getter-setter: +// If passed with no arguments, gets the value. +// If passed with arguments, sets the value and returns the target. +function d3_rebind(target, source, method) { + return function() { + var value = method.apply(source, arguments); + return arguments.length ? target : value; + }; +} +d3.ascending = function(a, b) { + return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; +}; +d3.descending = function(a, b) { + return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; +}; +d3.mean = function(array, f) { + var n = array.length, + a, + m = 0, + i = -1, + j = 0; + if (arguments.length === 1) { + while (++i < n) if (d3_number(a = array[i])) m += (a - m) / ++j; + } else { + while (++i < n) if (d3_number(a = f.call(array, array[i], i))) m += (a - m) / ++j; + } + return j ? m : undefined; +}; +d3.median = function(array, f) { + if (arguments.length > 1) array = array.map(f); + array = array.filter(d3_number); + return array.length ? d3.quantile(array.sort(d3.ascending), .5) : undefined; +}; +d3.min = function(array, f) { + var i = -1, + n = array.length, + a, + b; + if (arguments.length === 1) { + while (++i < n && ((a = array[i]) == null || a != a)) a = undefined; + while (++i < n) if ((b = array[i]) != null && a > b) a = b; + } else { + while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined; + while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b; + } + return a; +}; +d3.max = function(array, f) { + var i = -1, + n = array.length, + a, + b; + if (arguments.length === 1) { + while (++i < n && ((a = array[i]) == null || a != a)) a = undefined; + while (++i < n) if ((b = array[i]) != null && b > a) a = b; + } else { + while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined; + while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b; + } + return a; +}; +d3.extent = function(array, f) { + var i = -1, + n = array.length, + a, + b, + c; + if (arguments.length === 1) { + while (++i < n && ((a = c = array[i]) == null || a != a)) a = c = undefined; + while (++i < n) if ((b = array[i]) != null) { + if (a > b) a = b; + if (c < b) c = b; + } + } else { + while (++i < n && ((a = c = f.call(array, array[i], i)) == null || a != a)) a = undefined; + while (++i < n) if ((b = f.call(array, array[i], i)) != null) { + if (a > b) a = b; + if (c < b) c = b; + } + } + return [a, c]; +}; +d3.random = { + normal: function(mean, deviation) { + if (arguments.length < 2) deviation = 1; + if (arguments.length < 1) mean = 0; + return function() { + var x, y, r; + do { + x = Math.random() * 2 - 1; + y = Math.random() * 2 - 1; + r = x * x + y * y; + } while (!r || r > 1); + return mean + deviation * x * Math.sqrt(-2 * Math.log(r) / r); + }; + } +}; +function d3_number(x) { + return x != null && !isNaN(x); +} +d3.sum = function(array, f) { + var s = 0, + n = array.length, + a, + i = -1; + + if (arguments.length === 1) { + while (++i < n) if (!isNaN(a = +array[i])) s += a; + } else { + while (++i < n) if (!isNaN(a = +f.call(array, array[i], i))) s += a; + } + + return s; +}; +// R-7 per http://en.wikipedia.org/wiki/Quantile +d3.quantile = function(values, p) { + var H = (values.length - 1) * p + 1, + h = Math.floor(H), + v = values[h - 1], + e = H - h; + return e ? v + e * (values[h] - v) : v; +}; +d3.transpose = function(matrix) { + return d3.zip.apply(d3, matrix); +}; +d3.zip = function() { + if (!(n = arguments.length)) return []; + for (var i = -1, m = d3.min(arguments, d3_zipLength), zips = new Array(m); ++i < m;) { + for (var j = -1, n, zip = zips[i] = new Array(n); ++j < n;) { + zip[j] = arguments[j][i]; + } + } + return zips; +}; + +function d3_zipLength(d) { + return d.length; +} +// Locate the insertion point for x in a to maintain sorted order. The +// arguments lo and hi may be used to specify a subset of the array which should +// be considered; by default the entire array is used. If x is already present +// in a, the insertion point will be before (to the left of) any existing +// entries. The return value is suitable for use as the first argument to +// `array.splice` assuming that a is already sorted. +// +// The returned insertion point i partitions the array a into two halves so that +// all v < x for v in a[lo:i] for the left side and all v >= x for v in a[i:hi] +// for the right side. +d3.bisectLeft = function(a, x, lo, hi) { + if (arguments.length < 3) lo = 0; + if (arguments.length < 4) hi = a.length; + while (lo < hi) { + var mid = (lo + hi) >> 1; + if (a[mid] < x) lo = mid + 1; + else hi = mid; + } + return lo; +}; + +// Similar to bisectLeft, but returns an insertion point which comes after (to +// the right of) any existing entries of x in a. +// +// The returned insertion point i partitions the array into two halves so that +// all v <= x for v in a[lo:i] for the left side and all v > x for v in a[i:hi] +// for the right side. +d3.bisect = +d3.bisectRight = function(a, x, lo, hi) { + if (arguments.length < 3) lo = 0; + if (arguments.length < 4) hi = a.length; + while (lo < hi) { + var mid = (lo + hi) >> 1; + if (x < a[mid]) hi = mid; + else lo = mid + 1; + } + return lo; +}; +d3.first = function(array, f) { + var i = 0, + n = array.length, + a = array[0], + b; + if (arguments.length === 1) f = d3.ascending; + while (++i < n) { + if (f.call(array, a, b = array[i]) > 0) { + a = b; + } + } + return a; +}; +d3.last = function(array, f) { + var i = 0, + n = array.length, + a = array[0], + b; + if (arguments.length === 1) f = d3.ascending; + while (++i < n) { + if (f.call(array, a, b = array[i]) <= 0) { + a = b; + } + } + return a; +}; +d3.nest = function() { + var nest = {}, + keys = [], + sortKeys = [], + sortValues, + rollup; + + function map(array, depth) { + if (depth >= keys.length) return rollup + ? rollup.call(nest, array) : (sortValues + ? array.sort(sortValues) + : array); + + var i = -1, + n = array.length, + key = keys[depth++], + keyValue, + object, + o = {}; + + while (++i < n) { + if ((keyValue = key(object = array[i])) in o) { + o[keyValue].push(object); + } else { + o[keyValue] = [object]; + } + } + + for (keyValue in o) { + o[keyValue] = map(o[keyValue], depth); + } + + return o; + } + + function entries(map, depth) { + if (depth >= keys.length) return map; + + var a = [], + sortKey = sortKeys[depth++], + key; + + for (key in map) { + a.push({key: key, values: entries(map[key], depth)}); + } + + if (sortKey) a.sort(function(a, b) { + return sortKey(a.key, b.key); + }); + + return a; + } + + nest.map = function(array) { + return map(array, 0); + }; + + nest.entries = function(array) { + return entries(map(array, 0), 0); + }; + + nest.key = function(d) { + keys.push(d); + return nest; + }; + + // Specifies the order for the most-recently specified key. + // Note: only applies to entries. Map keys are unordered! + nest.sortKeys = function(order) { + sortKeys[keys.length - 1] = order; + return nest; + }; + + // Specifies the order for leaf values. + // Applies to both maps and entries array. + nest.sortValues = function(order) { + sortValues = order; + return nest; + }; + + nest.rollup = function(f) { + rollup = f; + return nest; + }; + + return nest; +}; +d3.keys = function(map) { + var keys = []; + for (var key in map) keys.push(key); + return keys; +}; +d3.values = function(map) { + var values = []; + for (var key in map) values.push(map[key]); + return values; +}; +d3.entries = function(map) { + var entries = []; + for (var key in map) entries.push({key: key, value: map[key]}); + return entries; +}; +d3.permute = function(array, indexes) { + var permutes = [], + i = -1, + n = indexes.length; + while (++i < n) permutes[i] = array[indexes[i]]; + return permutes; +}; +d3.merge = function(arrays) { + return Array.prototype.concat.apply([], arrays); +}; +d3.split = function(array, f) { + var arrays = [], + values = [], + value, + i = -1, + n = array.length; + if (arguments.length < 2) f = d3_splitter; + while (++i < n) { + if (f.call(values, value = array[i], i)) { + values = []; + } else { + if (!values.length) arrays.push(values); + values.push(value); + } + } + return arrays; +}; + +function d3_splitter(d) { + return d == null; +} +function d3_collapse(s) { + return s.replace(/(^\s+)|(\s+$)/g, "").replace(/\s+/g, " "); +} +/** + * @param {number} start + * @param {number=} stop + * @param {number=} step + */ +d3.range = function(start, stop, step) { + if (arguments.length < 3) { + step = 1; + if (arguments.length < 2) { + stop = start; + start = 0; + } + } + if ((stop - start) / step == Infinity) throw new Error("infinite range"); + var range = [], + i = -1, + j; + if (step < 0) while ((j = start + step * ++i) > stop) range.push(j); + else while ((j = start + step * ++i) < stop) range.push(j); + return range; +}; +d3.requote = function(s) { + return s.replace(d3_requote_re, "\$&"); +}; + +var d3_requote_re = /[\^$*+?|[]().{}]/g; +d3.round = function(x, n) { + return n + ? Math.round(x * Math.pow(10, n)) * Math.pow(10, -n) + : Math.round(x); +}; +d3.xhr = function(url, mime, callback) { + var req = new XMLHttpRequest; + if (arguments.length < 3) callback = mime, mime = null; + else if (mime && req.overrideMimeType) req.overrideMimeType(mime); + req.open("GET", url, true); + if (mime) req.setRequestHeader("Accept", mime); + req.onreadystatechange = function() { + if (req.readyState === 4) callback(req.status < 300 ? req : null); + }; + req.send(null); +}; +d3.text = function(url, mime, callback) { + function ready(req) { + callback(req && req.responseText); + } + if (arguments.length < 3) { + callback = mime; + mime = null; + } + d3.xhr(url, mime, ready); +}; +d3.json = function(url, callback) { + d3.text(url, "application/json", function(text) { + callback(text ? JSON.parse(text) : null); + }); +}; +d3.html = function(url, callback) { + d3.text(url, "text/html", function(text) { + if (text != null) { // Treat empty string as valid HTML. + var range = document.createRange(); + range.selectNode(document.body); + text = range.createContextualFragment(text); + } + callback(text); + }); +}; +d3.xml = function(url, mime, callback) { + function ready(req) { + callback(req && req.responseXML); + } + if (arguments.length < 3) { + callback = mime; + mime = null; + } + d3.xhr(url, mime, ready); +}; +var d3_nsPrefix = { + svg: "http://www.w3.org/2000/svg", + xhtml: "http://www.w3.org/1999/xhtml", + xlink: "http://www.w3.org/1999/xlink", + xml: "http://www.w3.org/XML/1998/namespace", + xmlns: "http://www.w3.org/2000/xmlns/" +}; + +d3.ns = { + prefix: d3_nsPrefix, + qualify: function(name) { + var i = name.indexOf(":"); + return i < 0 ? (name in d3_nsPrefix + ? {space: d3_nsPrefix[name], local: name} : name) + : {space: d3_nsPrefix[name.substring(0, i)], local: name.substring(i + 1)}; + } +}; +d3.dispatch = function() { + var dispatch = new d3_dispatch(), + i = -1, + n = arguments.length; + while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(); + return dispatch; +}; + +function d3_dispatch() {} + +d3_dispatch.prototype.on = function(type, listener) { + var i = type.indexOf("."), + name = ""; + + // Extract optional namespace, e.g., "click.foo" + if (i > 0) { + name = type.substring(i + 1); + type = type.substring(0, i); + } + + return arguments.length < 2 + ? this[type].on(name) + : (this[type].on(name, listener), this); +}; + +function d3_dispatch_event() { + var listeners = [], + listenerByName = {}; + + function dispatch() { + var z = listeners, // defensive reference + i = -1, + n = z.length, + l; + while (++i < n) if (l = z[i].on) l.apply(this, arguments); + } + + dispatch.on = function(name, listener) { + var l, i; + + // return the current listener, if any + if (arguments.length < 2) return (l = listenerByName[name]) && l.on; + + // remove the old listener, if any (with copy-on-write) + if (l = listenerByName[name]) { + l.on = null; + listeners = listeners.slice(0, i = listeners.indexOf(l)).concat(listeners.slice(i + 1)); + delete listenerByName[name]; + } + + // add the new listener, if any + if (listener) { + listeners.push(listenerByName[name] = {on: listener}); + } + + return dispatch; + }; + + return dispatch; +}; +// TODO align +d3.format = function(specifier) { + var match = d3_format_re.exec(specifier), + fill = match[1] || " ", + sign = match[3] || "", + zfill = match[5], + width = +match[6], + comma = match[7], + precision = match[8], + type = match[9], + scale = 1, + suffix = "", + integer = false; + + if (precision) precision = +precision.substring(1); + + if (zfill) { + fill = "0"; // TODO align = "="; + if (comma) width -= Math.floor((width - 1) / 4); + } + + switch (type) { + case "n": comma = true; type = "g"; break; + case "%": scale = 100; suffix = "%"; type = "f"; break; + case "p": scale = 100; suffix = "%"; type = "r"; break; + case "d": integer = true; precision = 0; break; + case "s": scale = -1; type = "r"; break; + } + + // If no precision is specified for r, fallback to general notation. + if (type == "r" && !precision) type = "g"; + + type = d3_format_types[type] || d3_format_typeDefault; + + return function(value) { + + // Return the empty string for floats formatted as ints. + if (integer && (value % 1)) return ""; + + // Convert negative to positive, and record the sign prefix. + var negative = (value < 0) && (value = -value) ? "\u2212" : sign; + + // Apply the scale, computing it from the value's exponent for si format. + if (scale < 0) { + var prefix = d3.formatPrefix(value, precision); + value *= prefix.scale; + suffix = prefix.symbol; + } else { + value *= scale; + } + + // Convert to the desired precision. + value = type(value, precision); + + // If the fill character is 0, the sign and group is applied after the fill. + if (zfill) { + var length = value.length + negative.length; + if (length < width) value = new Array(width - length + 1).join(fill) + value; + if (comma) value = d3_format_group(value); + value = negative + value; + } + + // Otherwise (e.g., space-filling), the sign and group is applied before. + else { + if (comma) value = d3_format_group(value); + value = negative + value; + var length = value.length; + if (length < width) value = new Array(width - length + 1).join(fill) + value; + } + + return value + suffix; + }; +}; + +// [[fill]align][sign][#][0][width][,][.precision][type] +var d3_format_re = /(?:([^{])?([<>=^]))?([+- ])?(#)?(0)?([0-9]+)?(,)?(.[0-9]+)?([a-zA-Z%])?/; + +var d3_format_types = { + g: function(x, p) { return x.toPrecision(p); }, + e: function(x, p) { return x.toExponential(p); }, + f: function(x, p) { return x.toFixed(p); }, + r: function(x, p) { return d3.round(x, p = d3_format_precision(x, p)).toFixed(Math.max(0, Math.min(20, p))); } +}; + +function d3_format_precision(x, p) { + return p - (x ? 1 + Math.floor(Math.log(x + Math.pow(10, 1 + Math.floor(Math.log(x) / Math.LN10) - p)) / Math.LN10) : 1); +} + +function d3_format_typeDefault(x) { + return x + ""; +} + +// Apply comma grouping for thousands. +function d3_format_group(value) { + var i = value.lastIndexOf("."), + f = i >= 0 ? value.substring(i) : (i = value.length, ""), + t = []; + while (i > 0) t.push(value.substring(i -= 3, i + 3)); + return t.reverse().join(",") + f; +} +var d3_formatPrefixes = ["y","z","a","f","p","n","μ","m","","k","M","G","T","P","E","Z","Y"].map(d3_formatPrefix); + +d3.formatPrefix = function(value, precision) { + var i = 0; + if (value) { + if (value < 0) value *= -1; + if (precision) value = d3.round(value, d3_format_precision(value, precision)); + i = 1 + Math.floor(1e-12 + Math.log(value) / Math.LN10); + i = Math.max(-24, Math.min(24, Math.floor((i <= 0 ? i + 1 : i - 1) / 3) * 3)); + } + return d3_formatPrefixes[8 + i / 3]; +}; + +function d3_formatPrefix(d, i) { + return { + scale: Math.pow(10, (8 - i) * 3), + symbol: d + }; +} + +/* + * TERMS OF USE - EASING EQUATIONS + * + * Open source under the BSD License. + * + * Copyright 2001 Robert Penner + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * - Neither the name of the author nor the names of contributors may be used to + * endorse or promote products derived from this software without specific + * prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +var d3_ease_quad = d3_ease_poly(2), + d3_ease_cubic = d3_ease_poly(3); + +var d3_ease = { + linear: function() { return d3_ease_linear; }, + poly: d3_ease_poly, + quad: function() { return d3_ease_quad; }, + cubic: function() { return d3_ease_cubic; }, + sin: function() { return d3_ease_sin; }, + exp: function() { return d3_ease_exp; }, + circle: function() { return d3_ease_circle; }, + elastic: d3_ease_elastic, + back: d3_ease_back, + bounce: function() { return d3_ease_bounce; } +}; + +var d3_ease_mode = { + "in": function(f) { return f; }, + "out": d3_ease_reverse, + "in-out": d3_ease_reflect, + "out-in": function(f) { return d3_ease_reflect(d3_ease_reverse(f)); } +}; + +d3.ease = function(name) { + var i = name.indexOf("-"), + t = i >= 0 ? name.substring(0, i) : name, + m = i >= 0 ? name.substring(i + 1) : "in"; + return d3_ease_clamp(d3_ease_mode[m](d3_ease[t].apply(null, Array.prototype.slice.call(arguments, 1)))); +}; + +function d3_ease_clamp(f) { + return function(t) { + return t <= 0 ? 0 : t >= 1 ? 1 : f(t); + }; +} + +function d3_ease_reverse(f) { + return function(t) { + return 1 - f(1 - t); + }; +} + +function d3_ease_reflect(f) { + return function(t) { + return .5 * (t < .5 ? f(2 * t) : (2 - f(2 - 2 * t))); + }; +} + +function d3_ease_linear(t) { + return t; +} + +function d3_ease_poly(e) { + return function(t) { + return Math.pow(t, e); + } +} + +function d3_ease_sin(t) { + return 1 - Math.cos(t * Math.PI / 2); +} + +function d3_ease_exp(t) { + return Math.pow(2, 10 * (t - 1)); +} + +function d3_ease_circle(t) { + return 1 - Math.sqrt(1 - t * t); +} + +function d3_ease_elastic(a, p) { + var s; + if (arguments.length < 2) p = 0.45; + if (arguments.length < 1) { a = 1; s = p / 4; } + else s = p / (2 * Math.PI) * Math.asin(1 / a); + return function(t) { + return 1 + a * Math.pow(2, 10 * -t) * Math.sin((t - s) * 2 * Math.PI / p); + }; +} + +function d3_ease_back(s) { + if (!s) s = 1.70158; + return function(t) { + return t * t * ((s + 1) * t - s); + }; +} + +function d3_ease_bounce(t) { + return t < 1 / 2.75 ? 7.5625 * t * t + : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75 + : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375 + : 7.5625 * (t -= 2.625 / 2.75) * t + .984375; +} +d3.event = null; + +function d3_eventCancel() { + d3.event.stopPropagation(); + d3.event.preventDefault(); +} +d3.interpolate = function(a, b) { + var i = d3.interpolators.length, f; + while (--i >= 0 && !(f = d3.interpolators[i](a, b))); + return f; +}; + +d3.interpolateNumber = function(a, b) { + b -= a; + return function(t) { return a + b * t; }; +}; + +d3.interpolateRound = function(a, b) { + b -= a; + return function(t) { return Math.round(a + b * t); }; +}; + +d3.interpolateString = function(a, b) { + var m, // current match + i, // current index + j, // current index (for coallescing) + s0 = 0, // start index of current string prefix + s1 = 0, // end index of current string prefix + s = [], // string constants and placeholders + q = [], // number interpolators + n, // q.length + o; + + // Reset our regular expression! + d3_interpolate_number.lastIndex = 0; + + // Find all numbers in b. + for (i = 0; m = d3_interpolate_number.exec(b); ++i) { + if (m.index) s.push(b.substring(s0, s1 = m.index)); + q.push({i: s.length, x: m[0]}); + s.push(null); + s0 = d3_interpolate_number.lastIndex; + } + if (s0 < b.length) s.push(b.substring(s0)); + + // Find all numbers in a. + for (i = 0, n = q.length; (m = d3_interpolate_number.exec(a)) && i < n; ++i) { + o = q[i]; + if (o.x == m[0]) { // The numbers match, so coallesce. + if (o.i) { + if (s[o.i + 1] == null) { // This match is followed by another number. + s[o.i - 1] += o.x; + s.splice(o.i, 1); + for (j = i + 1; j < n; ++j) q[j].i--; + } else { // This match is followed by a string, so coallesce twice. + s[o.i - 1] += o.x + s[o.i + 1]; + s.splice(o.i, 2); + for (j = i + 1; j < n; ++j) q[j].i -= 2; + } + } else { + if (s[o.i + 1] == null) { // This match is followed by another number. + s[o.i] = o.x; + } else { // This match is followed by a string, so coallesce twice. + s[o.i] = o.x + s[o.i + 1]; + s.splice(o.i + 1, 1); + for (j = i + 1; j < n; ++j) q[j].i--; + } + } + q.splice(i, 1); + n--; + i--; + } else { + o.x = d3.interpolateNumber(parseFloat(m[0]), parseFloat(o.x)); + } + } + + // Remove any numbers in b not found in a. + while (i < n) { + o = q.pop(); + if (s[o.i + 1] == null) { // This match is followed by another number. + s[o.i] = o.x; + } else { // This match is followed by a string, so coallesce twice. + s[o.i] = o.x + s[o.i + 1]; + s.splice(o.i + 1, 1); + } + n--; + } + + // Special optimization for only a single match. + if (s.length === 1) { + return s[0] == null ? q[0].x : function() { return b; }; + } + + // Otherwise, interpolate each of the numbers and rejoin the string. + return function(t) { + for (i = 0; i < n; ++i) s[(o = q[i]).i] = o.x(t); + return s.join(""); + }; +}; + +d3.interpolateTransform = function(a, b) { + return d3.interpolateString(d3.transform(a) + "", d3.transform(b) + ""); +}; + +d3.interpolateRgb = function(a, b) { + a = d3.rgb(a); + b = d3.rgb(b); + var ar = a.r, + ag = a.g, + ab = a.b, + br = b.r - ar, + bg = b.g - ag, + bb = b.b - ab; + return function(t) { + return "#" + + d3_rgb_hex(Math.round(ar + br * t)) + + d3_rgb_hex(Math.round(ag + bg * t)) + + d3_rgb_hex(Math.round(ab + bb * t)); + }; +}; + +// interpolates HSL space, but outputs RGB string (for compatibility) +d3.interpolateHsl = function(a, b) { + a = d3.hsl(a); + b = d3.hsl(b); + var h0 = a.h, + s0 = a.s, + l0 = a.l, + h1 = b.h - h0, + s1 = b.s - s0, + l1 = b.l - l0; + return function(t) { + return d3_hsl_rgb(h0 + h1 * t, s0 + s1 * t, l0 + l1 * t).toString(); + }; +}; + +d3.interpolateArray = function(a, b) { + var x = [], + c = [], + na = a.length, + nb = b.length, + n0 = Math.min(a.length, b.length), + i; + for (i = 0; i < n0; ++i) x.push(d3.interpolate(a[i], b[i])); + for (; i < na; ++i) c[i] = a[i]; + for (; i < nb; ++i) c[i] = b[i]; + return function(t) { + for (i = 0; i < n0; ++i) c[i] = x[i](t); + return c; + }; +}; + +d3.interpolateObject = function(a, b) { + var i = {}, + c = {}, + k; + for (k in a) { + if (k in b) { + i[k] = d3_interpolateByName(k)(a[k], b[k]); + } else { + c[k] = a[k]; + } + } + for (k in b) { + if (!(k in a)) { + c[k] = b[k]; + } + } + return function(t) { + for (k in i) c[k] = i[k](t); + return c; + }; +} + +var d3_interpolate_number = /[-+]?(?:\d*.?\d+)(?:[eE][-+]?\d+)?/g; + +function d3_interpolateByName(n) { + return n == "transform" + ? d3.interpolateTransform + : d3.interpolate; +} + +d3.interpolators = [ + d3.interpolateObject, + function(a, b) { return (b instanceof Array) && d3.interpolateArray(a, b); }, + function(a, b) { return (typeof a === "string" || typeof b === "string") && d3.interpolateString(a + "", b + ""); }, + function(a, b) { return (typeof b === "string" ? b in d3_rgb_names || /^(#|rgb(|hsl()/.test(b) : b instanceof d3_Rgb || b instanceof d3_Hsl) && d3.interpolateRgb(a, b); }, + function(a, b) { return !isNaN(a = +a) && !isNaN(b = +b) && d3.interpolateNumber(a, b); } +]; +function d3_uninterpolateNumber(a, b) { + b = b - (a = +a) ? 1 / (b - a) : 0; + return function(x) { return (x - a) * b; }; +} + +function d3_uninterpolateClamp(a, b) { + b = b - (a = +a) ? 1 / (b - a) : 0; + return function(x) { return Math.max(0, Math.min(1, (x - a) * b)); }; +} +d3.rgb = function(r, g, b) { + return arguments.length === 1 + ? (r instanceof d3_Rgb ? d3_rgb(r.r, r.g, r.b) + : d3_rgb_parse("" + r, d3_rgb, d3_hsl_rgb)) + : d3_rgb(~~r, ~~g, ~~b); +}; + +function d3_rgb(r, g, b) { + return new d3_Rgb(r, g, b); +} + +function d3_Rgb(r, g, b) { + this.r = r; + this.g = g; + this.b = b; +} + +d3_Rgb.prototype.brighter = function(k) { + k = Math.pow(0.7, arguments.length ? k : 1); + var r = this.r, + g = this.g, + b = this.b, + i = 30; + if (!r && !g && !b) return d3_rgb(i, i, i); + if (r && r < i) r = i; + if (g && g < i) g = i; + if (b && b < i) b = i; + return d3_rgb( + Math.min(255, Math.floor(r / k)), + Math.min(255, Math.floor(g / k)), + Math.min(255, Math.floor(b / k))); +}; + +d3_Rgb.prototype.darker = function(k) { + k = Math.pow(0.7, arguments.length ? k : 1); + return d3_rgb( + Math.floor(k * this.r), + Math.floor(k * this.g), + Math.floor(k * this.b)); +}; + +d3_Rgb.prototype.hsl = function() { + return d3_rgb_hsl(this.r, this.g, this.b); +}; + +d3_Rgb.prototype.toString = function() { + return "#" + d3_rgb_hex(this.r) + d3_rgb_hex(this.g) + d3_rgb_hex(this.b); +}; + +function d3_rgb_hex(v) { + return v < 0x10 + ? "0" + Math.max(0, v).toString(16) + : Math.min(255, v).toString(16); +} + +function d3_rgb_parse(format, rgb, hsl) { + var r = 0, // red channel; int in [0, 255] + g = 0, // green channel; int in [0, 255] + b = 0, // blue channel; int in [0, 255] + m1, // CSS color specification match + m2, // CSS color specification type (e.g., rgb) + name; + + /* Handle hsl, rgb. */ + m1 = /([a-z]+)((.*))/i.exec(format); + if (m1) { + m2 = m1[2].split(","); + switch (m1[1]) { + case "hsl": { + return hsl( + parseFloat(m2[0]), // degrees + parseFloat(m2[1]) / 100, // percentage + parseFloat(m2[2]) / 100 // percentage + ); + } + case "rgb": { + return rgb( + d3_rgb_parseNumber(m2[0]), + d3_rgb_parseNumber(m2[1]), + d3_rgb_parseNumber(m2[2]) + ); + } + } + } + + /* Named colors. */ + if (name = d3_rgb_names[format]) return rgb(name.r, name.g, name.b); + + /* Hexadecimal colors: #rgb and #rrggbb. */ + if (format != null && format.charAt(0) === "#") { + if (format.length === 4) { + r = format.charAt(1); r += r; + g = format.charAt(2); g += g; + b = format.charAt(3); b += b; + } else if (format.length === 7) { + r = format.substring(1, 3); + g = format.substring(3, 5); + b = format.substring(5, 7); + } + r = parseInt(r, 16); + g = parseInt(g, 16); + b = parseInt(b, 16); + } + + return rgb(r, g, b); +} + +function d3_rgb_hsl(r, g, b) { + var min = Math.min(r /= 255, g /= 255, b /= 255), + max = Math.max(r, g, b), + d = max - min, + h, + s, + l = (max + min) / 2; + if (d) { + s = l < .5 ? d / (max + min) : d / (2 - max - min); + if (r == max) h = (g - b) / d + (g < b ? 6 : 0); + else if (g == max) h = (b - r) / d + 2; + else h = (r - g) / d + 4; + h *= 60; + } else { + s = h = 0; + } + return d3_hsl(h, s, l); +} + +function d3_rgb_parseNumber(c) { // either integer or percentage + var f = parseFloat(c); + return c.charAt(c.length - 1) === "%" ? Math.round(f * 2.55) : f; +} + +var d3_rgb_names = { + aliceblue: "#f0f8ff", + antiquewhite: "#faebd7", + aqua: "#00ffff", + aquamarine: "#7fffd4", + azure: "#f0ffff", + beige: "#f5f5dc", + bisque: "#ffe4c4", + black: "#000000", + blanchedalmond: "#ffebcd", + blue: "#0000ff", + blueviolet: "#8a2be2", + brown: "#a52a2a", + burlywood: "#deb887", + cadetblue: "#5f9ea0", + chartreuse: "#7fff00", + chocolate: "#d2691e", + coral: "#ff7f50", + cornflowerblue: "#6495ed", + cornsilk: "#fff8dc", + crimson: "#dc143c", + cyan: "#00ffff", + darkblue: "#00008b", + darkcyan: "#008b8b", + darkgoldenrod: "#b8860b", + darkgray: "#a9a9a9", + darkgreen: "#006400", + darkgrey: "#a9a9a9", + darkkhaki: "#bdb76b", + darkmagenta: "#8b008b", + darkolivegreen: "#556b2f", + darkorange: "#ff8c00", + darkorchid: "#9932cc", + darkred: "#8b0000", + darksalmon: "#e9967a", + darkseagreen: "#8fbc8f", + darkslateblue: "#483d8b", + darkslategray: "#2f4f4f", + darkslategrey: "#2f4f4f", + darkturquoise: "#00ced1", + darkviolet: "#9400d3", + deeppink: "#ff1493", + deepskyblue: "#00bfff", + dimgray: "#696969", + dimgrey: "#696969", + dodgerblue: "#1e90ff", + firebrick: "#b22222", + floralwhite: "#fffaf0", + forestgreen: "#228b22", + fuchsia: "#ff00ff", + gainsboro: "#dcdcdc", + ghostwhite: "#f8f8ff", + gold: "#ffd700", + goldenrod: "#daa520", + gray: "#808080", + green: "#008000", + greenyellow: "#adff2f", + grey: "#808080", + honeydew: "#f0fff0", + hotpink: "#ff69b4", + indianred: "#cd5c5c", + indigo: "#4b0082", + ivory: "#fffff0", + khaki: "#f0e68c", + lavender: "#e6e6fa", + lavenderblush: "#fff0f5", + lawngreen: "#7cfc00", + lemonchiffon: "#fffacd", + lightblue: "#add8e6", + lightcoral: "#f08080", + lightcyan: "#e0ffff", + lightgoldenrodyellow: "#fafad2", + lightgray: "#d3d3d3", + lightgreen: "#90ee90", + lightgrey: "#d3d3d3", + lightpink: "#ffb6c1", + lightsalmon: "#ffa07a", + lightseagreen: "#20b2aa", + lightskyblue: "#87cefa", + lightslategray: "#778899", + lightslategrey: "#778899", + lightsteelblue: "#b0c4de", + lightyellow: "#ffffe0", + lime: "#00ff00", + limegreen: "#32cd32", + linen: "#faf0e6", + magenta: "#ff00ff", + maroon: "#800000", + mediumaquamarine: "#66cdaa", + mediumblue: "#0000cd", + mediumorchid: "#ba55d3", + mediumpurple: "#9370db", + mediumseagreen: "#3cb371", + mediumslateblue: "#7b68ee", + mediumspringgreen: "#00fa9a", + mediumturquoise: "#48d1cc", + mediumvioletred: "#c71585", + midnightblue: "#191970", + mintcream: "#f5fffa", + mistyrose: "#ffe4e1", + moccasin: "#ffe4b5", + navajowhite: "#ffdead", + navy: "#000080", + oldlace: "#fdf5e6", + olive: "#808000", + olivedrab: "#6b8e23", + orange: "#ffa500", + orangered: "#ff4500", + orchid: "#da70d6", + palegoldenrod: "#eee8aa", + palegreen: "#98fb98", + paleturquoise: "#afeeee", + palevioletred: "#db7093", + papayawhip: "#ffefd5", + peachpuff: "#ffdab9", + peru: "#cd853f", + pink: "#ffc0cb", + plum: "#dda0dd", + powderblue: "#b0e0e6", + purple: "#800080", + red: "#ff0000", + rosybrown: "#bc8f8f", + royalblue: "#4169e1", + saddlebrown: "#8b4513", + salmon: "#fa8072", + sandybrown: "#f4a460", + seagreen: "#2e8b57", + seashell: "#fff5ee", + sienna: "#a0522d", + silver: "#c0c0c0", + skyblue: "#87ceeb", + slateblue: "#6a5acd", + slategray: "#708090", + slategrey: "#708090", + snow: "#fffafa", + springgreen: "#00ff7f", + steelblue: "#4682b4", + tan: "#d2b48c", + teal: "#008080", + thistle: "#d8bfd8", + tomato: "#ff6347", + turquoise: "#40e0d0", + violet: "#ee82ee", + wheat: "#f5deb3", + white: "#ffffff", + whitesmoke: "#f5f5f5", + yellow: "#ffff00", + yellowgreen: "#9acd32" +}; + +for (var d3_rgb_name in d3_rgb_names) { + d3_rgb_names[d3_rgb_name] = d3_rgb_parse( + d3_rgb_names[d3_rgb_name], + d3_rgb, + d3_hsl_rgb); +} +d3.hsl = function(h, s, l) { + return arguments.length === 1 + ? (h instanceof d3_Hsl ? d3_hsl(h.h, h.s, h.l) + : d3_rgb_parse("" + h, d3_rgb_hsl, d3_hsl)) + : d3_hsl(+h, +s, +l); +}; + +function d3_hsl(h, s, l) { + return new d3_Hsl(h, s, l); +} + +function d3_Hsl(h, s, l) { + this.h = h; + this.s = s; + this.l = l; +} + +d3_Hsl.prototype.brighter = function(k) { + k = Math.pow(0.7, arguments.length ? k : 1); + return d3_hsl(this.h, this.s, this.l / k); +}; + +d3_Hsl.prototype.darker = function(k) { + k = Math.pow(0.7, arguments.length ? k : 1); + return d3_hsl(this.h, this.s, k * this.l); +}; + +d3_Hsl.prototype.rgb = function() { + return d3_hsl_rgb(this.h, this.s, this.l); +}; + +d3_Hsl.prototype.toString = function() { + return this.rgb().toString(); +}; + +function d3_hsl_rgb(h, s, l) { + var m1, + m2; + + /* Some simple corrections for h, s and l. */ + h = h % 360; if (h < 0) h += 360; + s = s < 0 ? 0 : s > 1 ? 1 : s; + l = l < 0 ? 0 : l > 1 ? 1 : l; + + /* From FvD 13.37, CSS Color Module Level 3 */ + m2 = l <= .5 ? l * (1 + s) : l + s - l * s; + m1 = 2 * l - m2; + + function v(h) { + if (h > 360) h -= 360; + else if (h < 0) h += 360; + if (h < 60) return m1 + (m2 - m1) * h / 60; + if (h < 180) return m2; + if (h < 240) return m1 + (m2 - m1) * (240 - h) / 60; + return m1; + } + + function vv(h) { + return Math.round(v(h) * 255); + } + + return d3_rgb(vv(h + 120), vv(h), vv(h - 120)); +} +function d3_selection(groups) { + d3_arraySubclass(groups, d3_selectionPrototype); + return groups; +} + +var d3_select = function(s, n) { return n.querySelector(s); }, + d3_selectAll = function(s, n) { return n.querySelectorAll(s); }, + d3_selectRoot = document.documentElement, + d3_selectMatcher = d3_selectRoot.matchesSelector || d3_selectRoot.webkitMatchesSelector || d3_selectRoot.mozMatchesSelector || d3_selectRoot.msMatchesSelector || d3_selectRoot.oMatchesSelector, + d3_selectMatches = function(n, s) { return d3_selectMatcher.call(n, s); }; + +// Prefer Sizzle, if available. +if (typeof Sizzle === "function") { + d3_select = function(s, n) { return Sizzle(s, n)[0]; }; + d3_selectAll = function(s, n) { return Sizzle.uniqueSort(Sizzle(s, n)); }; + d3_selectMatches = Sizzle.matchesSelector; +} + +var d3_selectionPrototype = []; + +d3.selection = function() { + return d3_selectionRoot; +}; + +d3.selection.prototype = d3_selectionPrototype; +d3_selectionPrototype.select = function(selector) { + var subgroups = [], + subgroup, + subnode, + group, + node; + + if (typeof selector !== "function") selector = d3_selection_selector(selector); + + for (var j = -1, m = this.length; ++j < m;) { + subgroups.push(subgroup = []); + subgroup.parentNode = (group = this[j]).parentNode; + for (var i = -1, n = group.length; ++i < n;) { + if (node = group[i]) { + subgroup.push(subnode = selector.call(node, node.__data__, i)); + if (subnode && "__data__" in node) subnode.__data__ = node.__data__; + } else { + subgroup.push(null); + } + } + } + + return d3_selection(subgroups); +}; + +function d3_selection_selector(selector) { + return function() { + return d3_select(selector, this); + }; +} +d3_selectionPrototype.selectAll = function(selector) { + var subgroups = [], + subgroup, + node; + + if (typeof selector !== "function") selector = d3_selection_selectorAll(selector); + + for (var j = -1, m = this.length; ++j < m;) { + for (var group = this[j], i = -1, n = group.length; ++i < n;) { + if (node = group[i]) { + subgroups.push(subgroup = d3_array(selector.call(node, node.__data__, i))); + subgroup.parentNode = node; + } + } + } + + return d3_selection(subgroups); +}; + +function d3_selection_selectorAll(selector) { + return function() { + return d3_selectAll(selector, this); + }; +} +d3_selectionPrototype.attr = function(name, value) { + name = d3.ns.qualify(name); + + // If no value is specified, return the first value. + if (arguments.length < 2) { + var node = this.node(); + return name.local + ? node.getAttributeNS(name.space, name.local) + : node.getAttribute(name); + } + + function attrNull() { + this.removeAttribute(name); + } + + function attrNullNS() { + this.removeAttributeNS(name.space, name.local); + } + + function attrConstant() { + this.setAttribute(name, value); + } + + function attrConstantNS() { + this.setAttributeNS(name.space, name.local, value); + } + + function attrFunction() { + var x = value.apply(this, arguments); + if (x == null) this.removeAttribute(name); + else this.setAttribute(name, x); + } + + function attrFunctionNS() { + var x = value.apply(this, arguments); + if (x == null) this.removeAttributeNS(name.space, name.local); + else this.setAttributeNS(name.space, name.local, x); + } + + return this.each(value == null + ? (name.local ? attrNullNS : attrNull) : (typeof value === "function" + ? (name.local ? attrFunctionNS : attrFunction) + : (name.local ? attrConstantNS : attrConstant))); +}; +d3_selectionPrototype.classed = function(name, value) { + var names = name.split(d3_selection_classedWhitespace), + n = names.length, + i = -1; + if (arguments.length > 1) { + while (++i < n) d3_selection_classed.call(this, names[i], value); + return this; + } else { + while (++i < n) if (!d3_selection_classed.call(this, names[i])) return false; + return true; + } +}; + +var d3_selection_classedWhitespace = /\s+/g; + +function d3_selection_classed(name, value) { + var re = new RegExp("(^|\s+)" + d3.requote(name) + "(\s+|$)", "g"); + + // If no value is specified, return the first value. + if (arguments.length < 2) { + var node = this.node(); + if (c = node.classList) return c.contains(name); + var c = node.className; + re.lastIndex = 0; + return re.test(c.baseVal != null ? c.baseVal : c); + } + + function classedAdd() { + if (c = this.classList) return c.add(name); + var c = this.className, + cb = c.baseVal != null, + cv = cb ? c.baseVal : c; + re.lastIndex = 0; + if (!re.test(cv)) { + cv = d3_collapse(cv + " " + name); + if (cb) c.baseVal = cv; + else this.className = cv; + } + } + + function classedRemove() { + if (c = this.classList) return c.remove(name); + var c = this.className, + cb = c.baseVal != null, + cv = cb ? c.baseVal : c; + cv = d3_collapse(cv.replace(re, " ")); + if (cb) c.baseVal = cv; + else this.className = cv; + } + + function classedFunction() { + (value.apply(this, arguments) + ? classedAdd + : classedRemove).call(this); + } + + return this.each(typeof value === "function" + ? classedFunction : value + ? classedAdd + : classedRemove); +} +d3_selectionPrototype.style = function(name, value, priority) { + if (arguments.length < 3) priority = ""; + + // If no value is specified, return the first value. + if (arguments.length < 2) return window + .getComputedStyle(this.node(), null) + .getPropertyValue(name); + + function styleNull() { + this.style.removeProperty(name); + } + + function styleConstant() { + this.style.setProperty(name, value, priority); + } + + function styleFunction() { + var x = value.apply(this, arguments); + if (x == null) this.style.removeProperty(name); + else this.style.setProperty(name, x, priority); + } + + return this.each(value == null + ? styleNull : (typeof value === "function" + ? styleFunction : styleConstant)); +}; +d3_selectionPrototype.property = function(name, value) { + + // If no value is specified, return the first value. + if (arguments.length < 2) return this.node()[name]; + + function propertyNull() { + delete this[name]; + } + + function propertyConstant() { + this[name] = value; + } + + function propertyFunction() { + var x = value.apply(this, arguments); + if (x == null) delete this[name]; + else this[name] = x; + } + + return this.each(value == null + ? propertyNull : (typeof value === "function" + ? propertyFunction : propertyConstant)); +}; +d3_selectionPrototype.text = function(value) { + return arguments.length < 1 + ? this.node().textContent : this.each(typeof value === "function" + ? function() { var v = value.apply(this, arguments); this.textContent = v == null ? "" : v; } : value == null + ? function() { this.textContent = ""; } + : function() { this.textContent = value; }); +}; +d3_selectionPrototype.html = function(value) { + return arguments.length < 1 + ? this.node().innerHTML : this.each(typeof value === "function" + ? function() { var v = value.apply(this, arguments); this.innerHTML = v == null ? "" : v; } : value == null + ? function() { this.innerHTML = ""; } + : function() { this.innerHTML = value; }); +}; +// TODO append(node)? +// TODO append(function)? +d3_selectionPrototype.append = function(name) { + name = d3.ns.qualify(name); + + function append() { + return this.appendChild(document.createElementNS(this.namespaceURI, name)); + } + + function appendNS() { + return this.appendChild(document.createElementNS(name.space, name.local)); + } + + return this.select(name.local ? appendNS : append); +}; +// TODO insert(node, function)? +// TODO insert(function, string)? +// TODO insert(function, function)? +d3_selectionPrototype.insert = function(name, before) { + name = d3.ns.qualify(name); + + function insert() { + return this.insertBefore( + document.createElementNS(this.namespaceURI, name), + d3_select(before, this)); + } + + function insertNS() { + return this.insertBefore( + document.createElementNS(name.space, name.local), + d3_select(before, this)); + } + + return this.select(name.local ? insertNS : insert); +}; +// TODO remove(selector)? +// TODO remove(node)? +// TODO remove(function)? +d3_selectionPrototype.remove = function() { + return this.each(function() { + var parent = this.parentNode; + if (parent) parent.removeChild(this); + }); +}; +// TODO data(null) for clearing data? +d3_selectionPrototype.data = function(data, join) { + var enter = [], + update = [], + exit = []; + + function bind(group, groupData) { + var i, + n = group.length, + m = groupData.length, + n0 = Math.min(n, m), + n1 = Math.max(n, m), + updateNodes = [], + enterNodes = [], + exitNodes = [], + node, + nodeData; + + if (join) { + var nodeByKey = {}, + keys = [], + key, + j = groupData.length; + + for (i = -1; ++i < n;) { + key = join.call(node = group[i], node.__data__, i); + if (key in nodeByKey) { + exitNodes[j++] = node; // duplicate key + } else { + nodeByKey[key] = node; + } + keys.push(key); + } + + for (i = -1; ++i < m;) { + node = nodeByKey[key = join.call(groupData, nodeData = groupData[i], i)]; + if (node) { + node.__data__ = nodeData; + updateNodes[i] = node; + enterNodes[i] = exitNodes[i] = null; + } else { + enterNodes[i] = d3_selection_dataNode(nodeData); + updateNodes[i] = exitNodes[i] = null; + } + delete nodeByKey[key]; + } + + for (i = -1; ++i < n;) { + if (keys[i] in nodeByKey) { + exitNodes[i] = group[i]; + } + } + } else { + for (i = -1; ++i < n0;) { + node = group[i]; + nodeData = groupData[i]; + if (node) { + node.__data__ = nodeData; + updateNodes[i] = node; + enterNodes[i] = exitNodes[i] = null; + } else { + enterNodes[i] = d3_selection_dataNode(nodeData); + updateNodes[i] = exitNodes[i] = null; + } + } + for (; i < m; ++i) { + enterNodes[i] = d3_selection_dataNode(groupData[i]); + updateNodes[i] = exitNodes[i] = null; + } + for (; i < n1; ++i) { + exitNodes[i] = group[i]; + enterNodes[i] = updateNodes[i] = null; + } + } + + enterNodes.update + = updateNodes; + + enterNodes.parentNode + = updateNodes.parentNode + = exitNodes.parentNode + = group.parentNode; + + enter.push(enterNodes); + update.push(updateNodes); + exit.push(exitNodes); + } + + var i = -1, + n = this.length, + group; + if (typeof data === "function") { + while (++i < n) { + bind(group = this[i], data.call(group, group.parentNode.__data__, i)); + } + } else { + while (++i < n) { + bind(group = this[i], data); + } + } + + var selection = d3_selection(update); + selection.enter = function() { return d3_selection_enter(enter); }; + selection.exit = function() { return d3_selection(exit); }; + return selection; +}; + +function d3_selection_dataNode(data) { + return {__data__: data}; +} +d3_selectionPrototype.filter = function(filter) { + var subgroups = [], + subgroup, + group, + node; + + if (typeof filter !== "function") filter = d3_selection_filter(filter); + + for (var j = 0, m = this.length; j < m; j++) { + subgroups.push(subgroup = []); + subgroup.parentNode = (group = this[j]).parentNode; + for (var i = 0, n = group.length; i < n; i++) { + if ((node = group[i]) && filter.call(node, node.__data__, i)) { + subgroup.push(node); + } + } + } + + return d3_selection(subgroups); +}; + +function d3_selection_filter(selector) { + return function() { + return d3_selectMatches(this, selector); + }; +} +d3_selectionPrototype.map = function(map) { + return this.each(function() { + this.__data__ = map.apply(this, arguments); + }); +}; +d3_selectionPrototype.order = function() { + for (var j = -1, m = this.length; ++j < m;) { + for (var group = this[j], i = group.length - 1, next = group[i], node; --i >= 0;) { + if (node = group[i]) { + if (next) next.parentNode.insertBefore(node, next); + next = node; + } + } + } + return this; +}; +d3_selectionPrototype.sort = function(comparator) { + comparator = d3_selection_sortComparator.apply(this, arguments); + for (var j = -1, m = this.length; ++j < m;) this[j].sort(comparator); + return this.order(); +}; + +function d3_selection_sortComparator(comparator) { + if (!arguments.length) comparator = d3.ascending; + return function(a, b) { + return comparator(a && a.__data__, b && b.__data__); + }; +} +// type can be namespaced, e.g., "click.foo" +// listener can be null for removal +d3_selectionPrototype.on = function(type, listener, capture) { + if (arguments.length < 3) capture = false; + + // parse the type specifier + var name = "__on" + type, i = type.indexOf("."); + if (i > 0) type = type.substring(0, i); + + // if called with only one argument, return the current listener + if (arguments.length < 2) return (i = this.node()[name]) && i._; + + // remove the old event listener, and add the new event listener + return this.each(function(d, i) { + var node = this; + + if (node[name]) node.removeEventListener(type, node[name], capture); + if (listener) node.addEventListener(type, node[name] = l, capture); + + // wrapped event listener that preserves i + function l(e) { + var o = d3.event; // Events can be reentrant (e.g., focus). + d3.event = e; + try { + listener.call(node, node.__data__, i); + } finally { + d3.event = o; + } + } + + // stash the unwrapped listener for retrieval + l._ = listener; + }); +}; +d3_selectionPrototype.each = function(callback) { + for (var j = -1, m = this.length; ++j < m;) { + for (var group = this[j], i = -1, n = group.length; ++i < n;) { + var node = group[i]; + if (node) callback.call(node, node.__data__, i, j); + } + } + return this; +}; +// +// Note: assigning to the arguments array simultaneously changes the value of +// the corresponding argument! +// +// TODO The `this` argument probably shouldn't be the first argument to the +// callback, anyway, since it's redundant. However, that will require a major +// version bump due to backwards compatibility, so I'm not changing it right +// away. +// +d3_selectionPrototype.call = function(callback) { + callback.apply(this, (arguments[0] = this, arguments)); + return this; +}; +d3_selectionPrototype.empty = function() { + return !this.node(); +}; +d3_selectionPrototype.node = function(callback) { + for (var j = 0, m = this.length; j < m; j++) { + for (var group = this[j], i = 0, n = group.length; i < n; i++) { + var node = group[i]; + if (node) return node; + } + } + return null; +}; +d3_selectionPrototype.transition = function() { + var subgroups = [], + subgroup, + node; + + for (var j = -1, m = this.length; ++j < m;) { + subgroups.push(subgroup = []); + for (var group = this[j], i = -1, n = group.length; ++i < n;) { + subgroup.push((node = group[i]) ? {node: node, delay: 0, duration: 250} : null); + } + } + + return d3_transition(subgroups, d3_transitionInheritId || ++d3_transitionId, Date.now()); +}; +var d3_selectionRoot = d3_selection([[document]]); + +d3_selectionRoot[0].parentNode = d3_selectRoot; + +// TODO fast singleton implementation! +// TODO select(function) +d3.select = function(selector) { + return typeof selector === "string" + ? d3_selectionRoot.select(selector) + : d3_selection([[selector]]); // assume node +}; + +// TODO selectAll(function) +d3.selectAll = function(selector) { + return typeof selector === "string" + ? d3_selectionRoot.selectAll(selector) + : d3_selection([d3_array(selector)]); // assume node[] +}; +function d3_selection_enter(selection) { + d3_arraySubclass(selection, d3_selection_enterPrototype); + return selection; +} + +var d3_selection_enterPrototype = []; + +d3_selection_enterPrototype.append = d3_selectionPrototype.append; +d3_selection_enterPrototype.insert = d3_selectionPrototype.insert; +d3_selection_enterPrototype.empty = d3_selectionPrototype.empty; +d3_selection_enterPrototype.node = d3_selectionPrototype.node; +d3_selection_enterPrototype.select = function(selector) { + var subgroups = [], + subgroup, + subnode, + upgroup, + group, + node; + + for (var j = -1, m = this.length; ++j < m;) { + upgroup = (group = this[j]).update; + subgroups.push(subgroup = []); + subgroup.parentNode = group.parentNode; + for (var i = -1, n = group.length; ++i < n;) { + if (node = group[i]) { + subgroup.push(upgroup[i] = subnode = selector.call(group.parentNode, node.__data__, i)); + subnode.__data__ = node.__data__; + } else { + subgroup.push(null); + } + } + } + + return d3_selection(subgroups); +}; +function d3_transition(groups, id, time) { + d3_arraySubclass(groups, d3_transitionPrototype); + + var tweens = {}, + event = d3.dispatch("start", "end"), + ease = d3_transitionEase; + + groups.id = id; + + groups.time = time; + + groups.tween = function(name, tween) { + if (arguments.length < 2) return tweens[name]; + if (tween == null) delete tweens[name]; + else tweens[name] = tween; + return groups; + }; + + groups.ease = function(value) { + if (!arguments.length) return ease; + ease = typeof value === "function" ? value : d3.ease.apply(d3, arguments); + return groups; + }; + + groups.each = function(type, listener) { + if (arguments.length < 2) return d3_transition_each.call(groups, type); + event.on(type, listener); + return groups; + }; + + d3.timer(function(elapsed) { + groups.each(function(d, i, j) { + var tweened = [], + node = this, + delay = groups[j][i].delay, + duration = groups[j][i].duration, + lock = node.__transition__ || (node.__transition__ = {active: 0, count: 0}); + + ++lock.count; + + delay <= elapsed ? start(elapsed) : d3.timer(start, delay, time); + + function start(elapsed) { + if (lock.active > id) return stop(); + lock.active = id; + + for (var tween in tweens) { + if (tween = tweens[tween].call(node, d, i)) { + tweened.push(tween); + } + } + + event.start.call(node, d, i); + if (!tick(elapsed)) d3.timer(tick, 0, time); + return 1; + } + + function tick(elapsed) { + if (lock.active !== id) return stop(); + + var t = (elapsed - delay) / duration, + e = ease(t), + n = tweened.length; + + while (n > 0) { + tweened[--n].call(node, e); + } + + if (t >= 1) { + stop(); + d3_transitionInheritId = id; + event.end.call(node, d, i); + d3_transitionInheritId = 0; + return 1; + } + } + + function stop() { + if (!--lock.count) delete node.__transition__; + return 1; + } + }); + return 1; + }, 0, time); + + return groups; +} + +var d3_transitionRemove = {}; + +function d3_transitionNull(d, i, a) { + return a != "" && d3_transitionRemove; +} + +function d3_transitionTween(name, b) { + var interpolate = d3_interpolateByName(name); + + function transitionFunction(d, i, a) { + var v = b.call(this, d, i); + return v == null + ? a != "" && d3_transitionRemove + : a != v && interpolate(a, v); + } + + function transitionString(d, i, a) { + return a != b && interpolate(a, b); + } + + return typeof b === "function" ? transitionFunction + : b == null ? d3_transitionNull + : (b += "", transitionString); +} + +var d3_transitionPrototype = [], + d3_transitionId = 0, + d3_transitionInheritId = 0, + d3_transitionEase = d3.ease("cubic-in-out"); + +d3_transitionPrototype.call = d3_selectionPrototype.call; + +d3.transition = function() { + return d3_selectionRoot.transition(); +}; + +d3.transition.prototype = d3_transitionPrototype; +d3_transitionPrototype.select = function(selector) { + var subgroups = [], + subgroup, + subnode, + node; + + if (typeof selector !== "function") selector = d3_selection_selector(selector); + + for (var j = -1, m = this.length; ++j < m;) { + subgroups.push(subgroup = []); + for (var group = this[j], i = -1, n = group.length; ++i < n;) { + if ((node = group[i]) && (subnode = selector.call(node.node, node.node.__data__, i))) { + if ("__data__" in node.node) subnode.__data__ = node.node.__data__; + subgroup.push({node: subnode, delay: node.delay, duration: node.duration}); + } else { + subgroup.push(null); + } + } + } + + return d3_transition(subgroups, this.id, this.time).ease(this.ease()); +}; +d3_transitionPrototype.selectAll = function(selector) { + var subgroups = [], + subgroup, + subnodes, + node; + + if (typeof selector !== "function") selector = d3_selection_selectorAll(selector); + + for (var j = -1, m = this.length; ++j < m;) { + for (var group = this[j], i = -1, n = group.length; ++i < n;) { + if (node = group[i]) { + subnodes = selector.call(node.node, node.node.__data__, i); + subgroups.push(subgroup = []); + for (var k = -1, o = subnodes.length; ++k < o;) { + subgroup.push({node: subnodes[k], delay: node.delay, duration: node.duration}); + } + } + } + } + + return d3_transition(subgroups, this.id, this.time).ease(this.ease()); +}; +d3_transitionPrototype.attr = function(name, value) { + return this.attrTween(name, d3_transitionTween(name, value)); +}; + +d3_transitionPrototype.attrTween = function(nameNS, tween) { + var name = d3.ns.qualify(nameNS); + + function attrTween(d, i) { + var f = tween.call(this, d, i, this.getAttribute(name)); + return f === d3_transitionRemove + ? (this.removeAttribute(name), null) + : f && function(t) { this.setAttribute(name, f(t)); }; + } + + function attrTweenNS(d, i) { + var f = tween.call(this, d, i, this.getAttributeNS(name.space, name.local)); + return f === d3_transitionRemove + ? (this.removeAttributeNS(name.space, name.local), null) + : f && function(t) { this.setAttributeNS(name.space, name.local, f(t)); }; + } + + return this.tween("attr." + nameNS, name.local ? attrTweenNS : attrTween); +}; +d3_transitionPrototype.style = function(name, value, priority) { + if (arguments.length < 3) priority = ""; + return this.styleTween(name, d3_transitionTween(name, value), priority); +}; + +d3_transitionPrototype.styleTween = function(name, tween, priority) { + if (arguments.length < 3) priority = ""; + return this.tween("style." + name, function(d, i) { + var f = tween.call(this, d, i, window.getComputedStyle(this, null).getPropertyValue(name)); + return f === d3_transitionRemove + ? (this.style.removeProperty(name), null) + : f && function(t) { this.style.setProperty(name, f(t), priority); }; + }); +}; +d3_transitionPrototype.text = function(value) { + return this.tween("text", function(d, i) { + this.textContent = typeof value === "function" + ? value.call(this, d, i) + : value; + }); +}; +d3_transitionPrototype.remove = function() { + return this.each("end", function() { + var p; + if (!this.__transition__ && (p = this.parentNode)) p.removeChild(this); + }); +}; +d3_transitionPrototype.delay = function(value) { + var groups = this; + return groups.each(typeof value === "function" + ? function(d, i, j) { groups[j][i].delay = +value.apply(this, arguments); } + : (value = +value, function(d, i, j) { groups[j][i].delay = value; })); +}; +d3_transitionPrototype.duration = function(value) { + var groups = this; + return groups.each(typeof value === "function" + ? function(d, i, j) { groups[j][i].duration = +value.apply(this, arguments); } + : (value = +value, function(d, i, j) { groups[j][i].duration = value; })); +}; +function d3_transition_each(callback) { + for (var j = 0, m = this.length; j < m; j++) { + for (var group = this[j], i = 0, n = group.length; i < n; i++) { + var node = group[i]; + if (node) callback.call(node = node.node, node.__data__, i, j); + } + } + return this; +} +d3_transitionPrototype.transition = function() { + return this.select(d3_this); +}; +var d3_timer_queue = null, + d3_timer_interval, // is an interval (or frame) active? + d3_timer_timeout; // is a timeout active? + +// The timer will continue to fire until callback returns true. +d3.timer = function(callback, delay, then) { + var found = false, + t0, + t1 = d3_timer_queue; + + if (arguments.length < 3) { + if (arguments.length < 2) delay = 0; + else if (!isFinite(delay)) return; + then = Date.now(); + } + + // See if the callback's already in the queue. + while (t1) { + if (t1.callback === callback) { + t1.then = then; + t1.delay = delay; + found = true; + break; + } + t0 = t1; + t1 = t1.next; + } + + // Otherwise, add the callback to the queue. + if (!found) d3_timer_queue = { + callback: callback, + then: then, + delay: delay, + next: d3_timer_queue + }; + + // Start animatin'! + if (!d3_timer_interval) { + d3_timer_timeout = clearTimeout(d3_timer_timeout); + d3_timer_interval = 1; + d3_timer_frame(d3_timer_step); + } +} + +function d3_timer_step() { + var elapsed, + now = Date.now(), + t1 = d3_timer_queue; + + while (t1) { + elapsed = now - t1.then; + if (elapsed >= t1.delay) t1.flush = t1.callback(elapsed); + t1 = t1.next; + } + + var delay = d3_timer_flush() - now; + if (delay > 24) { + if (isFinite(delay)) { + clearTimeout(d3_timer_timeout); + d3_timer_timeout = setTimeout(d3_timer_step, delay); + } + d3_timer_interval = 0; + } else { + d3_timer_interval = 1; + d3_timer_frame(d3_timer_step); + } +} + +d3.timer.flush = function() { + var elapsed, + now = Date.now(), + t1 = d3_timer_queue; + + while (t1) { + elapsed = now - t1.then; + if (!t1.delay) t1.flush = t1.callback(elapsed); + t1 = t1.next; + } + + d3_timer_flush(); +}; + +// Flush after callbacks, to avoid concurrent queue modification. +function d3_timer_flush() { + var t0 = null, + t1 = d3_timer_queue, + then = Infinity; + while (t1) { + if (t1.flush) { + t1 = t0 ? t0.next = t1.next : d3_timer_queue = t1.next; + } else { + then = Math.min(then, t1.then + t1.delay); + t1 = (t0 = t1).next; + } + } + return then; +} + +var d3_timer_frame = window.requestAnimationFrame + || window.webkitRequestAnimationFrame + || window.mozRequestAnimationFrame + || window.oRequestAnimationFrame + || window.msRequestAnimationFrame + || function(callback) { setTimeout(callback, 17); }; +d3.transform = function(string) { + var g = document.createElementNS(d3.ns.prefix.svg, "g"), + identity = {a: 1, b: 0, c: 0, d: 1, e: 0, f: 0}; + return (d3.transform = function(string) { + g.setAttribute("transform", string); + var t = g.transform.baseVal.consolidate(); + return new d3_transform(t ? t.matrix : identity); + })(string); +}; + +// Compute x-scale and normalize the first row. +// Compute shear and make second row orthogonal to first. +// Compute y-scale and normalize the second row. +// Finally, compute the rotation. +function d3_transform(m) { + var r0 = [m.a, m.b], + r1 = [m.c, m.d], + kx = d3_transformNormalize(r0), + kz = d3_transformDot(r0, r1), + ky = d3_transformNormalize(d3_transformCombine(r1, r0, -kz)) || 0; + if (r0[0] * r1[1] < r1[0] * r0[1]) { + r0[0] *= -1; + r0[1] *= -1; + kx *= -1; + kz *= -1; + } + this.rotate = (kx ? Math.atan2(r0[1], r0[0]) : Math.atan2(-r1[0], r1[1])) * d3_transformDegrees; + this.translate = [m.e, m.f]; + this.scale = [kx, ky]; + this.skew = ky ? Math.atan2(kz, ky) * d3_transformDegrees : 0; +}; + +d3_transform.prototype.toString = function() { + return "translate(" + this.translate + + ")rotate(" + this.rotate + + ")skewX(" + this.skew + + ")scale(" + this.scale + + ")"; +}; + +function d3_transformDot(a, b) { + return a[0] * b[0] + a[1] * b[1]; +} + +function d3_transformNormalize(a) { + var k = Math.sqrt(d3_transformDot(a, a)); + if (k) { + a[0] /= k; + a[1] /= k; + } + return k; +} + +function d3_transformCombine(a, b, k) { + a[0] += k * b[0]; + a[1] += k * b[1]; + return a; +} + +var d3_transformDegrees = 180 / Math.PI; +function d3_noop() {} +d3.scale = {}; + +function d3_scaleExtent(domain) { + var start = domain[0], stop = domain[domain.length - 1]; + return start < stop ? [start, stop] : [stop, start]; +} + +function d3_scaleRange(scale) { + return scale.rangeExtent ? scale.rangeExtent() : d3_scaleExtent(scale.range()); +} +function d3_scale_nice(domain, nice) { + var i0 = 0, + i1 = domain.length - 1, + x0 = domain[i0], + x1 = domain[i1], + dx; + + if (x1 < x0) { + dx = i0; i0 = i1; i1 = dx; + dx = x0; x0 = x1; x1 = dx; + } + + if (dx = x1 - x0) { + nice = nice(dx); + domain[i0] = nice.floor(x0); + domain[i1] = nice.ceil(x1); + } + + return domain; +} + +function d3_scale_niceDefault() { + return Math; +} +d3.scale.linear = function() { + return d3_scale_linear([0, 1], [0, 1], d3.interpolate, false); +}; + +function d3_scale_linear(domain, range, interpolate, clamp) { + var output, + input; + + function rescale() { + var linear = domain.length == 2 ? d3_scale_bilinear : d3_scale_polylinear, + uninterpolate = clamp ? d3_uninterpolateClamp : d3_uninterpolateNumber; + output = linear(domain, range, uninterpolate, interpolate); + input = linear(range, domain, uninterpolate, d3.interpolate); + return scale; + } + + function scale(x) { + return output(x); + } + + // Note: requires range is coercible to number! + scale.invert = function(y) { + return input(y); + }; + + scale.domain = function(x) { + if (!arguments.length) return domain; + domain = x.map(Number); + return rescale(); + }; + + scale.range = function(x) { + if (!arguments.length) return range; + range = x; + return rescale(); + }; + + scale.rangeRound = function(x) { + return scale.range(x).interpolate(d3.interpolateRound); + }; + + scale.clamp = function(x) { + if (!arguments.length) return clamp; + clamp = x; + return rescale(); + }; + + scale.interpolate = function(x) { + if (!arguments.length) return interpolate; + interpolate = x; + return rescale(); + }; + + scale.ticks = function(m) { + return d3_scale_linearTicks(domain, m); + }; + + scale.tickFormat = function(m) { + return d3_scale_linearTickFormat(domain, m); + }; + + scale.nice = function() { + d3_scale_nice(domain, d3_scale_linearNice); + return rescale(); + }; + + scale.copy = function() { + return d3_scale_linear(domain, range, interpolate, clamp); + }; + + return rescale(); +}; + +function d3_scale_linearRebind(scale, linear) { + return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp"); +} + +function d3_scale_linearNice(dx) { + dx = Math.pow(10, Math.round(Math.log(dx) / Math.LN10) - 1); + return { + floor: function(x) { return Math.floor(x / dx) * dx; }, + ceil: function(x) { return Math.ceil(x / dx) * dx; } + }; +} + +// TODO Dates? Ugh. +function d3_scale_linearTickRange(domain, m) { + var extent = d3_scaleExtent(domain), + span = extent[1] - extent[0], + step = Math.pow(10, Math.floor(Math.log(span / m) / Math.LN10)), + err = m / span * step; + + // Filter ticks to get closer to the desired count. + if (err <= .15) step *= 10; + else if (err <= .35) step *= 5; + else if (err <= .75) step *= 2; + + // Round start and stop values to step interval. + extent[0] = Math.ceil(extent[0] / step) * step; + extent[1] = Math.floor(extent[1] / step) * step + step * .5; // inclusive + extent[2] = step; + return extent; +} + +function d3_scale_linearTicks(domain, m) { + return d3.range.apply(d3, d3_scale_linearTickRange(domain, m)); +} + +function d3_scale_linearTickFormat(domain, m) { + return d3.format(",." + Math.max(0, -Math.floor(Math.log(d3_scale_linearTickRange(domain, m)[2]) / Math.LN10 + .01)) + "f"); +} +function d3_scale_bilinear(domain, range, uninterpolate, interpolate) { + var u = uninterpolate(domain[0], domain[1]), + i = interpolate(range[0], range[1]); + return function(x) { + return i(u(x)); + }; +} +function d3_scale_polylinear(domain, range, uninterpolate, interpolate) { + var u = [], + i = [], + j = 0, + n = domain.length; + + while (++j < n) { + u.push(uninterpolate(domain[j - 1], domain[j])); + i.push(interpolate(range[j - 1], range[j])); + } + + return function(x) { + var j = d3.bisect(domain, x, 1, domain.length - 1) - 1; + return i[j](u[j](x)); + }; +} +d3.scale.log = function() { + return d3_scale_log(d3.scale.linear(), d3_scale_logp); +}; + +function d3_scale_log(linear, log) { + var pow = log.pow; + + function scale(x) { + return linear(log(x)); + } + + scale.invert = function(x) { + return pow(linear.invert(x)); + }; + + scale.domain = function(x) { + if (!arguments.length) return linear.domain().map(pow); + log = x[0] < 0 ? d3_scale_logn : d3_scale_logp; + pow = log.pow; + linear.domain(x.map(log)); + return scale; + }; + + scale.nice = function() { + linear.domain(d3_scale_nice(linear.domain(), d3_scale_niceDefault)); + return scale; + }; + + scale.ticks = function() { + var extent = d3_scaleExtent(linear.domain()), + ticks = []; + if (extent.every(isFinite)) { + var i = Math.floor(extent[0]), + j = Math.ceil(extent[1]), + u = pow(extent[0]), + v = pow(extent[1]); + if (log === d3_scale_logn) { + ticks.push(pow(i)); + for (; i++ < j;) for (var k = 9; k > 0; k--) ticks.push(pow(i) * k); + } else { + for (; i < j; i++) for (var k = 1; k < 10; k++) ticks.push(pow(i) * k); + ticks.push(pow(i)); + } + for (i = 0; ticks[i] < u; i++) {} // strip small values + for (j = ticks.length; ticks[j - 1] > v; j--) {} // strip big values + ticks = ticks.slice(i, j); + } + return ticks; + }; + + scale.tickFormat = function(n, format) { + if (arguments.length < 2) format = d3_scale_logFormat; + if (arguments.length < 1) return format; + var k = n / scale.ticks().length, + f = log === d3_scale_logn ? (e = -1e-12, Math.floor) : (e = 1e-12, Math.ceil), + e; + return function(d) { + return d / pow(f(log(d) + e)) < k ? format(d) : ""; + }; + }; + + scale.copy = function() { + return d3_scale_log(linear.copy(), log); + }; + + return d3_scale_linearRebind(scale, linear); +}; + +var d3_scale_logFormat = d3.format(".0e"); + +function d3_scale_logp(x) { + return Math.log(x) / Math.LN10; +} + +function d3_scale_logn(x) { + return -Math.log(-x) / Math.LN10; +} + +d3_scale_logp.pow = function(x) { + return Math.pow(10, x); +}; + +d3_scale_logn.pow = function(x) { + return -Math.pow(10, -x); +}; +d3.scale.pow = function() { + return d3_scale_pow(d3.scale.linear(), 1); +}; + +function d3_scale_pow(linear, exponent) { + var powp = d3_scale_powPow(exponent), + powb = d3_scale_powPow(1 / exponent); + + function scale(x) { + return linear(powp(x)); + } + + scale.invert = function(x) { + return powb(linear.invert(x)); + }; + + scale.domain = function(x) { + if (!arguments.length) return linear.domain().map(powb); + linear.domain(x.map(powp)); + return scale; + }; + + scale.ticks = function(m) { + return d3_scale_linearTicks(scale.domain(), m); + }; + + scale.tickFormat = function(m) { + return d3_scale_linearTickFormat(scale.domain(), m); + }; + + scale.nice = function() { + return scale.domain(d3_scale_nice(scale.domain(), d3_scale_linearNice)); + }; + + scale.exponent = function(x) { + if (!arguments.length) return exponent; + var domain = scale.domain(); + powp = d3_scale_powPow(exponent = x); + powb = d3_scale_powPow(1 / exponent); + return scale.domain(domain); + }; + + scale.copy = function() { + return d3_scale_pow(linear.copy(), exponent); + }; + + return d3_scale_linearRebind(scale, linear); +}; + +function d3_scale_powPow(e) { + return function(x) { + return x < 0 ? -Math.pow(-x, e) : Math.pow(x, e); + }; +} +d3.scale.sqrt = function() { + return d3.scale.pow().exponent(.5); +}; +d3.scale.ordinal = function() { + return d3_scale_ordinal([], {t: "range", x: []}); +}; + +function d3_scale_ordinal(domain, ranger) { + var index, + range, + rangeBand; + + function scale(x) { + return range[((index[x] || (index[x] = domain.push(x))) - 1) % range.length]; + } + + function steps(start, step) { + return d3.range(domain.length).map(function(i) { return start + step * i; }); + } + + scale.domain = function(x) { + if (!arguments.length) return domain; + domain = []; + index = {}; + var i = -1, n = x.length, xi; + while (++i < n) if (!index[xi = x[i]]) index[xi] = domain.push(xi); + return scale[ranger.t](ranger.x, ranger.p); + }; + + scale.range = function(x) { + if (!arguments.length) return range; + range = x; + rangeBand = 0; + ranger = {t: "range", x: x}; + return scale; + }; + + scale.rangePoints = function(x, padding) { + if (arguments.length < 2) padding = 0; + var start = x[0], + stop = x[1], + step = (stop - start) / (domain.length - 1 + padding); + range = steps(domain.length < 2 ? (start + stop) / 2 : start + step * padding / 2, step); + rangeBand = 0; + ranger = {t: "rangePoints", x: x, p: padding}; + return scale; + }; + + scale.rangeBands = function(x, padding) { + if (arguments.length < 2) padding = 0; + var start = x[0], + stop = x[1], + step = (stop - start) / (domain.length + padding); + range = steps(start + step * padding, step); + rangeBand = step * (1 - padding); + ranger = {t: "rangeBands", x: x, p: padding}; + return scale; + }; + + scale.rangeRoundBands = function(x, padding) { + if (arguments.length < 2) padding = 0; + var start = x[0], + stop = x[1], + step = Math.floor((stop - start) / (domain.length + padding)); + range = steps(start + Math.round((stop - start - (domain.length - padding) * step) / 2), step); + rangeBand = Math.round(step * (1 - padding)); + ranger = {t: "rangeRoundBands", x: x, p: padding}; + return scale; + }; + + scale.rangeBand = function() { + return rangeBand; + }; + + scale.rangeExtent = function() { + return ranger.t === "range" ? d3_scaleExtent(ranger.x) : ranger.x; + }; + + scale.copy = function() { + return d3_scale_ordinal(domain, ranger); + }; + + return scale.domain(domain); +}; +/* + * This product includes color specifications and designs developed by Cynthia + * Brewer (http://colorbrewer.org/). See lib/colorbrewer for more information. + */ + +d3.scale.category10 = function() { + return d3.scale.ordinal().range(d3_category10); +}; + +d3.scale.category20 = function() { + return d3.scale.ordinal().range(d3_category20); +}; + +d3.scale.category20b = function() { + return d3.scale.ordinal().range(d3_category20b); +}; + +d3.scale.category20c = function() { + return d3.scale.ordinal().range(d3_category20c); +}; + +var d3_category10 = [ + "#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", + "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf" +]; + +var d3_category20 = [ + "#1f77b4", "#aec7e8", + "#ff7f0e", "#ffbb78", + "#2ca02c", "#98df8a", + "#d62728", "#ff9896", + "#9467bd", "#c5b0d5", + "#8c564b", "#c49c94", + "#e377c2", "#f7b6d2", + "#7f7f7f", "#c7c7c7", + "#bcbd22", "#dbdb8d", + "#17becf", "#9edae5" +]; + +var d3_category20b = [ + "#393b79", "#5254a3", "#6b6ecf", "#9c9ede", + "#637939", "#8ca252", "#b5cf6b", "#cedb9c", + "#8c6d31", "#bd9e39", "#e7ba52", "#e7cb94", + "#843c39", "#ad494a", "#d6616b", "#e7969c", + "#7b4173", "#a55194", "#ce6dbd", "#de9ed6" +]; + +var d3_category20c = [ + "#3182bd", "#6baed6", "#9ecae1", "#c6dbef", + "#e6550d", "#fd8d3c", "#fdae6b", "#fdd0a2", + "#31a354", "#74c476", "#a1d99b", "#c7e9c0", + "#756bb1", "#9e9ac8", "#bcbddc", "#dadaeb", + "#636363", "#969696", "#bdbdbd", "#d9d9d9" +]; +d3.scale.quantile = function() { + return d3_scale_quantile([], []); +}; + +function d3_scale_quantile(domain, range) { + var thresholds; + + function rescale() { + var k = 0, + n = domain.length, + q = range.length; + thresholds = []; + while (++k < q) thresholds[k - 1] = d3.quantile(domain, k / q); + return scale; + } + + function scale(x) { + if (isNaN(x = +x)) return NaN; + return range[d3.bisect(thresholds, x)]; + } + + scale.domain = function(x) { + if (!arguments.length) return domain; + domain = x.filter(function(d) { return !isNaN(d); }).sort(d3.ascending); + return rescale(); + }; + + scale.range = function(x) { + if (!arguments.length) return range; + range = x; + return rescale(); + }; + + scale.quantiles = function() { + return thresholds; + }; + + scale.copy = function() { + return d3_scale_quantile(domain, range); // copy on write! + }; + + return rescale(); +}; +d3.scale.quantize = function() { + return d3_scale_quantize(0, 1, [0, 1]); +}; + +function d3_scale_quantize(x0, x1, range) { + var kx, i; + + function scale(x) { + return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x0))))]; + } + + function rescale() { + kx = range.length / (x1 - x0); + i = range.length - 1; + return scale; + } + + scale.domain = function(x) { + if (!arguments.length) return [x0, x1]; + x0 = +x[0]; + x1 = +x[x.length - 1]; + return rescale(); + }; + + scale.range = function(x) { + if (!arguments.length) return range; + range = x; + return rescale(); + }; + + scale.copy = function() { + return d3_scale_quantize(x0, x1, range); // copy on write + }; + + return rescale(); +}; +d3.svg = {}; +d3.svg.arc = function() { + var innerRadius = d3_svg_arcInnerRadius, + outerRadius = d3_svg_arcOuterRadius, + startAngle = d3_svg_arcStartAngle, + endAngle = d3_svg_arcEndAngle; + + function arc() { + var r0 = innerRadius.apply(this, arguments), + r1 = outerRadius.apply(this, arguments), + a0 = startAngle.apply(this, arguments) + d3_svg_arcOffset, + a1 = endAngle.apply(this, arguments) + d3_svg_arcOffset, + da = (a1 < a0 && (da = a0, a0 = a1, a1 = da), a1 - a0), + df = da < Math.PI ? "0" : "1", + c0 = Math.cos(a0), + s0 = Math.sin(a0), + c1 = Math.cos(a1), + s1 = Math.sin(a1); + return da >= d3_svg_arcMax + ? (r0 + ? "M0," + r1 + + "A" + r1 + "," + r1 + " 0 1,1 0," + (-r1) + + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 + + "M0," + r0 + + "A" + r0 + "," + r0 + " 0 1,0 0," + (-r0) + + "A" + r0 + "," + r0 + " 0 1,0 0," + r0 + + "Z" + : "M0," + r1 + + "A" + r1 + "," + r1 + " 0 1,1 0," + (-r1) + + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 + + "Z") + : (r0 + ? "M" + r1 * c0 + "," + r1 * s0 + + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1 + + "L" + r0 * c1 + "," + r0 * s1 + + "A" + r0 + "," + r0 + " 0 " + df + ",0 " + r0 * c0 + "," + r0 * s0 + + "Z" + : "M" + r1 * c0 + "," + r1 * s0 + + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1 + + "L0,0" + + "Z"); + } + + arc.innerRadius = function(v) { + if (!arguments.length) return innerRadius; + innerRadius = d3.functor(v); + return arc; + }; + + arc.outerRadius = function(v) { + if (!arguments.length) return outerRadius; + outerRadius = d3.functor(v); + return arc; + }; + + arc.startAngle = function(v) { + if (!arguments.length) return startAngle; + startAngle = d3.functor(v); + return arc; + }; + + arc.endAngle = function(v) { + if (!arguments.length) return endAngle; + endAngle = d3.functor(v); + return arc; + }; + + arc.centroid = function() { + var r = (innerRadius.apply(this, arguments) + + outerRadius.apply(this, arguments)) / 2, + a = (startAngle.apply(this, arguments) + + endAngle.apply(this, arguments)) / 2 + d3_svg_arcOffset; + return [Math.cos(a) * r, Math.sin(a) * r]; + }; + + return arc; +}; + +var d3_svg_arcOffset = -Math.PI / 2, + d3_svg_arcMax = 2 * Math.PI - 1e-6; + +function d3_svg_arcInnerRadius(d) { + return d.innerRadius; +} + +function d3_svg_arcOuterRadius(d) { + return d.outerRadius; +} + +function d3_svg_arcStartAngle(d) { + return d.startAngle; +} + +function d3_svg_arcEndAngle(d) { + return d.endAngle; +} +function d3_svg_line(projection) { + var x = d3_svg_lineX, + y = d3_svg_lineY, + interpolate = "linear", + interpolator = d3_svg_lineInterpolators[interpolate], + tension = .7; + + function line(d) { + return d.length < 1 ? null : "M" + interpolator(projection(d3_svg_linePoints(this, d, x, y)), tension); + } + + line.x = function(v) { + if (!arguments.length) return x; + x = v; + return line; + }; + + line.y = function(v) { + if (!arguments.length) return y; + y = v; + return line; + }; + + line.interpolate = function(v) { + if (!arguments.length) return interpolate; + interpolator = d3_svg_lineInterpolators[interpolate = v]; + return line; + }; + + line.tension = function(v) { + if (!arguments.length) return tension; + tension = v; + return line; + }; + + return line; +} + +d3.svg.line = function() { + return d3_svg_line(Object); +}; + +// Converts the specified array of data into an array of points +// (x-y tuples), by evaluating the specified `x` and `y` functions on each +// data point. The `this` context of the evaluated functions is the specified +// "self" object; each function is passed the current datum and index. +function d3_svg_linePoints(self, d, x, y) { + var points = [], + i = -1, + n = d.length, + fx = typeof x === "function", + fy = typeof y === "function", + value; + if (fx && fy) { + while (++i < n) points.push([ + x.call(self, value = d[i], i), + y.call(self, value, i) + ]); + } else if (fx) { + while (++i < n) points.push([x.call(self, d[i], i), y]); + } else if (fy) { + while (++i < n) points.push([x, y.call(self, d[i], i)]); + } else { + while (++i < n) points.push([x, y]); + } + return points; +} + +// The default `x` property, which references d[0]. +function d3_svg_lineX(d) { + return d[0]; +} + +// The default `y` property, which references d[1]. +function d3_svg_lineY(d) { + return d[1]; +} + +// The various interpolators supported by the `line` class. +var d3_svg_lineInterpolators = { + "linear": d3_svg_lineLinear, + "step-before": d3_svg_lineStepBefore, + "step-after": d3_svg_lineStepAfter, + "basis": d3_svg_lineBasis, + "basis-open": d3_svg_lineBasisOpen, + "basis-closed": d3_svg_lineBasisClosed, + "bundle": d3_svg_lineBundle, + "cardinal": d3_svg_lineCardinal, + "cardinal-open": d3_svg_lineCardinalOpen, + "cardinal-closed": d3_svg_lineCardinalClosed, + "monotone": d3_svg_lineMonotone +}; + +// Linear interpolation; generates "L" commands. +function d3_svg_lineLinear(points) { + var i = 0, + n = points.length, + p = points[0], + path = [p[0], ",", p[1]]; + while (++i < n) path.push("L", (p = points[i])[0], ",", p[1]); + return path.join(""); +} + +// Step interpolation; generates "H" and "V" commands. +function d3_svg_lineStepBefore(points) { + var i = 0, + n = points.length, + p = points[0], + path = [p[0], ",", p[1]]; + while (++i < n) path.push("V", (p = points[i])[1], "H", p[0]); + return path.join(""); +} + +// Step interpolation; generates "H" and "V" commands. +function d3_svg_lineStepAfter(points) { + var i = 0, + n = points.length, + p = points[0], + path = [p[0], ",", p[1]]; + while (++i < n) path.push("H", (p = points[i])[0], "V", p[1]); + return path.join(""); +} + +// Open cardinal spline interpolation; generates "C" commands. +function d3_svg_lineCardinalOpen(points, tension) { + return points.length < 4 + ? d3_svg_lineLinear(points) + : points[1] + d3_svg_lineHermite(points.slice(1, points.length - 1), + d3_svg_lineCardinalTangents(points, tension)); +} + +// Closed cardinal spline interpolation; generates "C" commands. +function d3_svg_lineCardinalClosed(points, tension) { + return points.length < 3 + ? d3_svg_lineLinear(points) + : points[0] + d3_svg_lineHermite((points.push(points[0]), points), + d3_svg_lineCardinalTangents([points[points.length - 2]] + .concat(points, [points[1]]), tension)); +} + +// Cardinal spline interpolation; generates "C" commands. +function d3_svg_lineCardinal(points, tension, closed) { + return points.length < 3 + ? d3_svg_lineLinear(points) + : points[0] + d3_svg_lineHermite(points, + d3_svg_lineCardinalTangents(points, tension)); +} + +// Hermite spline construction; generates "C" commands. +function d3_svg_lineHermite(points, tangents) { + if (tangents.length < 1 + || (points.length != tangents.length + && points.length != tangents.length + 2)) { + return d3_svg_lineLinear(points); + } + + var quad = points.length != tangents.length, + path = "", + p0 = points[0], + p = points[1], + t0 = tangents[0], + t = t0, + pi = 1; + + if (quad) { + path += "Q" + (p[0] - t0[0] * 2 / 3) + "," + (p[1] - t0[1] * 2 / 3) + + "," + p[0] + "," + p[1]; + p0 = points[1]; + pi = 2; + } + + if (tangents.length > 1) { + t = tangents[1]; + p = points[pi]; + pi++; + path += "C" + (p0[0] + t0[0]) + "," + (p0[1] + t0[1]) + + "," + (p[0] - t[0]) + "," + (p[1] - t[1]) + + "," + p[0] + "," + p[1]; + for (var i = 2; i < tangents.length; i++, pi++) { + p = points[pi]; + t = tangents[i]; + path += "S" + (p[0] - t[0]) + "," + (p[1] - t[1]) + + "," + p[0] + "," + p[1]; + } + } + + if (quad) { + var lp = points[pi]; + path += "Q" + (p[0] + t[0] * 2 / 3) + "," + (p[1] + t[1] * 2 / 3) + + "," + lp[0] + "," + lp[1]; + } + + return path; +} + +// Generates tangents for a cardinal spline. +function d3_svg_lineCardinalTangents(points, tension) { + var tangents = [], + a = (1 - tension) / 2, + p0, + p1 = points[0], + p2 = points[1], + i = 1, + n = points.length; + while (++i < n) { + p0 = p1; + p1 = p2; + p2 = points[i]; + tangents.push([a * (p2[0] - p0[0]), a * (p2[1] - p0[1])]); + } + return tangents; +} + +// B-spline interpolation; generates "C" commands. +function d3_svg_lineBasis(points) { + if (points.length < 3) return d3_svg_lineLinear(points); + var i = 1, + n = points.length, + pi = points[0], + x0 = pi[0], + y0 = pi[1], + px = [x0, x0, x0, (pi = points[1])[0]], + py = [y0, y0, y0, pi[1]], + path = [x0, ",", y0]; + d3_svg_lineBasisBezier(path, px, py); + while (++i < n) { + pi = points[i]; + px.shift(); px.push(pi[0]); + py.shift(); py.push(pi[1]); + d3_svg_lineBasisBezier(path, px, py); + } + i = -1; + while (++i < 2) { + px.shift(); px.push(pi[0]); + py.shift(); py.push(pi[1]); + d3_svg_lineBasisBezier(path, px, py); + } + return path.join(""); +} + +// Open B-spline interpolation; generates "C" commands. +function d3_svg_lineBasisOpen(points) { + if (points.length < 4) return d3_svg_lineLinear(points); + var path = [], + i = -1, + n = points.length, + pi, + px = [0], + py = [0]; + while (++i < 3) { + pi = points[i]; + px.push(pi[0]); + py.push(pi[1]); + } + path.push(d3_svg_lineDot4(d3_svg_lineBasisBezier3, px) + + "," + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py)); + --i; while (++i < n) { + pi = points[i]; + px.shift(); px.push(pi[0]); + py.shift(); py.push(pi[1]); + d3_svg_lineBasisBezier(path, px, py); + } + return path.join(""); +} + +// Closed B-spline interpolation; generates "C" commands. +function d3_svg_lineBasisClosed(points) { + var path, + i = -1, + n = points.length, + m = n + 4, + pi, + px = [], + py = []; + while (++i < 4) { + pi = points[i % n]; + px.push(pi[0]); + py.push(pi[1]); + } + path = [ + d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) + ]; + --i; while (++i < m) { + pi = points[i % n]; + px.shift(); px.push(pi[0]); + py.shift(); py.push(pi[1]); + d3_svg_lineBasisBezier(path, px, py); + } + return path.join(""); +} + +function d3_svg_lineBundle(points, tension) { + var n = points.length - 1, + x0 = points[0][0], + y0 = points[0][1], + dx = points[n][0] - x0, + dy = points[n][1] - y0, + i = -1, + p, + t; + while (++i <= n) { + p = points[i]; + t = i / n; + p[0] = tension * p[0] + (1 - tension) * (x0 + t * dx); + p[1] = tension * p[1] + (1 - tension) * (y0 + t * dy); + } + return d3_svg_lineBasis(points); +} + +// Returns the dot product of the given four-element vectors. +function d3_svg_lineDot4(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; +} + +// Matrix to transform basis (b-spline) control points to bezier +// control points. Derived from FvD 11.2.8. +var d3_svg_lineBasisBezier1 = [0, 2/3, 1/3, 0], + d3_svg_lineBasisBezier2 = [0, 1/3, 2/3, 0], + d3_svg_lineBasisBezier3 = [0, 1/6, 2/3, 1/6]; + +// Pushes a "C" Bézier curve onto the specified path array, given the +// two specified four-element arrays which define the control points. +function d3_svg_lineBasisBezier(path, x, y) { + path.push( + "C", d3_svg_lineDot4(d3_svg_lineBasisBezier1, x), + ",", d3_svg_lineDot4(d3_svg_lineBasisBezier1, y), + ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, x), + ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, y), + ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, x), + ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, y)); +} + +// Computes the slope from points p0 to p1. +function d3_svg_lineSlope(p0, p1) { + return (p1[1] - p0[1]) / (p1[0] - p0[0]); +} + +// Compute three-point differences for the given points. +// http://en.wikipedia.org/wiki/Cubic_Hermite_spline#Finite_difference +function d3_svg_lineFiniteDifferences(points) { + var i = 0, + j = points.length - 1, + m = [], + p0 = points[0], + p1 = points[1], + d = m[0] = d3_svg_lineSlope(p0, p1); + while (++i < j) { + m[i] = d + (d = d3_svg_lineSlope(p0 = p1, p1 = points[i + 1])); + } + m[i] = d; + return m; +} + +// Interpolates the given points using Fritsch-Carlson Monotone cubic Hermite +// interpolation. Returns an array of tangent vectors. For details, see +// http://en.wikipedia.org/wiki/Monotone_cubic_interpolation +function d3_svg_lineMonotoneTangents(points) { + var tangents = [], + d, + a, + b, + s, + m = d3_svg_lineFiniteDifferences(points), + i = -1, + j = points.length - 1; + + // The first two steps are done by computing finite-differences: + // 1. Compute the slopes of the secant lines between successive points. + // 2. Initialize the tangents at every point as the average of the secants. + + // Then, for each segment… + while (++i < j) { + d = d3_svg_lineSlope(points[i], points[i + 1]); + + // 3. If two successive yk = y{k + 1} are equal (i.e., d is zero), then set + // mk = m{k + 1} = 0 as the spline connecting these points must be flat to + // preserve monotonicity. Ignore step 4 and 5 for those k. + + if (Math.abs(d) < 1e-6) { + m[i] = m[i + 1] = 0; + } else { + // 4. Let ak = mk / dk and bk = m{k + 1} / dk. + a = m[i] / d; + b = m[i + 1] / d; + + // 5. Prevent overshoot and ensure monotonicity by restricting the + // magnitude of vector <ak, bk> to a circle of radius 3. + s = a * a + b * b; + if (s > 9) { + s = d * 3 / Math.sqrt(s); + m[i] = s * a; + m[i + 1] = s * b; + } + } + } + + // Compute the normalized tangent vector from the slopes. Note that if x is + // not monotonic, it's possible that the slope will be infinite, so we protect + // against NaN by setting the coordinate to zero. + i = -1; while (++i <= j) { + s = (points[Math.min(j, i + 1)][0] - points[Math.max(0, i - 1)][0]) + / (6 * (1 + m[i] * m[i])); + tangents.push([s || 0, m[i] * s || 0]); + } + + return tangents; +} + +function d3_svg_lineMonotone(points) { + return points.length < 3 + ? d3_svg_lineLinear(points) + : points[0] + + d3_svg_lineHermite(points, d3_svg_lineMonotoneTangents(points)); +} +d3.svg.line.radial = function() { + var line = d3_svg_line(d3_svg_lineRadial); + line.radius = line.x, delete line.x; + line.angle = line.y, delete line.y; + return line; +}; + +function d3_svg_lineRadial(points) { + var point, + i = -1, + n = points.length, + r, + a; + while (++i < n) { + point = points[i]; + r = point[0]; + a = point[1] + d3_svg_arcOffset; + point[0] = r * Math.cos(a); + point[1] = r * Math.sin(a); + } + return points; +} +function d3_svg_area(projection) { + var x0 = d3_svg_lineX, + x1 = d3_svg_lineX, + y0 = 0, + y1 = d3_svg_lineY, + interpolate, + i0, + i1, + tension = .7; + + function area(d) { + if (d.length < 1) return null; + var points0 = d3_svg_linePoints(this, d, x0, y0), + points1 = d3_svg_linePoints(this, d, x0 === x1 ? d3_svg_areaX(points0) : x1, y0 === y1 ? d3_svg_areaY(points0) : y1); + return "M" + i0(projection(points1), tension) + + "L" + i1(projection(points0.reverse()), tension) + + "Z"; + } + + area.x = function(x) { + if (!arguments.length) return x1; + x0 = x1 = x; + return area; + }; + + area.x0 = function(x) { + if (!arguments.length) return x0; + x0 = x; + return area; + }; + + area.x1 = function(x) { + if (!arguments.length) return x1; + x1 = x; + return area; + }; + + area.y = function(y) { + if (!arguments.length) return y1; + y0 = y1 = y; + return area; + }; + + area.y0 = function(y) { + if (!arguments.length) return y0; + y0 = y; + return area; + }; + + area.y1 = function(y) { + if (!arguments.length) return y1; + y1 = y; + return area; + }; + + area.interpolate = function(x) { + if (!arguments.length) return interpolate; + i0 = d3_svg_lineInterpolators[interpolate = x]; + i1 = i0.reverse || i0; + return area; + }; + + area.tension = function(x) { + if (!arguments.length) return tension; + tension = x; + return area; + }; + + return area.interpolate("linear"); +} + +d3_svg_lineStepBefore.reverse = d3_svg_lineStepAfter; +d3_svg_lineStepAfter.reverse = d3_svg_lineStepBefore; + +d3.svg.area = function() { + return d3_svg_area(Object); +}; + +function d3_svg_areaX(points) { + return function(d, i) { + return points[i][0]; + }; +} + +function d3_svg_areaY(points) { + return function(d, i) { + return points[i][1]; + }; +} +d3.svg.area.radial = function() { + var area = d3_svg_area(d3_svg_lineRadial); + area.radius = area.x, delete area.x; + area.innerRadius = area.x0, delete area.x0; + area.outerRadius = area.x1, delete area.x1; + area.angle = area.y, delete area.y; + area.startAngle = area.y0, delete area.y0; + area.endAngle = area.y1, delete area.y1; + return area; +}; +d3.svg.chord = function() { + var source = d3_svg_chordSource, + target = d3_svg_chordTarget, + radius = d3_svg_chordRadius, + startAngle = d3_svg_arcStartAngle, + endAngle = d3_svg_arcEndAngle; + + // TODO Allow control point to be customized. + + function chord(d, i) { + var s = subgroup(this, source, d, i), + t = subgroup(this, target, d, i); + return "M" + s.p0 + + arc(s.r, s.p1, s.a1 - s.a0) + (equals(s, t) + ? curve(s.r, s.p1, s.r, s.p0) + : curve(s.r, s.p1, t.r, t.p0) + + arc(t.r, t.p1, t.a1 - t.a0) + + curve(t.r, t.p1, s.r, s.p0)) + + "Z"; + } + + function subgroup(self, f, d, i) { + var subgroup = f.call(self, d, i), + r = radius.call(self, subgroup, i), + a0 = startAngle.call(self, subgroup, i) + d3_svg_arcOffset, + a1 = endAngle.call(self, subgroup, i) + d3_svg_arcOffset; + return { + r: r, + a0: a0, + a1: a1, + p0: [r * Math.cos(a0), r * Math.sin(a0)], + p1: [r * Math.cos(a1), r * Math.sin(a1)] + }; + } + + function equals(a, b) { + return a.a0 == b.a0 && a.a1 == b.a1; + } + + function arc(r, p, a) { + return "A" + r + "," + r + " 0 " + +(a > Math.PI) + ",1 " + p; + } + + function curve(r0, p0, r1, p1) { + return "Q 0,0 " + p1; + } + + chord.radius = function(v) { + if (!arguments.length) return radius; + radius = d3.functor(v); + return chord; + }; + + chord.source = function(v) { + if (!arguments.length) return source; + source = d3.functor(v); + return chord; + }; + + chord.target = function(v) { + if (!arguments.length) return target; + target = d3.functor(v); + return chord; + }; + + chord.startAngle = function(v) { + if (!arguments.length) return startAngle; + startAngle = d3.functor(v); + return chord; + }; + + chord.endAngle = function(v) { + if (!arguments.length) return endAngle; + endAngle = d3.functor(v); + return chord; + }; + + return chord; +}; + +function d3_svg_chordSource(d) { + return d.source; +} + +function d3_svg_chordTarget(d) { + return d.target; +} + +function d3_svg_chordRadius(d) { + return d.radius; +} + +function d3_svg_chordStartAngle(d) { + return d.startAngle; +} + +function d3_svg_chordEndAngle(d) { + return d.endAngle; +} +d3.svg.diagonal = function() { + var source = d3_svg_chordSource, + target = d3_svg_chordTarget, + projection = d3_svg_diagonalProjection; + + function diagonal(d, i) { + var p0 = source.call(this, d, i), + p3 = target.call(this, d, i), + m = (p0.y + p3.y) / 2, + p = [p0, {x: p0.x, y: m}, {x: p3.x, y: m}, p3]; + p = p.map(projection); + return "M" + p[0] + "C" + p[1] + " " + p[2] + " " + p[3]; + } + + diagonal.source = function(x) { + if (!arguments.length) return source; + source = d3.functor(x); + return diagonal; + }; + + diagonal.target = function(x) { + if (!arguments.length) return target; + target = d3.functor(x); + return diagonal; + }; + + diagonal.projection = function(x) { + if (!arguments.length) return projection; + projection = x; + return diagonal; + }; + + return diagonal; +}; + +function d3_svg_diagonalProjection(d) { + return [d.x, d.y]; +} +d3.svg.diagonal.radial = function() { + var diagonal = d3.svg.diagonal(), + projection = d3_svg_diagonalProjection, + projection_ = diagonal.projection; + + diagonal.projection = function(x) { + return arguments.length + ? projection_(d3_svg_diagonalRadialProjection(projection = x)) + : projection; + }; + + return diagonal; +}; + +function d3_svg_diagonalRadialProjection(projection) { + return function() { + var d = projection.apply(this, arguments), + r = d[0], + a = d[1] + d3_svg_arcOffset; + return [r * Math.cos(a), r * Math.sin(a)]; + }; +} +d3.svg.mouse = function(container) { + return d3_svg_mousePoint(container, d3.event); +}; + +// https://bugs.webkit.org/show_bug.cgi?id=44083 +var d3_mouse_bug44083 = /WebKit/.test(navigator.userAgent) ? -1 : 0; + +function d3_svg_mousePoint(container, e) { + var point = (container.ownerSVGElement || container).createSVGPoint(); + if ((d3_mouse_bug44083 < 0) && (window.scrollX || window.scrollY)) { + var svg = d3.select(document.body) + .append("svg") + .style("position", "absolute") + .style("top", 0) + .style("left", 0); + var ctm = svg[0][0].getScreenCTM(); + d3_mouse_bug44083 = !(ctm.f || ctm.e); + svg.remove(); + } + if (d3_mouse_bug44083) { + point.x = e.pageX; + point.y = e.pageY; + } else { + point.x = e.clientX; + point.y = e.clientY; + } + point = point.matrixTransform(container.getScreenCTM().inverse()); + return [point.x, point.y]; +}; +d3.svg.touches = function(container, touches) { + if (arguments.length < 2) touches = d3.event.touches; + + return touches ? d3_array(touches).map(function(touch) { + var point = d3_svg_mousePoint(container, touch); + point.identifier = touch.identifier; + return point; + }) : []; +}; +d3.svg.symbol = function() { + var type = d3_svg_symbolType, + size = d3_svg_symbolSize; + + function symbol(d, i) { + return (d3_svg_symbols[type.call(this, d, i)] + || d3_svg_symbols.circle) + (size.call(this, d, i)); + } + + symbol.type = function(x) { + if (!arguments.length) return type; + type = d3.functor(x); + return symbol; + }; + + // size of symbol in square pixels + symbol.size = function(x) { + if (!arguments.length) return size; + size = d3.functor(x); + return symbol; + }; + + return symbol; +}; + +function d3_svg_symbolSize() { + return 64; +} + +function d3_svg_symbolType() { + return "circle"; +} + +// TODO cross-diagonal? +var d3_svg_symbols = { + "circle": function(size) { + var r = Math.sqrt(size / Math.PI); + return "M0," + r + + "A" + r + "," + r + " 0 1,1 0," + (-r) + + "A" + r + "," + r + " 0 1,1 0," + r + + "Z"; + }, + "cross": function(size) { + var r = Math.sqrt(size / 5) / 2; + return "M" + -3 * r + "," + -r + + "H" + -r + + "V" + -3 * r + + "H" + r + + "V" + -r + + "H" + 3 * r + + "V" + r + + "H" + r + + "V" + 3 * r + + "H" + -r + + "V" + r + + "H" + -3 * r + + "Z"; + }, + "diamond": function(size) { + var ry = Math.sqrt(size / (2 * d3_svg_symbolTan30)), + rx = ry * d3_svg_symbolTan30; + return "M0," + -ry + + "L" + rx + ",0" + + " 0," + ry + + " " + -rx + ",0" + + "Z"; + }, + "square": function(size) { + var r = Math.sqrt(size) / 2; + return "M" + -r + "," + -r + + "L" + r + "," + -r + + " " + r + "," + r + + " " + -r + "," + r + + "Z"; + }, + "triangle-down": function(size) { + var rx = Math.sqrt(size / d3_svg_symbolSqrt3), + ry = rx * d3_svg_symbolSqrt3 / 2; + return "M0," + ry + + "L" + rx +"," + -ry + + " " + -rx + "," + -ry + + "Z"; + }, + "triangle-up": function(size) { + var rx = Math.sqrt(size / d3_svg_symbolSqrt3), + ry = rx * d3_svg_symbolSqrt3 / 2; + return "M0," + -ry + + "L" + rx +"," + ry + + " " + -rx + "," + ry + + "Z"; + } +}; + +d3.svg.symbolTypes = d3.keys(d3_svg_symbols); + +var d3_svg_symbolSqrt3 = Math.sqrt(3), + d3_svg_symbolTan30 = Math.tan(30 * Math.PI / 180); +d3.svg.axis = function() { + var scale = d3.scale.linear(), + orient = "bottom", + tickMajorSize = 6, + tickMinorSize = 6, + tickEndSize = 6, + tickPadding = 3, + tickArguments_ = [10], + tickFormat_, + tickSubdivide = 0; + + function axis(selection) { + selection.each(function(d, i, j) { + var g = d3.select(this); + + // If selection is a transition, create subtransitions. + var transition = selection.delay ? function(o) { + var id = d3_transitionInheritId; + try { + d3_transitionInheritId = selection.id; + return o.transition() + .delay(selection[j][i].delay) + .duration(selection[j][i].duration) + .ease(selection.ease()); + } finally { + d3_transitionInheritId = id; + } + } : Object; + + // Ticks, or domain values for ordinal scales. + var ticks = scale.ticks ? scale.ticks.apply(scale, tickArguments_) : scale.domain(), + tickFormat = tickFormat_ == null ? (scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments_) : String) : tickFormat_; + + // Minor ticks. + var subticks = d3_svg_axisSubdivide(scale, ticks, tickSubdivide), + subtick = g.selectAll(".minor").data(subticks, String), + subtickEnter = subtick.enter().insert("line", "g").attr("class", "tick minor").style("opacity", 1e-6), + subtickExit = transition(subtick.exit()).style("opacity", 1e-6).remove(), + subtickUpdate = transition(subtick).style("opacity", 1); + + // Major ticks. + var tick = g.selectAll("g").data(ticks, String), + tickEnter = tick.enter().insert("g", "path").style("opacity", 1e-6), + tickExit = transition(tick.exit()).style("opacity", 1e-6).remove(), + tickUpdate = transition(tick).style("opacity", 1), + tickTransform; + + // Domain. + var range = d3_scaleRange(scale), + path = g.selectAll(".domain").data([0]), + pathEnter = path.enter().append("path").attr("class", "domain"), + pathUpdate = transition(path); + + // Stash a snapshot of the new scale, and retrieve the old snapshot. + var scale1 = scale.copy(), + scale0 = this.__chart__ || scale1; + this.__chart__ = scale1; + + tickEnter.append("line").attr("class", "tick"); + tickEnter.append("text"); + tickUpdate.select("text").text(tickFormat); + + switch (orient) { + case "bottom": { + tickTransform = d3_svg_axisX; + subtickUpdate.attr("x2", 0).attr("y2", tickMinorSize); + tickUpdate.select("line").attr("x2", 0).attr("y2", tickMajorSize); + tickUpdate.select("text").attr("x", 0).attr("y", Math.max(tickMajorSize, 0) + tickPadding).attr("dy", ".71em").attr("text-anchor", "middle"); + pathUpdate.attr("d", "M" + range[0] + "," + tickEndSize + "V0H" + range[1] + "V" + tickEndSize); + break; + } + case "top": { + tickTransform = d3_svg_axisX; + subtickUpdate.attr("x2", 0).attr("y2", -tickMinorSize); + tickUpdate.select("line").attr("x2", 0).attr("y2", -tickMajorSize); + tickUpdate.select("text").attr("x", 0).attr("y", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("dy", "0em").attr("text-anchor", "middle"); + pathUpdate.attr("d", "M" + range[0] + "," + -tickEndSize + "V0H" + range[1] + "V" + -tickEndSize); + break; + } + case "left": { + tickTransform = d3_svg_axisY; + subtickUpdate.attr("x2", -tickMinorSize).attr("y2", 0); + tickUpdate.select("line").attr("x2", -tickMajorSize).attr("y2", 0); + tickUpdate.select("text").attr("x", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("y", 0).attr("dy", ".32em").attr("text-anchor", "end"); + pathUpdate.attr("d", "M" + -tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + -tickEndSize); + break; + } + case "right": { + tickTransform = d3_svg_axisY; + subtickUpdate.attr("x2", tickMinorSize).attr("y2", 0); + tickUpdate.select("line").attr("x2", tickMajorSize).attr("y2", 0); + tickUpdate.select("text").attr("x", Math.max(tickMajorSize, 0) + tickPadding).attr("y", 0).attr("dy", ".32em").attr("text-anchor", "start"); + pathUpdate.attr("d", "M" + tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + tickEndSize); + break; + } + } + + // For quantitative scales: + // - enter new ticks from the old scale + // - exit old ticks to the new scale + if (scale.ticks) { + tickEnter.call(tickTransform, scale0); + tickUpdate.call(tickTransform, scale1); + tickExit.call(tickTransform, scale1); + subtickEnter.call(tickTransform, scale0); + subtickUpdate.call(tickTransform, scale1); + subtickExit.call(tickTransform, scale1); + } + + // For ordinal scales: + // - any entering ticks are undefined in the old scale + // - any exiting ticks are undefined in the new scale + // Therefore, we only need to transition updating ticks. + else { + var dx = scale1.rangeBand() / 2, x = function(d) { return scale1(d) + dx; }; + tickEnter.call(tickTransform, x); + tickUpdate.call(tickTransform, x); + } + }); + } + + axis.scale = function(x) { + if (!arguments.length) return scale; + scale = x; + return axis; + }; + + axis.orient = function(x) { + if (!arguments.length) return orient; + orient = x; + return axis; + }; + + axis.ticks = function() { + if (!arguments.length) return tickArguments_; + tickArguments_ = arguments; + return axis; + }; + + axis.tickFormat = function(x) { + if (!arguments.length) return tickFormat_; + tickFormat_ = x; + return axis; + }; + + axis.tickSize = function(x, y, z) { + if (!arguments.length) return tickMajorSize; + var n = arguments.length - 1; + tickMajorSize = +x; + tickMinorSize = n > 1 ? +y : tickMajorSize; + tickEndSize = n > 0 ? +arguments[n] : tickMajorSize; + return axis; + }; + + axis.tickPadding = function(x) { + if (!arguments.length) return tickPadding; + tickPadding = +x; + return axis; + }; + + axis.tickSubdivide = function(x) { + if (!arguments.length) return tickSubdivide; + tickSubdivide = +x; + return axis; + }; + + return axis; +}; + +function d3_svg_axisX(selection, x) { + selection.attr("transform", function(d) { return "translate(" + x(d) + ",0)"; }); +} + +function d3_svg_axisY(selection, y) { + selection.attr("transform", function(d) { return "translate(0," + y(d) + ")"; }); +} + +function d3_svg_axisSubdivide(scale, ticks, m) { + subticks = []; + if (m && ticks.length > 1) { + var extent = d3_scaleExtent(scale.domain()), + subticks, + i = -1, + n = ticks.length, + d = (ticks[1] - ticks[0]) / ++m, + j, + v; + while (++i < n) { + for (j = m; --j > 0;) { + if ((v = +ticks[i] - j * d) >= extent[0]) { + subticks.push(v); + } + } + } + for (--i, j = 0; ++j < m && (v = +ticks[i] + j * d) < extent[1];) { + subticks.push(v); + } + } + return subticks; +} +d3.svg.brush = function() { + var event = d3.dispatch("brushstart", "brush", "brushend"), + x, // x-scale, optional + y, // y-scale, optional + extent = [[0, 0], [0, 0]]; // [x0, y0], [x1, y1] + + function brush(g) { + var resizes = x && y ? ["n", "e", "s", "w", "nw", "ne", "se", "sw"] + : x ? ["e", "w"] + : y ? ["n", "s"] + : []; + + g.each(function() { + var g = d3.select(this).on("mousedown.brush", down), + bg = g.selectAll(".background").data([,]), + fg = g.selectAll(".extent").data([,]), + tz = g.selectAll(".resize").data(resizes, String), + e; + + // An invisible, mouseable area for starting a new brush. + bg.enter().append("rect") + .attr("class", "background") + .style("visibility", "hidden") + .style("pointer-events", "all") + .style("cursor", "crosshair"); + + // The visible brush extent; style this as you like! + fg.enter().append("rect") + .attr("class", "extent") + .style("cursor", "move"); + + // More invisible rects for resizing the extent. + tz.enter().append("rect") + .attr("class", function(d) { return "resize " + d; }) + .attr("width", 6) + .attr("height", 6) + .style("visibility", "hidden") + .style("pointer-events", brush.empty() ? "none" : "all") + .style("cursor", function(d) { return d3_svg_brushCursor[d]; }); + + // Remove any superfluous resizers. + tz.exit().remove(); + + // Initialize the background to fill the defined range. + // If the range isn't defined, you can post-process. + if (x) { + e = d3_scaleRange(x); + bg.attr("x", e[0]).attr("width", e[1] - e[0]); + d3_svg_brushRedrawX(g, extent); + } + if (y) { + e = d3_scaleRange(y); + bg.attr("y", e[0]).attr("height", e[1] - e[0]); + d3_svg_brushRedrawY(g, extent); + } + }); + } + + function down() { + var target = d3.select(d3.event.target); + + // Store some global state for the duration of the brush gesture. + d3_svg_brush = brush; + d3_svg_brushTarget = this; + d3_svg_brushExtent = extent; + d3_svg_brushOffset = d3.svg.mouse(d3_svg_brushTarget); + + // If the extent was clicked on, drag rather than brush; + // store the offset between the mouse and extent origin instead. + if (d3_svg_brushDrag = target.classed("extent")) { + d3_svg_brushOffset[0] = extent[0][0] - d3_svg_brushOffset[0]; + d3_svg_brushOffset[1] = extent[0][1] - d3_svg_brushOffset[1]; + } + + // If a resizer was clicked on, record which side is to be resized. + // Also, set the offset to the opposite side. + else if (target.classed("resize")) { + d3_svg_brushResize = d3.event.target.__data__; + d3_svg_brushOffset[0] = extent[+/w$/.test(d3_svg_brushResize)][0]; + d3_svg_brushOffset[1] = extent[+/^n/.test(d3_svg_brushResize)][1]; + } + + // If the ALT key is down when starting a brush, the center is at the mouse. + else if (d3.event.altKey) { + d3_svg_brushCenter = d3_svg_brushOffset.slice(); + } + + // Restrict which dimensions are resized. + d3_svg_brushX = !/^(n|s)$/.test(d3_svg_brushResize) && x; + d3_svg_brushY = !/^(e|w)$/.test(d3_svg_brushResize) && y; + + // Notify listeners. + d3_svg_brushDispatch = dispatcher(this, arguments); + d3_svg_brushDispatch("brushstart"); + d3_svg_brushMove(); + d3_eventCancel(); + } + + function dispatcher(that, argumentz) { + return function(type) { + var e = d3.event; + try { + d3.event = {type: type, target: brush}; + event[type].apply(that, argumentz); + } finally { + d3.event = e; + } + }; + } + + brush.x = function(z) { + if (!arguments.length) return x; + x = z; + return brush; + }; + + brush.y = function(z) { + if (!arguments.length) return y; + y = z; + return brush; + }; + + brush.extent = function(z) { + var x0, x1, y0, y1, t; + + // Invert the pixel extent to data-space. + if (!arguments.length) { + if (x) { + x0 = extent[0][0], x1 = extent[1][0]; + if (x.invert) x0 = x.invert(x0), x1 = x.invert(x1); + if (x1 < x0) t = x0, x0 = x1, x1 = t; + } + if (y) { + y0 = extent[0][1], y1 = extent[1][1]; + if (y.invert) y0 = y.invert(y0), y1 = y.invert(y1); + if (y1 < y0) t = y0, y0 = y1, y1 = t; + } + return x && y ? [[x0, y0], [x1, y1]] : x ? [x0, x1] : y && [y0, y1]; + } + + // Scale the data-space extent to pixels. + if (x) { + x0 = z[0], x1 = z[1]; + if (y) x0 = x0[0], x1 = x1[0]; + if (x.invert) x0 = x(x0), x1 = x(x1); + if (x1 < x0) t = x0, x0 = x1, x1 = t; + extent[0][0] = x0, extent[1][0] = x1; + } + if (y) { + y0 = z[0], y1 = z[1]; + if (x) y0 = y0[1], y1 = y1[1]; + if (y.invert) y0 = y(y0), y1 = y(y1); + if (y1 < y0) t = y0, y0 = y1, y1 = t; + extent[0][1] = y0, extent[1][1] = y1; + } + + return brush; + }; + + brush.clear = function() { + extent[0][0] = + extent[0][1] = + extent[1][0] = + extent[1][1] = 0; + return brush; + }; + + brush.empty = function() { + return (x && extent[0][0] === extent[1][0]) + || (y && extent[0][1] === extent[1][1]); + }; + + d3.select(window) + .on("mousemove.brush", d3_svg_brushMove) + .on("mouseup.brush", d3_svg_brushUp) + .on("keydown.brush", d3_svg_brushKeydown) + .on("keyup.brush", d3_svg_brushKeyup); + + return d3.rebind(brush, event, "on"); +}; + +var d3_svg_brush, + d3_svg_brushDispatch, + d3_svg_brushTarget, + d3_svg_brushX, + d3_svg_brushY, + d3_svg_brushExtent, + d3_svg_brushDrag, + d3_svg_brushResize, + d3_svg_brushCenter, + d3_svg_brushOffset; + +function d3_svg_brushRedrawX(g, extent) { + g.select(".extent").attr("x", extent[0][0]); + g.selectAll(".n,.s,.w,.nw,.sw").attr("x", extent[0][0] - 2); + g.selectAll(".e,.ne,.se").attr("x", extent[1][0] - 3); + g.selectAll(".extent,.n,.s").attr("width", extent[1][0] - extent[0][0]); +} + +function d3_svg_brushRedrawY(g, extent) { + g.select(".extent").attr("y", extent[0][1]); + g.selectAll(".n,.e,.w,.nw,.ne").attr("y", extent[0][1] - 3); + g.selectAll(".s,.se,.sw").attr("y", extent[1][1] - 4); + g.selectAll(".extent,.e,.w").attr("height", extent[1][1] - extent[0][1]); +} + +function d3_svg_brushKeydown() { + if (d3.event.keyCode == 32 && d3_svg_brushTarget && !d3_svg_brushDrag) { + d3_svg_brushCenter = null; + d3_svg_brushOffset[0] -= d3_svg_brushExtent[1][0]; + d3_svg_brushOffset[1] -= d3_svg_brushExtent[1][1]; + d3_svg_brushDrag = 2; + d3_eventCancel(); + } +} + +function d3_svg_brushKeyup() { + if (d3.event.keyCode == 32 && d3_svg_brushDrag == 2) { + d3_svg_brushOffset[0] += d3_svg_brushExtent[1][0]; + d3_svg_brushOffset[1] += d3_svg_brushExtent[1][1]; + d3_svg_brushDrag = 0; + d3_eventCancel(); + } +} + +function d3_svg_brushMove() { + if (d3_svg_brushOffset) { + var mouse = d3.svg.mouse(d3_svg_brushTarget), + g = d3.select(d3_svg_brushTarget); + + if (!d3_svg_brushDrag) { + + // If needed, determine the center from the current extent. + if (d3.event.altKey) { + if (!d3_svg_brushCenter) { + d3_svg_brushCenter = [ + (d3_svg_brushExtent[0][0] + d3_svg_brushExtent[1][0]) / 2, + (d3_svg_brushExtent[0][1] + d3_svg_brushExtent[1][1]) / 2 + ]; + } + + // Update the offset, for when the ALT key is released. + d3_svg_brushOffset[0] = d3_svg_brushExtent[+(mouse[0] < d3_svg_brushCenter[0])][0]; + d3_svg_brushOffset[1] = d3_svg_brushExtent[+(mouse[1] < d3_svg_brushCenter[1])][1]; + } + + // When the ALT key is released, we clear the center. + else d3_svg_brushCenter = null; + } + + // Update the brush extent for each dimension. + if (d3_svg_brushX) { + d3_svg_brushMove1(mouse, d3_svg_brushX, 0); + d3_svg_brushRedrawX(g, d3_svg_brushExtent); + } + if (d3_svg_brushY) { + d3_svg_brushMove1(mouse, d3_svg_brushY, 1); + d3_svg_brushRedrawY(g, d3_svg_brushExtent); + } + + // Notify listeners. + d3_svg_brushDispatch("brush"); + } +} + +function d3_svg_brushMove1(mouse, scale, i) { + var range = d3_scaleRange(scale), + r0 = range[0], + r1 = range[1], + offset = d3_svg_brushOffset[i], + size = d3_svg_brushExtent[1][i] - d3_svg_brushExtent[0][i], + min, + max; + + // When dragging, reduce the range by the extent size and offset. + if (d3_svg_brushDrag) { + r0 -= offset; + r1 -= size + offset; + } + + // Clamp the mouse so that the extent fits within the range extent. + min = Math.max(r0, Math.min(r1, mouse[i])); + + // Compute the new extent bounds. + if (d3_svg_brushDrag) { + max = (min += offset) + size; + } else { + + // If the ALT key is pressed, then preserve the center of the extent. + if (d3_svg_brushCenter) offset = Math.max(r0, Math.min(r1, 2 * d3_svg_brushCenter[i] - min)); + + // Compute the min and max of the offset and mouse. + if (offset < min) { + max = min; + min = offset; + } else { + max = offset; + } + } + + // Update the stored bounds. + d3_svg_brushExtent[0][i] = min; + d3_svg_brushExtent[1][i] = max; +} + +function d3_svg_brushUp() { + if (d3_svg_brushOffset) { + d3_svg_brushMove(); + d3.select(d3_svg_brushTarget).selectAll(".resize").style("pointer-events", d3_svg_brush.empty() ? "none" : "all"); + d3_svg_brushDispatch("brushend"); + d3_svg_brush = + d3_svg_brushDispatch = + d3_svg_brushTarget = + d3_svg_brushX = + d3_svg_brushY = + d3_svg_brushExtent = + d3_svg_brushDrag = + d3_svg_brushResize = + d3_svg_brushCenter = + d3_svg_brushOffset = null; + d3_eventCancel(); + } +} + +var d3_svg_brushCursor = { + n: "ns-resize", + e: "ew-resize", + s: "ns-resize", + w: "ew-resize", + nw: "nwse-resize", + ne: "nesw-resize", + se: "nwse-resize", + sw: "nesw-resize" +}; +d3.behavior = {}; +// TODO Track touch points by identifier. + +d3.behavior.drag = function() { + var event = d3.dispatch("drag", "dragstart", "dragend"), + origin = null; + + function drag() { + this + .on("mousedown.drag", mousedown) + .on("touchstart.drag", mousedown); + + d3.select(window) + .on("mousemove.drag", d3_behavior_dragMove) + .on("touchmove.drag", d3_behavior_dragMove) + .on("mouseup.drag", d3_behavior_dragUp, true) + .on("touchend.drag", d3_behavior_dragUp, true) + .on("click.drag", d3_behavior_dragClick, true); + } + + // snapshot the local context for subsequent dispatch + function start() { + d3_behavior_dragEvent = event; + d3_behavior_dragEventTarget = d3.event.target; + d3_behavior_dragTarget = this; + d3_behavior_dragArguments = arguments; + d3_behavior_dragOrigin = d3_behavior_dragPoint(); + if (origin) { + d3_behavior_dragOffset = origin.apply(d3_behavior_dragTarget, d3_behavior_dragArguments); + d3_behavior_dragOffset = [d3_behavior_dragOffset.x - d3_behavior_dragOrigin[0], d3_behavior_dragOffset.y - d3_behavior_dragOrigin[1]]; + } else { + d3_behavior_dragOffset = [0, 0]; + } + d3_behavior_dragMoved = 0; + } + + function mousedown() { + start.apply(this, arguments); + d3_behavior_dragDispatch("dragstart"); + } + + drag.origin = function(x) { + if (!arguments.length) return origin; + origin = x; + return drag; + }; + + return d3.rebind(drag, event, "on"); +}; + +var d3_behavior_dragEvent, + d3_behavior_dragEventTarget, + d3_behavior_dragTarget, + d3_behavior_dragArguments, + d3_behavior_dragOffset, + d3_behavior_dragOrigin, + d3_behavior_dragMoved; + +function d3_behavior_dragDispatch(type) { + var p = d3_behavior_dragPoint(), + o = d3.event, + e = d3.event = {type: type}; + + if (p) { + e.x = p[0] + d3_behavior_dragOffset[0]; + e.y = p[1] + d3_behavior_dragOffset[1]; + e.dx = p[0] - d3_behavior_dragOrigin[0]; + e.dy = p[1] - d3_behavior_dragOrigin[1]; + d3_behavior_dragMoved |= e.dx | e.dy; + d3_behavior_dragOrigin = p; + } + + try { + d3_behavior_dragEvent[type].apply(d3_behavior_dragTarget, d3_behavior_dragArguments); + } finally { + d3.event = o; + } + + o.stopPropagation(); + o.preventDefault(); +} + +function d3_behavior_dragPoint() { + var p = d3_behavior_dragTarget.parentNode, + t = d3.event.changedTouches; + return p && (t + ? d3.svg.touches(p, t)[0] + : d3.svg.mouse(p)); +} + +function d3_behavior_dragMove() { + if (!d3_behavior_dragTarget) return; + var parent = d3_behavior_dragTarget.parentNode; + + // O NOES! The drag element was removed from the DOM. + if (!parent) return d3_behavior_dragUp(); + + d3_behavior_dragDispatch("drag"); + d3_eventCancel(); +} + +function d3_behavior_dragUp() { + if (!d3_behavior_dragTarget) return; + d3_behavior_dragDispatch("dragend"); + + // If the node was moved, prevent the mouseup from propagating. + // Also prevent the subsequent click from propagating (e.g., for anchors). + if (d3_behavior_dragMoved) { + d3_eventCancel(); + d3_behavior_dragMoved = d3.event.target === d3_behavior_dragEventTarget; + } + + d3_behavior_dragEvent = + d3_behavior_dragEventTarget = + d3_behavior_dragTarget = + d3_behavior_dragArguments = + d3_behavior_dragOffset = + d3_behavior_dragOrigin = null; +} + +function d3_behavior_dragClick() { + if (d3_behavior_dragMoved) { + d3_eventCancel(); + d3_behavior_dragMoved = 0; + } +} +// TODO unbind zoom behavior? +d3.behavior.zoom = function() { + var xyz = [0, 0, 0], + event = d3.dispatch("zoom"), + extent = d3_behavior_zoomInfiniteExtent; + + function zoom() { + this + .on("mousedown.zoom", mousedown) + .on("mousewheel.zoom", mousewheel) + .on("DOMMouseScroll.zoom", mousewheel) + .on("dblclick.zoom", dblclick) + .on("touchstart.zoom", touchstart); + + d3.select(window) + .on("mousemove.zoom", d3_behavior_zoomMousemove) + .on("mouseup.zoom", d3_behavior_zoomMouseup) + .on("touchmove.zoom", d3_behavior_zoomTouchmove) + .on("touchend.zoom", d3_behavior_zoomTouchup) + .on("click.zoom", d3_behavior_zoomClick, true); + } + + // snapshot the local context for subsequent dispatch + function start() { + d3_behavior_zoomXyz = xyz; + d3_behavior_zoomExtent = extent; + d3_behavior_zoomDispatch = event.zoom; + d3_behavior_zoomEventTarget = d3.event.target; + d3_behavior_zoomTarget = this; + d3_behavior_zoomArguments = arguments; + } + + function mousedown() { + start.apply(this, arguments); + d3_behavior_zoomPanning = d3_behavior_zoomLocation(d3.svg.mouse(d3_behavior_zoomTarget)); + d3_behavior_zoomMoved = 0; + d3.event.preventDefault(); + window.focus(); + } + + // store starting mouse location + function mousewheel() { + start.apply(this, arguments); + if (!d3_behavior_zoomZooming) d3_behavior_zoomZooming = d3_behavior_zoomLocation(d3.svg.mouse(d3_behavior_zoomTarget)); + d3_behavior_zoomTo(d3_behavior_zoomDelta() + xyz[2], d3.svg.mouse(d3_behavior_zoomTarget), d3_behavior_zoomZooming); + } + + function dblclick() { + start.apply(this, arguments); + var mouse = d3.svg.mouse(d3_behavior_zoomTarget); + d3_behavior_zoomTo(d3.event.shiftKey ? Math.ceil(xyz[2] - 1) : Math.floor(xyz[2] + 1), mouse, d3_behavior_zoomLocation(mouse)); + } + + // doubletap detection + function touchstart() { + start.apply(this, arguments); + var touches = d3_behavior_zoomTouchup(), + touch, + now = Date.now(); + if ((touches.length === 1) && (now - d3_behavior_zoomLast < 300)) { + d3_behavior_zoomTo(1 + Math.floor(xyz[2]), touch = touches[0], d3_behavior_zoomLocations[touch.identifier]); + } + d3_behavior_zoomLast = now; + } + + zoom.extent = function(x) { + if (!arguments.length) return extent; + extent = x == null ? d3_behavior_zoomInfiniteExtent : x; + return zoom; + }; + + return d3.rebind(zoom, event, "on"); +}; + +var d3_behavior_zoomDiv, + d3_behavior_zoomPanning, + d3_behavior_zoomZooming, + d3_behavior_zoomLocations = {}, // identifier -> location + d3_behavior_zoomLast = 0, + d3_behavior_zoomXyz, + d3_behavior_zoomExtent, + d3_behavior_zoomDispatch, + d3_behavior_zoomEventTarget, + d3_behavior_zoomTarget, + d3_behavior_zoomArguments, + d3_behavior_zoomMoved; + +function d3_behavior_zoomLocation(point) { + return [ + point[0] - d3_behavior_zoomXyz[0], + point[1] - d3_behavior_zoomXyz[1], + d3_behavior_zoomXyz[2] + ]; +} + +// detect the pixels that would be scrolled by this wheel event +function d3_behavior_zoomDelta() { + + // mousewheel events are totally broken! + // https://bugs.webkit.org/show_bug.cgi?id=40441 + // not only that, but Chrome and Safari differ in re. to acceleration! + if (!d3_behavior_zoomDiv) { + d3_behavior_zoomDiv = d3.select("body").append("div") + .style("visibility", "hidden") + .style("top", 0) + .style("height", 0) + .style("width", 0) + .style("overflow-y", "scroll") + .append("div") + .style("height", "2000px") + .node().parentNode; + } + + var e = d3.event, delta; + try { + d3_behavior_zoomDiv.scrollTop = 1000; + d3_behavior_zoomDiv.dispatchEvent(e); + delta = 1000 - d3_behavior_zoomDiv.scrollTop; + } catch (error) { + delta = e.wheelDelta || (-e.detail * 5); + } + + return delta * .005; +} + +// Note: Since we don't rotate, it's possible for the touches to become +// slightly detached from their original positions. Thus, we recompute the +// touch points on touchend as well as touchstart! +function d3_behavior_zoomTouchup() { + var touches = d3.svg.touches(d3_behavior_zoomTarget), + i = -1, + n = touches.length, + touch; + while (++i < n) d3_behavior_zoomLocations[(touch = touches[i]).identifier] = d3_behavior_zoomLocation(touch); + return touches; +} + +function d3_behavior_zoomTouchmove() { + var touches = d3.svg.touches(d3_behavior_zoomTarget); + switch (touches.length) { + + // single-touch pan + case 1: { + var touch = touches[0]; + d3_behavior_zoomTo(d3_behavior_zoomXyz[2], touch, d3_behavior_zoomLocations[touch.identifier]); + break; + } + + // double-touch pan + zoom + case 2: { + var p0 = touches[0], + p1 = touches[1], + p2 = [(p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2], + l0 = d3_behavior_zoomLocations[p0.identifier], + l1 = d3_behavior_zoomLocations[p1.identifier], + l2 = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2, l0[2]]; + d3_behavior_zoomTo(Math.log(d3.event.scale) / Math.LN2 + l0[2], p2, l2); + break; + } + } +} + +function d3_behavior_zoomMousemove() { + d3_behavior_zoomZooming = null; + if (d3_behavior_zoomPanning) { + d3_behavior_zoomMoved = 1; + d3_behavior_zoomTo(d3_behavior_zoomXyz[2], d3.svg.mouse(d3_behavior_zoomTarget), d3_behavior_zoomPanning); + } +} + +function d3_behavior_zoomMouseup() { + if (d3_behavior_zoomPanning) { + if (d3_behavior_zoomMoved) { + d3_eventCancel(); + d3_behavior_zoomMoved = d3_behavior_zoomEventTarget === d3.event.target; + } + + d3_behavior_zoomXyz = + d3_behavior_zoomExtent = + d3_behavior_zoomDispatch = + d3_behavior_zoomEventTarget = + d3_behavior_zoomTarget = + d3_behavior_zoomArguments = + d3_behavior_zoomPanning = null; + } +} + +function d3_behavior_zoomClick() { + if (d3_behavior_zoomMoved) { + d3_eventCancel(); + d3_behavior_zoomMoved = 0; + } +} + +function d3_behavior_zoomTo(z, x0, x1) { + z = d3_behavior_zoomExtentClamp(z, 2); + var j = Math.pow(2, d3_behavior_zoomXyz[2]), + k = Math.pow(2, z), + K = Math.pow(2, (d3_behavior_zoomXyz[2] = z) - x1[2]), + x_ = d3_behavior_zoomXyz[0], + y_ = d3_behavior_zoomXyz[1], + x = d3_behavior_zoomXyz[0] = d3_behavior_zoomExtentClamp((x0[0] - x1[0] * K), 0, k), + y = d3_behavior_zoomXyz[1] = d3_behavior_zoomExtentClamp((x0[1] - x1[1] * K), 1, k), + o = d3.event; // Events can be reentrant (e.g., focus). + + d3.event = { + scale: k, + translate: [x, y], + transform: function(sx, sy) { + if (sx) transform(sx, x_, x); + if (sy) transform(sy, y_, y); + } + }; + + function transform(scale, a, b) { + scale.domain(scale.range().map(function(v) { return scale.invert(((v - b) * j) / k + a); })); + } + + try { + d3_behavior_zoomDispatch.apply(d3_behavior_zoomTarget, d3_behavior_zoomArguments); + } finally { + d3.event = o; + } + + o.preventDefault(); +} + +var d3_behavior_zoomInfiniteExtent = [ + [-Infinity, Infinity], + [-Infinity, Infinity], + [-Infinity, Infinity] +]; + +function d3_behavior_zoomExtentClamp(x, i, k) { + var range = d3_behavior_zoomExtent[i], + r0 = range[0], + r1 = range[1]; + return arguments.length === 3 + ? Math.max(r1 * (r1 === Infinity ? -Infinity : 1 / k - 1), + Math.min(r0 === -Infinity ? Infinity : r0, x / k)) * k + : Math.max(r0, Math.min(r1, x)); +} +})(); diff --git a/modules/enterprise/gui/rest-examples-war/src/main/webapp/js/d3.layout.js b/modules/enterprise/gui/rest-examples-war/src/main/webapp/js/d3.layout.js new file mode 100755 index 0000000..24bcc42 --- /dev/null +++ b/modules/enterprise/gui/rest-examples-war/src/main/webapp/js/d3.layout.js @@ -0,0 +1,1889 @@ +(function(){d3.layout = {}; +// Implements hierarchical edge bundling using Holten's algorithm. For each +// input link, a path is computed that travels through the tree, up the parent +// hierarchy to the least common ancestor, and then back down to the destination +// node. Each path is simply an array of nodes. +d3.layout.bundle = function() { + return function(links) { + var paths = [], + i = -1, + n = links.length; + while (++i < n) paths.push(d3_layout_bundlePath(links[i])); + return paths; + }; +}; + +function d3_layout_bundlePath(link) { + var start = link.source, + end = link.target, + lca = d3_layout_bundleLeastCommonAncestor(start, end), + points = [start]; + while (start !== lca) { + start = start.parent; + points.push(start); + } + var k = points.length; + while (end !== lca) { + points.splice(k, 0, end); + end = end.parent; + } + return points; +} + +function d3_layout_bundleAncestors(node) { + var ancestors = [], + parent = node.parent; + while (parent != null) { + ancestors.push(node); + node = parent; + parent = parent.parent; + } + ancestors.push(node); + return ancestors; +} + +function d3_layout_bundleLeastCommonAncestor(a, b) { + if (a === b) return a; + var aNodes = d3_layout_bundleAncestors(a), + bNodes = d3_layout_bundleAncestors(b), + aNode = aNodes.pop(), + bNode = bNodes.pop(), + sharedNode = null; + while (aNode === bNode) { + sharedNode = aNode; + aNode = aNodes.pop(); + bNode = bNodes.pop(); + } + return sharedNode; +} +d3.layout.chord = function() { + var chord = {}, + chords, + groups, + matrix, + n, + padding = 0, + sortGroups, + sortSubgroups, + sortChords; + + function relayout() { + var subgroups = {}, + groupSums = [], + groupIndex = d3.range(n), + subgroupIndex = [], + k, + x, + x0, + i, + j; + + chords = []; + groups = []; + + // Compute the sum. + k = 0, i = -1; while (++i < n) { + x = 0, j = -1; while (++j < n) { + x += matrix[i][j]; + } + groupSums.push(x); + subgroupIndex.push(d3.range(n)); + k += x; + } + + // Sort groups… + if (sortGroups) { + groupIndex.sort(function(a, b) { + return sortGroups(groupSums[a], groupSums[b]); + }); + } + + // Sort subgroups… + if (sortSubgroups) { + subgroupIndex.forEach(function(d, i) { + d.sort(function(a, b) { + return sortSubgroups(matrix[i][a], matrix[i][b]); + }); + }); + } + + // Convert the sum to scaling factor for [0, 2pi]. + // TODO Allow start and end angle to be specified. + // TODO Allow padding to be specified as percentage? + k = (2 * Math.PI - padding * n) / k; + + // Compute the start and end angle for each group and subgroup. + // Note: Opera has a bug reordering object literal properties! + x = 0, i = -1; while (++i < n) { + x0 = x, j = -1; while (++j < n) { + var di = groupIndex[i], + dj = subgroupIndex[di][j], + v = matrix[di][dj], + a0 = x, + a1 = x += v * k; + subgroups[di + "-" + dj] = { + index: di, + subindex: dj, + startAngle: a0, + endAngle: a1, + value: v + }; + } + groups.push({ + index: di, + startAngle: x0, + endAngle: x, + value: (x - x0) / k + }); + x += padding; + } + + // Generate chords for each (non-empty) subgroup-subgroup link. + i = -1; while (++i < n) { + j = i - 1; while (++j < n) { + var source = subgroups[i + "-" + j], + target = subgroups[j + "-" + i]; + if (source.value || target.value) { + chords.push(source.value < target.value + ? {source: target, target: source} + : {source: source, target: target}); + } + } + } + + if (sortChords) resort(); + } + + function resort() { + chords.sort(function(a, b) { + return sortChords( + (a.source.value + a.target.value) / 2, + (b.source.value + b.target.value) / 2); + }); + } + + chord.matrix = function(x) { + if (!arguments.length) return matrix; + n = (matrix = x) && matrix.length; + chords = groups = null; + return chord; + }; + + chord.padding = function(x) { + if (!arguments.length) return padding; + padding = x; + chords = groups = null; + return chord; + }; + + chord.sortGroups = function(x) { + if (!arguments.length) return sortGroups; + sortGroups = x; + chords = groups = null; + return chord; + }; + + chord.sortSubgroups = function(x) { + if (!arguments.length) return sortSubgroups; + sortSubgroups = x; + chords = null; + return chord; + }; + + chord.sortChords = function(x) { + if (!arguments.length) return sortChords; + sortChords = x; + if (chords) resort(); + return chord; + }; + + chord.chords = function() { + if (!chords) relayout(); + return chords; + }; + + chord.groups = function() { + if (!groups) relayout(); + return groups; + }; + + return chord; +}; +// A rudimentary force layout using Gauss-Seidel. +d3.layout.force = function() { + var force = {}, + event = d3.dispatch("tick"), + size = [1, 1], + drag, + alpha, + friction = .9, + linkDistance = d3_layout_forceLinkDistance, + linkStrength = d3_layout_forceLinkStrength, + charge = -30, + gravity = .1, + theta = .8, + interval, + nodes = [], + links = [], + distances, + strengths, + charges; + + function repulse(node) { + return function(quad, x1, y1, x2, y2) { + if (quad.point !== node) { + var dx = quad.cx - node.x, + dy = quad.cy - node.y, + dn = 1 / Math.sqrt(dx * dx + dy * dy); + + /* Barnes-Hut criterion. */ + if ((x2 - x1) * dn < theta) { + var k = quad.charge * dn * dn; + node.px -= dx * k; + node.py -= dy * k; + return true; + } + + if (quad.point && isFinite(dn)) { + var k = quad.pointCharge * dn * dn; + node.px -= dx * k; + node.py -= dy * k; + } + } + return !quad.charge; + }; + } + + function tick() { + var n = nodes.length, + m = links.length, + q, + i, // current index + o, // current object + s, // current source + t, // current target + l, // current distance + k, // current force + x, // x-distance + y; // y-distance + + // gauss-seidel relaxation for links + for (i = 0; i < m; ++i) { + o = links[i]; + s = o.source; + t = o.target; + x = t.x - s.x; + y = t.y - s.y; + if (l = (x * x + y * y)) { + l = alpha * strengths[i] * ((l = Math.sqrt(l)) - distances[i]) / l; + x *= l; + y *= l; + t.x -= x * (k = s.weight / (t.weight + s.weight)); + t.y -= y * k; + s.x += x * (k = 1 - k); + s.y += y * k; + } + } + + // apply gravity forces + if (k = alpha * gravity) { + x = size[0] / 2; + y = size[1] / 2; + i = -1; if (k) while (++i < n) { + o = nodes[i]; + o.x += (x - o.x) * k; + o.y += (y - o.y) * k; + } + } + + // compute quadtree center of mass and apply charge forces + if (charge) { + d3_layout_forceAccumulate(q = d3.geom.quadtree(nodes), alpha, charges); + i = -1; while (++i < n) { + if (!(o = nodes[i]).fixed) { + q.visit(repulse(o)); + } + } + } + + // position verlet integration + i = -1; while (++i < n) { + o = nodes[i]; + if (o.fixed) { + o.x = o.px; + o.y = o.py; + } else { + o.x -= (o.px - (o.px = o.x)) * friction; + o.y -= (o.py - (o.py = o.y)) * friction; + } + } + + event.tick({type: "tick", alpha: alpha}); + + // simulated annealing, basically + return (alpha *= .99) < .005; + } + + force.nodes = function(x) { + if (!arguments.length) return nodes; + nodes = x; + return force; + }; + + force.links = function(x) { + if (!arguments.length) return links; + links = x; + return force; + }; + + force.size = function(x) { + if (!arguments.length) return size; + size = x; + return force; + }; + + force.linkDistance = function(x) { + if (!arguments.length) return linkDistance; + linkDistance = d3.functor(x); + return force; + }; + + // For backwards-compatibility. + force.distance = force.linkDistance; + + force.linkStrength = function(x) { + if (!arguments.length) return linkStrength; + linkStrength = d3.functor(x); + return force; + }; + + force.friction = function(x) { + if (!arguments.length) return friction; + friction = x; + return force; + }; + + force.charge = function(x) { + if (!arguments.length) return charge; + charge = typeof x === "function" ? x : +x; + return force; + }; + + force.gravity = function(x) { + if (!arguments.length) return gravity; + gravity = x; + return force; + }; + + force.theta = function(x) { + if (!arguments.length) return theta; + theta = x; + return force; + }; + + force.start = function() { + var i, + j, + n = nodes.length, + m = links.length, + w = size[0], + h = size[1], + neighbors, + o; + + for (i = 0; i < n; ++i) { + (o = nodes[i]).index = i; + o.weight = 0; + } + + distances = []; + strengths = []; + for (i = 0; i < m; ++i) { + o = links[i]; + if (typeof o.source == "number") o.source = nodes[o.source]; + if (typeof o.target == "number") o.target = nodes[o.target]; + distances[i] = linkDistance.call(this, o, i); + strengths[i] = linkStrength.call(this, o, i); + ++o.source.weight; + ++o.target.weight; + } + + for (i = 0; i < n; ++i) { + o = nodes[i]; + if (isNaN(o.x)) o.x = position("x", w); + if (isNaN(o.y)) o.y = position("y", h); + if (isNaN(o.px)) o.px = o.x; + if (isNaN(o.py)) o.py = o.y; + } + + charges = []; + if (typeof charge === "function") { + for (i = 0; i < n; ++i) { + charges[i] = +charge.call(this, nodes[i], i); + } + } else { + for (i = 0; i < n; ++i) { + charges[i] = charge; + } + } + + // initialize node position based on first neighbor + function position(dimension, size) { + var neighbors = neighbor(i), + j = -1, + m = neighbors.length, + x; + while (++j < m) if (!isNaN(x = neighbors[j][dimension])) return x; + return Math.random() * size; + } + + // initialize neighbors lazily + function neighbor() { + if (!neighbors) { + neighbors = []; + for (j = 0; j < n; ++j) { + neighbors[j] = []; + } + for (j = 0; j < m; ++j) { + var o = links[j]; + neighbors[o.source.index].push(o.target); + neighbors[o.target.index].push(o.source); + } + } + return neighbors[i]; + } + + return force.resume(); + }; + + force.resume = function() { + alpha = .1; + d3.timer(tick); + return force; + }; + + force.stop = function() { + alpha = 0; + return force; + }; + + // use `node.call(force.drag)` to make nodes draggable + force.drag = function() { + if (!drag) drag = d3.behavior.drag() + .origin(Object) + .on("dragstart", dragstart) + .on("drag", d3_layout_forceDrag) + .on("dragend", d3_layout_forceDragEnd); + + this.on("mouseover.force", d3_layout_forceDragOver) + .on("mouseout.force", d3_layout_forceDragOut) + .call(drag); + }; + + function dragstart(d) { + d3_layout_forceDragOver(d3_layout_forceDragNode = d); + d3_layout_forceDragForce = force; + } + + return d3.rebind(force, event, "on"); +}; + +var d3_layout_forceDragForce, + d3_layout_forceDragNode; + +function d3_layout_forceDragOver(d) { + d.fixed |= 2; +} + +function d3_layout_forceDragOut(d) { + if (d !== d3_layout_forceDragNode) d.fixed &= 1; +} + +function d3_layout_forceDragEnd() { + d3_layout_forceDrag(); + d3_layout_forceDragNode.fixed &= 1; + d3_layout_forceDragForce = d3_layout_forceDragNode = null; +} + +function d3_layout_forceDrag() { + d3_layout_forceDragNode.px = d3.event.x; + d3_layout_forceDragNode.py = d3.event.y; + d3_layout_forceDragForce.resume(); // restart annealing +} + +function d3_layout_forceAccumulate(quad, alpha, charges) { + var cx = 0, + cy = 0; + quad.charge = 0; + if (!quad.leaf) { + var nodes = quad.nodes, + n = nodes.length, + i = -1, + c; + while (++i < n) { + c = nodes[i]; + if (c == null) continue; + d3_layout_forceAccumulate(c, alpha, charges); + quad.charge += c.charge; + cx += c.charge * c.cx; + cy += c.charge * c.cy; + } + } + if (quad.point) { + // jitter internal nodes that are coincident + if (!quad.leaf) { + quad.point.x += Math.random() - .5; + quad.point.y += Math.random() - .5; + } + var k = alpha * charges[quad.point.index]; + quad.charge += quad.pointCharge = k; + cx += k * quad.point.x; + cy += k * quad.point.y; + } + quad.cx = cx / quad.charge; + quad.cy = cy / quad.charge; +} + +function d3_layout_forceLinkDistance(link) { + return 20; +} + +function d3_layout_forceLinkStrength(link) { + return 1; +} +d3.layout.partition = function() { + var hierarchy = d3.layout.hierarchy(), + size = [1, 1]; // width, height + + function position(node, x, dx, dy) { + var children = node.children; + node.x = x; + node.y = node.depth * dy; + node.dx = dx; + node.dy = dy; + if (children && (n = children.length)) { + var i = -1, + n, + c, + d; + dx = node.value ? dx / node.value : 0; + while (++i < n) { + position(c = children[i], x, d = c.value * dx, dy); + x += d; + } + } + } + + function depth(node) { + var children = node.children, + d = 0; + if (children && (n = children.length)) { + var i = -1, + n; + while (++i < n) d = Math.max(d, depth(children[i])); + } + return 1 + d; + } + + function partition(d, i) { + var nodes = hierarchy.call(this, d, i); + position(nodes[0], 0, size[0], size[1] / depth(nodes[0])); + return nodes; + } + + partition.size = function(x) { + if (!arguments.length) return size; + size = x; + return partition; + }; + + return d3_layout_hierarchyRebind(partition, hierarchy); +}; +d3.layout.pie = function() { + var value = Number, + sort = d3_layout_pieSortByValue, + startAngle = 0, + endAngle = 2 * Math.PI; + + function pie(data, i) { + + // Compute the numeric values for each data element. + var values = data.map(function(d, i) { return +value.call(pie, d, i); }); + + // Compute the start angle. + var a = +(typeof startAngle === "function" + ? startAngle.apply(this, arguments) + : startAngle); + + // Compute the angular scale factor: from value to radians. + var k = ((typeof endAngle === "function" + ? endAngle.apply(this, arguments) + : endAngle) - startAngle) + / d3.sum(values); + + // Optionally sort the data. + var index = d3.range(data.length); + if (sort != null) index.sort(sort === d3_layout_pieSortByValue + ? function(i, j) { return values[j] - values[i]; } + : function(i, j) { return sort(data[i], data[j]); }); + + // Compute the arcs! + // They are stored in the original data's order. + var arcs = []; + index.forEach(function(i) { + arcs[i] = { + data: data[i], + value: d = values[i], + startAngle: a, + endAngle: a += d * k + }; + }); + return arcs; + } + + /** + * Specifies the value function *x*, which returns a nonnegative numeric value + * for each datum. The default value function is `Number`. The value function + * is passed two arguments: the current datum and the current index. + */ + pie.value = function(x) { + if (!arguments.length) return value; + value = x; + return pie; + }; + + /** + * Specifies a sort comparison operator *x*. The comparator is passed two data + * elements from the data array, a and b; it returns a negative value if a is + * less than b, a positive value if a is greater than b, and zero if a equals + * b. + */ + pie.sort = function(x) { + if (!arguments.length) return sort; + sort = x; + return pie; + }; + + /** + * Specifies the overall start angle of the pie chart. Defaults to 0. The + * start angle can be specified either as a constant or as a function; in the + * case of a function, it is evaluated once per array (as opposed to per + * element). + */ + pie.startAngle = function(x) { + if (!arguments.length) return startAngle; + startAngle = x; + return pie; + }; + + /** + * Specifies the overall end angle of the pie chart. Defaults to 2π. The + * end angle can be specified either as a constant or as a function; in the + * case of a function, it is evaluated once per array (as opposed to per + * element). + */ + pie.endAngle = function(x) { + if (!arguments.length) return endAngle; + endAngle = x; + return pie; + }; + + return pie; +}; + +var d3_layout_pieSortByValue = {}; +// data is two-dimensional array of x,y; we populate y0 +d3.layout.stack = function() { + var values = Object, + order = d3_layout_stackOrders["default"], + offset = d3_layout_stackOffsets["zero"], + out = d3_layout_stackOut, + x = d3_layout_stackX, + y = d3_layout_stackY; + + function stack(data, index) { + + // Convert series to canonical two-dimensional representation. + var series = data.map(function(d, i) { + return values.call(stack, d, i); + }); + + // Convert each series to canonical [[x,y]] representation. + var points = series.map(function(d, i) { + return d.map(function(v, i) { + return [x.call(stack, v, i), y.call(stack, v, i)]; + }); + }); + + // Compute the order of series, and permute them. + var orders = order.call(stack, points, index); + series = d3.permute(series, orders); + points = d3.permute(points, orders); + + // Compute the baseline… + var offsets = offset.call(stack, points, index); + + // And propagate it to other series. + var n = series.length, + m = series[0].length, + i, + j, + o; + for (j = 0; j < m; ++j) { + out.call(stack, series[0][j], o = offsets[j], points[0][j][1]); + for (i = 1; i < n; ++i) { + out.call(stack, series[i][j], o += points[i - 1][j][1], points[i][j][1]); + } + } + + return data; + } + + stack.values = function(x) { + if (!arguments.length) return values; + values = x; + return stack; + }; + + stack.order = function(x) { + if (!arguments.length) return order; + order = typeof x === "function" ? x : d3_layout_stackOrders[x]; + return stack; + }; + + stack.offset = function(x) { + if (!arguments.length) return offset; + offset = typeof x === "function" ? x : d3_layout_stackOffsets[x]; + return stack; + }; + + stack.x = function(z) { + if (!arguments.length) return x; + x = z; + return stack; + }; + + stack.y = function(z) { + if (!arguments.length) return y; + y = z; + return stack; + }; + + stack.out = function(z) { + if (!arguments.length) return out; + out = z; + return stack; + }; + + return stack; +} + +function d3_layout_stackX(d) { + return d.x; +} + +function d3_layout_stackY(d) { + return d.y; +} + +function d3_layout_stackOut(d, y0, y) { + d.y0 = y0; + d.y = y; +} + +var d3_layout_stackOrders = { + + "inside-out": function(data) { + var n = data.length, + i, + j, + max = data.map(d3_layout_stackMaxIndex), + sums = data.map(d3_layout_stackReduceSum), + index = d3.range(n).sort(function(a, b) { return max[a] - max[b]; }), + top = 0, + bottom = 0, + tops = [], + bottoms = []; + for (i = 0; i < n; ++i) { + j = index[i]; + if (top < bottom) { + top += sums[j]; + tops.push(j); + } else { + bottom += sums[j]; + bottoms.push(j); + } + } + return bottoms.reverse().concat(tops); + }, + + "reverse": function(data) { + return d3.range(data.length).reverse(); + }, + + "default": function(data) { + return d3.range(data.length); + } + +}; + +var d3_layout_stackOffsets = { + + "silhouette": function(data) { + var n = data.length, + m = data[0].length, + sums = [], + max = 0, + i, + j, + o, + y0 = []; + for (j = 0; j < m; ++j) { + for (i = 0, o = 0; i < n; i++) o += data[i][j][1]; + if (o > max) max = o; + sums.push(o); + } + for (j = 0; j < m; ++j) { + y0[j] = (max - sums[j]) / 2; + } + return y0; + }, + + "wiggle": function(data) { + var n = data.length, + x = data[0], + m = x.length, + max = 0, + i, + j, + k, + s1, + s2, + s3, + dx, + o, + o0, + y0 = []; + y0[0] = o = o0 = 0; + for (j = 1; j < m; ++j) { + for (i = 0, s1 = 0; i < n; ++i) s1 += data[i][j][1]; + for (i = 0, s2 = 0, dx = x[j][0] - x[j - 1][0]; i < n; ++i) { + for (k = 0, s3 = (data[i][j][1] - data[i][j - 1][1]) / (2 * dx); k < i; ++k) { + s3 += (data[k][j][1] - data[k][j - 1][1]) / dx; + } + s2 += s3 * data[i][j][1]; + } + y0[j] = o -= s1 ? s2 / s1 * dx : 0; + if (o < o0) o0 = o; + } + for (j = 0; j < m; ++j) y0[j] -= o0; + return y0; + }, + + "expand": function(data) { + var n = data.length, + m = data[0].length, + k = 1 / n, + i, + j, + o, + y0 = []; + for (j = 0; j < m; ++j) { + for (i = 0, o = 0; i < n; i++) o += data[i][j][1]; + if (o) for (i = 0; i < n; i++) data[i][j][1] /= o; + else for (i = 0; i < n; i++) data[i][j][1] = k; + } + for (j = 0; j < m; ++j) y0[j] = 0; + return y0; + }, + + "zero": function(data) { + var j = -1, + m = data[0].length, + y0 = []; + while (++j < m) y0[j] = 0; + return y0; + } + +}; + +function d3_layout_stackMaxIndex(array) { + var i = 1, + j = 0, + v = array[0][1], + k, + n = array.length; + for (; i < n; ++i) { + if ((k = array[i][1]) > v) { + j = i; + v = k; + } + } + return j; +} + +function d3_layout_stackReduceSum(d) { + return d.reduce(d3_layout_stackSum, 0); +} + +function d3_layout_stackSum(p, d) { + return p + d[1]; +} +d3.layout.histogram = function() { + var frequency = true, + valuer = Number, + ranger = d3_layout_histogramRange, + binner = d3_layout_histogramBinSturges; + + function histogram(data, i) { + var bins = [], + values = data.map(valuer, this), + range = ranger.call(this, values, i), + thresholds = binner.call(this, range, values, i), + bin, + i = -1, + n = values.length, + m = thresholds.length - 1, + k = frequency ? 1 : 1 / n, + x; + + // Initialize the bins. + while (++i < m) { + bin = bins[i] = []; + bin.dx = thresholds[i + 1] - (bin.x = thresholds[i]); + bin.y = 0; + } + + // Fill the bins, ignoring values outside the range. + i = -1; while(++i < n) { + x = values[i]; + if ((x >= range[0]) && (x <= range[1])) { + bin = bins[d3.bisect(thresholds, x, 1, m) - 1]; + bin.y += k; + bin.push(data[i]); + } + } + + return bins; + } + + // Specifies how to extract a value from the associated data. The default + // value function is `Number`, which is equivalent to the identity function. + histogram.value = function(x) { + if (!arguments.length) return valuer; + valuer = x; + return histogram; + }; + + // Specifies the range of the histogram. Values outside the specified range + // will be ignored. The argument `x` may be specified either as a two-element + // array representing the minimum and maximum value of the range, or as a + // function that returns the range given the array of values and the current + // index `i`. The default range is the extent (minimum and maximum) of the + // values. + histogram.range = function(x) { + if (!arguments.length) return ranger; + ranger = d3.functor(x); + return histogram; + }; + + // Specifies how to bin values in the histogram. The argument `x` may be + // specified as a number, in which case the range of values will be split + // uniformly into the given number of bins. Or, `x` may be an array of + // threshold values, defining the bins; the specified array must contain the + // rightmost (upper) value, thus specifying n + 1 values for n bins. Or, `x` + // may be a function which is evaluated, being passed the range, the array of + // values, and the current index `i`, returning an array of thresholds. The + // default bin function will divide the values into uniform bins using + // Sturges' formula. + histogram.bins = function(x) { + if (!arguments.length) return binner; + binner = typeof x === "number" + ? function(range) { return d3_layout_histogramBinFixed(range, x); } + : d3.functor(x); + return histogram; + }; + + // Specifies whether the histogram's `y` value is a count (frequency) or a + // probability (density). The default value is true. + histogram.frequency = function(x) { + if (!arguments.length) return frequency; + frequency = !!x; + return histogram; + }; + + return histogram; +}; + +function d3_layout_histogramBinSturges(range, values) { + return d3_layout_histogramBinFixed(range, Math.ceil(Math.log(values.length) / Math.LN2 + 1)); +} + +function d3_layout_histogramBinFixed(range, n) { + var x = -1, + b = +range[0], + m = (range[1] - b) / n, + f = []; + while (++x <= n) f[x] = m * x + b; + return f; +} + +function d3_layout_histogramRange(values) { + return [d3.min(values), d3.max(values)]; +} +d3.layout.hierarchy = function() { + var sort = d3_layout_hierarchySort, + children = d3_layout_hierarchyChildren, + value = d3_layout_hierarchyValue; + + // Recursively compute the node depth and value. + // Also converts the data representation into a standard hierarchy structure. + function recurse(data, depth, nodes) { + var childs = children.call(hierarchy, data, depth), + node = d3_layout_hierarchyInline ? data : {data: data}; + node.depth = depth; + nodes.push(node); + if (childs && (n = childs.length)) { + var i = -1, + n, + c = node.children = [], + v = 0, + j = depth + 1; + while (++i < n) { + d = recurse(childs[i], j, nodes); + d.parent = node; + c.push(d); + v += d.value; + } + if (sort) c.sort(sort); + if (value) node.value = v; + } else if (value) { + node.value = +value.call(hierarchy, data, depth) || 0; + } + return node; + } + + // Recursively re-evaluates the node value. + function revalue(node, depth) { + var children = node.children, + v = 0; + if (children && (n = children.length)) { + var i = -1, + n, + j = depth + 1; + while (++i < n) v += revalue(children[i], j); + } else if (value) { + v = +value.call(hierarchy, d3_layout_hierarchyInline ? node : node.data, depth) || 0; + } + if (value) node.value = v; + return v; + } + + function hierarchy(d) { + var nodes = []; + recurse(d, 0, nodes); + return nodes; + } + + hierarchy.sort = function(x) { + if (!arguments.length) return sort; + sort = x; + return hierarchy; + }; + + hierarchy.children = function(x) { + if (!arguments.length) return children; + children = x; + return hierarchy; + }; + + hierarchy.value = function(x) { + if (!arguments.length) return value; + value = x; + return hierarchy; + }; + + // Re-evaluates the `value` property for the specified hierarchy. + hierarchy.revalue = function(root) { + revalue(root, 0); + return root; + }; + + return hierarchy; +}; + +// A method assignment helper for hierarchy subclasses. +function d3_layout_hierarchyRebind(object, hierarchy) { + d3.rebind(object, hierarchy, "sort", "children", "value"); + + // Add an alias for links, for convenience. + object.links = d3_layout_hierarchyLinks; + + // If the new API is used, enabling inlining. + object.nodes = function(d) { + d3_layout_hierarchyInline = true; + return (object.nodes = object)(d); + }; + + return object; +} + +function d3_layout_hierarchyChildren(d) { + return d.children; +} + +function d3_layout_hierarchyValue(d) { + return d.value; +} + +function d3_layout_hierarchySort(a, b) { + return b.value - a.value; +} + +// Returns an array source+target objects for the specified nodes. +function d3_layout_hierarchyLinks(nodes) { + return d3.merge(nodes.map(function(parent) { + return (parent.children || []).map(function(child) { + return {source: parent, target: child}; + }); + })); +} + +// For backwards-compatibility, don't enable inlining by default. +var d3_layout_hierarchyInline = false; +d3.layout.pack = function() { + var hierarchy = d3.layout.hierarchy().sort(d3_layout_packSort), + size = [1, 1]; + + function pack(d, i) { + var nodes = hierarchy.call(this, d, i), + root = nodes[0]; + + // Recursively compute the layout. + root.x = 0; + root.y = 0; + d3_layout_packTree(root); + + // Scale the layout to fit the requested size. + var w = size[0], + h = size[1], + k = 1 / Math.max(2 * root.r / w, 2 * root.r / h); + d3_layout_packTransform(root, w / 2, h / 2, k); + + return nodes; + } + + pack.size = function(x) { + if (!arguments.length) return size; + size = x; + return pack; + }; + + return d3_layout_hierarchyRebind(pack, hierarchy); +}; + +function d3_layout_packSort(a, b) { + return a.value - b.value; +} + +function d3_layout_packInsert(a, b) { + var c = a._pack_next; + a._pack_next = b; + b._pack_prev = a; + b._pack_next = c; + c._pack_prev = b; +} + +function d3_layout_packSplice(a, b) { + a._pack_next = b; + b._pack_prev = a; +} + +function d3_layout_packIntersects(a, b) { + var dx = b.x - a.x, + dy = b.y - a.y, + dr = a.r + b.r; + return (dr * dr - dx * dx - dy * dy) > .001; // within epsilon +} + +function d3_layout_packCircle(nodes) { + var xMin = Infinity, + xMax = -Infinity, + yMin = Infinity, + yMax = -Infinity, + n = nodes.length, + a, b, c, j, k; + + function bound(node) { + xMin = Math.min(node.x - node.r, xMin); + xMax = Math.max(node.x + node.r, xMax); + yMin = Math.min(node.y - node.r, yMin); + yMax = Math.max(node.y + node.r, yMax); + } + + // Create node links. + nodes.forEach(d3_layout_packLink); + + // Create first node. + a = nodes[0]; + a.x = -a.r; + a.y = 0; + bound(a); + + // Create second node. + if (n > 1) { + b = nodes[1]; + b.x = b.r; + b.y = 0; + bound(b); + + // Create third node and build chain. + if (n > 2) { + c = nodes[2]; + d3_layout_packPlace(a, b, c); + bound(c); + d3_layout_packInsert(a, c); + a._pack_prev = c; + d3_layout_packInsert(c, b); + b = a._pack_next; + + // Now iterate through the rest. + for (var i = 3; i < n; i++) { + d3_layout_packPlace(a, b, c = nodes[i]); + + // Search for the closest intersection. + var isect = 0, s1 = 1, s2 = 1; + for (j = b._pack_next; j !== b; j = j._pack_next, s1++) { + if (d3_layout_packIntersects(j, c)) { + isect = 1; + break; + } + } + if (isect == 1) { + for (k = a._pack_prev; k !== j._pack_prev; k = k._pack_prev, s2++) { + if (d3_layout_packIntersects(k, c)) { + if (s2 < s1) { + isect = -1; + j = k; + } + break; + } + } + } + + // Update node chain. + if (isect == 0) { + d3_layout_packInsert(a, c); + b = c; + bound(c); + } else if (isect > 0) { + d3_layout_packSplice(a, j); + b = j; + i--; + } else { // isect < 0 + d3_layout_packSplice(j, b); + a = j; + i--; + } + } + } + } + + // Re-center the circles and return the encompassing radius. + var cx = (xMin + xMax) / 2, + cy = (yMin + yMax) / 2, + cr = 0; + for (var i = 0; i < n; i++) { + var node = nodes[i]; + node.x -= cx; + node.y -= cy; + cr = Math.max(cr, node.r + Math.sqrt(node.x * node.x + node.y * node.y)); + } + + // Remove node links. + nodes.forEach(d3_layout_packUnlink); + + return cr; +} + +function d3_layout_packLink(node) { + node._pack_next = node._pack_prev = node; +} + +function d3_layout_packUnlink(node) { + delete node._pack_next; + delete node._pack_prev; +} + +function d3_layout_packTree(node) { + var children = node.children; + if (children && children.length) { + children.forEach(d3_layout_packTree); + node.r = d3_layout_packCircle(children); + } else { + node.r = Math.sqrt(node.value); + } +} + +function d3_layout_packTransform(node, x, y, k) { + var children = node.children; + node.x = (x += k * node.x); + node.y = (y += k * node.y); + node.r *= k; + if (children) { + var i = -1, n = children.length; + while (++i < n) d3_layout_packTransform(children[i], x, y, k); + } +} + +function d3_layout_packPlace(a, b, c) { + var db = a.r + c.r, + dx = b.x - a.x, + dy = b.y - a.y; + if (db && (dx || dy)) { + var da = b.r + c.r, + dc = Math.sqrt(dx * dx + dy * dy), + cos = Math.max(-1, Math.min(1, (db * db + dc * dc - da * da) / (2 * db * dc))), + theta = Math.acos(cos), + x = cos * (db /= dc), + y = Math.sin(theta) * db; + c.x = a.x + x * dx + y * dy; + c.y = a.y + x * dy - y * dx; + } else { + c.x = a.x + db; + c.y = a.y; + } +} +// Implements a hierarchical layout using the cluster (or dendogram) algorithm. +d3.layout.cluster = function() { + var hierarchy = d3.layout.hierarchy().sort(null).value(null), + separation = d3_layout_treeSeparation, + size = [1, 1]; // width, height + + function cluster(d, i) { + var nodes = hierarchy.call(this, d, i), + root = nodes[0], + previousNode, + x = 0, + kx, + ky; + + // First walk, computing the initial x & y values. + d3_layout_treeVisitAfter(root, function(node) { + var children = node.children; + if (children && children.length) { + node.x = d3_layout_clusterX(children); + node.y = d3_layout_clusterY(children); + } else { + node.x = previousNode ? x += separation(node, previousNode) : 0; + node.y = 0; + previousNode = node; + } + }); + + // Compute the left-most, right-most, and depth-most nodes for extents. + var left = d3_layout_clusterLeft(root), + right = d3_layout_clusterRight(root), + x0 = left.x - separation(left, right) / 2, + x1 = right.x + separation(right, left) / 2; + + // Second walk, normalizing x & y to the desired size. + d3_layout_treeVisitAfter(root, function(node) { + node.x = (node.x - x0) / (x1 - x0) * size[0]; + node.y = (1 - (root.y ? node.y / root.y : 1)) * size[1]; + }); + + return nodes; + } + + cluster.separation = function(x) { + if (!arguments.length) return separation; + separation = x; + return cluster; + }; + + cluster.size = function(x) { + if (!arguments.length) return size; + size = x; + return cluster; + }; + + return d3_layout_hierarchyRebind(cluster, hierarchy); +}; + +function d3_layout_clusterY(children) { + return 1 + d3.max(children, function(child) { + return child.y; + }); +} + +function d3_layout_clusterX(children) { + return children.reduce(function(x, child) { + return x + child.x; + }, 0) / children.length; +} + +function d3_layout_clusterLeft(node) { + var children = node.children; + return children && children.length ? d3_layout_clusterLeft(children[0]) : node; +} + +function d3_layout_clusterRight(node) { + var children = node.children, n; + return children && (n = children.length) ? d3_layout_clusterRight(children[n - 1]) : node; +} +// Node-link tree diagram using the Reingold-Tilford "tidy" algorithm +d3.layout.tree = function() { + var hierarchy = d3.layout.hierarchy().sort(null).value(null), + separation = d3_layout_treeSeparation, + size = [1, 1]; // width, height + + function tree(d, i) { + var nodes = hierarchy.call(this, d, i), + root = nodes[0]; + + function firstWalk(node, previousSibling) { + var children = node.children, + layout = node._tree; + if (children && (n = children.length)) { + var n, + firstChild = children[0], + previousChild, + ancestor = firstChild, + child, + i = -1; + while (++i < n) { + child = children[i]; + firstWalk(child, previousChild); + ancestor = apportion(child, previousChild, ancestor); + previousChild = child; + } + d3_layout_treeShift(node); + var midpoint = .5 * (firstChild._tree.prelim + child._tree.prelim); + if (previousSibling) { + layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling); + layout.mod = layout.prelim - midpoint; + } else { + layout.prelim = midpoint; + } + } else { + if (previousSibling) { + layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling); + } + } + } + + function secondWalk(node, x) { + node.x = node._tree.prelim + x; + var children = node.children; + if (children && (n = children.length)) { + var i = -1, + n; + x += node._tree.mod; + while (++i < n) { + secondWalk(children[i], x); + } + } + } + + function apportion(node, previousSibling, ancestor) { + if (previousSibling) { + var vip = node, + vop = node, + vim = previousSibling, + vom = node.parent.children[0], + sip = vip._tree.mod, + sop = vop._tree.mod, + sim = vim._tree.mod, + som = vom._tree.mod, + shift; + while (vim = d3_layout_treeRight(vim), vip = d3_layout_treeLeft(vip), vim && vip) { + vom = d3_layout_treeLeft(vom); + vop = d3_layout_treeRight(vop); + vop._tree.ancestor = node; + shift = vim._tree.prelim + sim - vip._tree.prelim - sip + separation(vim, vip); + if (shift > 0) { + d3_layout_treeMove(d3_layout_treeAncestor(vim, node, ancestor), node, shift); + sip += shift; + sop += shift; + } + sim += vim._tree.mod; + sip += vip._tree.mod; + som += vom._tree.mod; + sop += vop._tree.mod; + } + if (vim && !d3_layout_treeRight(vop)) { + vop._tree.thread = vim; + vop._tree.mod += sim - sop; + } + if (vip && !d3_layout_treeLeft(vom)) { + vom._tree.thread = vip; + vom._tree.mod += sip - som; + ancestor = node; + } + } + return ancestor; + } + + // Initialize temporary layout variables. + d3_layout_treeVisitAfter(root, function(node, previousSibling) { + node._tree = { + ancestor: node, + prelim: 0, + mod: 0, + change: 0, + shift: 0, + number: previousSibling ? previousSibling._tree.number + 1 : 0 + }; + }); + + // Compute the layout using Buchheim et al.'s algorithm. + firstWalk(root); + secondWalk(root, -root._tree.prelim); + + // Compute the left-most, right-most, and depth-most nodes for extents. + var left = d3_layout_treeSearch(root, d3_layout_treeLeftmost), + right = d3_layout_treeSearch(root, d3_layout_treeRightmost), + deep = d3_layout_treeSearch(root, d3_layout_treeDeepest), + x0 = left.x - separation(left, right) / 2, + x1 = right.x + separation(right, left) / 2, + y1 = deep.depth || 1; + + // Clear temporary layout variables; transform x and y. + d3_layout_treeVisitAfter(root, function(node) { + node.x = (node.x - x0) / (x1 - x0) * size[0]; + node.y = node.depth / y1 * size[1]; + delete node._tree; + }); + + return nodes; + } + + tree.separation = function(x) { + if (!arguments.length) return separation; + separation = x; + return tree; + }; + + tree.size = function(x) { + if (!arguments.length) return size; + size = x; + return tree; + }; + + return d3_layout_hierarchyRebind(tree, hierarchy); +}; + +function d3_layout_treeSeparation(a, b) { + return a.parent == b.parent ? 1 : 2; +} + +// function d3_layout_treeSeparationRadial(a, b) { +// return (a.parent == b.parent ? 1 : 2) / a.depth; +// } + +function d3_layout_treeLeft(node) { + var children = node.children; + return children && children.length ? children[0] : node._tree.thread; +} + +function d3_layout_treeRight(node) { + var children = node.children, + n; + return children && (n = children.length) ? children[n - 1] : node._tree.thread; +} + +function d3_layout_treeSearch(node, compare) { + var children = node.children; + if (children && (n = children.length)) { + var child, + n, + i = -1; + while (++i < n) { + if (compare(child = d3_layout_treeSearch(children[i], compare), node) > 0) { + node = child; + } + } + } + return node; +} + +function d3_layout_treeRightmost(a, b) { + return a.x - b.x; +} + +function d3_layout_treeLeftmost(a, b) { + return b.x - a.x; +} + +function d3_layout_treeDeepest(a, b) { + return a.depth - b.depth; +} + +function d3_layout_treeVisitAfter(node, callback) { + function visit(node, previousSibling) { + var children = node.children; + if (children && (n = children.length)) { + var child, + previousChild = null, + i = -1, + n; + while (++i < n) { + child = children[i]; + visit(child, previousChild); + previousChild = child; + } + } + callback(node, previousSibling); + } + visit(node, null); +} + +function d3_layout_treeShift(node) { + var shift = 0, + change = 0, + children = node.children, + i = children.length, + child; + while (--i >= 0) { + child = children[i]._tree; + child.prelim += shift; + child.mod += shift; + shift += child.shift + (change += child.change); + } +} + +function d3_layout_treeMove(ancestor, node, shift) { + ancestor = ancestor._tree; + node = node._tree; + var change = shift / (node.number - ancestor.number); + ancestor.change += change; + node.change -= change; + node.shift += shift; + node.prelim += shift; + node.mod += shift; +} + +function d3_layout_treeAncestor(vim, node, ancestor) { + return vim._tree.ancestor.parent == node.parent + ? vim._tree.ancestor + : ancestor; +} +// Squarified Treemaps by Mark Bruls, Kees Huizing, and Jarke J. van Wijk +// Modified to support a target aspect ratio by Jeff Heer +d3.layout.treemap = function() { + var hierarchy = d3.layout.hierarchy(), + round = Math.round, + size = [1, 1], // width, height + padding = null, + pad = d3_layout_treemapPadNull, + sticky = false, + stickies, + ratio = 0.5 * (1 + Math.sqrt(5)); // golden ratio + + // Compute the area for each child based on value & scale. + function scale(children, k) { + var i = -1, + n = children.length, + child, + area; + while (++i < n) { + area = (child = children[i]).value * (k < 0 ? 0 : k); + child.area = isNaN(area) || area <= 0 ? 0 : area; + } + } + + // Recursively arranges the specified node's children into squarified rows. + function squarify(node) { + var children = node.children; + if (children && children.length) { + var rect = pad(node), + row = [], + remaining = children.slice(), // copy-on-write + child, + best = Infinity, // the best row score so far + score, // the current row score + u = Math.min(rect.dx, rect.dy), // initial orientation + n; + scale(remaining, rect.dx * rect.dy / node.value); + row.area = 0; + while ((n = remaining.length) > 0) { + row.push(child = remaining[n - 1]); + row.area += child.area; + if ((score = worst(row, u)) <= best) { // continue with this orientation + remaining.pop(); + best = score; + } else { // abort, and try a different orientation + row.area -= row.pop().area; + position(row, u, rect, false); + u = Math.min(rect.dx, rect.dy); + row.length = row.area = 0; + best = Infinity; + } + } + if (row.length) { + position(row, u, rect, true); + row.length = row.area = 0; + } + children.forEach(squarify); + } + } + + // Recursively resizes the specified node's children into existing rows. + // Preserves the existing layout! + function stickify(node) { + var children = node.children; + if (children && children.length) { + var rect = pad(node), + remaining = children.slice(), // copy-on-write + child, + row = []; + scale(remaining, rect.dx * rect.dy / node.value); + row.area = 0; + while (child = remaining.pop()) { + row.push(child); + row.area += child.area; + if (child.z != null) { + position(row, child.z ? rect.dx : rect.dy, rect, !remaining.length); + row.length = row.area = 0; + } + } + children.forEach(stickify); + } + } + + // Computes the score for the specified row, as the worst aspect ratio. + function worst(row, u) { + var s = row.area, + r, + rmax = 0, + rmin = Infinity, + i = -1, + n = row.length; + while (++i < n) { + if (!(r = row[i].area)) continue; + if (r < rmin) rmin = r; + if (r > rmax) rmax = r; + } + s *= s; + u *= u; + return s + ? Math.max((u * rmax * ratio) / s, s / (u * rmin * ratio)) + : Infinity; + } + + // Positions the specified row of nodes. Modifies `rect`. + function position(row, u, rect, flush) { + var i = -1, + n = row.length, + x = rect.x, + y = rect.y, + v = u ? round(row.area / u) : 0, + o; + if (u == rect.dx) { // horizontal subdivision + if (flush || v > rect.dy) v = v ? rect.dy : 0; // over+underflow + while (++i < n) { + o = row[i]; + o.x = x; + o.y = y; + o.dy = v; + x += o.dx = v ? round(o.area / v) : 0; + } + o.z = true; + o.dx += rect.x + rect.dx - x; // rounding error + rect.y += v; + rect.dy -= v; + } else { // vertical subdivision + if (flush || v > rect.dx) v = v ? rect.dx : 0; // over+underflow + while (++i < n) { + o = row[i]; + o.x = x; + o.y = y; + o.dx = v; + y += o.dy = v ? round(o.area / v) : 0; + } + o.z = false; + o.dy += rect.y + rect.dy - y; // rounding error + rect.x += v; + rect.dx -= v; + } + } + + function treemap(d) { + var nodes = stickies || hierarchy(d), + root = nodes[0]; + root.x = 0; + root.y = 0; + root.dx = size[0]; + root.dy = size[1]; + if (stickies) hierarchy.revalue(root); + scale([root], root.dx * root.dy / root.value); + (stickies ? stickify : squarify)(root); + if (sticky) stickies = nodes; + return nodes; + } + + treemap.size = function(x) { + if (!arguments.length) return size; + size = x; + return treemap; + }; + + treemap.padding = function(x) { + if (!arguments.length) return padding; + + function padFunction(node) { + var p = x.call(treemap, node, node.depth); + return p == null + ? d3_layout_treemapPadNull(node) + : d3_layout_treemapPad(node, typeof p === "number" ? [p, p, p, p] : p); + } + + function padConstant(node) { + return d3_layout_treemapPad(node, x); + } + + var type; + pad = (padding = x) == null ? d3_layout_treemapPadNull + : (type = typeof x) === "function" ? padFunction + : type === "number" ? (x = [x, x, x, x], padConstant) + : padConstant; + return treemap; + }; + + treemap.round = function(x) { + if (!arguments.length) return round != Number; + round = x ? Math.round : Number; + return treemap; + }; + + treemap.sticky = function(x) { + if (!arguments.length) return sticky; + sticky = x; + stickies = null; + return treemap; + }; + + treemap.ratio = function(x) { + if (!arguments.length) return ratio; + ratio = x; + return treemap; + }; + + return d3_layout_hierarchyRebind(treemap, hierarchy); +}; + +function d3_layout_treemapPadNull(node) { + return {x: node.x, y: node.y, dx: node.dx, dy: node.dy}; +} + +function d3_layout_treemapPad(node, padding) { + var x = node.x + padding[3], + y = node.y + padding[0], + dx = node.dx - padding[1] - padding[3], + dy = node.dy - padding[0] - padding[2]; + if (dx < 0) { x += dx / 2; dx = 0; } + if (dy < 0) { y += dy / 2; dy = 0; } + return {x: x, y: y, dx: dx, dy: dy}; +} +})(); diff --git a/modules/enterprise/gui/rest-examples-war/src/main/webapp/js/d3.time.js b/modules/enterprise/gui/rest-examples-war/src/main/webapp/js/d3.time.js new file mode 100755 index 0000000..4c1cda4 --- /dev/null +++ b/modules/enterprise/gui/rest-examples-war/src/main/webapp/js/d3.time.js @@ -0,0 +1,687 @@ +(function(){d3.time = {}; + +var d3_time = Date; +d3.time.format = function(template) { + var n = template.length; + + function format(date) { + var string = [], + i = -1, + j = 0, + c, + f; + while (++i < n) { + if (template.charCodeAt(i) == 37) { + string.push( + template.substring(j, i), + (f = d3_time_formats[c = template.charAt(++i)]) + ? f(date) : c); + j = i + 1; + } + } + string.push(template.substring(j, i)); + return string.join(""); + } + + format.parse = function(string) { + var date = new d3_time(1900, 0, 1), + i = d3_time_parse(date, template, string, 0); + if (i != string.length) return null; + if (date.hour12) { + var hours = date.getHours() % 12; + date.setHours(date.hour12pm ? hours + 12 : hours); + } + delete date.hour12; + delete date.hour12pm; + return date; + }; + + format.toString = function() { + return template; + }; + + return format; +}; + +function d3_time_parse(date, template, string, j) { + var c, + p, + i = 0, + n = template.length, + m = string.length; + while (i < n) { + if (j >= m) return -1; + c = template.charCodeAt(i++); + if (c == 37) { + p = d3_time_parsers[template.charAt(i++)]; + if (!p || ((j = p(date, string, j)) < 0)) return -1; + } else if (c != string.charCodeAt(j++)) { + return -1; + } + } + return j; +} + +var d3_time_zfill2 = d3.format("02d"), + d3_time_zfill3 = d3.format("03d"), + d3_time_zfill4 = d3.format("04d"), + d3_time_sfill2 = d3.format("2d"); + +var d3_time_formats = { + a: function(d) { return d3_time_weekdays[d.getDay()].substring(0, 3); }, + A: function(d) { return d3_time_weekdays[d.getDay()]; }, + b: function(d) { return d3_time_months[d.getMonth()].substring(0, 3); }, + B: function(d) { return d3_time_months[d.getMonth()]; }, + c: d3.time.format("%a %b %e %H:%M:%S %Y"), + d: function(d) { return d3_time_zfill2(d.getDate()); }, + e: function(d) { return d3_time_sfill2(d.getDate()); }, + H: function(d) { return d3_time_zfill2(d.getHours()); }, + I: function(d) { return d3_time_zfill2(d.getHours() % 12 || 12); }, + j: d3_time_dayOfYear, + L: function(d) { return d3_time_zfill3(d.getMilliseconds()); }, + m: function(d) { return d3_time_zfill2(d.getMonth() + 1); }, + M: function(d) { return d3_time_zfill2(d.getMinutes()); }, + p: function(d) { return d.getHours() >= 12 ? "PM" : "AM"; }, + S: function(d) { return d3_time_zfill2(d.getSeconds()); }, + U: d3_time_weekNumberSunday, + w: function(d) { return d.getDay(); }, + W: d3_time_weekNumberMonday, + x: d3.time.format("%m/%d/%y"), + X: d3.time.format("%H:%M:%S"), + y: function(d) { return d3_time_zfill2(d.getFullYear() % 100); }, + Y: function(d) { return d3_time_zfill4(d.getFullYear() % 10000); }, + Z: d3_time_zone, + "%": function(d) { return "%"; } +}; + +var d3_time_parsers = { + a: d3_time_parseWeekdayAbbrev, + A: d3_time_parseWeekday, + b: d3_time_parseMonthAbbrev, + B: d3_time_parseMonth, + c: d3_time_parseLocaleFull, + d: d3_time_parseDay, + e: d3_time_parseDay, + H: d3_time_parseHour24, + I: d3_time_parseHour12, + // j: function(d, s, i) { /*TODO day of year [001,366] */ return i; }, + L: d3_time_parseMilliseconds, + m: d3_time_parseMonthNumber, + M: d3_time_parseMinutes, + p: d3_time_parseAmPm, + S: d3_time_parseSeconds, + // U: function(d, s, i) { /*TODO week number (sunday) [00,53] */ return i; }, + // w: function(d, s, i) { /*TODO weekday [0,6] */ return i; }, + // W: function(d, s, i) { /*TODO week number (monday) [00,53] */ return i; }, + x: d3_time_parseLocaleDate, + X: d3_time_parseLocaleTime, + y: d3_time_parseYear, + Y: d3_time_parseFullYear + // , + // Z: function(d, s, i) { /*TODO time zone */ return i; }, + // "%": function(d, s, i) { /*TODO literal % */ return i; } +}; + +// Note: weekday is validated, but does not set the date. +function d3_time_parseWeekdayAbbrev(date, string, i) { + return string.substring(i, i += 3).toLowerCase() in d3_time_weekdayAbbrevLookup ? i : -1; +} + +var d3_time_weekdayAbbrevLookup = { + sun: 3, + mon: 3, + tue: 3, + wed: 3, + thu: 3, + fri: 3, + sat: 3 +}; + +// Note: weekday is validated, but does not set the date. +function d3_time_parseWeekday(date, string, i) { + d3_time_weekdayRe.lastIndex = 0; + var n = d3_time_weekdayRe.exec(string.substring(i, i + 10)); + return n ? i += n[0].length : -1; +} + +var d3_time_weekdayRe = /^(?:Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday)/ig; + +var d3_time_weekdays = [ + "Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday" +]; + +function d3_time_parseMonthAbbrev(date, string, i) { + var n = d3_time_monthAbbrevLookup[string.substring(i, i += 3).toLowerCase()]; + return n == null ? -1 : (date.setMonth(n), i); +} + +var d3_time_monthAbbrevLookup = { + jan: 0, + feb: 1, + mar: 2, + apr: 3, + may: 4, + jun: 5, + jul: 6, + aug: 7, + sep: 8, + oct: 9, + nov: 10, + dec: 11 +}; + +function d3_time_parseMonth(date, string, i) { + d3_time_monthRe.lastIndex = 0; + var n = d3_time_monthRe.exec(string.substring(i, i + 12)); + return n ? (date.setMonth(d3_time_monthLookup[n[0].toLowerCase()]), i += n[0].length) : -1; +} + +var d3_time_monthRe = /^(?:January|February|March|April|May|June|July|August|September|October|November|December)/ig; + +var d3_time_monthLookup = { + january: 0, + february: 1, + march: 2, + april: 3, + may: 4, + june: 5, + july: 6, + august: 7, + september: 8, + october: 9, + november: 10, + december: 11 +}; + +var d3_time_months = [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December" +]; + +function d3_time_parseLocaleFull(date, string, i) { + return d3_time_parse(date, d3_time_formats.c.toString(), string, i); +} + +function d3_time_parseLocaleDate(date, string, i) { + return d3_time_parse(date, d3_time_formats.x.toString(), string, i); +} + +function d3_time_parseLocaleTime(date, string, i) { + return d3_time_parse(date, d3_time_formats.X.toString(), string, i); +} + +function d3_time_parseFullYear(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 4)); + return n ? (date.setFullYear(n[0]), i += n[0].length) : -1; +} + +function d3_time_parseYear(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 2)); + return n ? (date.setFullYear(d3_time_century() + +n[0]), i += n[0].length) : -1; +} + +function d3_time_century() { + return ~~(new Date().getFullYear() / 1000) * 1000; +} + +function d3_time_parseMonthNumber(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 2)); + return n ? (date.setMonth(n[0] - 1), i += n[0].length) : -1; +} + +function d3_time_parseDay(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 2)); + return n ? (date.setDate(+n[0]), i += n[0].length) : -1; +} + +// Note: we don't validate that the hour is in the range [0,23]. +function d3_time_parseHour24(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 2)); + return n ? (date.setHours(+n[0]), i += n[0].length) : -1; +} + +// Note: we don't validate that the hour is in the range [1,12]. +function d3_time_parseHour12(date, string, i) { + date.hour12 = true; + return d3_time_parseHour24(date, string, i); +} + +function d3_time_parseMinutes(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 2)); + return n ? (date.setMinutes(+n[0]), i += n[0].length) : -1; +} + +function d3_time_parseSeconds(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 2)); + return n ? (date.setSeconds(+n[0]), i += n[0].length) : -1; +} + +function d3_time_parseMilliseconds(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 3)); + return n ? (date.setMilliseconds(+n[0]), i += n[0].length) : -1; +} + +// Note: we don't look at the next directive. +var d3_time_numberRe = /\s*\d+/; + +function d3_time_parseAmPm(date, string, i) { + var n = d3_time_amPmLookup[string.substring(i, i += 2).toLowerCase()]; + return n == null ? -1 : (date.hour12pm = n, i); +} + +var d3_time_amPmLookup = { + am: 0, + pm: 1 +}; + +function d3_time_year(d) { + return new d3_time(d.getFullYear(), 0, 1); +} + +function d3_time_daysElapsed(d0, d1) { + return ~~((d1 - d0) / 864e5 - (d1.getTimezoneOffset() - d0.getTimezoneOffset()) / 1440); +} + +function d3_time_dayOfYear(d) { + return d3_time_zfill3(1 + d3_time_daysElapsed(d3_time_year(d), d)); +} + +function d3_time_weekNumberSunday(d) { + var d0 = d3_time_year(d); + return d3_time_zfill2(~~((d3_time_daysElapsed(d0, d) + d0.getDay()) / 7)); +} + +function d3_time_weekNumberMonday(d) { + var d0 = d3_time_year(d); + return d3_time_zfill2(~~((d3_time_daysElapsed(d0, d) + (d0.getDay() + 6) % 7) / 7)); +} + +// TODO table of time zone offset names? +function d3_time_zone(d) { + var z = d.getTimezoneOffset(), + zs = z > 0 ? "-" : "+", + zh = ~~(Math.abs(z) / 60), + zm = Math.abs(z) % 60; + return zs + d3_time_zfill2(zh) + d3_time_zfill2(zm); +} +d3.time.format.utc = function(template) { + var local = d3.time.format(template); + + function format(date) { + try { + d3_time = d3_time_format_utc; + var utc = new d3_time(); + utc._ = date; + return local(utc); + } finally { + d3_time = Date; + } + } + + format.parse = function(string) { + try { + d3_time = d3_time_format_utc; + var date = local.parse(string); + return date && date._; + } finally { + d3_time = Date; + } + }; + + format.toString = local.toString; + + return format; +}; + +function d3_time_format_utc() { + this._ = new Date(Date.UTC.apply(this, arguments)); +} + +d3_time_format_utc.prototype = { + getDate: function() { return this._.getUTCDate(); }, + getDay: function() { return this._.getUTCDay(); }, + getFullYear: function() { return this._.getUTCFullYear(); }, + getHours: function() { return this._.getUTCHours(); }, + getMilliseconds: function() { return this._.getUTCMilliseconds(); }, + getMinutes: function() { return this._.getUTCMinutes(); }, + getMonth: function() { return this._.getUTCMonth(); }, + getSeconds: function() { return this._.getUTCSeconds(); }, + getTimezoneOffset: function() { return 0; }, + valueOf: function() { return this._.getTime(); }, + setDate: function(x) { this._.setUTCDate(x); }, + setDay: function(x) { this._.setUTCDay(x); }, + setFullYear: function(x) { this._.setUTCFullYear(x); }, + setHours: function(x) { this._.setUTCHours(x); }, + setMilliseconds: function(x) { this._.setUTCMilliseconds(x); }, + setMinutes: function(x) { this._.setUTCMinutes(x); }, + setMonth: function(x) { this._.setUTCMonth(x); }, + setSeconds: function(x) { this._.setUTCSeconds(x); } +}; +var d3_time_formatIso = d3.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ"); + +d3.time.format.iso = Date.prototype.toISOString ? d3_time_formatIsoNative : d3_time_formatIso; + +function d3_time_formatIsoNative(date) { + return date.toISOString(); +} + +d3_time_formatIsoNative.parse = function(string) { + return new Date(string); +}; + +d3_time_formatIsoNative.toString = d3_time_formatIso.toString; +function d3_time_range(floor, step, number) { + return function(t0, t1, dt) { + var time = floor(t0), times = []; + if (time < t0) step(time); + if (dt > 1) { + while (time < t1) { + var date = new Date(+time); + if (!(number(date) % dt)) times.push(date); + step(time); + } + } else { + while (time < t1) times.push(new Date(+time)), step(time); + } + return times; + }; +} +d3.time.second = function(date) { + return new Date(~~(date / 1e3) * 1e3); +}; + +d3.time.second.utc = d3.time.second; +d3.time.seconds = d3_time_range(d3.time.second, function(date) { + date.setTime(date.getTime() + 1e3); +}, function(date) { + return date.getSeconds(); +}); + +d3.time.seconds.utc = d3.time.seconds; +d3.time.minute = function(date) { + return new Date(~~(date / 6e4) * 6e4); +}; + +d3.time.minute.utc = d3.time.minute;d3.time.minutes = d3_time_range(d3.time.minute, d3_time_minutesStep, function(date) { + return date.getMinutes(); +}); + +d3.time.minutes.utc = d3_time_range(d3.time.minute, d3_time_minutesStep, function(date) { + return date.getUTCMinutes(); +}); + +function d3_time_minutesStep(date) { + date.setTime(date.getTime() + 6e4); // assumes no leap seconds +} +d3.time.hour = function(date) { + var offset = date.getTimezoneOffset() / 60; + return new Date((~~(date / 36e5 - offset) + offset) * 36e5); +}; + +d3.time.hour.utc = function(date) { + return new Date(~~(date / 36e5) * 36e5); +}; +d3.time.hours = d3_time_range(d3.time.hour, d3_time_hoursStep, function(date) { + return date.getHours(); +}); + +d3.time.hours.utc = d3_time_range(d3.time.hour.utc, d3_time_hoursStep, function(date) { + return date.getUTCHours(); +}); + +function d3_time_hoursStep(date) { + date.setTime(date.getTime() + 36e5); +} +d3.time.day = function(date) { + return new Date(date.getFullYear(), date.getMonth(), date.getDate()); +}; + +d3.time.day.utc = function(date) { + return new Date(~~(date / 864e5) * 864e5); +}; +d3.time.days = d3_time_range(d3.time.day, function(date) { + date.setDate(date.getDate() + 1); +}, function(date) { + return date.getDate() - 1; +}); + +d3.time.days.utc = d3_time_range(d3.time.day.utc, function(date) { + date.setUTCDate(date.getUTCDate() + 1); +}, function(date) { + return date.getUTCDate() - 1; +}); +d3.time.week = function(date) { + (date = d3.time.day(date)).setDate(date.getDate() - date.getDay()); + return date; +}; + +d3.time.week.utc = function(date) { + (date = d3.time.day.utc(date)).setUTCDate(date.getUTCDate() - date.getUTCDay()); + return date; +}; +d3.time.weeks = d3_time_range(d3.time.week, function(date) { + date.setDate(date.getDate() + 7); +}, function(date) { + return ~~((date - new Date(date.getFullYear(), 0, 1)) / 6048e5); +}); + +d3.time.weeks.utc = d3_time_range(d3.time.week.utc, function(date) { + date.setUTCDate(date.getUTCDate() + 7); +}, function(date) { + return ~~((date - Date.UTC(date.getUTCFullYear(), 0, 1)) / 6048e5); +}); +d3.time.month = function(date) { + return new Date(date.getFullYear(), date.getMonth(), 1); +}; + +d3.time.month.utc = function(date) { + return new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), 1)); +}; +d3.time.months = d3_time_range(d3.time.month, function(date) { + date.setMonth(date.getMonth() + 1); +}, function(date) { + return date.getMonth(); +}); + +d3.time.months.utc = d3_time_range(d3.time.month.utc, function(date) { + date.setUTCMonth(date.getUTCMonth() + 1); +}, function(date) { + return date.getUTCMonth(); +}); +d3.time.year = function(date) { + return new Date(date.getFullYear(), 0, 1); +}; + +d3.time.year.utc = function(date) { + return new Date(Date.UTC(date.getUTCFullYear(), 0, 1)); +}; +d3.time.years = d3_time_range(d3.time.year, function(date) { + date.setFullYear(date.getFullYear() + 1); +}, function(date) { + return date.getFullYear(); +}); + +d3.time.years.utc = d3_time_range(d3.time.year.utc, function(date) { + date.setUTCFullYear(date.getUTCFullYear() + 1); +}, function(date) { + return date.getUTCFullYear(); +}); +// TODO nice +function d3_time_scale(linear, methods, format) { + + function scale(x) { + return linear(x); + } + + scale.invert = function(x) { + return d3_time_scaleDate(linear.invert(x)); + }; + + scale.domain = function(x) { + if (!arguments.length) return linear.domain().map(d3_time_scaleDate); + linear.domain(x); + return scale; + }; + + scale.ticks = function(m, k) { + var extent = d3_time_scaleExtent(scale.domain()); + if (typeof m !== "function") { + var span = extent[1] - extent[0], + target = span / m, + i = d3.bisect(d3_time_scaleSteps, target, 1, d3_time_scaleSteps.length - 1); + if (Math.log(target / d3_time_scaleSteps[i - 1]) < Math.log(d3_time_scaleSteps[i] / target)) --i; + m = methods[i]; + k = m[1]; + m = m[0]; + } + return m(extent[0], extent[1], k); + }; + + scale.tickFormat = function() { + return format; + }; + + scale.copy = function() { + return d3_time_scale(linear.copy(), methods, format); + }; + + // TOOD expose d3_scale_linear_rebind? + return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp"); +} + +// TODO expose d3_scaleExtent? +function d3_time_scaleExtent(domain) { + var start = domain[0], stop = domain[domain.length - 1]; + return start < stop ? [start, stop] : [stop, start]; +} + +function d3_time_scaleDate(t) { + return new Date(t); +} + +function d3_time_scaleFormat(formats) { + return function(date) { + var i = formats.length - 1, f = formats[i]; + while (!f[1](date)) f = formats[--i]; + return f[0](date); + }; +} + +var d3_time_scaleSteps = [ + 1e3, // 1-second + 5e3, // 5-second + 15e3, // 15-second + 3e4, // 30-second + 6e4, // 1-minute + 3e5, // 5-minute + 9e5, // 15-minute + 18e5, // 30-minute + 36e5, // 1-hour + 108e5, // 3-hour + 216e5, // 6-hour + 432e5, // 12-hour + 864e5, // 1-day + 1728e5, // 2-day + 6048e5, // 1-week + 1728e6, // 1-month + 7776e6, // 3-month + 31536e6 // 1-year +]; + +var d3_time_scaleLocalMethods = [ + [d3.time.seconds, 1], + [d3.time.seconds, 5], + [d3.time.seconds, 15], + [d3.time.seconds, 30], + [d3.time.minutes, 1], + [d3.time.minutes, 5], + [d3.time.minutes, 15], + [d3.time.minutes, 30], + [d3.time.hours, 1], + [d3.time.hours, 3], + [d3.time.hours, 6], + [d3.time.hours, 12], + [d3.time.days, 1], + [d3.time.days, 2], + [d3.time.weeks, 1], + [d3.time.months, 1], + [d3.time.months, 3], + [d3.time.years, 1] +]; + +var d3_time_scaleLocalFormats = [ + [d3.time.format("%Y"), function(d) { return true; }], + [d3.time.format("%B"), function(d) { return d.getMonth(); }], + [d3.time.format("%b %d"), function(d) { return d.getDate() != 1; }], + [d3.time.format("%a %d"), function(d) { return d.getDay() && d.getDate() != 1; }], + [d3.time.format("%I %p"), function(d) { return d.getHours(); }], + [d3.time.format("%I:%M"), function(d) { return d.getMinutes(); }], + [d3.time.format(":%S"), function(d) { return d.getSeconds() || d.getMilliseconds(); }] +]; + +var d3_time_scaleLocalFormat = d3_time_scaleFormat(d3_time_scaleLocalFormats); + +d3.time.scale = function() { + return d3_time_scale(d3.scale.linear(), d3_time_scaleLocalMethods, d3_time_scaleLocalFormat); +}; +var d3_time_scaleUTCMethods = [ + [d3.time.seconds.utc, 1], + [d3.time.seconds.utc, 5], + [d3.time.seconds.utc, 15], + [d3.time.seconds.utc, 30], + [d3.time.minutes.utc, 1], + [d3.time.minutes.utc, 5], + [d3.time.minutes.utc, 15], + [d3.time.minutes.utc, 30], + [d3.time.hours.utc, 1], + [d3.time.hours.utc, 3], + [d3.time.hours.utc, 6], + [d3.time.hours.utc, 12], + [d3.time.days.utc, 1], + [d3.time.days.utc, 2], + [d3.time.weeks.utc, 1], + [d3.time.months.utc, 1], + [d3.time.months.utc, 3], + [d3.time.years.utc, 1] +]; + +var d3_time_scaleUTCFormats = [ + [d3.time.format.utc("%Y"), function(d) { return true; }], + [d3.time.format.utc("%B"), function(d) { return d.getUTCMonth(); }], + [d3.time.format.utc("%b %d"), function(d) { return d.getUTCDate() != 1; }], + [d3.time.format.utc("%a %d"), function(d) { return d.getUTCDay() && d.getUTCDate() != 1; }], + [d3.time.format.utc("%I %p"), function(d) { return d.getUTCHours(); }], + [d3.time.format.utc("%I:%M"), function(d) { return d.getUTCMinutes(); }], + [d3.time.format.utc(":%S"), function(d) { return d.getUTCSeconds() || d.getUTCMilliseconds(); }] +]; + +var d3_time_scaleUTCFormat = d3_time_scaleFormat(d3_time_scaleUTCFormats); + +d3.time.scale.utc = function() { + return d3_time_scale(d3.scale.linear(), d3_time_scaleUTCMethods, d3_time_scaleUTCFormat); +}; +})(); diff --git a/modules/enterprise/gui/rest-examples-war/src/main/webapp/js/jquery.js b/modules/enterprise/gui/rest-examples-war/src/main/webapp/js/jquery.js new file mode 100644 index 0000000..8ccd0ea --- /dev/null +++ b/modules/enterprise/gui/rest-examples-war/src/main/webapp/js/jquery.js @@ -0,0 +1,9266 @@ +/*! + * jQuery JavaScript Library v1.7.1 + * http://jquery.com/ + * + * Copyright 2011, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2011, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Mon Nov 21 21:11:03 2011 -0500 + */ +(function( window, undefined ) { + +// Use the correct document accordingly with window argument (sandbox) +var document = window.document, + navigator = window.navigator, + location = window.location; +var jQuery = (function() { + +// Define a local copy of jQuery +var jQuery = function( selector, context ) { + // The jQuery object is actually just the init constructor 'enhanced' + return new jQuery.fn.init( selector, context, rootjQuery ); + }, + + // Map over jQuery in case of overwrite + _jQuery = window.jQuery, + + // Map over the $ in case of overwrite + _$ = window.$, + + // A central reference to the root jQuery(document) + rootjQuery, + + // A simple way to check for HTML strings or ID strings + // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) + quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w-]*)$)/, + + // Check if a string has a non-whitespace character in it + rnotwhite = /\S/, + + // Used for trimming whitespace + trimLeft = /^\s+/, + trimRight = /\s+$/, + + // Match a standalone tag + rsingleTag = /^<(\w+)\s*/?>(?:</\1>)?$/, + + // JSON RegExp + rvalidchars = /^[],:{}\s]*$/, + rvalidescape = /\(?:["\/bfnrt]|u[0-9a-fA-F]{4})/g, + rvalidtokens = /"[^"\\n\r]*"|true|false|null|-?\d+(?:.\d*)?(?:[eE][+-]?\d+)?/g, + rvalidbraces = /(?:^|:|,)(?:\s*[)+/g, + + // Useragent RegExp + rwebkit = /(webkit)[ /]([\w.]+)/, + ropera = /(opera)(?:.*version)?[ /]([\w.]+)/, + rmsie = /(msie) ([\w.]+)/, + rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/, + + // Matches dashed string for camelizing + rdashAlpha = /-([a-z]|[0-9])/ig, + rmsPrefix = /^-ms-/, + + // Used by jQuery.camelCase as callback to replace() + fcamelCase = function( all, letter ) { + return ( letter + "" ).toUpperCase(); + }, + + // Keep a UserAgent string for use with jQuery.browser + userAgent = navigator.userAgent, + + // For matching the engine and version of the browser + browserMatch, + + // The deferred used on DOM ready + readyList, + + // The ready event handler + DOMContentLoaded, + + // Save a reference to some core methods + toString = Object.prototype.toString, + hasOwn = Object.prototype.hasOwnProperty, + push = Array.prototype.push, + slice = Array.prototype.slice, + trim = String.prototype.trim, + indexOf = Array.prototype.indexOf, + + // [[Class]] -> type pairs + class2type = {}; + +jQuery.fn = jQuery.prototype = { + constructor: jQuery, + init: function( selector, context, rootjQuery ) { + var match, elem, ret, doc; + + // Handle $(""), $(null), or $(undefined) + if ( !selector ) { + return this; + } + + // Handle $(DOMElement) + if ( selector.nodeType ) { + this.context = this[0] = selector; + this.length = 1; + return this; + } + + // The body element only exists once, optimize finding it + if ( selector === "body" && !context && document.body ) { + this.context = document; + this[0] = document.body; + this.selector = selector; + this.length = 1; + return this; + } + + // Handle HTML strings + if ( typeof selector === "string" ) { + // Are we dealing with HTML string or an ID? + if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { + // Assume that strings that start and end with <> are HTML and skip the regex check + match = [ null, selector, null ]; + + } else { + match = quickExpr.exec( selector ); + } + + // Verify a match, and that no context was specified for #id + if ( match && (match[1] || !context) ) { + + // HANDLE: $(html) -> $(array) + if ( match[1] ) { + context = context instanceof jQuery ? context[0] : context; + doc = ( context ? context.ownerDocument || context : document ); + + // If a single string is passed in and it's a single tag + // just do a createElement and skip the rest + ret = rsingleTag.exec( selector ); + + if ( ret ) { + if ( jQuery.isPlainObject( context ) ) { + selector = [ document.createElement( ret[1] ) ]; + jQuery.fn.attr.call( selector, context, true ); + + } else { + selector = [ doc.createElement( ret[1] ) ]; + } + + } else { + ret = jQuery.buildFragment( [ match[1] ], [ doc ] ); + selector = ( ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment ).childNodes; + } + + return jQuery.merge( this, selector ); + + // HANDLE: $("#id") + } else { + elem = document.getElementById( match[2] ); + + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + if ( elem && elem.parentNode ) { + // Handle the case where IE and Opera return items + // by name instead of ID + if ( elem.id !== match[2] ) { + return rootjQuery.find( selector ); + } + + // Otherwise, we inject the element directly into the jQuery object + this.length = 1; + this[0] = elem; + } + + this.context = document; + this.selector = selector; + return this; + } + + // HANDLE: $(expr, $(...)) + } else if ( !context || context.jquery ) { + return ( context || rootjQuery ).find( selector ); + + // HANDLE: $(expr, context) + // (which is just equivalent to: $(context).find(expr) + } else { + return this.constructor( context ).find( selector ); + } + + // HANDLE: $(function) + // Shortcut for document ready + } else if ( jQuery.isFunction( selector ) ) { + return rootjQuery.ready( selector ); + } + + if ( selector.selector !== undefined ) { + this.selector = selector.selector; + this.context = selector.context; + } + + return jQuery.makeArray( selector, this ); + }, + + // Start with an empty selector + selector: "", + + // The current version of jQuery being used + jquery: "1.7.1", + + // The default length of a jQuery object is 0 + length: 0, + + // The number of elements contained in the matched element set + size: function() { + return this.length; + }, + + toArray: function() { + return slice.call( this, 0 ); + }, + + // Get the Nth element in the matched element set OR + // Get the whole matched element set as a clean array + get: function( num ) { + return num == null ? + + // Return a 'clean' array + this.toArray() : + + // Return just the object + ( num < 0 ? this[ this.length + num ] : this[ num ] ); + }, + + // Take an array of elements and push it onto the stack + // (returning the new matched element set) + pushStack: function( elems, name, selector ) { + // Build a new jQuery matched element set + var ret = this.constructor(); + + if ( jQuery.isArray( elems ) ) { + push.apply( ret, elems ); + + } else { + jQuery.merge( ret, elems ); + } + + // Add the old object onto the stack (as a reference) + ret.prevObject = this; + + ret.context = this.context; + + if ( name === "find" ) { + ret.selector = this.selector + ( this.selector ? " " : "" ) + selector; + } else if ( name ) { + ret.selector = this.selector + "." + name + "(" + selector + ")"; + } + + // Return the newly-formed element set + return ret; + }, + + // Execute a callback for every element in the matched set. + // (You can seed the arguments with an array of args, but this is + // only used internally.) + each: function( callback, args ) { + return jQuery.each( this, callback, args ); + }, + + ready: function( fn ) { + // Attach the listeners + jQuery.bindReady(); + + // Add the callback + readyList.add( fn ); + + return this; + }, + + eq: function( i ) { + i = +i; + return i === -1 ? + this.slice( i ) : + this.slice( i, i + 1 ); + }, + + first: function() { + return this.eq( 0 ); + }, + + last: function() { + return this.eq( -1 ); + }, + + slice: function() { + return this.pushStack( slice.apply( this, arguments ), + "slice", slice.call(arguments).join(",") ); + }, + + map: function( callback ) { + return this.pushStack( jQuery.map(this, function( elem, i ) { + return callback.call( elem, i, elem ); + })); + }, + + end: function() { + return this.prevObject || this.constructor(null); + }, + + // For internal use only. + // Behaves like an Array's method, not like a jQuery method. + push: push, + sort: [].sort, + splice: [].splice +}; + +// Give the init function the jQuery prototype for later instantiation +jQuery.fn.init.prototype = jQuery.fn; + +jQuery.extend = jQuery.fn.extend = function() { + var options, name, src, copy, copyIsArray, clone, + target = arguments[0] || {}, + i = 1, + length = arguments.length, + deep = false; + + // Handle a deep copy situation + if ( typeof target === "boolean" ) { + deep = target; + target = arguments[1] || {}; + // skip the boolean and the target + i = 2; + } + + // Handle case when target is a string or something (possible in deep copy) + if ( typeof target !== "object" && !jQuery.isFunction(target) ) { + target = {}; + } + + // extend jQuery itself if only one argument is passed + if ( length === i ) { + target = this; + --i; + } + + for ( ; i < length; i++ ) { + // Only deal with non-null/undefined values + if ( (options = arguments[ i ]) != null ) { + // Extend the base object + for ( name in options ) { + src = target[ name ]; + copy = options[ name ]; + + // Prevent never-ending loop + if ( target === copy ) { + continue; + } + + // Recurse if we're merging plain objects or arrays + if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { + if ( copyIsArray ) { + copyIsArray = false; + clone = src && jQuery.isArray(src) ? src : []; + + } else { + clone = src && jQuery.isPlainObject(src) ? src : {}; + } + + // Never move original objects, clone them + target[ name ] = jQuery.extend( deep, clone, copy ); + + // Don't bring in undefined values + } else if ( copy !== undefined ) { + target[ name ] = copy; + } + } + } + } + + // Return the modified object + return target; +}; + +jQuery.extend({ + noConflict: function( deep ) { + if ( window.$ === jQuery ) { + window.$ = _$; + } + + if ( deep && window.jQuery === jQuery ) { + window.jQuery = _jQuery; + } + + return jQuery; + }, + + // Is the DOM ready to be used? Set to true once it occurs. + isReady: false, + + // A counter to track how many items to wait for before + // the ready event fires. See #6781 + readyWait: 1, + + // Hold (or release) the ready event + holdReady: function( hold ) { + if ( hold ) { + jQuery.readyWait++; + } else { + jQuery.ready( true ); + } + }, + + // Handle when the DOM is ready + ready: function( wait ) { + // Either a released hold or an DOMready/load event and not yet ready + if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) { + // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). + if ( !document.body ) { + return setTimeout( jQuery.ready, 1 ); + } + + // Remember that the DOM is ready + jQuery.isReady = true; + + // If a normal DOM Ready event fired, decrement, and wait if need be + if ( wait !== true && --jQuery.readyWait > 0 ) { + return; + } + + // If there are functions bound, to execute + readyList.fireWith( document, [ jQuery ] ); + + // Trigger any bound ready events + if ( jQuery.fn.trigger ) { + jQuery( document ).trigger( "ready" ).off( "ready" ); + } + } + }, + + bindReady: function() { + if ( readyList ) { + return; + } + + readyList = jQuery.Callbacks( "once memory" ); + + // Catch cases where $(document).ready() is called after the + // browser event has already occurred. + if ( document.readyState === "complete" ) { + // Handle it asynchronously to allow scripts the opportunity to delay ready + return setTimeout( jQuery.ready, 1 ); + } + + // Mozilla, Opera and webkit nightlies currently support this event + if ( document.addEventListener ) { + // Use the handy event callback + document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); + + // A fallback to window.onload, that will always work + window.addEventListener( "load", jQuery.ready, false ); + + // If IE event model is used + } else if ( document.attachEvent ) { + // ensure firing before onload, + // maybe late but safe also for iframes + document.attachEvent( "onreadystatechange", DOMContentLoaded ); + + // A fallback to window.onload, that will always work + window.attachEvent( "onload", jQuery.ready ); + + // If IE and not a frame + // continually check to see if the document is ready + var toplevel = false; + + try { + toplevel = window.frameElement == null; + } catch(e) {} + + if ( document.documentElement.doScroll && toplevel ) { + doScrollCheck(); + } + } + }, + + // See test/unit/core.js for details concerning isFunction. + // Since version 1.3, DOM methods and functions like alert + // aren't supported. They return false on IE (#2968). + isFunction: function( obj ) { + return jQuery.type(obj) === "function"; + }, + + isArray: Array.isArray || function( obj ) { + return jQuery.type(obj) === "array"; + }, + + // A crude way of determining if an object is a window + isWindow: function( obj ) { + return obj && typeof obj === "object" && "setInterval" in obj; + }, + + isNumeric: function( obj ) { + return !isNaN( parseFloat(obj) ) && isFinite( obj ); + }, + + type: function( obj ) { + return obj == null ? + String( obj ) : + class2type[ toString.call(obj) ] || "object"; + }, + + isPlainObject: function( obj ) { + // Must be an Object. + // Because of IE, we also have to check the presence of the constructor property. + // Make sure that DOM nodes and window objects don't pass through, as well + if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { + return false; + } + + try { + // Not own constructor property must be Object + if ( obj.constructor && + !hasOwn.call(obj, "constructor") && + !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { + return false; + } + } catch ( e ) { + // IE8,9 Will throw exceptions on certain host objects #9897 + return false; + } + + // Own properties are enumerated firstly, so to speed up, + // if last one is own, then all properties are own. + + var key; + for ( key in obj ) {} + + return key === undefined || hasOwn.call( obj, key ); + }, + + isEmptyObject: function( obj ) { + for ( var name in obj ) { + return false; + } + return true; + }, + + error: function( msg ) { + throw new Error( msg ); + }, + + parseJSON: function( data ) { + if ( typeof data !== "string" || !data ) { + return null; + } + + // Make sure leading/trailing whitespace is removed (IE can't handle it) + data = jQuery.trim( data ); + + // Attempt to parse using the native JSON parser first + if ( window.JSON && window.JSON.parse ) { + return window.JSON.parse( data ); + } + + // Make sure the incoming data is actual JSON + // Logic borrowed from http://json.org/json2.js + if ( rvalidchars.test( data.replace( rvalidescape, "@" ) + .replace( rvalidtokens, "]" ) + .replace( rvalidbraces, "")) ) { + + return ( new Function( "return " + data ) )(); + + } + jQuery.error( "Invalid JSON: " + data ); + }, + + // Cross-browser xml parsing + parseXML: function( data ) { + var xml, tmp; + try { + if ( window.DOMParser ) { // Standard + tmp = new DOMParser(); + xml = tmp.parseFromString( data , "text/xml" ); + } else { // IE + xml = new ActiveXObject( "Microsoft.XMLDOM" ); + xml.async = "false"; + xml.loadXML( data ); + } + } catch( e ) { + xml = undefined; + } + if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { + jQuery.error( "Invalid XML: " + data ); + } + return xml; + }, + + noop: function() {}, + + // Evaluates a script in a global context + // Workarounds based on findings by Jim Driscoll + // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-glo... + globalEval: function( data ) { + if ( data && rnotwhite.test( data ) ) { + // We use execScript on Internet Explorer + // We use an anonymous function so that context is window + // rather than jQuery in Firefox + ( window.execScript || function( data ) { + window[ "eval" ].call( window, data ); + } )( data ); + } + }, + + // Convert dashed to camelCase; used by the css and data modules + // Microsoft forgot to hump their vendor prefix (#9572) + camelCase: function( string ) { + return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); + }, + + nodeName: function( elem, name ) { + return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); + }, + + // args is for internal usage only + each: function( object, callback, args ) { + var name, i = 0, + length = object.length, + isObj = length === undefined || jQuery.isFunction( object ); + + if ( args ) { + if ( isObj ) { + for ( name in object ) { + if ( callback.apply( object[ name ], args ) === false ) { + break; + } + } + } else { + for ( ; i < length; ) { + if ( callback.apply( object[ i++ ], args ) === false ) { + break; + } + } + } + + // A special, fast, case for the most common use of each + } else { + if ( isObj ) { + for ( name in object ) { + if ( callback.call( object[ name ], name, object[ name ] ) === false ) { + break; + } + } + } else { + for ( ; i < length; ) { + if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) { + break; + } + } + } + } + + return object; + }, + + // Use native String.trim function wherever possible + trim: trim ? + function( text ) { + return text == null ? + "" : + trim.call( text ); + } : + + // Otherwise use our own trimming functionality + function( text ) { + return text == null ? + "" : + text.toString().replace( trimLeft, "" ).replace( trimRight, "" ); + }, + + // results is for internal usage only + makeArray: function( array, results ) { + var ret = results || []; + + if ( array != null ) { + // The window, strings (and functions) also have 'length' + // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 + var type = jQuery.type( array ); + + if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) { + push.call( ret, array ); + } else { + jQuery.merge( ret, array ); + } + } + + return ret; + }, + + inArray: function( elem, array, i ) { + var len; + + if ( array ) { + if ( indexOf ) { + return indexOf.call( array, elem, i ); + } + + len = array.length; + i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; + + for ( ; i < len; i++ ) { + // Skip accessing in sparse arrays + if ( i in array && array[ i ] === elem ) { + return i; + } + } + } + + return -1; + }, + + merge: function( first, second ) { + var i = first.length, + j = 0; + + if ( typeof second.length === "number" ) { + for ( var l = second.length; j < l; j++ ) { + first[ i++ ] = second[ j ]; + } + + } else { + while ( second[j] !== undefined ) { + first[ i++ ] = second[ j++ ]; + } + } + + first.length = i; + + return first; + }, + + grep: function( elems, callback, inv ) { + var ret = [], retVal; + inv = !!inv; + + // Go through the array, only saving the items + // that pass the validator function + for ( var i = 0, length = elems.length; i < length; i++ ) { + retVal = !!callback( elems[ i ], i ); + if ( inv !== retVal ) { + ret.push( elems[ i ] ); + } + } + + return ret; + }, + + // arg is for internal usage only + map: function( elems, callback, arg ) { + var value, key, ret = [], + i = 0, + length = elems.length, + // jquery objects are treated as arrays + isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ; + + // Go through the array, translating each of the items to their + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret[ ret.length ] = value; + } + } + + // Go through every key on the object, + } else { + for ( key in elems ) { + value = callback( elems[ key ], key, arg ); + + if ( value != null ) { + ret[ ret.length ] = value; + } + } + } + + // Flatten any nested arrays + return ret.concat.apply( [], ret ); + }, + + // A global GUID counter for objects + guid: 1, + + // Bind a function to a context, optionally partially applying any + // arguments. + proxy: function( fn, context ) { + if ( typeof context === "string" ) { + var tmp = fn[ context ]; + context = fn; + fn = tmp; + } + + // Quick check to determine if target is callable, in the spec + // this throws a TypeError, but we will just return undefined. + if ( !jQuery.isFunction( fn ) ) { + return undefined; + } + + // Simulated bind + var args = slice.call( arguments, 2 ), + proxy = function() { + return fn.apply( context, args.concat( slice.call( arguments ) ) ); + }; + + // Set the guid of unique handler to the same of original handler, so it can be removed + proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; + + return proxy; + }, + + // Mutifunctional method to get and set values to a collection + // The value/s can optionally be executed if it's a function + access: function( elems, key, value, exec, fn, pass ) { + var length = elems.length; + + // Setting many attributes + if ( typeof key === "object" ) { + for ( var k in key ) { + jQuery.access( elems, k, key[k], exec, fn, value ); + } + return elems; + } + + // Setting one attribute + if ( value !== undefined ) { + // Optionally, function values get executed if exec is true + exec = !pass && exec && jQuery.isFunction(value); + + for ( var i = 0; i < length; i++ ) { + fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); + } + + return elems; + } + + // Getting an attribute + return length ? fn( elems[0], key ) : undefined; + }, + + now: function() { + return ( new Date() ).getTime(); + }, + + // Use of jQuery.browser is frowned upon. + // More details: http://docs.jquery.com/Utilities/jQuery.browser + uaMatch: function( ua ) { + ua = ua.toLowerCase(); + + var match = rwebkit.exec( ua ) || + ropera.exec( ua ) || + rmsie.exec( ua ) || + ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) || + []; + + return { browser: match[1] || "", version: match[2] || "0" }; + }, + + sub: function() { + function jQuerySub( selector, context ) { + return new jQuerySub.fn.init( selector, context ); + } + jQuery.extend( true, jQuerySub, this ); + jQuerySub.superclass = this; + jQuerySub.fn = jQuerySub.prototype = this(); + jQuerySub.fn.constructor = jQuerySub; + jQuerySub.sub = this.sub; + jQuerySub.fn.init = function init( selector, context ) { + if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { + context = jQuerySub( context ); + } + + return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); + }; + jQuerySub.fn.init.prototype = jQuerySub.fn; + var rootjQuerySub = jQuerySub(document); + return jQuerySub; + }, + + browser: {} +}); + +// Populate the class2type map +jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { + class2type[ "[object " + name + "]" ] = name.toLowerCase(); +}); + +browserMatch = jQuery.uaMatch( userAgent ); +if ( browserMatch.browser ) { + jQuery.browser[ browserMatch.browser ] = true; + jQuery.browser.version = browserMatch.version; +} + +// Deprecated, use jQuery.browser.webkit instead +if ( jQuery.browser.webkit ) { + jQuery.browser.safari = true; +} + +// IE doesn't match non-breaking spaces with \s +if ( rnotwhite.test( "\xA0" ) ) { + trimLeft = /^[\s\xA0]+/; + trimRight = /[\s\xA0]+$/; +} + +// All jQuery objects should point back to these +rootjQuery = jQuery(document); + +// Cleanup functions for the document ready method +if ( document.addEventListener ) { + DOMContentLoaded = function() { + document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); + jQuery.ready(); + }; + +} else if ( document.attachEvent ) { + DOMContentLoaded = function() { + // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). + if ( document.readyState === "complete" ) { + document.detachEvent( "onreadystatechange", DOMContentLoaded ); + jQuery.ready(); + } + }; +} + +// The DOM ready check for Internet Explorer +function doScrollCheck() { + if ( jQuery.isReady ) { + return; + } + + try { + // If IE is used, use the trick by Diego Perini + // http://javascript.nwbox.com/IEContentLoaded/ + document.documentElement.doScroll("left"); + } catch(e) { + setTimeout( doScrollCheck, 1 ); + return; + } + + // and execute any waiting functions + jQuery.ready(); +} + +return jQuery; + +})(); + + +// String to Object flags format cache +var flagsCache = {}; + +// Convert String-formatted flags into Object-formatted ones and store in cache +function createFlags( flags ) { + var object = flagsCache[ flags ] = {}, + i, length; + flags = flags.split( /\s+/ ); + for ( i = 0, length = flags.length; i < length; i++ ) { + object[ flags[i] ] = true; + } + return object; +} + +/* + * Create a callback list using the following parameters: + * + * flags: an optional list of space-separated flags that will change how + * the callback list behaves + * + * By default a callback list will act like an event callback list and can be + * "fired" multiple times. + * + * Possible flags: + * + * once: will ensure the callback list can only be fired once (like a Deferred) + * + * memory: will keep track of previous values and will call any callback added + * after the list has been fired right away with the latest "memorized" + * values (like a Deferred) + * + * unique: will ensure a callback can only be added once (no duplicate in the list) + * + * stopOnFalse: interrupt callings when a callback returns false + * + */ +jQuery.Callbacks = function( flags ) { + + // Convert flags from String-formatted to Object-formatted + // (we check in cache first) + flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {}; + + var // Actual callback list + list = [], + // Stack of fire calls for repeatable lists + stack = [], + // Last fire value (for non-forgettable lists) + memory, + // Flag to know if list is currently firing + firing, + // First callback to fire (used internally by add and fireWith) + firingStart, + // End of the loop when firing + firingLength, + // Index of currently firing callback (modified by remove if needed) + firingIndex, + // Add one or several callbacks to the list + add = function( args ) { + var i, + length, + elem, + type, + actual; + for ( i = 0, length = args.length; i < length; i++ ) { + elem = args[ i ]; + type = jQuery.type( elem ); + if ( type === "array" ) { + // Inspect recursively + add( elem ); + } else if ( type === "function" ) { + // Add if not in unique mode and callback is not in + if ( !flags.unique || !self.has( elem ) ) { + list.push( elem ); + } + } + } + }, + // Fire callbacks + fire = function( context, args ) { + args = args || []; + memory = !flags.memory || [ context, args ]; + firing = true; + firingIndex = firingStart || 0; + firingStart = 0; + firingLength = list.length; + for ( ; list && firingIndex < firingLength; firingIndex++ ) { + if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) { + memory = true; // Mark as halted + break; + } + } + firing = false; + if ( list ) { + if ( !flags.once ) { + if ( stack && stack.length ) { + memory = stack.shift(); + self.fireWith( memory[ 0 ], memory[ 1 ] ); + } + } else if ( memory === true ) { + self.disable(); + } else { + list = []; + } + } + }, + // Actual Callbacks object + self = { + // Add a callback or a collection of callbacks to the list + add: function() { + if ( list ) { + var length = list.length; + add( arguments ); + // Do we need to add the callbacks to the + // current firing batch? + if ( firing ) { + firingLength = list.length; + // With memory, if we're not firing then + // we should call right away, unless previous + // firing was halted (stopOnFalse) + } else if ( memory && memory !== true ) { + firingStart = length; + fire( memory[ 0 ], memory[ 1 ] ); + } + } + return this; + }, + // Remove a callback from the list + remove: function() { + if ( list ) { + var args = arguments, + argIndex = 0, + argLength = args.length; + for ( ; argIndex < argLength ; argIndex++ ) { + for ( var i = 0; i < list.length; i++ ) { + if ( args[ argIndex ] === list[ i ] ) { + // Handle firingIndex and firingLength + if ( firing ) { + if ( i <= firingLength ) { + firingLength--; + if ( i <= firingIndex ) { + firingIndex--; + } + } + } + // Remove the element + list.splice( i--, 1 ); + // If we have some unicity property then + // we only need to do this once + if ( flags.unique ) { + break; + } + } + } + } + } + return this; + }, + // Control if a given callback is in the list + has: function( fn ) { + if ( list ) { + var i = 0, + length = list.length; + for ( ; i < length; i++ ) { + if ( fn === list[ i ] ) { + return true; + } + } + } + return false; + }, + // Remove all callbacks from the list + empty: function() { + list = []; + return this; + }, + // Have the list do nothing anymore + disable: function() { + list = stack = memory = undefined; + return this; + }, + // Is it disabled? + disabled: function() { + return !list; + }, + // Lock the list in its current state + lock: function() { + stack = undefined; + if ( !memory || memory === true ) { + self.disable(); + } + return this; + }, + // Is it locked? + locked: function() { + return !stack; + }, + // Call all callbacks with the given context and arguments + fireWith: function( context, args ) { + if ( stack ) { + if ( firing ) { + if ( !flags.once ) { + stack.push( [ context, args ] ); + } + } else if ( !( flags.once && memory ) ) { + fire( context, args ); + } + } + return this; + }, + // Call all the callbacks with the given arguments + fire: function() { + self.fireWith( this, arguments ); + return this; + }, + // To know if the callbacks have already been called at least once + fired: function() { + return !!memory; + } + }; + + return self; +}; + + + + +var // Static reference to slice + sliceDeferred = [].slice; + +jQuery.extend({ + + Deferred: function( func ) { + var doneList = jQuery.Callbacks( "once memory" ), + failList = jQuery.Callbacks( "once memory" ), + progressList = jQuery.Callbacks( "memory" ), + state = "pending", + lists = { + resolve: doneList, + reject: failList, + notify: progressList + }, + promise = { + done: doneList.add, + fail: failList.add, + progress: progressList.add, + + state: function() { + return state; + }, + + // Deprecated + isResolved: doneList.fired, + isRejected: failList.fired, + + then: function( doneCallbacks, failCallbacks, progressCallbacks ) { + deferred.done( doneCallbacks ).fail( failCallbacks ).progress( progressCallbacks ); + return this; + }, + always: function() { + deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments ); + return this; + }, + pipe: function( fnDone, fnFail, fnProgress ) { + return jQuery.Deferred(function( newDefer ) { + jQuery.each( { + done: [ fnDone, "resolve" ], + fail: [ fnFail, "reject" ], + progress: [ fnProgress, "notify" ] + }, function( handler, data ) { + var fn = data[ 0 ], + action = data[ 1 ], + returned; + if ( jQuery.isFunction( fn ) ) { + deferred[ handler ](function() { + returned = fn.apply( this, arguments ); + if ( returned && jQuery.isFunction( returned.promise ) ) { + returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.notify ); + } else { + newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] ); + } + }); + } else { + deferred[ handler ]( newDefer[ action ] ); + } + }); + }).promise(); + }, + // Get a promise for this deferred + // If obj is provided, the promise aspect is added to the object + promise: function( obj ) { + if ( obj == null ) { + obj = promise; + } else { + for ( var key in promise ) { + obj[ key ] = promise[ key ]; + } + } + return obj; + } + }, + deferred = promise.promise({}), + key; + + for ( key in lists ) { + deferred[ key ] = lists[ key ].fire; + deferred[ key + "With" ] = lists[ key ].fireWith; + } + + // Handle state + deferred.done( function() { + state = "resolved"; + }, failList.disable, progressList.lock ).fail( function() { + state = "rejected"; + }, doneList.disable, progressList.lock ); + + // Call given func if any + if ( func ) { + func.call( deferred, deferred ); + } + + // All done! + return deferred; + }, + + // Deferred helper + when: function( firstParam ) { + var args = sliceDeferred.call( arguments, 0 ), + i = 0, + length = args.length, + pValues = new Array( length ), + count = length, + pCount = length, + deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ? + firstParam : + jQuery.Deferred(), + promise = deferred.promise(); + function resolveFunc( i ) { + return function( value ) { + args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; + if ( !( --count ) ) { + deferred.resolveWith( deferred, args ); + } + }; + } + function progressFunc( i ) { + return function( value ) { + pValues[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; + deferred.notifyWith( promise, pValues ); + }; + } + if ( length > 1 ) { + for ( ; i < length; i++ ) { + if ( args[ i ] && args[ i ].promise && jQuery.isFunction( args[ i ].promise ) ) { + args[ i ].promise().then( resolveFunc(i), deferred.reject, progressFunc(i) ); + } else { + --count; + } + } + if ( !count ) { + deferred.resolveWith( deferred, args ); + } + } else if ( deferred !== firstParam ) { + deferred.resolveWith( deferred, length ? [ firstParam ] : [] ); + } + return promise; + } +}); + + + + +jQuery.support = (function() { + + var support, + all, + a, + select, + opt, + input, + marginDiv, + fragment, + tds, + events, + eventName, + i, + isSupported, + div = document.createElement( "div" ), + documentElement = document.documentElement; + + // Preliminary tests + div.setAttribute("className", "t"); + div.innerHTML = " <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>"; + + all = div.getElementsByTagName( "*" ); + a = div.getElementsByTagName( "a" )[ 0 ]; + + // Can't get basic test support + if ( !all || !all.length || !a ) { + return {}; + } + + // First batch of supports tests + select = document.createElement( "select" ); + opt = select.appendChild( document.createElement("option") ); + input = div.getElementsByTagName( "input" )[ 0 ]; + + support = { + // IE strips leading whitespace when .innerHTML is used + leadingWhitespace: ( div.firstChild.nodeType === 3 ), + + // Make sure that tbody elements aren't automatically inserted + // IE will insert them into empty tables + tbody: !div.getElementsByTagName("tbody").length, + + // Make sure that link elements get serialized correctly by innerHTML + // This requires a wrapper element in IE + htmlSerialize: !!div.getElementsByTagName("link").length, + + // Get the style information from getAttribute + // (IE uses .cssText instead) + style: /top/.test( a.getAttribute("style") ), + + // Make sure that URLs aren't manipulated + // (IE normalizes it by default) + hrefNormalized: ( a.getAttribute("href") === "/a" ), + + // Make sure that element opacity exists + // (IE uses filter instead) + // Use a regex to work around a WebKit issue. See #5145 + opacity: /^0.55/.test( a.style.opacity ), + + // Verify style float existence + // (IE uses styleFloat instead of cssFloat) + cssFloat: !!a.style.cssFloat, + + // Make sure that if no value is specified for a checkbox + // that it defaults to "on". + // (WebKit defaults to "" instead) + checkOn: ( input.value === "on" ), + + // Make sure that a selected-by-default option has a working selected property. + // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) + optSelected: opt.selected, + + // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) + getSetAttribute: div.className !== "t", + + // Tests for enctype support on a form(#6743) + enctype: !!document.createElement("form").enctype, + + // Makes sure cloning an html5 element does not cause problems + // Where outerHTML is undefined, this still works + html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>", + + // Will be defined later + submitBubbles: true, + changeBubbles: true, + focusinBubbles: false, + deleteExpando: true, + noCloneEvent: true, + inlineBlockNeedsLayout: false, + shrinkWrapBlocks: false, + reliableMarginRight: true + }; + + // Make sure checked status is properly cloned + input.checked = true; + support.noCloneChecked = input.cloneNode( true ).checked; + + // Make sure that the options inside disabled selects aren't marked as disabled + // (WebKit marks them as disabled) + select.disabled = true; + support.optDisabled = !opt.disabled; + + // Test to see if it's possible to delete an expando from an element + // Fails in Internet Explorer + try { + delete div.test; + } catch( e ) { + support.deleteExpando = false; + } + + if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { + div.attachEvent( "onclick", function() { + // Cloning a node shouldn't copy over any + // bound event handlers (IE does this) + support.noCloneEvent = false; + }); + div.cloneNode( true ).fireEvent( "onclick" ); + } + + // Check if a radio maintains its value + // after being appended to the DOM + input = document.createElement("input"); + input.value = "t"; + input.setAttribute("type", "radio"); + support.radioValue = input.value === "t"; + + input.setAttribute("checked", "checked"); + div.appendChild( input ); + fragment = document.createDocumentFragment(); + fragment.appendChild( div.lastChild ); + + // WebKit doesn't clone checked state correctly in fragments + support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; + + // Check if a disconnected checkbox will retain its checked + // value of true after appended to the DOM (IE6/7) + support.appendChecked = input.checked; + + fragment.removeChild( input ); + fragment.appendChild( div ); + + div.innerHTML = ""; + + // Check if div with explicit width and no margin-right incorrectly + // gets computed margin-right based on width of container. For more + // info see bug #3333 + // Fails in WebKit before Feb 2011 nightlies + // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right + if ( window.getComputedStyle ) { + marginDiv = document.createElement( "div" ); + marginDiv.style.width = "0"; + marginDiv.style.marginRight = "0"; + div.style.width = "2px"; + div.appendChild( marginDiv ); + support.reliableMarginRight = + ( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0; + } + + // Technique from Juriy Zaytsev + // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ + // We only care about the case where non-standard event systems + // are used, namely in IE. Short-circuiting here helps us to + // avoid an eval call (in setAttribute) which can cause CSP + // to go haywire. See: https://developer.mozilla.org/en/Security/CSP + if ( div.attachEvent ) { + for( i in { + submit: 1, + change: 1, + focusin: 1 + }) { + eventName = "on" + i; + isSupported = ( eventName in div ); + if ( !isSupported ) { + div.setAttribute( eventName, "return;" ); + isSupported = ( typeof div[ eventName ] === "function" ); + } + support[ i + "Bubbles" ] = isSupported; + } + } + + fragment.removeChild( div ); + + // Null elements to avoid leaks in IE + fragment = select = opt = marginDiv = div = input = null; + + // Run tests that need a body at doc ready + jQuery(function() { + var container, outer, inner, table, td, offsetSupport, + conMarginTop, ptlm, vb, style, html, + body = document.getElementsByTagName("body")[0]; + + if ( !body ) { + // Return for frameset docs that don't have a body + return; + } + + conMarginTop = 1; + ptlm = "position:absolute;top:0;left:0;width:1px;height:1px;margin:0;"; + vb = "visibility:hidden;border:0;"; + style = "style='" + ptlm + "border:5px solid #000;padding:0;'"; + html = "<div " + style + "><div></div></div>" + + "<table " + style + " cellpadding='0' cellspacing='0'>" + + "<tr><td></td></tr></table>"; + + container = document.createElement("div"); + container.style.cssText = vb + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px"; + body.insertBefore( container, body.firstChild ); + + // Construct the test element + div = document.createElement("div"); + container.appendChild( div ); + + // Check if table cells still have offsetWidth/Height when they are set + // to display:none and there are still other visible table cells in a + // table row; if so, offsetWidth/Height are not reliable for use when + // determining if an element has been hidden directly using + // display:none (it is still safe to use offsets if a parent element is + // hidden; don safety goggles and see bug #4512 for more information). + // (only IE 8 fails this test) + div.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>"; + tds = div.getElementsByTagName( "td" ); + isSupported = ( tds[ 0 ].offsetHeight === 0 ); + + tds[ 0 ].style.display = ""; + tds[ 1 ].style.display = "none"; + + // Check if empty table cells still have offsetWidth/Height + // (IE <= 8 fail this test) + support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); + + // Figure out if the W3C box model works as expected + div.innerHTML = ""; + div.style.width = div.style.paddingLeft = "1px"; + jQuery.boxModel = support.boxModel = div.offsetWidth === 2; + + if ( typeof div.style.zoom !== "undefined" ) { + // Check if natively block-level elements act like inline-block + // elements when setting their display to 'inline' and giving + // them layout + // (IE < 8 does this) + div.style.display = "inline"; + div.style.zoom = 1; + support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 ); + + // Check if elements with layout shrink-wrap their children + // (IE 6 does this) + div.style.display = ""; + div.innerHTML = "<div style='width:4px;'></div>"; + support.shrinkWrapBlocks = ( div.offsetWidth !== 2 ); + } + + div.style.cssText = ptlm + vb; + div.innerHTML = html; + + outer = div.firstChild; + inner = outer.firstChild; + td = outer.nextSibling.firstChild.firstChild; + + offsetSupport = { + doesNotAddBorder: ( inner.offsetTop !== 5 ), + doesAddBorderForTableAndCells: ( td.offsetTop === 5 ) + }; + + inner.style.position = "fixed"; + inner.style.top = "20px"; + + // safari subtracts parent border width here which is 5px + offsetSupport.fixedPosition = ( inner.offsetTop === 20 || inner.offsetTop === 15 ); + inner.style.position = inner.style.top = ""; + + outer.style.overflow = "hidden"; + outer.style.position = "relative"; + + offsetSupport.subtractsBorderForOverflowNotVisible = ( inner.offsetTop === -5 ); + offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop ); + + body.removeChild( container ); + div = container = null; + + jQuery.extend( support, offsetSupport ); + }); + + return support; +})(); + + + + +var rbrace = /^(?:{.*}|[.*])$/, + rmultiDash = /([A-Z])/g; + +jQuery.extend({ + cache: {}, + + // Please use with caution + uuid: 0, + + // Unique for each copy of jQuery on the page + // Non-digits removed to match rinlinejQuery + expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ), + + // The following elements throw uncatchable exceptions if you + // attempt to add expando properties to them. + noData: { + "embed": true, + // Ban all objects except for Flash (which handle expandos) + "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", + "applet": true + }, + + hasData: function( elem ) { + elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; + return !!elem && !isEmptyDataObject( elem ); + }, + + data: function( elem, name, data, pvt /* Internal Use Only */ ) { + if ( !jQuery.acceptData( elem ) ) { + return; + } + + var privateCache, thisCache, ret, + internalKey = jQuery.expando, + getByName = typeof name === "string", + + // We have to handle DOM nodes and JS objects differently because IE6-7 + // can't GC object references properly across the DOM-JS boundary + isNode = elem.nodeType, + + // Only DOM nodes need the global jQuery cache; JS object data is + // attached directly to the object so GC can occur automatically + cache = isNode ? jQuery.cache : elem, + + // Only defining an ID for JS objects if its cache already exists allows + // the code to shortcut on the same path as a DOM node with no cache + id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey, + isEvents = name === "events"; + + // Avoid doing any more work than we need to when trying to get data on an + // object that has no data at all + if ( (!id || !cache[id] || (!isEvents && !pvt && !cache[id].data)) && getByName && data === undefined ) { + return; + } + + if ( !id ) { + // Only DOM nodes need a new unique ID for each element since their data + // ends up in the global cache + if ( isNode ) { + elem[ internalKey ] = id = ++jQuery.uuid; + } else { + id = internalKey; + } + } + + if ( !cache[ id ] ) { + cache[ id ] = {}; + + // Avoids exposing jQuery metadata on plain JS objects when the object + // is serialized using JSON.stringify + if ( !isNode ) { + cache[ id ].toJSON = jQuery.noop; + } + } + + // An object can be passed to jQuery.data instead of a key/value pair; this gets + // shallow copied over onto the existing cache + if ( typeof name === "object" || typeof name === "function" ) { + if ( pvt ) { + cache[ id ] = jQuery.extend( cache[ id ], name ); + } else { + cache[ id ].data = jQuery.extend( cache[ id ].data, name ); + } + } + + privateCache = thisCache = cache[ id ]; + + // jQuery data() is stored in a separate object inside the object's internal data + // cache in order to avoid key collisions between internal data and user-defined + // data. + if ( !pvt ) { + if ( !thisCache.data ) { + thisCache.data = {}; + } + + thisCache = thisCache.data; + } + + if ( data !== undefined ) { + thisCache[ jQuery.camelCase( name ) ] = data; + } + + // Users should not attempt to inspect the internal events object using jQuery.data, + // it is undocumented and subject to change. But does anyone listen? No. + if ( isEvents && !thisCache[ name ] ) { + return privateCache.events; + } + + // Check for both converted-to-camel and non-converted data property names + // If a data property was specified + if ( getByName ) { + + // First Try to find as-is property data + ret = thisCache[ name ]; + + // Test for null|undefined property data + if ( ret == null ) { + + // Try to find the camelCased property + ret = thisCache[ jQuery.camelCase( name ) ]; + } + } else { + ret = thisCache; + } + + return ret; + }, + + removeData: function( elem, name, pvt /* Internal Use Only */ ) { + if ( !jQuery.acceptData( elem ) ) { + return; + } + + var thisCache, i, l, + + // Reference to internal data cache key + internalKey = jQuery.expando, + + isNode = elem.nodeType, + + // See jQuery.data for more information + cache = isNode ? jQuery.cache : elem, + + // See jQuery.data for more information + id = isNode ? elem[ internalKey ] : internalKey; + + // If there is already no cache entry for this object, there is no + // purpose in continuing + if ( !cache[ id ] ) { + return; + } + + if ( name ) { + + thisCache = pvt ? cache[ id ] : cache[ id ].data; + + if ( thisCache ) { + + // Support array or space separated string names for data keys + if ( !jQuery.isArray( name ) ) { + + // try the string as a key before any manipulation + if ( name in thisCache ) { + name = [ name ]; + } else { + + // split the camel cased version by spaces unless a key with the spaces exists + name = jQuery.camelCase( name ); + if ( name in thisCache ) { + name = [ name ]; + } else { + name = name.split( " " ); + } + } + } + + for ( i = 0, l = name.length; i < l; i++ ) { + delete thisCache[ name[i] ]; + } + + // If there is no data left in the cache, we want to continue + // and let the cache object itself get destroyed + if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { + return; + } + } + } + + // See jQuery.data for more information + if ( !pvt ) { + delete cache[ id ].data; + + // Don't destroy the parent cache unless the internal data object + // had been the only thing left in it + if ( !isEmptyDataObject(cache[ id ]) ) { + return; + } + } + + // Browsers that fail expando deletion also refuse to delete expandos on + // the window, but it will allow it on all other JS objects; other browsers + // don't care + // Ensure that `cache` is not a window object #10080 + if ( jQuery.support.deleteExpando || !cache.setInterval ) { + delete cache[ id ]; + } else { + cache[ id ] = null; + } + + // We destroyed the cache and need to eliminate the expando on the node to avoid + // false lookups in the cache for entries that no longer exist + if ( isNode ) { + // IE does not allow us to delete expando properties from nodes, + // nor does it have a removeAttribute function on Document nodes; + // we must handle all of these cases + if ( jQuery.support.deleteExpando ) { + delete elem[ internalKey ]; + } else if ( elem.removeAttribute ) { + elem.removeAttribute( internalKey ); + } else { + elem[ internalKey ] = null; + } + } + }, + + // For internal use only. + _data: function( elem, name, data ) { + return jQuery.data( elem, name, data, true ); + }, + + // A method for determining if a DOM node can handle the data expando + acceptData: function( elem ) { + if ( elem.nodeName ) { + var match = jQuery.noData[ elem.nodeName.toLowerCase() ]; + + if ( match ) { + return !(match === true || elem.getAttribute("classid") !== match); + } + } + + return true; + } +}); + +jQuery.fn.extend({ + data: function( key, value ) { + var parts, attr, name, + data = null; + + if ( typeof key === "undefined" ) { + if ( this.length ) { + data = jQuery.data( this[0] ); + + if ( this[0].nodeType === 1 && !jQuery._data( this[0], "parsedAttrs" ) ) { + attr = this[0].attributes; + for ( var i = 0, l = attr.length; i < l; i++ ) { + name = attr[i].name; + + if ( name.indexOf( "data-" ) === 0 ) { + name = jQuery.camelCase( name.substring(5) ); + + dataAttr( this[0], name, data[ name ] ); + } + } + jQuery._data( this[0], "parsedAttrs", true ); + } + } + + return data; + + } else if ( typeof key === "object" ) { + return this.each(function() { + jQuery.data( this, key ); + }); + } + + parts = key.split("."); + parts[1] = parts[1] ? "." + parts[1] : ""; + + if ( value === undefined ) { + data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); + + // Try to fetch any internally stored data first + if ( data === undefined && this.length ) { + data = jQuery.data( this[0], key ); + data = dataAttr( this[0], key, data ); + } + + return data === undefined && parts[1] ? + this.data( parts[0] ) : + data; + + } else { + return this.each(function() { + var self = jQuery( this ), + args = [ parts[0], value ]; + + self.triggerHandler( "setData" + parts[1] + "!", args ); + jQuery.data( this, key, value ); + self.triggerHandler( "changeData" + parts[1] + "!", args ); + }); + } + }, + + removeData: function( key ) { + return this.each(function() { + jQuery.removeData( this, key ); + }); + } +}); + +function dataAttr( elem, key, data ) { + // If nothing was found internally, try to fetch any + // data from the HTML5 data-* attribute + if ( data === undefined && elem.nodeType === 1 ) { + + var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); + + data = elem.getAttribute( name ); + + if ( typeof data === "string" ) { + try { + data = data === "true" ? true : + data === "false" ? false : + data === "null" ? null : + jQuery.isNumeric( data ) ? parseFloat( data ) : + rbrace.test( data ) ? jQuery.parseJSON( data ) : + data; + } catch( e ) {} + + // Make sure we set the data so it isn't changed later + jQuery.data( elem, key, data ); + + } else { + data = undefined; + } + } + + return data; +} + +// checks a cache object for emptiness +function isEmptyDataObject( obj ) { + for ( var name in obj ) { + + // if the public data object is empty, the private is still empty + if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { + continue; + } + if ( name !== "toJSON" ) { + return false; + } + } + + return true; +} + + + + +function handleQueueMarkDefer( elem, type, src ) { + var deferDataKey = type + "defer", + queueDataKey = type + "queue", + markDataKey = type + "mark", + defer = jQuery._data( elem, deferDataKey ); + if ( defer && + ( src === "queue" || !jQuery._data(elem, queueDataKey) ) && + ( src === "mark" || !jQuery._data(elem, markDataKey) ) ) { + // Give room for hard-coded callbacks to fire first + // and eventually mark/queue something else on the element + setTimeout( function() { + if ( !jQuery._data( elem, queueDataKey ) && + !jQuery._data( elem, markDataKey ) ) { + jQuery.removeData( elem, deferDataKey, true ); + defer.fire(); + } + }, 0 ); + } +} + +jQuery.extend({ + + _mark: function( elem, type ) { + if ( elem ) { + type = ( type || "fx" ) + "mark"; + jQuery._data( elem, type, (jQuery._data( elem, type ) || 0) + 1 ); + } + }, + + _unmark: function( force, elem, type ) { + if ( force !== true ) { + type = elem; + elem = force; + force = false; + } + if ( elem ) { + type = type || "fx"; + var key = type + "mark", + count = force ? 0 : ( (jQuery._data( elem, key ) || 1) - 1 ); + if ( count ) { + jQuery._data( elem, key, count ); + } else { + jQuery.removeData( elem, key, true ); + handleQueueMarkDefer( elem, type, "mark" ); + } + } + }, + + queue: function( elem, type, data ) { + var q; + if ( elem ) { + type = ( type || "fx" ) + "queue"; + q = jQuery._data( elem, type ); + + // Speed up dequeue by getting out quickly if this is just a lookup + if ( data ) { + if ( !q || jQuery.isArray(data) ) { + q = jQuery._data( elem, type, jQuery.makeArray(data) ); + } else { + q.push( data ); + } + } + return q || []; + } + }, + + dequeue: function( elem, type ) { + type = type || "fx"; + + var queue = jQuery.queue( elem, type ), + fn = queue.shift(), + hooks = {}; + + // If the fx queue is dequeued, always remove the progress sentinel + if ( fn === "inprogress" ) { + fn = queue.shift(); + } + + if ( fn ) { + // Add a progress sentinel to prevent the fx queue from being + // automatically dequeued + if ( type === "fx" ) { + queue.unshift( "inprogress" ); + } + + jQuery._data( elem, type + ".run", hooks ); + fn.call( elem, function() { + jQuery.dequeue( elem, type ); + }, hooks ); + } + + if ( !queue.length ) { + jQuery.removeData( elem, type + "queue " + type + ".run", true ); + handleQueueMarkDefer( elem, type, "queue" ); + } + } +}); + +jQuery.fn.extend({ + queue: function( type, data ) { + if ( typeof type !== "string" ) { + data = type; + type = "fx"; + } + + if ( data === undefined ) { + return jQuery.queue( this[0], type ); + } + return this.each(function() { + var queue = jQuery.queue( this, type, data ); + + if ( type === "fx" && queue[0] !== "inprogress" ) { + jQuery.dequeue( this, type ); + } + }); + }, + dequeue: function( type ) { + return this.each(function() { + jQuery.dequeue( this, type ); + }); + }, + // Based off of the plugin by Clint Helfers, with permission. + // http://blindsignals.com/index.php/2009/07/jquery-delay/ + delay: function( time, type ) { + time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; + type = type || "fx"; + + return this.queue( type, function( next, hooks ) { + var timeout = setTimeout( next, time ); + hooks.stop = function() { + clearTimeout( timeout ); + }; + }); + }, + clearQueue: function( type ) { + return this.queue( type || "fx", [] ); + }, + // Get a promise resolved when queues of a certain type + // are emptied (fx is the type by default) + promise: function( type, object ) { + if ( typeof type !== "string" ) { + object = type; + type = undefined; + } + type = type || "fx"; + var defer = jQuery.Deferred(), + elements = this, + i = elements.length, + count = 1, + deferDataKey = type + "defer", + queueDataKey = type + "queue", + markDataKey = type + "mark", + tmp; + function resolve() { + if ( !( --count ) ) { + defer.resolveWith( elements, [ elements ] ); + } + } + while( i-- ) { + if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) || + ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) || + jQuery.data( elements[ i ], markDataKey, undefined, true ) ) && + jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) { + count++; + tmp.add( resolve ); + } + } + resolve(); + return defer.promise(); + } +}); + + + + +var rclass = /[\n\t\r]/g, + rspace = /\s+/, + rreturn = /\r/g, + rtype = /^(?:button|input)$/i, + rfocusable = /^(?:button|input|object|select|textarea)$/i, + rclickable = /^a(?:rea)?$/i, + rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, + getSetAttribute = jQuery.support.getSetAttribute, + nodeHook, boolHook, fixSpecified; + +jQuery.fn.extend({ + attr: function( name, value ) { + return jQuery.access( this, name, value, true, jQuery.attr ); + }, + + removeAttr: function( name ) { + return this.each(function() { + jQuery.removeAttr( this, name ); + }); + }, + + prop: function( name, value ) { + return jQuery.access( this, name, value, true, jQuery.prop ); + }, + + removeProp: function( name ) { + name = jQuery.propFix[ name ] || name; + return this.each(function() { + // try/catch handles cases where IE balks (such as removing a property on window) + try { + this[ name ] = undefined; + delete this[ name ]; + } catch( e ) {} + }); + }, + + addClass: function( value ) { + var classNames, i, l, elem, + setClass, c, cl; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( j ) { + jQuery( this ).addClass( value.call(this, j, this.className) ); + }); + } + + if ( value && typeof value === "string" ) { + classNames = value.split( rspace ); + + for ( i = 0, l = this.length; i < l; i++ ) { + elem = this[ i ]; + + if ( elem.nodeType === 1 ) { + if ( !elem.className && classNames.length === 1 ) { + elem.className = value; + + } else { + setClass = " " + elem.className + " "; + + for ( c = 0, cl = classNames.length; c < cl; c++ ) { + if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) { + setClass += classNames[ c ] + " "; + } + } + elem.className = jQuery.trim( setClass ); + } + } + } + } + + return this; + }, + + removeClass: function( value ) { + var classNames, i, l, elem, className, c, cl; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( j ) { + jQuery( this ).removeClass( value.call(this, j, this.className) ); + }); + } + + if ( (value && typeof value === "string") || value === undefined ) { + classNames = ( value || "" ).split( rspace ); + + for ( i = 0, l = this.length; i < l; i++ ) { + elem = this[ i ]; + + if ( elem.nodeType === 1 && elem.className ) { + if ( value ) { + className = (" " + elem.className + " ").replace( rclass, " " ); + for ( c = 0, cl = classNames.length; c < cl; c++ ) { + className = className.replace(" " + classNames[ c ] + " ", " "); + } + elem.className = jQuery.trim( className ); + + } else { + elem.className = ""; + } + } + } + } + + return this; + }, + + toggleClass: function( value, stateVal ) { + var type = typeof value, + isBool = typeof stateVal === "boolean"; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( i ) { + jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); + }); + } + + return this.each(function() { + if ( type === "string" ) { + // toggle individual class names + var className, + i = 0, + self = jQuery( this ), + state = stateVal, + classNames = value.split( rspace ); + + while ( (className = classNames[ i++ ]) ) { + // check each className given, space seperated list + state = isBool ? state : !self.hasClass( className ); + self[ state ? "addClass" : "removeClass" ]( className ); + } + + } else if ( type === "undefined" || type === "boolean" ) { + if ( this.className ) { + // store className if set + jQuery._data( this, "__className__", this.className ); + } + + // toggle whole className + this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; + } + }); + }, + + hasClass: function( selector ) { + var className = " " + selector + " ", + i = 0, + l = this.length; + for ( ; i < l; i++ ) { + if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { + return true; + } + } + + return false; + }, + + val: function( value ) { + var hooks, ret, isFunction, + elem = this[0]; + + if ( !arguments.length ) { + if ( elem ) { + hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ]; + + if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { + return ret; + } + + ret = elem.value; + + return typeof ret === "string" ? + // handle most common string cases + ret.replace(rreturn, "") : + // handle cases where value is null/undef or number + ret == null ? "" : ret; + } + + return; + } + + isFunction = jQuery.isFunction( value ); + + return this.each(function( i ) { + var self = jQuery(this), val; + + if ( this.nodeType !== 1 ) { + return; + } + + if ( isFunction ) { + val = value.call( this, i, self.val() ); + } else { + val = value; + } + + // Treat null/undefined as ""; convert numbers to string + if ( val == null ) { + val = ""; + } else if ( typeof val === "number" ) { + val += ""; + } else if ( jQuery.isArray( val ) ) { + val = jQuery.map(val, function ( value ) { + return value == null ? "" : value + ""; + }); + } + + hooks = jQuery.valHooks[ this.nodeName.toLowerCase() ] || jQuery.valHooks[ this.type ]; + + // If set returns undefined, fall back to normal setting + if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { + this.value = val; + } + }); + } +}); + +jQuery.extend({ + valHooks: { + option: { + get: function( elem ) { + // attributes.value is undefined in Blackberry 4.7 but + // uses .value. See #6932 + var val = elem.attributes.value; + return !val || val.specified ? elem.value : elem.text; + } + }, + select: { + get: function( elem ) { + var value, i, max, option, + index = elem.selectedIndex, + values = [], + options = elem.options, + one = elem.type === "select-one"; + + // Nothing was selected + if ( index < 0 ) { + return null; + } + + // Loop through all the selected options + i = one ? index : 0; + max = one ? index + 1 : options.length; + for ( ; i < max; i++ ) { + option = options[ i ]; + + // Don't return options that are disabled or in a disabled optgroup + if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && + (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) { + + // Get the specific value for the option + value = jQuery( option ).val(); + + // We don't need an array for one selects + if ( one ) { + return value; + } + + // Multi-Selects return an array + values.push( value ); + } + } + + // Fixes Bug #2551 -- select.val() broken in IE after form.reset() + if ( one && !values.length && options.length ) { + return jQuery( options[ index ] ).val(); + } + + return values; + }, + + set: function( elem, value ) { + var values = jQuery.makeArray( value ); + + jQuery(elem).find("option").each(function() { + this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; + }); + + if ( !values.length ) { + elem.selectedIndex = -1; + } + return values; + } + } + }, + + attrFn: { + val: true, + css: true, + html: true, + text: true, + data: true, + width: true, + height: true, + offset: true + }, + + attr: function( elem, name, value, pass ) { + var ret, hooks, notxml, + nType = elem.nodeType; + + // don't get/set attributes on text, comment and attribute nodes + if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + if ( pass && name in jQuery.attrFn ) { + return jQuery( elem )[ name ]( value ); + } + + // Fallback to prop when attributes are not supported + if ( typeof elem.getAttribute === "undefined" ) { + return jQuery.prop( elem, name, value ); + } + + notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); + + // All attributes are lowercase + // Grab necessary hook if one is defined + if ( notxml ) { + name = name.toLowerCase(); + hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); + } + + if ( value !== undefined ) { + + if ( value === null ) { + jQuery.removeAttr( elem, name ); + return; + + } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) { + return ret; + + } else { + elem.setAttribute( name, "" + value ); + return value; + } + + } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) { + return ret; + + } else { + + ret = elem.getAttribute( name ); + + // Non-existent attributes return null, we normalize to undefined + return ret === null ? + undefined : + ret; + } + }, + + removeAttr: function( elem, value ) { + var propName, attrNames, name, l, + i = 0; + + if ( value && elem.nodeType === 1 ) { + attrNames = value.toLowerCase().split( rspace ); + l = attrNames.length; + + for ( ; i < l; i++ ) { + name = attrNames[ i ]; + + if ( name ) { + propName = jQuery.propFix[ name ] || name; + + // See #9699 for explanation of this approach (setting first, then removal) + jQuery.attr( elem, name, "" ); + elem.removeAttribute( getSetAttribute ? name : propName ); + + // Set corresponding property to false for boolean attributes + if ( rboolean.test( name ) && propName in elem ) { + elem[ propName ] = false; + } + } + } + } + }, + + attrHooks: { + type: { + set: function( elem, value ) { + // We can't allow the type property to be changed (since it causes problems in IE) + if ( rtype.test( elem.nodeName ) && elem.parentNode ) { + jQuery.error( "type property can't be changed" ); + } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { + // Setting the type on a radio button after the value resets the value in IE6-9 + // Reset value to it's default in case type is set after value + // This is for element creation + var val = elem.value; + elem.setAttribute( "type", value ); + if ( val ) { + elem.value = val; + } + return value; + } + } + }, + // Use the value property for back compat + // Use the nodeHook for button elements in IE6/7 (#1954) + value: { + get: function( elem, name ) { + if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { + return nodeHook.get( elem, name ); + } + return name in elem ? + elem.value : + null; + }, + set: function( elem, value, name ) { + if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { + return nodeHook.set( elem, value, name ); + } + // Does not return so that setAttribute is also used + elem.value = value; + } + } + }, + + propFix: { + tabindex: "tabIndex", + readonly: "readOnly", + "for": "htmlFor", + "class": "className", + maxlength: "maxLength", + cellspacing: "cellSpacing", + cellpadding: "cellPadding", + rowspan: "rowSpan", + colspan: "colSpan", + usemap: "useMap", + frameborder: "frameBorder", + contenteditable: "contentEditable" + }, + + prop: function( elem, name, value ) { + var ret, hooks, notxml, + nType = elem.nodeType; + + // don't get/set properties on text, comment and attribute nodes + if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); + + if ( notxml ) { + // Fix name and attach hooks + name = jQuery.propFix[ name ] || name; + hooks = jQuery.propHooks[ name ]; + } + + if ( value !== undefined ) { + if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { + return ret; + + } else { + return ( elem[ name ] = value ); + } + + } else { + if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { + return ret; + + } else { + return elem[ name ]; + } + } + }, + + propHooks: { + tabIndex: { + get: function( elem ) { + // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set + // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabinde... + var attributeNode = elem.getAttributeNode("tabindex"); + + return attributeNode && attributeNode.specified ? + parseInt( attributeNode.value, 10 ) : + rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? + 0 : + undefined; + } + } + } +}); + +// Add the tabIndex propHook to attrHooks for back-compat (different case is intentional) +jQuery.attrHooks.tabindex = jQuery.propHooks.tabIndex; + +// Hook for boolean attributes +boolHook = { + get: function( elem, name ) { + // Align boolean attributes with corresponding properties + // Fall back to attribute presence where some booleans are not supported + var attrNode, + property = jQuery.prop( elem, name ); + return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ? + name.toLowerCase() : + undefined; + }, + set: function( elem, value, name ) { + var propName; + if ( value === false ) { + // Remove boolean attributes when set to false + jQuery.removeAttr( elem, name ); + } else { + // value is true since we know at this point it's type boolean and not false + // Set boolean attributes to the same name and set the DOM property + propName = jQuery.propFix[ name ] || name; + if ( propName in elem ) { + // Only set the IDL specifically if it already exists on the element + elem[ propName ] = true; + } + + elem.setAttribute( name, name.toLowerCase() ); + } + return name; + } +}; + +// IE6/7 do not support getting/setting some attributes with get/setAttribute +if ( !getSetAttribute ) { + + fixSpecified = { + name: true, + id: true + }; + + // Use this for any attribute in IE6/7 + // This fixes almost every IE6/7 issue + nodeHook = jQuery.valHooks.button = { + get: function( elem, name ) { + var ret; + ret = elem.getAttributeNode( name ); + return ret && ( fixSpecified[ name ] ? ret.nodeValue !== "" : ret.specified ) ? + ret.nodeValue : + undefined; + }, + set: function( elem, value, name ) { + // Set the existing or create a new attribute node + var ret = elem.getAttributeNode( name ); + if ( !ret ) { + ret = document.createAttribute( name ); + elem.setAttributeNode( ret ); + } + return ( ret.nodeValue = value + "" ); + } + }; + + // Apply the nodeHook to tabindex + jQuery.attrHooks.tabindex.set = nodeHook.set; + + // Set width and height to auto instead of 0 on empty string( Bug #8150 ) + // This is for removals + jQuery.each([ "width", "height" ], function( i, name ) { + jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { + set: function( elem, value ) { + if ( value === "" ) { + elem.setAttribute( name, "auto" ); + return value; + } + } + }); + }); + + // Set contenteditable to false on removals(#10429) + // Setting to empty string throws an error as an invalid value + jQuery.attrHooks.contenteditable = { + get: nodeHook.get, + set: function( elem, value, name ) { + if ( value === "" ) { + value = "false"; + } + nodeHook.set( elem, value, name ); + } + }; +} + + +// Some attributes require a special call on IE +if ( !jQuery.support.hrefNormalized ) { + jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { + jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { + get: function( elem ) { + var ret = elem.getAttribute( name, 2 ); + return ret === null ? undefined : ret; + } + }); + }); +} + +if ( !jQuery.support.style ) { + jQuery.attrHooks.style = { + get: function( elem ) { + // Return undefined in the case of empty string + // Normalize to lowercase since IE uppercases css property names + return elem.style.cssText.toLowerCase() || undefined; + }, + set: function( elem, value ) { + return ( elem.style.cssText = "" + value ); + } + }; +} + +// Safari mis-reports the default selected property of an option +// Accessing the parent's selectedIndex property fixes it +if ( !jQuery.support.optSelected ) { + jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { + get: function( elem ) { + var parent = elem.parentNode; + + if ( parent ) { + parent.selectedIndex; + + // Make sure that it also works with optgroups, see #5701 + if ( parent.parentNode ) { + parent.parentNode.selectedIndex; + } + } + return null; + } + }); +} + +// IE6/7 call enctype encoding +if ( !jQuery.support.enctype ) { + jQuery.propFix.enctype = "encoding"; +} + +// Radios and checkboxes getter/setter +if ( !jQuery.support.checkOn ) { + jQuery.each([ "radio", "checkbox" ], function() { + jQuery.valHooks[ this ] = { + get: function( elem ) { + // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified + return elem.getAttribute("value") === null ? "on" : elem.value; + } + }; + }); +} +jQuery.each([ "radio", "checkbox" ], function() { + jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { + set: function( elem, value ) { + if ( jQuery.isArray( value ) ) { + return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); + } + } + }); +}); + + + + +var rformElems = /^(?:textarea|input|select)$/i, + rtypenamespace = /^([^.]*)?(?:.(.+))?$/, + rhoverHack = /\bhover(.\S+)?\b/, + rkeyEvent = /^key/, + rmouseEvent = /^(?:mouse|contextmenu)|click/, + rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, + rquickIs = /^(\w*)(?:#([\w-]+))?(?:.([\w-]+))?$/, + quickParse = function( selector ) { + var quick = rquickIs.exec( selector ); + if ( quick ) { + // 0 1 2 3 + // [ _, tag, id, class ] + quick[1] = ( quick[1] || "" ).toLowerCase(); + quick[3] = quick[3] && new RegExp( "(?:^|\s)" + quick[3] + "(?:\s|$)" ); + } + return quick; + }, + quickIs = function( elem, m ) { + var attrs = elem.attributes || {}; + return ( + (!m[1] || elem.nodeName.toLowerCase() === m[1]) && + (!m[2] || (attrs.id || {}).value === m[2]) && + (!m[3] || m[3].test( (attrs[ "class" ] || {}).value )) + ); + }, + hoverHack = function( events ) { + return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" ); + }; + +/* + * Helper functions for managing events -- not part of the public interface. + * Props to Dean Edwards' addEvent library for many of the ideas. + */ +jQuery.event = { + + add: function( elem, types, handler, data, selector ) { + + var elemData, eventHandle, events, + t, tns, type, namespaces, handleObj, + handleObjIn, quick, handlers, special; + + // Don't attach events to noData or text/comment nodes (allow plain objects tho) + if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) { + return; + } + + // Caller can pass in an object of custom data in lieu of the handler + if ( handler.handler ) { + handleObjIn = handler; + handler = handleObjIn.handler; + } + + // Make sure that the handler has a unique ID, used to find/remove it later + if ( !handler.guid ) { + handler.guid = jQuery.guid++; + } + + // Init the element's event structure and main handler, if this is the first + events = elemData.events; + if ( !events ) { + elemData.events = events = {}; + } + eventHandle = elemData.handle; + if ( !eventHandle ) { + elemData.handle = eventHandle = function( e ) { + // Discard the second event of a jQuery.event.trigger() and + // when an event is called after a page has unloaded + return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? + jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : + undefined; + }; + // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events + eventHandle.elem = elem; + } + + // Handle multiple events separated by a space + // jQuery(...).bind("mouseover mouseout", fn); + types = jQuery.trim( hoverHack(types) ).split( " " ); + for ( t = 0; t < types.length; t++ ) { + + tns = rtypenamespace.exec( types[t] ) || []; + type = tns[1]; + namespaces = ( tns[2] || "" ).split( "." ).sort(); + + // If event changes its type, use the special event handlers for the changed type + special = jQuery.event.special[ type ] || {}; + + // If selector defined, determine special event api type, otherwise given type + type = ( selector ? special.delegateType : special.bindType ) || type; + + // Update special based on newly reset type + special = jQuery.event.special[ type ] || {}; + + // handleObj is passed to all event handlers + handleObj = jQuery.extend({ + type: type, + origType: tns[1], + data: data, + handler: handler, + guid: handler.guid, + selector: selector, + quick: quickParse( selector ), + namespace: namespaces.join(".") + }, handleObjIn ); + + // Init the event handler queue if we're the first + handlers = events[ type ]; + if ( !handlers ) { + handlers = events[ type ] = []; + handlers.delegateCount = 0; + + // Only use addEventListener/attachEvent if the special events handler returns false + if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { + // Bind the global event handler to the element + if ( elem.addEventListener ) { + elem.addEventListener( type, eventHandle, false ); + + } else if ( elem.attachEvent ) { + elem.attachEvent( "on" + type, eventHandle ); + } + } + } + + if ( special.add ) { + special.add.call( elem, handleObj ); + + if ( !handleObj.handler.guid ) { + handleObj.handler.guid = handler.guid; + } + } + + // Add to the element's handler list, delegates in front + if ( selector ) { + handlers.splice( handlers.delegateCount++, 0, handleObj ); + } else { + handlers.push( handleObj ); + } + + // Keep track of which events have ever been used, for event optimization + jQuery.event.global[ type ] = true; + } + + // Nullify elem to prevent memory leaks in IE + elem = null; + }, + + global: {}, + + // Detach an event or set of events from an element + remove: function( elem, types, handler, selector, mappedTypes ) { + + var elemData = jQuery.hasData( elem ) && jQuery._data( elem ), + t, tns, type, origType, namespaces, origCount, + j, events, special, handle, eventType, handleObj; + + if ( !elemData || !(events = elemData.events) ) { + return; + } + + // Once for each type.namespace in types; type may be omitted + types = jQuery.trim( hoverHack( types || "" ) ).split(" "); + for ( t = 0; t < types.length; t++ ) { + tns = rtypenamespace.exec( types[t] ) || []; + type = origType = tns[1]; + namespaces = tns[2]; + + // Unbind all events (on this namespace, if provided) for the element + if ( !type ) { + for ( type in events ) { + jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); + } + continue; + } + + special = jQuery.event.special[ type ] || {}; + type = ( selector? special.delegateType : special.bindType ) || type; + eventType = events[ type ] || []; + origCount = eventType.length; + namespaces = namespaces ? new RegExp("(^|\.)" + namespaces.split(".").sort().join("\.(?:.*\.)?") + "(\.|$)") : null; + + // Remove matching events + for ( j = 0; j < eventType.length; j++ ) { + handleObj = eventType[ j ]; + + if ( ( mappedTypes || origType === handleObj.origType ) && + ( !handler || handler.guid === handleObj.guid ) && + ( !namespaces || namespaces.test( handleObj.namespace ) ) && + ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { + eventType.splice( j--, 1 ); + + if ( handleObj.selector ) { + eventType.delegateCount--; + } + if ( special.remove ) { + special.remove.call( elem, handleObj ); + } + } + } + + // Remove generic event handler if we removed something and no more handlers exist + // (avoids potential for endless recursion during removal of special event handlers) + if ( eventType.length === 0 && origCount !== eventType.length ) { + if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { + jQuery.removeEvent( elem, type, elemData.handle ); + } + + delete events[ type ]; + } + } + + // Remove the expando if it's no longer used + if ( jQuery.isEmptyObject( events ) ) { + handle = elemData.handle; + if ( handle ) { + handle.elem = null; + } + + // removeData also checks for emptiness and clears the expando if empty + // so use it instead of delete + jQuery.removeData( elem, [ "events", "handle" ], true ); + } + }, + + // Events that are safe to short-circuit if no handlers are attached. + // Native DOM events should not be added, they may have inline handlers. + customEvent: { + "getData": true, + "setData": true, + "changeData": true + }, + + trigger: function( event, data, elem, onlyHandlers ) { + // Don't do events on text and comment nodes + if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) { + return; + } + + // Event object or event type + var type = event.type || event, + namespaces = [], + cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType; + + // focus/blur morphs to focusin/out; ensure we're not firing them right now + if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { + return; + } + + if ( type.indexOf( "!" ) >= 0 ) { + // Exclusive events trigger only for the exact event (no namespaces) + type = type.slice(0, -1); + exclusive = true; + } + + if ( type.indexOf( "." ) >= 0 ) { + // Namespaced trigger; create a regexp to match event type in handle() + namespaces = type.split("."); + type = namespaces.shift(); + namespaces.sort(); + } + + if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) { + // No jQuery handlers for this event type, and it can't have inline handlers + return; + } + + // Caller can pass in an Event, Object, or just an event type string + event = typeof event === "object" ? + // jQuery.Event object + event[ jQuery.expando ] ? event : + // Object literal + new jQuery.Event( type, event ) : + // Just the event type (string) + new jQuery.Event( type ); + + event.type = type; + event.isTrigger = true; + event.exclusive = exclusive; + event.namespace = namespaces.join( "." ); + event.namespace_re = event.namespace? new RegExp("(^|\.)" + namespaces.join("\.(?:.*\.)?") + "(\.|$)") : null; + ontype = type.indexOf( ":" ) < 0 ? "on" + type : ""; + + // Handle a global trigger + if ( !elem ) { + + // TODO: Stop taunting the data cache; remove global events and always attach to document + cache = jQuery.cache; + for ( i in cache ) { + if ( cache[ i ].events && cache[ i ].events[ type ] ) { + jQuery.event.trigger( event, data, cache[ i ].handle.elem, true ); + } + } + return; + } + + // Clean up the event in case it is being reused + event.result = undefined; + if ( !event.target ) { + event.target = elem; + } + + // Clone any incoming data and prepend the event, creating the handler arg list + data = data != null ? jQuery.makeArray( data ) : []; + data.unshift( event ); + + // Allow special events to draw outside the lines + special = jQuery.event.special[ type ] || {}; + if ( special.trigger && special.trigger.apply( elem, data ) === false ) { + return; + } + + // Determine event propagation path in advance, per W3C events spec (#9951) + // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) + eventPath = [[ elem, special.bindType || type ]]; + if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { + + bubbleType = special.delegateType || type; + cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode; + old = null; + for ( ; cur; cur = cur.parentNode ) { + eventPath.push([ cur, bubbleType ]); + old = cur; + } + + // Only add window if we got to document (e.g., not plain obj or detached DOM) + if ( old && old === elem.ownerDocument ) { + eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]); + } + } + + // Fire handlers on the event path + for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) { + + cur = eventPath[i][0]; + event.type = eventPath[i][1]; + + handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); + if ( handle ) { + handle.apply( cur, data ); + } + // Note that this is a bare JS function and not a jQuery handler + handle = ontype && cur[ ontype ]; + if ( handle && jQuery.acceptData( cur ) && handle.apply( cur, data ) === false ) { + event.preventDefault(); + } + } + event.type = type; + + // If nobody prevented the default action, do it now + if ( !onlyHandlers && !event.isDefaultPrevented() ) { + + if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && + !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { + + // Call a native DOM method on the target with the same name name as the event. + // Can't use an .isFunction() check here because IE6/7 fails that test. + // Don't do default actions on window, that's where global variables be (#6170) + // IE<9 dies on focus/blur to hidden element (#1486) + if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) { + + // Don't re-trigger an onFOO event when we call its FOO() method + old = elem[ ontype ]; + + if ( old ) { + elem[ ontype ] = null; + } + + // Prevent re-triggering of the same event, since we already bubbled it above + jQuery.event.triggered = type; + elem[ type ](); + jQuery.event.triggered = undefined; + + if ( old ) { + elem[ ontype ] = old; + } + } + } + } + + return event.result; + }, + + dispatch: function( event ) { + + // Make a writable jQuery.Event from the native event object + event = jQuery.event.fix( event || window.event ); + + var handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []), + delegateCount = handlers.delegateCount, + args = [].slice.call( arguments, 0 ), + run_all = !event.exclusive && !event.namespace, + handlerQueue = [], + i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related; + + // Use the fix-ed jQuery.Event rather than the (read-only) native event + args[0] = event; + event.delegateTarget = this; + + // Determine handlers that should run if there are delegated events + // Avoid disabled elements in IE (#6911) and non-left-click bubbling in Firefox (#3861) + if ( delegateCount && !event.target.disabled && !(event.button && event.type === "click") ) { + + // Pregenerate a single jQuery object for reuse with .is() + jqcur = jQuery(this); + jqcur.context = this.ownerDocument || this; + + for ( cur = event.target; cur != this; cur = cur.parentNode || this ) { + selMatch = {}; + matches = []; + jqcur[0] = cur; + for ( i = 0; i < delegateCount; i++ ) { + handleObj = handlers[ i ]; + sel = handleObj.selector; + + if ( selMatch[ sel ] === undefined ) { + selMatch[ sel ] = ( + handleObj.quick ? quickIs( cur, handleObj.quick ) : jqcur.is( sel ) + ); + } + if ( selMatch[ sel ] ) { + matches.push( handleObj ); + } + } + if ( matches.length ) { + handlerQueue.push({ elem: cur, matches: matches }); + } + } + } + + // Add the remaining (directly-bound) handlers + if ( handlers.length > delegateCount ) { + handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) }); + } + + // Run delegates first; they may want to stop propagation beneath us + for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) { + matched = handlerQueue[ i ]; + event.currentTarget = matched.elem; + + for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) { + handleObj = matched.matches[ j ]; + + // Triggered event must either 1) be non-exclusive and have no namespace, or + // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). + if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) { + + event.data = handleObj.data; + event.handleObj = handleObj; + + ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) + .apply( matched.elem, args ); + + if ( ret !== undefined ) { + event.result = ret; + if ( ret === false ) { + event.preventDefault(); + event.stopPropagation(); + } + } + } + } + } + + return event.result; + }, + + // Includes some event props shared by KeyEvent and MouseEvent + // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 *** + props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), + + fixHooks: {}, + + keyHooks: { + props: "char charCode key keyCode".split(" "), + filter: function( event, original ) { + + // Add which for key events + if ( event.which == null ) { + event.which = original.charCode != null ? original.charCode : original.keyCode; + } + + return event; + } + }, + + mouseHooks: { + props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), + filter: function( event, original ) { + var eventDoc, doc, body, + button = original.button, + fromElement = original.fromElement; + + // Calculate pageX/Y if missing and clientX/Y available + if ( event.pageX == null && original.clientX != null ) { + eventDoc = event.target.ownerDocument || document; + doc = eventDoc.documentElement; + body = eventDoc.body; + + event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); + event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); + } + + // Add relatedTarget, if necessary + if ( !event.relatedTarget && fromElement ) { + event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; + } + + // Add which for click: 1 === left; 2 === middle; 3 === right + // Note: button is not normalized, so don't use it + if ( !event.which && button !== undefined ) { + event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); + } + + return event; + } + }, + + fix: function( event ) { + if ( event[ jQuery.expando ] ) { + return event; + } + + // Create a writable copy of the event object and normalize some properties + var i, prop, + originalEvent = event, + fixHook = jQuery.event.fixHooks[ event.type ] || {}, + copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; + + event = jQuery.Event( originalEvent ); + + for ( i = copy.length; i; ) { + prop = copy[ --i ]; + event[ prop ] = originalEvent[ prop ]; + } + + // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2) + if ( !event.target ) { + event.target = originalEvent.srcElement || document; + } + + // Target should not be a text node (#504, Safari) + if ( event.target.nodeType === 3 ) { + event.target = event.target.parentNode; + } + + // For mouse/key events; add metaKey if it's not there (#3368, IE6/7/8) + if ( event.metaKey === undefined ) { + event.metaKey = event.ctrlKey; + } + + return fixHook.filter? fixHook.filter( event, originalEvent ) : event; + }, + + special: { + ready: { + // Make sure the ready event is setup + setup: jQuery.bindReady + }, + + load: { + // Prevent triggered image.load events from bubbling to window.load + noBubble: true + }, + + focus: { + delegateType: "focusin" + }, + blur: { + delegateType: "focusout" + }, + + beforeunload: { + setup: function( data, namespaces, eventHandle ) { + // We only want to do this special case on windows + if ( jQuery.isWindow( this ) ) { + this.onbeforeunload = eventHandle; + } + }, + + teardown: function( namespaces, eventHandle ) { + if ( this.onbeforeunload === eventHandle ) { + this.onbeforeunload = null; + } + } + } + }, + + simulate: function( type, elem, event, bubble ) { + // Piggyback on a donor event to simulate a different one. + // Fake originalEvent to avoid donor's stopPropagation, but if the + // simulated event prevents default then we do the same on the donor. + var e = jQuery.extend( + new jQuery.Event(), + event, + { type: type, + isSimulated: true, + originalEvent: {} + } + ); + if ( bubble ) { + jQuery.event.trigger( e, null, elem ); + } else { + jQuery.event.dispatch.call( elem, e ); + } + if ( e.isDefaultPrevented() ) { + event.preventDefault(); + } + } +}; + +// Some plugins are using, but it's undocumented/deprecated and will be removed. +// The 1.7 special event interface should provide all the hooks needed now. +jQuery.event.handle = jQuery.event.dispatch; + +jQuery.removeEvent = document.removeEventListener ? + function( elem, type, handle ) { + if ( elem.removeEventListener ) { + elem.removeEventListener( type, handle, false ); + } + } : + function( elem, type, handle ) { + if ( elem.detachEvent ) { + elem.detachEvent( "on" + type, handle ); + } + }; + +jQuery.Event = function( src, props ) { + // Allow instantiation without the 'new' keyword + if ( !(this instanceof jQuery.Event) ) { + return new jQuery.Event( src, props ); + } + + // Event object + if ( src && src.type ) { + this.originalEvent = src; + this.type = src.type; + + // Events bubbling up the document may have been marked as prevented + // by a handler lower down the tree; reflect the correct value. + this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || + src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; + + // Event type + } else { + this.type = src; + } + + // Put explicitly provided properties onto the event object + if ( props ) { + jQuery.extend( this, props ); + } + + // Create a timestamp if incoming event doesn't have one + this.timeStamp = src && src.timeStamp || jQuery.now(); + + // Mark it as fixed + this[ jQuery.expando ] = true; +}; + +function returnFalse() { + return false; +} +function returnTrue() { + return true; +} + +// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding +// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding... +jQuery.Event.prototype = { + preventDefault: function() { + this.isDefaultPrevented = returnTrue; + + var e = this.originalEvent; + if ( !e ) { + return; + } + + // if preventDefault exists run it on the original event + if ( e.preventDefault ) { + e.preventDefault(); + + // otherwise set the returnValue property of the original event to false (IE) + } else { + e.returnValue = false; + } + }, + stopPropagation: function() { + this.isPropagationStopped = returnTrue; + + var e = this.originalEvent; + if ( !e ) { + return; + } + // if stopPropagation exists run it on the original event + if ( e.stopPropagation ) { + e.stopPropagation(); + } + // otherwise set the cancelBubble property of the original event to true (IE) + e.cancelBubble = true; + }, + stopImmediatePropagation: function() { + this.isImmediatePropagationStopped = returnTrue; + this.stopPropagation(); + }, + isDefaultPrevented: returnFalse, + isPropagationStopped: returnFalse, + isImmediatePropagationStopped: returnFalse +}; + +// Create mouseenter/leave events using mouseover/out and event-time checks +jQuery.each({ + mouseenter: "mouseover", + mouseleave: "mouseout" +}, function( orig, fix ) { + jQuery.event.special[ orig ] = { + delegateType: fix, + bindType: fix, + + handle: function( event ) { + var target = this, + related = event.relatedTarget, + handleObj = event.handleObj, + selector = handleObj.selector, + ret; + + // For mousenter/leave call the handler if related is outside the target. + // NB: No relatedTarget if the mouse left/entered the browser window + if ( !related || (related !== target && !jQuery.contains( target, related )) ) { + event.type = handleObj.origType; + ret = handleObj.handler.apply( this, arguments ); + event.type = fix; + } + return ret; + } + }; +}); + +// IE submit delegation +if ( !jQuery.support.submitBubbles ) { + + jQuery.event.special.submit = { + setup: function() { + // Only need this for delegated form submit events + if ( jQuery.nodeName( this, "form" ) ) { + return false; + } + + // Lazy-add a submit handler when a descendant form may potentially be submitted + jQuery.event.add( this, "click._submit keypress._submit", function( e ) { + // Node name check avoids a VML-related crash in IE (#9807) + var elem = e.target, + form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; + if ( form && !form._submit_attached ) { + jQuery.event.add( form, "submit._submit", function( event ) { + // If form was submitted by the user, bubble the event up the tree + if ( this.parentNode && !event.isTrigger ) { + jQuery.event.simulate( "submit", this.parentNode, event, true ); + } + }); + form._submit_attached = true; + } + }); + // return undefined since we don't need an event listener + }, + + teardown: function() { + // Only need this for delegated form submit events + if ( jQuery.nodeName( this, "form" ) ) { + return false; + } + + // Remove delegated handlers; cleanData eventually reaps submit handlers attached above + jQuery.event.remove( this, "._submit" ); + } + }; +} + +// IE change delegation and checkbox/radio fix +if ( !jQuery.support.changeBubbles ) { + + jQuery.event.special.change = { + + setup: function() { + + if ( rformElems.test( this.nodeName ) ) { + // IE doesn't fire change on a check/radio until blur; trigger it on click + // after a propertychange. Eat the blur-change in special.change.handle. + // This still fires onchange a second time for check/radio after blur. + if ( this.type === "checkbox" || this.type === "radio" ) { + jQuery.event.add( this, "propertychange._change", function( event ) { + if ( event.originalEvent.propertyName === "checked" ) { + this._just_changed = true; + } + }); + jQuery.event.add( this, "click._change", function( event ) { + if ( this._just_changed && !event.isTrigger ) { + this._just_changed = false; + jQuery.event.simulate( "change", this, event, true ); + } + }); + } + return false; + } + // Delegated event; lazy-add a change handler on descendant inputs + jQuery.event.add( this, "beforeactivate._change", function( e ) { + var elem = e.target; + + if ( rformElems.test( elem.nodeName ) && !elem._change_attached ) { + jQuery.event.add( elem, "change._change", function( event ) { + if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { + jQuery.event.simulate( "change", this.parentNode, event, true ); + } + }); + elem._change_attached = true; + } + }); + }, + + handle: function( event ) { + var elem = event.target; + + // Swallow native change events from checkbox/radio, we already triggered them above + if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { + return event.handleObj.handler.apply( this, arguments ); + } + }, + + teardown: function() { + jQuery.event.remove( this, "._change" ); + + return rformElems.test( this.nodeName ); + } + }; +} + +// Create "bubbling" focus and blur events +if ( !jQuery.support.focusinBubbles ) { + jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { + + // Attach a single capturing handler while someone wants focusin/focusout + var attaches = 0, + handler = function( event ) { + jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); + }; + + jQuery.event.special[ fix ] = { + setup: function() { + if ( attaches++ === 0 ) { + document.addEventListener( orig, handler, true ); + } + }, + teardown: function() { + if ( --attaches === 0 ) { + document.removeEventListener( orig, handler, true ); + } + } + }; + }); +} + +jQuery.fn.extend({ + + on: function( types, selector, data, fn, /*INTERNAL*/ one ) { + var origFn, type; + + // Types can be a map of types/handlers + if ( typeof types === "object" ) { + // ( types-Object, selector, data ) + if ( typeof selector !== "string" ) { + // ( types-Object, data ) + data = selector; + selector = undefined; + } + for ( type in types ) { + this.on( type, selector, data, types[ type ], one ); + } + return this; + } + + if ( data == null && fn == null ) { + // ( types, fn ) + fn = selector; + data = selector = undefined; + } else if ( fn == null ) { + if ( typeof selector === "string" ) { + // ( types, selector, fn ) + fn = data; + data = undefined; + } else { + // ( types, data, fn ) + fn = data; + data = selector; + selector = undefined; + } + } + if ( fn === false ) { + fn = returnFalse; + } else if ( !fn ) { + return this; + } + + if ( one === 1 ) { + origFn = fn; + fn = function( event ) { + // Can use an empty set, since event contains the info + jQuery().off( event ); + return origFn.apply( this, arguments ); + }; + // Use same guid so caller can remove using origFn + fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); + } + return this.each( function() { + jQuery.event.add( this, types, fn, data, selector ); + }); + }, + one: function( types, selector, data, fn ) { + return this.on.call( this, types, selector, data, fn, 1 ); + }, + off: function( types, selector, fn ) { + if ( types && types.preventDefault && types.handleObj ) { + // ( event ) dispatched jQuery.Event + var handleObj = types.handleObj; + jQuery( types.delegateTarget ).off( + handleObj.namespace? handleObj.type + "." + handleObj.namespace : handleObj.type, + handleObj.selector, + handleObj.handler + ); + return this; + } + if ( typeof types === "object" ) { + // ( types-object [, selector] ) + for ( var type in types ) { + this.off( type, selector, types[ type ] ); + } + return this; + } + if ( selector === false || typeof selector === "function" ) { + // ( types [, fn] ) + fn = selector; + selector = undefined; + } + if ( fn === false ) { + fn = returnFalse; + } + return this.each(function() { + jQuery.event.remove( this, types, fn, selector ); + }); + }, + + bind: function( types, data, fn ) { + return this.on( types, null, data, fn ); + }, + unbind: function( types, fn ) { + return this.off( types, null, fn ); + }, + + live: function( types, data, fn ) { + jQuery( this.context ).on( types, this.selector, data, fn ); + return this; + }, + die: function( types, fn ) { + jQuery( this.context ).off( types, this.selector || "**", fn ); + return this; + }, + + delegate: function( selector, types, data, fn ) { + return this.on( types, selector, data, fn ); + }, + undelegate: function( selector, types, fn ) { + // ( namespace ) or ( selector, types [, fn] ) + return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector, fn ); + }, + + trigger: function( type, data ) { + return this.each(function() { + jQuery.event.trigger( type, data, this ); + }); + }, + triggerHandler: function( type, data ) { + if ( this[0] ) { + return jQuery.event.trigger( type, data, this[0], true ); + } + }, + + toggle: function( fn ) { + // Save reference to arguments for access in closure + var args = arguments, + guid = fn.guid || jQuery.guid++, + i = 0, + toggler = function( event ) { + // Figure out which function to execute + var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; + jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); + + // Make sure that clicks stop + event.preventDefault(); + + // and execute the function + return args[ lastToggle ].apply( this, arguments ) || false; + }; + + // link all the functions, so any of them can unbind this click handler + toggler.guid = guid; + while ( i < args.length ) { + args[ i++ ].guid = guid; + } + + return this.click( toggler ); + }, + + hover: function( fnOver, fnOut ) { + return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); + } +}); + +jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + + "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { + + // Handle event binding + jQuery.fn[ name ] = function( data, fn ) { + if ( fn == null ) { + fn = data; + data = null; + } + + return arguments.length > 0 ? + this.on( name, null, data, fn ) : + this.trigger( name ); + }; + + if ( jQuery.attrFn ) { + jQuery.attrFn[ name ] = true; + } + + if ( rkeyEvent.test( name ) ) { + jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks; + } + + if ( rmouseEvent.test( name ) ) { + jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks; + } +}); + + + +/*! + * Sizzle CSS Selector Engine + * Copyright 2011, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * More information: http://sizzlejs.com/ + */ +(function(){ + +var chunker = /((?:((?:([^()]+)|[^()]+)+)|[(?:[[^[]]*]|['"][^'"]*['"]|[^[]'"]+)+]|\.|[^ >+~,([\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, + expando = "sizcache" + (Math.random() + '').replace('.', ''), + done = 0, + toString = Object.prototype.toString, + hasDuplicate = false, + baseHasDuplicate = true, + rBackslash = /\/g, + rReturn = /\r\n/g, + rNonWord = /\W/; + +// Here we check if the JavaScript engine is using some sort of +// optimization where it does not always call our comparision +// function. If that is the case, discard the hasDuplicate value. +// Thus far that includes Google Chrome. +[0, 0].sort(function() { + baseHasDuplicate = false; + return 0; +}); + +var Sizzle = function( selector, context, results, seed ) { + results = results || []; + context = context || document; + + var origContext = context; + + if ( context.nodeType !== 1 && context.nodeType !== 9 ) { + return []; + } + + if ( !selector || typeof selector !== "string" ) { + return results; + } + + var m, set, checkSet, extra, ret, cur, pop, i, + prune = true, + contextXML = Sizzle.isXML( context ), + parts = [], + soFar = selector; + + // Reset the position of the chunker regexp (start from head) + do { + chunker.exec( "" ); + m = chunker.exec( soFar ); + + if ( m ) { + soFar = m[3]; + + parts.push( m[1] ); + + if ( m[2] ) { + extra = m[3]; + break; + } + } + } while ( m ); + + if ( parts.length > 1 && origPOS.exec( selector ) ) { + + if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { + set = posProcess( parts[0] + parts[1], context, seed ); + + } else { + set = Expr.relative[ parts[0] ] ? + [ context ] : + Sizzle( parts.shift(), context ); + + while ( parts.length ) { + selector = parts.shift(); + + if ( Expr.relative[ selector ] ) { + selector += parts.shift(); + } + + set = posProcess( selector, set, seed ); + } + } + + } else { + // Take a shortcut and set the context if the root selector is an ID + // (but not if it'll be faster if the inner selector is an ID) + if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && + Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { + + ret = Sizzle.find( parts.shift(), context, contextXML ); + context = ret.expr ? + Sizzle.filter( ret.expr, ret.set )[0] : + ret.set[0]; + } + + if ( context ) { + ret = seed ? + { expr: parts.pop(), set: makeArray(seed) } : + Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); + + set = ret.expr ? + Sizzle.filter( ret.expr, ret.set ) : + ret.set; + + if ( parts.length > 0 ) { + checkSet = makeArray( set ); + + } else { + prune = false; + } + + while ( parts.length ) { + cur = parts.pop(); + pop = cur; + + if ( !Expr.relative[ cur ] ) { + cur = ""; + } else { + pop = parts.pop(); + } + + if ( pop == null ) { + pop = context; + } + + Expr.relative[ cur ]( checkSet, pop, contextXML ); + } + + } else { + checkSet = parts = []; + } + } + + if ( !checkSet ) { + checkSet = set; + } + + if ( !checkSet ) { + Sizzle.error( cur || selector ); + } + + if ( toString.call(checkSet) === "[object Array]" ) { + if ( !prune ) { + results.push.apply( results, checkSet ); + + } else if ( context && context.nodeType === 1 ) { + for ( i = 0; checkSet[i] != null; i++ ) { + if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) { + results.push( set[i] ); + } + } + + } else { + for ( i = 0; checkSet[i] != null; i++ ) { + if ( checkSet[i] && checkSet[i].nodeType === 1 ) { + results.push( set[i] ); + } + } + } + + } else { + makeArray( checkSet, results ); + } + + if ( extra ) { + Sizzle( extra, origContext, results, seed ); + Sizzle.uniqueSort( results ); + } + + return results; +}; + +Sizzle.uniqueSort = function( results ) { + if ( sortOrder ) { + hasDuplicate = baseHasDuplicate; + results.sort( sortOrder ); + + if ( hasDuplicate ) { + for ( var i = 1; i < results.length; i++ ) { + if ( results[i] === results[ i - 1 ] ) { + results.splice( i--, 1 ); + } + } + } + } + + return results; +}; + +Sizzle.matches = function( expr, set ) { + return Sizzle( expr, null, null, set ); +}; + +Sizzle.matchesSelector = function( node, expr ) { + return Sizzle( expr, null, null, [node] ).length > 0; +}; + +Sizzle.find = function( expr, context, isXML ) { + var set, i, len, match, type, left; + + if ( !expr ) { + return []; + } + + for ( i = 0, len = Expr.order.length; i < len; i++ ) { + type = Expr.order[i]; + + if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { + left = match[1]; + match.splice( 1, 1 ); + + if ( left.substr( left.length - 1 ) !== "\" ) { + match[1] = (match[1] || "").replace( rBackslash, "" ); + set = Expr.find[ type ]( match, context, isXML ); + + if ( set != null ) { + expr = expr.replace( Expr.match[ type ], "" ); + break; + } + } + } + } + + if ( !set ) { + set = typeof context.getElementsByTagName !== "undefined" ? + context.getElementsByTagName( "*" ) : + []; + } + + return { set: set, expr: expr }; +}; + +Sizzle.filter = function( expr, set, inplace, not ) { + var match, anyFound, + type, found, item, filter, left, + i, pass, + old = expr, + result = [], + curLoop = set, + isXMLFilter = set && set[0] && Sizzle.isXML( set[0] ); + + while ( expr && set.length ) { + for ( type in Expr.filter ) { + if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) { + filter = Expr.filter[ type ]; + left = match[1]; + + anyFound = false; + + match.splice(1,1); + + if ( left.substr( left.length - 1 ) === "\" ) { + continue; + } + + if ( curLoop === result ) { + result = []; + } + + if ( Expr.preFilter[ type ] ) { + match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); + + if ( !match ) { + anyFound = found = true; + + } else if ( match === true ) { + continue; + } + } + + if ( match ) { + for ( i = 0; (item = curLoop[i]) != null; i++ ) { + if ( item ) { + found = filter( item, match, i, curLoop ); + pass = not ^ found; + + if ( inplace && found != null ) { + if ( pass ) { + anyFound = true; + + } else { + curLoop[i] = false; + } + + } else if ( pass ) { + result.push( item ); + anyFound = true; + } + } + } + } + + if ( found !== undefined ) { + if ( !inplace ) { + curLoop = result; + } + + expr = expr.replace( Expr.match[ type ], "" ); + + if ( !anyFound ) { + return []; + } + + break; + } + } + } + + // Improper expression + if ( expr === old ) { + if ( anyFound == null ) { + Sizzle.error( expr ); + + } else { + break; + } + } + + old = expr; + } + + return curLoop; +}; + +Sizzle.error = function( msg ) { + throw new Error( "Syntax error, unrecognized expression: " + msg ); +}; + +/** + * Utility function for retreiving the text value of an array of DOM nodes + * @param {Array|Element} elem + */ +var getText = Sizzle.getText = function( elem ) { + var i, node, + nodeType = elem.nodeType, + ret = ""; + + if ( nodeType ) { + if ( nodeType === 1 || nodeType === 9 ) { + // Use textContent || innerText for elements + if ( typeof elem.textContent === 'string' ) { + return elem.textContent; + } else if ( typeof elem.innerText === 'string' ) { + // Replace IE's carriage returns + return elem.innerText.replace( rReturn, '' ); + } else { + // Traverse it's children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling) { + ret += getText( elem ); + } + } + } else if ( nodeType === 3 || nodeType === 4 ) { + return elem.nodeValue; + } + } else { + + // If no nodeType, this is expected to be an array + for ( i = 0; (node = elem[i]); i++ ) { + // Do not traverse comment nodes + if ( node.nodeType !== 8 ) { + ret += getText( node ); + } + } + } + return ret; +}; + +var Expr = Sizzle.selectors = { + order: [ "ID", "NAME", "TAG" ], + + match: { + ID: /#((?:[\w\u00c0-\uFFFF-]|\.)+)/, + CLASS: /.((?:[\w\u00c0-\uFFFF-]|\.)+)/, + NAME: /[name=['"]*((?:[\w\u00c0-\uFFFF-]|\.)+)['"]*]/, + ATTR: /[\s*((?:[\w\u00c0-\uFFFF-]|\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF-]|\.)*)|)|)\s*]/, + TAG: /^((?:[\w\u00c0-\uFFFF*-]|\.)+)/, + CHILD: /:(only|nth|last|first)-child(?:(\s*(even|odd|(?:[+-]?\d+|(?:[+-]?\d*)?n\s*(?:[+-]\s*\d+)?))\s*))?/, + POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:((\d*)))?(?=[^-]|$)/, + PSEUDO: /:((?:[\w\u00c0-\uFFFF-]|\.)+)(?:((['"]?)((?:([^)]+)|[^()]*)+)\2))?/ + }, + + leftMatch: {}, + + attrMap: { + "class": "className", + "for": "htmlFor" + }, + + attrHandle: { + href: function( elem ) { + return elem.getAttribute( "href" ); + }, + type: function( elem ) { + return elem.getAttribute( "type" ); + } + }, + + relative: { + "+": function(checkSet, part){ + var isPartStr = typeof part === "string", + isTag = isPartStr && !rNonWord.test( part ), + isPartStrNotTag = isPartStr && !isTag; + + if ( isTag ) { + part = part.toLowerCase(); + } + + for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { + if ( (elem = checkSet[i]) ) { + while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} + + checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ? + elem || false : + elem === part; + } + } + + if ( isPartStrNotTag ) { + Sizzle.filter( part, checkSet, true ); + } + }, + + ">": function( checkSet, part ) { + var elem, + isPartStr = typeof part === "string", + i = 0, + l = checkSet.length; + + if ( isPartStr && !rNonWord.test( part ) ) { + part = part.toLowerCase(); + + for ( ; i < l; i++ ) { + elem = checkSet[i]; + + if ( elem ) { + var parent = elem.parentNode; + checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false; + } + } + + } else { + for ( ; i < l; i++ ) { + elem = checkSet[i]; + + if ( elem ) { + checkSet[i] = isPartStr ? + elem.parentNode : + elem.parentNode === part; + } + } + + if ( isPartStr ) { + Sizzle.filter( part, checkSet, true ); + } + } + }, + + "": function(checkSet, part, isXML){ + var nodeCheck, + doneName = done++, + checkFn = dirCheck; + + if ( typeof part === "string" && !rNonWord.test( part ) ) { + part = part.toLowerCase(); + nodeCheck = part; + checkFn = dirNodeCheck; + } + + checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML ); + }, + + "~": function( checkSet, part, isXML ) { + var nodeCheck, + doneName = done++, + checkFn = dirCheck; + + if ( typeof part === "string" && !rNonWord.test( part ) ) { + part = part.toLowerCase(); + nodeCheck = part; + checkFn = dirNodeCheck; + } + + checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML ); + } + }, + + find: { + ID: function( match, context, isXML ) { + if ( typeof context.getElementById !== "undefined" && !isXML ) { + var m = context.getElementById(match[1]); + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + return m && m.parentNode ? [m] : []; + } + }, + + NAME: function( match, context ) { + if ( typeof context.getElementsByName !== "undefined" ) { + var ret = [], + results = context.getElementsByName( match[1] ); + + for ( var i = 0, l = results.length; i < l; i++ ) { + if ( results[i].getAttribute("name") === match[1] ) { + ret.push( results[i] ); + } + } + + return ret.length === 0 ? null : ret; + } + }, + + TAG: function( match, context ) { + if ( typeof context.getElementsByTagName !== "undefined" ) { + return context.getElementsByTagName( match[1] ); + } + } + }, + preFilter: { + CLASS: function( match, curLoop, inplace, result, not, isXML ) { + match = " " + match[1].replace( rBackslash, "" ) + " "; + + if ( isXML ) { + return match; + } + + for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { + if ( elem ) { + if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) { + if ( !inplace ) { + result.push( elem ); + } + + } else if ( inplace ) { + curLoop[i] = false; + } + } + } + + return false; + }, + + ID: function( match ) { + return match[1].replace( rBackslash, "" ); + }, + + TAG: function( match, curLoop ) { + return match[1].replace( rBackslash, "" ).toLowerCase(); + }, + + CHILD: function( match ) { + if ( match[1] === "nth" ) { + if ( !match[2] ) { + Sizzle.error( match[0] ); + } + + match[2] = match[2].replace(/^+|\s*/g, ''); + + // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' + var test = /(-?)(\d*)(?:n([+-]?\d*))?/.exec( + match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || + !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); + + // calculate the numbers (first)n+(last) including if they are negative + match[2] = (test[1] + (test[2] || 1)) - 0; + match[3] = test[3] - 0; + } + else if ( match[2] ) { + Sizzle.error( match[0] ); + } + + // TODO: Move to normal caching system + match[0] = done++; + + return match; + }, + + ATTR: function( match, curLoop, inplace, result, not, isXML ) { + var name = match[1] = match[1].replace( rBackslash, "" ); + + if ( !isXML && Expr.attrMap[name] ) { + match[1] = Expr.attrMap[name]; + } + + // Handle if an un-quoted value was used + match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" ); + + if ( match[2] === "~=" ) { + match[4] = " " + match[4] + " "; + } + + return match; + }, + + PSEUDO: function( match, curLoop, inplace, result, not ) { + if ( match[1] === "not" ) { + // If we're dealing with a complex expression, or a simple one + if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { + match[3] = Sizzle(match[3], null, null, curLoop); + + } else { + var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); + + if ( !inplace ) { + result.push.apply( result, ret ); + } + + return false; + } + + } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { + return true; + } + + return match; + }, + + POS: function( match ) { + match.unshift( true ); + + return match; + } + }, + + filters: { + enabled: function( elem ) { + return elem.disabled === false && elem.type !== "hidden"; + }, + + disabled: function( elem ) { + return elem.disabled === true; + }, + + checked: function( elem ) { + return elem.checked === true; + }, + + selected: function( elem ) { + // Accessing this property makes selected-by-default + // options in Safari work properly + if ( elem.parentNode ) { + elem.parentNode.selectedIndex; + } + + return elem.selected === true; + }, + + parent: function( elem ) { + return !!elem.firstChild; + }, + + empty: function( elem ) { + return !elem.firstChild; + }, + + has: function( elem, i, match ) { + return !!Sizzle( match[3], elem ).length; + }, + + header: function( elem ) { + return (/h\d/i).test( elem.nodeName ); + }, + + text: function( elem ) { + var attr = elem.getAttribute( "type" ), type = elem.type; + // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) + // use getAttribute instead to test this case + return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null ); + }, + + radio: function( elem ) { + return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type; + }, + + checkbox: function( elem ) { + return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type; + }, + + file: function( elem ) { + return elem.nodeName.toLowerCase() === "input" && "file" === elem.type; + }, + + password: function( elem ) { + return elem.nodeName.toLowerCase() === "input" && "password" === elem.type; + }, + + submit: function( elem ) { + var name = elem.nodeName.toLowerCase(); + return (name === "input" || name === "button") && "submit" === elem.type; + }, + + image: function( elem ) { + return elem.nodeName.toLowerCase() === "input" && "image" === elem.type; + }, + + reset: function( elem ) { + var name = elem.nodeName.toLowerCase(); + return (name === "input" || name === "button") && "reset" === elem.type; + }, + + button: function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && "button" === elem.type || name === "button"; + }, + + input: function( elem ) { + return (/input|select|textarea|button/i).test( elem.nodeName ); + }, + + focus: function( elem ) { + return elem === elem.ownerDocument.activeElement; + } + }, + setFilters: { + first: function( elem, i ) { + return i === 0; + }, + + last: function( elem, i, match, array ) { + return i === array.length - 1; + }, + + even: function( elem, i ) { + return i % 2 === 0; + }, + + odd: function( elem, i ) { + return i % 2 === 1; + }, + + lt: function( elem, i, match ) { + return i < match[3] - 0; + }, + + gt: function( elem, i, match ) { + return i > match[3] - 0; + }, + + nth: function( elem, i, match ) { + return match[3] - 0 === i; + }, + + eq: function( elem, i, match ) { + return match[3] - 0 === i; + } + }, + filter: { + PSEUDO: function( elem, match, i, array ) { + var name = match[1], + filter = Expr.filters[ name ]; + + if ( filter ) { + return filter( elem, i, match, array ); + + } else if ( name === "contains" ) { + return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0; + + } else if ( name === "not" ) { + var not = match[3]; + + for ( var j = 0, l = not.length; j < l; j++ ) { + if ( not[j] === elem ) { + return false; + } + } + + return true; + + } else { + Sizzle.error( name ); + } + }, + + CHILD: function( elem, match ) { + var first, last, + doneName, parent, cache, + count, diff, + type = match[1], + node = elem; + + switch ( type ) { + case "only": + case "first": + while ( (node = node.previousSibling) ) { + if ( node.nodeType === 1 ) { + return false; + } + } + + if ( type === "first" ) { + return true; + } + + node = elem; + + case "last": + while ( (node = node.nextSibling) ) { + if ( node.nodeType === 1 ) { + return false; + } + } + + return true; + + case "nth": + first = match[2]; + last = match[3]; + + if ( first === 1 && last === 0 ) { + return true; + } + + doneName = match[0]; + parent = elem.parentNode; + + if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) { + count = 0; + + for ( node = parent.firstChild; node; node = node.nextSibling ) { + if ( node.nodeType === 1 ) { + node.nodeIndex = ++count; + } + } + + parent[ expando ] = doneName; + } + + diff = elem.nodeIndex - last; + + if ( first === 0 ) { + return diff === 0; + + } else { + return ( diff % first === 0 && diff / first >= 0 ); + } + } + }, + + ID: function( elem, match ) { + return elem.nodeType === 1 && elem.getAttribute("id") === match; + }, + + TAG: function( elem, match ) { + return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match; + }, + + CLASS: function( elem, match ) { + return (" " + (elem.className || elem.getAttribute("class")) + " ") + .indexOf( match ) > -1; + }, + + ATTR: function( elem, match ) { + var name = match[1], + result = Sizzle.attr ? + Sizzle.attr( elem, name ) : + Expr.attrHandle[ name ] ? + Expr.attrHandle[ name ]( elem ) : + elem[ name ] != null ? + elem[ name ] : + elem.getAttribute( name ), + value = result + "", + type = match[2], + check = match[4]; + + return result == null ? + type === "!=" : + !type && Sizzle.attr ? + result != null : + type === "=" ? + value === check : + type === "*=" ? + value.indexOf(check) >= 0 : + type === "~=" ? + (" " + value + " ").indexOf(check) >= 0 : + !check ? + value && result !== false : + type === "!=" ? + value !== check : + type === "^=" ? + value.indexOf(check) === 0 : + type === "$=" ? + value.substr(value.length - check.length) === check : + type === "|=" ? + value === check || value.substr(0, check.length + 1) === check + "-" : + false; + }, + + POS: function( elem, match, i, array ) { + var name = match[2], + filter = Expr.setFilters[ name ]; + + if ( filter ) { + return filter( elem, i, match, array ); + } + } + } +}; + +var origPOS = Expr.match.POS, + fescape = function(all, num){ + return "\" + (num - 0 + 1); + }; + +for ( var type in Expr.match ) { + Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^[]*])(?![^(]*))/.source) ); + Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\(\d+)/g, fescape) ); +} + +var makeArray = function( array, results ) { + array = Array.prototype.slice.call( array, 0 ); + + if ( results ) { + results.push.apply( results, array ); + return results; + } + + return array; +}; + +// Perform a simple check to determine if the browser is capable of +// converting a NodeList to an array using builtin methods. +// Also verifies that the returned array holds DOM nodes +// (which is not the case in the Blackberry browser) +try { + Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType; + +// Provide a fallback method if it does not work +} catch( e ) { + makeArray = function( array, results ) { + var i = 0, + ret = results || []; + + if ( toString.call(array) === "[object Array]" ) { + Array.prototype.push.apply( ret, array ); + + } else { + if ( typeof array.length === "number" ) { + for ( var l = array.length; i < l; i++ ) { + ret.push( array[i] ); + } + + } else { + for ( ; array[i]; i++ ) { + ret.push( array[i] ); + } + } + } + + return ret; + }; +} + +var sortOrder, siblingCheck; + +if ( document.documentElement.compareDocumentPosition ) { + sortOrder = function( a, b ) { + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { + return a.compareDocumentPosition ? -1 : 1; + } + + return a.compareDocumentPosition(b) & 4 ? -1 : 1; + }; + +} else { + sortOrder = function( a, b ) { + // The nodes are identical, we can exit early + if ( a === b ) { + hasDuplicate = true; + return 0; + + // Fallback to using sourceIndex (in IE) if it's available on both nodes + } else if ( a.sourceIndex && b.sourceIndex ) { + return a.sourceIndex - b.sourceIndex; + } + + var al, bl, + ap = [], + bp = [], + aup = a.parentNode, + bup = b.parentNode, + cur = aup; + + // If the nodes are siblings (or identical) we can do a quick check + if ( aup === bup ) { + return siblingCheck( a, b ); + + // If no parents were found then the nodes are disconnected + } else if ( !aup ) { + return -1; + + } else if ( !bup ) { + return 1; + } + + // Otherwise they're somewhere else in the tree so we need + // to build up a full list of the parentNodes for comparison + while ( cur ) { + ap.unshift( cur ); + cur = cur.parentNode; + } + + cur = bup; + + while ( cur ) { + bp.unshift( cur ); + cur = cur.parentNode; + } + + al = ap.length; + bl = bp.length; + + // Start walking down the tree looking for a discrepancy + for ( var i = 0; i < al && i < bl; i++ ) { + if ( ap[i] !== bp[i] ) { + return siblingCheck( ap[i], bp[i] ); + } + } + + // We ended someplace up the tree so do a sibling check + return i === al ? + siblingCheck( a, bp[i], -1 ) : + siblingCheck( ap[i], b, 1 ); + }; + + siblingCheck = function( a, b, ret ) { + if ( a === b ) { + return ret; + } + + var cur = a.nextSibling; + + while ( cur ) { + if ( cur === b ) { + return -1; + } + + cur = cur.nextSibling; + } + + return 1; + }; +} + +// Check to see if the browser returns elements by name when +// querying by getElementById (and provide a workaround) +(function(){ + // We're going to inject a fake input element with a specified name + var form = document.createElement("div"), + id = "script" + (new Date()).getTime(), + root = document.documentElement; + + form.innerHTML = "<a name='" + id + "'/>"; + + // Inject it into the root element, check its status, and remove it quickly + root.insertBefore( form, root.firstChild ); + + // The workaround has to do additional checks after a getElementById + // Which slows things down for other browsers (hence the branching) + if ( document.getElementById( id ) ) { + Expr.find.ID = function( match, context, isXML ) { + if ( typeof context.getElementById !== "undefined" && !isXML ) { + var m = context.getElementById(match[1]); + + return m ? + m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? + [m] : + undefined : + []; + } + }; + + Expr.filter.ID = function( elem, match ) { + var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); + + return elem.nodeType === 1 && node && node.nodeValue === match; + }; + } + + root.removeChild( form ); + + // release memory in IE + root = form = null; +})(); + +(function(){ + // Check to see if the browser returns only elements + // when doing getElementsByTagName("*") + + // Create a fake element + var div = document.createElement("div"); + div.appendChild( document.createComment("") ); + + // Make sure no comments are found + if ( div.getElementsByTagName("*").length > 0 ) { + Expr.find.TAG = function( match, context ) { + var results = context.getElementsByTagName( match[1] ); + + // Filter out possible comments + if ( match[1] === "*" ) { + var tmp = []; + + for ( var i = 0; results[i]; i++ ) { + if ( results[i].nodeType === 1 ) { + tmp.push( results[i] ); + } + } + + results = tmp; + } + + return results; + }; + } + + // Check to see if an attribute returns normalized href attributes + div.innerHTML = "<a href='#'></a>"; + + if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && + div.firstChild.getAttribute("href") !== "#" ) { + + Expr.attrHandle.href = function( elem ) { + return elem.getAttribute( "href", 2 ); + }; + } + + // release memory in IE + div = null; +})(); + +if ( document.querySelectorAll ) { + (function(){ + var oldSizzle = Sizzle, + div = document.createElement("div"), + id = "__sizzle__"; + + div.innerHTML = "<p class='TEST'></p>"; + + // Safari can't handle uppercase or unicode characters when + // in quirks mode. + if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { + return; + } + + Sizzle = function( query, context, extra, seed ) { + context = context || document; + + // Only use querySelectorAll on non-XML documents + // (ID selectors don't work in non-HTML documents) + if ( !seed && !Sizzle.isXML(context) ) { + // See if we find a selector to speed up + var match = /^(\w+$)|^.([\w-]+$)|^#([\w-]+$)/.exec( query ); + + if ( match && (context.nodeType === 1 || context.nodeType === 9) ) { + // Speed-up: Sizzle("TAG") + if ( match[1] ) { + return makeArray( context.getElementsByTagName( query ), extra ); + + // Speed-up: Sizzle(".CLASS") + } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) { + return makeArray( context.getElementsByClassName( match[2] ), extra ); + } + } + + if ( context.nodeType === 9 ) { + // Speed-up: Sizzle("body") + // The body element only exists once, optimize finding it + if ( query === "body" && context.body ) { + return makeArray( [ context.body ], extra ); + + // Speed-up: Sizzle("#ID") + } else if ( match && match[3] ) { + var elem = context.getElementById( match[3] ); + + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + if ( elem && elem.parentNode ) { + // Handle the case where IE and Opera return items + // by name instead of ID + if ( elem.id === match[3] ) { + return makeArray( [ elem ], extra ); + } + + } else { + return makeArray( [], extra ); + } + } + + try { + return makeArray( context.querySelectorAll(query), extra ); + } catch(qsaError) {} + + // qSA works strangely on Element-rooted queries + // We can work around this by specifying an extra ID on the root + // and working up from there (Thanks to Andrew Dupont for the technique) + // IE 8 doesn't work on object elements + } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { + var oldContext = context, + old = context.getAttribute( "id" ), + nid = old || id, + hasParent = context.parentNode, + relativeHierarchySelector = /^\s*[+~]/.test( query ); + + if ( !old ) { + context.setAttribute( "id", nid ); + } else { + nid = nid.replace( /'/g, "\$&" ); + } + if ( relativeHierarchySelector && hasParent ) { + context = context.parentNode; + } + + try { + if ( !relativeHierarchySelector || hasParent ) { + return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra ); + } + + } catch(pseudoError) { + } finally { + if ( !old ) { + oldContext.removeAttribute( "id" ); + } + } + } + } + + return oldSizzle(query, context, extra, seed); + }; + + for ( var prop in oldSizzle ) { + Sizzle[ prop ] = oldSizzle[ prop ]; + } + + // release memory in IE + div = null; + })(); +} + +(function(){ + var html = document.documentElement, + matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector; + + if ( matches ) { + // Check to see if it's possible to do matchesSelector + // on a disconnected node (IE 9 fails this) + var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ), + pseudoWorks = false; + + try { + // This should fail with an exception + // Gecko does not error, returns false instead + matches.call( document.documentElement, "[test!='']:sizzle" ); + + } catch( pseudoError ) { + pseudoWorks = true; + } + + Sizzle.matchesSelector = function( node, expr ) { + // Make sure that attribute selectors are quoted + expr = expr.replace(/=\s*([^'"]]*)\s*]/g, "='$1']"); + + if ( !Sizzle.isXML( node ) ) { + try { + if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) { + var ret = matches.call( node, expr ); + + // IE 9's matchesSelector returns false on disconnected nodes + if ( ret || !disconnectedMatch || + // As well, disconnected nodes are said to be in a document + // fragment in IE 9, so check for that + node.document && node.document.nodeType !== 11 ) { + return ret; + } + } + } catch(e) {} + } + + return Sizzle(expr, null, null, [node]).length > 0; + }; + } +})(); + +(function(){ + var div = document.createElement("div"); + + div.innerHTML = "<div class='test e'></div><div class='test'></div>"; + + // Opera can't find a second classname (in 9.6) + // Also, make sure that getElementsByClassName actually exists + if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) { + return; + } + + // Safari caches class attributes, doesn't catch changes (in 3.2) + div.lastChild.className = "e"; + + if ( div.getElementsByClassName("e").length === 1 ) { + return; + } + + Expr.order.splice(1, 0, "CLASS"); + Expr.find.CLASS = function( match, context, isXML ) { + if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { + return context.getElementsByClassName(match[1]); + } + }; + + // release memory in IE + div = null; +})(); + +function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { + for ( var i = 0, l = checkSet.length; i < l; i++ ) { + var elem = checkSet[i]; + + if ( elem ) { + var match = false; + + elem = elem[dir]; + + while ( elem ) { + if ( elem[ expando ] === doneName ) { + match = checkSet[elem.sizset]; + break; + } + + if ( elem.nodeType === 1 && !isXML ){ + elem[ expando ] = doneName; + elem.sizset = i; + } + + if ( elem.nodeName.toLowerCase() === cur ) { + match = elem; + break; + } + + elem = elem[dir]; + } + + checkSet[i] = match; + } + } +} + +function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { + for ( var i = 0, l = checkSet.length; i < l; i++ ) { + var elem = checkSet[i]; + + if ( elem ) { + var match = false; + + elem = elem[dir]; + + while ( elem ) { + if ( elem[ expando ] === doneName ) { + match = checkSet[elem.sizset]; + break; + } + + if ( elem.nodeType === 1 ) { + if ( !isXML ) { + elem[ expando ] = doneName; + elem.sizset = i; + } + + if ( typeof cur !== "string" ) { + if ( elem === cur ) { + match = true; + break; + } + + } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { + match = elem; + break; + } + } + + elem = elem[dir]; + } + + checkSet[i] = match; + } + } +} + +if ( document.documentElement.contains ) { + Sizzle.contains = function( a, b ) { + return a !== b && (a.contains ? a.contains(b) : true); + }; + +} else if ( document.documentElement.compareDocumentPosition ) { + Sizzle.contains = function( a, b ) { + return !!(a.compareDocumentPosition(b) & 16); + }; + +} else { + Sizzle.contains = function() { + return false; + }; +} + +Sizzle.isXML = function( elem ) { + // documentElement is verified for cases where it doesn't yet exist + // (such as loading iframes in IE - #4833) + var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; + + return documentElement ? documentElement.nodeName !== "HTML" : false; +}; + +var posProcess = function( selector, context, seed ) { + var match, + tmpSet = [], + later = "", + root = context.nodeType ? [context] : context; + + // Position selectors must be done after the filter + // And so must :not(positional) so we move all PSEUDOs to the end + while ( (match = Expr.match.PSEUDO.exec( selector )) ) { + later += match[0]; + selector = selector.replace( Expr.match.PSEUDO, "" ); + } + + selector = Expr.relative[selector] ? selector + "*" : selector; + + for ( var i = 0, l = root.length; i < l; i++ ) { + Sizzle( selector, root[i], tmpSet, seed ); + } + + return Sizzle.filter( later, tmpSet ); +}; + +// EXPOSE +// Override sizzle attribute retrieval +Sizzle.attr = jQuery.attr; +Sizzle.selectors.attrMap = {}; +jQuery.find = Sizzle; +jQuery.expr = Sizzle.selectors; +jQuery.expr[":"] = jQuery.expr.filters; +jQuery.unique = Sizzle.uniqueSort; +jQuery.text = Sizzle.getText; +jQuery.isXMLDoc = Sizzle.isXML; +jQuery.contains = Sizzle.contains; + + +})(); + + +var runtil = /Until$/, + rparentsprev = /^(?:parents|prevUntil|prevAll)/, + // Note: This RegExp should be improved, or likely pulled from Sizzle + rmultiselector = /,/, + isSimple = /^.[^:#[.,]*$/, + slice = Array.prototype.slice, + POS = jQuery.expr.match.POS, + // methods guaranteed to produce a unique set when starting from a unique set + guaranteedUnique = { + children: true, + contents: true, + next: true, + prev: true + }; + +jQuery.fn.extend({ + find: function( selector ) { + var self = this, + i, l; + + if ( typeof selector !== "string" ) { + return jQuery( selector ).filter(function() { + for ( i = 0, l = self.length; i < l; i++ ) { + if ( jQuery.contains( self[ i ], this ) ) { + return true; + } + } + }); + } + + var ret = this.pushStack( "", "find", selector ), + length, n, r; + + for ( i = 0, l = this.length; i < l; i++ ) { + length = ret.length; + jQuery.find( selector, this[i], ret ); + + if ( i > 0 ) { + // Make sure that the results are unique + for ( n = length; n < ret.length; n++ ) { + for ( r = 0; r < length; r++ ) { + if ( ret[r] === ret[n] ) { + ret.splice(n--, 1); + break; + } + } + } + } + } + + return ret; + }, + + has: function( target ) { + var targets = jQuery( target ); + return this.filter(function() { + for ( var i = 0, l = targets.length; i < l; i++ ) { + if ( jQuery.contains( this, targets[i] ) ) { + return true; + } + } + }); + }, + + not: function( selector ) { + return this.pushStack( winnow(this, selector, false), "not", selector); + }, + + filter: function( selector ) { + return this.pushStack( winnow(this, selector, true), "filter", selector ); + }, + + is: function( selector ) { + return !!selector && ( + typeof selector === "string" ? + // If this is a positional selector, check membership in the returned set + // so $("p:first").is("p:last") won't return true for a doc with two "p". + POS.test( selector ) ? + jQuery( selector, this.context ).index( this[0] ) >= 0 : + jQuery.filter( selector, this ).length > 0 : + this.filter( selector ).length > 0 ); + }, + + closest: function( selectors, context ) { + var ret = [], i, l, cur = this[0]; + + // Array (deprecated as of jQuery 1.7) + if ( jQuery.isArray( selectors ) ) { + var level = 1; + + while ( cur && cur.ownerDocument && cur !== context ) { + for ( i = 0; i < selectors.length; i++ ) { + + if ( jQuery( cur ).is( selectors[ i ] ) ) { + ret.push({ selector: selectors[ i ], elem: cur, level: level }); + } + } + + cur = cur.parentNode; + level++; + } + + return ret; + } + + // String + var pos = POS.test( selectors ) || typeof selectors !== "string" ? + jQuery( selectors, context || this.context ) : + 0; + + for ( i = 0, l = this.length; i < l; i++ ) { + cur = this[i]; + + while ( cur ) { + if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { + ret.push( cur ); + break; + + } else { + cur = cur.parentNode; + if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) { + break; + } + } + } + } + + ret = ret.length > 1 ? jQuery.unique( ret ) : ret; + + return this.pushStack( ret, "closest", selectors ); + }, + + // Determine the position of an element within + // the matched set of elements + index: function( elem ) { + + // No argument, return index in parent + if ( !elem ) { + return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1; + } + + // index in selector + if ( typeof elem === "string" ) { + return jQuery.inArray( this[0], jQuery( elem ) ); + } + + // Locate the position of the desired element + return jQuery.inArray( + // If it receives a jQuery object, the first element is used + elem.jquery ? elem[0] : elem, this ); + }, + + add: function( selector, context ) { + var set = typeof selector === "string" ? + jQuery( selector, context ) : + jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), + all = jQuery.merge( this.get(), set ); + + return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? + all : + jQuery.unique( all ) ); + }, + + andSelf: function() { + return this.add( this.prevObject ); + } +}); + +// A painfully simple check to see if an element is disconnected +// from a document (should be improved, where feasible). +function isDisconnected( node ) { + return !node || !node.parentNode || node.parentNode.nodeType === 11; +} + +jQuery.each({ + parent: function( elem ) { + var parent = elem.parentNode; + return parent && parent.nodeType !== 11 ? parent : null; + }, + parents: function( elem ) { + return jQuery.dir( elem, "parentNode" ); + }, + parentsUntil: function( elem, i, until ) { + return jQuery.dir( elem, "parentNode", until ); + }, + next: function( elem ) { + return jQuery.nth( elem, 2, "nextSibling" ); + }, + prev: function( elem ) { + return jQuery.nth( elem, 2, "previousSibling" ); + }, + nextAll: function( elem ) { + return jQuery.dir( elem, "nextSibling" ); + }, + prevAll: function( elem ) { + return jQuery.dir( elem, "previousSibling" ); + }, + nextUntil: function( elem, i, until ) { + return jQuery.dir( elem, "nextSibling", until ); + }, + prevUntil: function( elem, i, until ) { + return jQuery.dir( elem, "previousSibling", until ); + }, + siblings: function( elem ) { + return jQuery.sibling( elem.parentNode.firstChild, elem ); + }, + children: function( elem ) { + return jQuery.sibling( elem.firstChild ); + }, + contents: function( elem ) { + return jQuery.nodeName( elem, "iframe" ) ? + elem.contentDocument || elem.contentWindow.document : + jQuery.makeArray( elem.childNodes ); + } +}, function( name, fn ) { + jQuery.fn[ name ] = function( until, selector ) { + var ret = jQuery.map( this, fn, until ); + + if ( !runtil.test( name ) ) { + selector = until; + } + + if ( selector && typeof selector === "string" ) { + ret = jQuery.filter( selector, ret ); + } + + ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; + + if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) { + ret = ret.reverse(); + } + + return this.pushStack( ret, name, slice.call( arguments ).join(",") ); + }; +}); + +jQuery.extend({ + filter: function( expr, elems, not ) { + if ( not ) { + expr = ":not(" + expr + ")"; + } + + return elems.length === 1 ? + jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : + jQuery.find.matches(expr, elems); + }, + + dir: function( elem, dir, until ) { + var matched = [], + cur = elem[ dir ]; + + while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { + if ( cur.nodeType === 1 ) { + matched.push( cur ); + } + cur = cur[dir]; + } + return matched; + }, + + nth: function( cur, result, dir, elem ) { + result = result || 1; + var num = 0; + + for ( ; cur; cur = cur[dir] ) { + if ( cur.nodeType === 1 && ++num === result ) { + break; + } + } + + return cur; + }, + + sibling: function( n, elem ) { + var r = []; + + for ( ; n; n = n.nextSibling ) { + if ( n.nodeType === 1 && n !== elem ) { + r.push( n ); + } + } + + return r; + } +}); + +// Implement the identical functionality for filter and not +function winnow( elements, qualifier, keep ) { + + // Can't pass null or undefined to indexOf in Firefox 4 + // Set to 0 to skip string check + qualifier = qualifier || 0; + + if ( jQuery.isFunction( qualifier ) ) { + return jQuery.grep(elements, function( elem, i ) { + var retVal = !!qualifier.call( elem, i, elem ); + return retVal === keep; + }); + + } else if ( qualifier.nodeType ) { + return jQuery.grep(elements, function( elem, i ) { + return ( elem === qualifier ) === keep; + }); + + } else if ( typeof qualifier === "string" ) { + var filtered = jQuery.grep(elements, function( elem ) { + return elem.nodeType === 1; + }); + + if ( isSimple.test( qualifier ) ) { + return jQuery.filter(qualifier, filtered, !keep); + } else { + qualifier = jQuery.filter( qualifier, filtered ); + } + } + + return jQuery.grep(elements, function( elem, i ) { + return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; + }); +} + + + + +function createSafeFragment( document ) { + var list = nodeNames.split( "|" ), + safeFrag = document.createDocumentFragment(); + + if ( safeFrag.createElement ) { + while ( list.length ) { + safeFrag.createElement( + list.pop() + ); + } + } + return safeFrag; +} + +var nodeNames = "abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|" + + "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", + rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, + rleadingWhitespace = /^\s+/, + rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)/>/ig, + rtagName = /<([\w:]+)/, + rtbody = /<tbody/i, + rhtml = /<|&#?\w+;/, + rnoInnerhtml = /<(?:script|style)/i, + rnocache = /<(?:script|object|embed|option|style)/i, + rnoshimcache = new RegExp("<(?:" + nodeNames + ")", "i"), + // checked="checked" or checked + rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, + rscriptType = //(java|ecma)script/i, + rcleanScript = /^\s*<!(?:[CDATA[|--)/, + wrapMap = { + option: [ 1, "<select multiple='multiple'>", "</select>" ], + legend: [ 1, "<fieldset>", "</fieldset>" ], + thead: [ 1, "<table>", "</table>" ], + tr: [ 2, "<table><tbody>", "</tbody></table>" ], + td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], + col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ], + area: [ 1, "<map>", "</map>" ], + _default: [ 0, "", "" ] + }, + safeFragment = createSafeFragment( document ); + +wrapMap.optgroup = wrapMap.option; +wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; +wrapMap.th = wrapMap.td; + +// IE can't serialize <link> and <script> tags normally +if ( !jQuery.support.htmlSerialize ) { + wrapMap._default = [ 1, "div<div>", "</div>" ]; +} + +jQuery.fn.extend({ + text: function( text ) { + if ( jQuery.isFunction(text) ) { + return this.each(function(i) { + var self = jQuery( this ); + + self.text( text.call(this, i, self.text()) ); + }); + } + + if ( typeof text !== "object" && text !== undefined ) { + return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) ); + } + + return jQuery.text( this ); + }, + + wrapAll: function( html ) { + if ( jQuery.isFunction( html ) ) { + return this.each(function(i) { + jQuery(this).wrapAll( html.call(this, i) ); + }); + } + + if ( this[0] ) { + // The elements to wrap the target around + var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); + + if ( this[0].parentNode ) { + wrap.insertBefore( this[0] ); + } + + wrap.map(function() { + var elem = this; + + while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { + elem = elem.firstChild; + } + + return elem; + }).append( this ); + } + + return this; + }, + + wrapInner: function( html ) { + if ( jQuery.isFunction( html ) ) { + return this.each(function(i) { + jQuery(this).wrapInner( html.call(this, i) ); + }); + } + + return this.each(function() { + var self = jQuery( this ), + contents = self.contents(); + + if ( contents.length ) { + contents.wrapAll( html ); + + } else { + self.append( html ); + } + }); + }, + + wrap: function( html ) { + var isFunction = jQuery.isFunction( html ); + + return this.each(function(i) { + jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); + }); + }, + + unwrap: function() { + return this.parent().each(function() { + if ( !jQuery.nodeName( this, "body" ) ) { + jQuery( this ).replaceWith( this.childNodes ); + } + }).end(); + }, + + append: function() { + return this.domManip(arguments, true, function( elem ) { + if ( this.nodeType === 1 ) { + this.appendChild( elem ); + } + }); + }, + + prepend: function() { + return this.domManip(arguments, true, function( elem ) { + if ( this.nodeType === 1 ) { + this.insertBefore( elem, this.firstChild ); + } + }); + }, + + before: function() { + if ( this[0] && this[0].parentNode ) { + return this.domManip(arguments, false, function( elem ) { + this.parentNode.insertBefore( elem, this ); + }); + } else if ( arguments.length ) { + var set = jQuery.clean( arguments ); + set.push.apply( set, this.toArray() ); + return this.pushStack( set, "before", arguments ); + } + }, + + after: function() { + if ( this[0] && this[0].parentNode ) { + return this.domManip(arguments, false, function( elem ) { + this.parentNode.insertBefore( elem, this.nextSibling ); + }); + } else if ( arguments.length ) { + var set = this.pushStack( this, "after", arguments ); + set.push.apply( set, jQuery.clean(arguments) ); + return set; + } + }, + + // keepData is for internal use only--do not document + remove: function( selector, keepData ) { + for ( var i = 0, elem; (elem = this[i]) != null; i++ ) { + if ( !selector || jQuery.filter( selector, [ elem ] ).length ) { + if ( !keepData && elem.nodeType === 1 ) { + jQuery.cleanData( elem.getElementsByTagName("*") ); + jQuery.cleanData( [ elem ] ); + } + + if ( elem.parentNode ) { + elem.parentNode.removeChild( elem ); + } + } + } + + return this; + }, + + empty: function() { + for ( var i = 0, elem; (elem = this[i]) != null; i++ ) { + // Remove element nodes and prevent memory leaks + if ( elem.nodeType === 1 ) { + jQuery.cleanData( elem.getElementsByTagName("*") ); + } + + // Remove any remaining nodes + while ( elem.firstChild ) { + elem.removeChild( elem.firstChild ); + } + } + + return this; + }, + + clone: function( dataAndEvents, deepDataAndEvents ) { + dataAndEvents = dataAndEvents == null ? false : dataAndEvents; + deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; + + return this.map( function () { + return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); + }); + }, + + html: function( value ) { + if ( value === undefined ) { + return this[0] && this[0].nodeType === 1 ? + this[0].innerHTML.replace(rinlinejQuery, "") : + null; + + // See if we can take a shortcut and just use innerHTML + } else if ( typeof value === "string" && !rnoInnerhtml.test( value ) && + (jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) && + !wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) { + + value = value.replace(rxhtmlTag, "<$1></$2>"); + + try { + for ( var i = 0, l = this.length; i < l; i++ ) { + // Remove element nodes and prevent memory leaks + if ( this[i].nodeType === 1 ) { + jQuery.cleanData( this[i].getElementsByTagName("*") ); + this[i].innerHTML = value; + } + } + + // If using innerHTML throws an exception, use the fallback method + } catch(e) { + this.empty().append( value ); + } + + } else if ( jQuery.isFunction( value ) ) { + this.each(function(i){ + var self = jQuery( this ); + + self.html( value.call(this, i, self.html()) ); + }); + + } else { + this.empty().append( value ); + } + + return this; + }, + + replaceWith: function( value ) { + if ( this[0] && this[0].parentNode ) { + // Make sure that the elements are removed from the DOM before they are inserted + // this can help fix replacing a parent with child elements + if ( jQuery.isFunction( value ) ) { + return this.each(function(i) { + var self = jQuery(this), old = self.html(); + self.replaceWith( value.call( this, i, old ) ); + }); + } + + if ( typeof value !== "string" ) { + value = jQuery( value ).detach(); + } + + return this.each(function() { + var next = this.nextSibling, + parent = this.parentNode; + + jQuery( this ).remove(); + + if ( next ) { + jQuery(next).before( value ); + } else { + jQuery(parent).append( value ); + } + }); + } else { + return this.length ? + this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) : + this; + } + }, + + detach: function( selector ) { + return this.remove( selector, true ); + }, + + domManip: function( args, table, callback ) { + var results, first, fragment, parent, + value = args[0], + scripts = []; + + // We can't cloneNode fragments that contain checked, in WebKit + if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) { + return this.each(function() { + jQuery(this).domManip( args, table, callback, true ); + }); + } + + if ( jQuery.isFunction(value) ) { + return this.each(function(i) { + var self = jQuery(this); + args[0] = value.call(this, i, table ? self.html() : undefined); + self.domManip( args, table, callback ); + }); + } + + if ( this[0] ) { + parent = value && value.parentNode; + + // If we're in a fragment, just use that instead of building a new one + if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) { + results = { fragment: parent }; + + } else { + results = jQuery.buildFragment( args, this, scripts ); + } + + fragment = results.fragment; + + if ( fragment.childNodes.length === 1 ) { + first = fragment = fragment.firstChild; + } else { + first = fragment.firstChild; + } + + if ( first ) { + table = table && jQuery.nodeName( first, "tr" ); + + for ( var i = 0, l = this.length, lastIndex = l - 1; i < l; i++ ) { + callback.call( + table ? + root(this[i], first) : + this[i], + // Make sure that we do not leak memory by inadvertently discarding + // the original fragment (which might have attached data) instead of + // using it; in addition, use the original fragment object for the last + // item instead of first because it can end up being emptied incorrectly + // in certain situations (Bug #8070). + // Fragments from the fragment cache must always be cloned and never used + // in place. + results.cacheable || ( l > 1 && i < lastIndex ) ? + jQuery.clone( fragment, true, true ) : + fragment + ); + } + } + + if ( scripts.length ) { + jQuery.each( scripts, evalScript ); + } + } + + return this; + } +}); + +function root( elem, cur ) { + return jQuery.nodeName(elem, "table") ? + (elem.getElementsByTagName("tbody")[0] || + elem.appendChild(elem.ownerDocument.createElement("tbody"))) : + elem; +} + +function cloneCopyEvent( src, dest ) { + + if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { + return; + } + + var type, i, l, + oldData = jQuery._data( src ), + curData = jQuery._data( dest, oldData ), + events = oldData.events; + + if ( events ) { + delete curData.handle; + curData.events = {}; + + for ( type in events ) { + for ( i = 0, l = events[ type ].length; i < l; i++ ) { + jQuery.event.add( dest, type + ( events[ type ][ i ].namespace ? "." : "" ) + events[ type ][ i ].namespace, events[ type ][ i ], events[ type ][ i ].data ); + } + } + } + + // make the cloned public data object a copy from the original + if ( curData.data ) { + curData.data = jQuery.extend( {}, curData.data ); + } +} + +function cloneFixAttributes( src, dest ) { + var nodeName; + + // We do not need to do anything for non-Elements + if ( dest.nodeType !== 1 ) { + return; + } + + // clearAttributes removes the attributes, which we don't want, + // but also removes the attachEvent events, which we *do* want + if ( dest.clearAttributes ) { + dest.clearAttributes(); + } + + // mergeAttributes, in contrast, only merges back on the + // original attributes, not the events + if ( dest.mergeAttributes ) { + dest.mergeAttributes( src ); + } + + nodeName = dest.nodeName.toLowerCase(); + + // IE6-8 fail to clone children inside object elements that use + // the proprietary classid attribute value (rather than the type + // attribute) to identify the type of content to display + if ( nodeName === "object" ) { + dest.outerHTML = src.outerHTML; + + } else if ( nodeName === "input" && (src.type === "checkbox" || src.type === "radio") ) { + // IE6-8 fails to persist the checked state of a cloned checkbox + // or radio button. Worse, IE6-7 fail to give the cloned element + // a checked appearance if the defaultChecked value isn't also set + if ( src.checked ) { + dest.defaultChecked = dest.checked = src.checked; + } + + // IE6-7 get confused and end up setting the value of a cloned + // checkbox/radio button to an empty string instead of "on" + if ( dest.value !== src.value ) { + dest.value = src.value; + } + + // IE6-8 fails to return the selected option to the default selected + // state when cloning options + } else if ( nodeName === "option" ) { + dest.selected = src.defaultSelected; + + // IE6-8 fails to set the defaultValue to the correct value when + // cloning other types of input fields + } else if ( nodeName === "input" || nodeName === "textarea" ) { + dest.defaultValue = src.defaultValue; + } + + // Event data gets referenced instead of copied if the expando + // gets copied too + dest.removeAttribute( jQuery.expando ); +} + +jQuery.buildFragment = function( args, nodes, scripts ) { + var fragment, cacheable, cacheresults, doc, + first = args[ 0 ]; + + // nodes may contain either an explicit document object, + // a jQuery collection or context object. + // If nodes[0] contains a valid object to assign to doc + if ( nodes && nodes[0] ) { + doc = nodes[0].ownerDocument || nodes[0]; + } + + // Ensure that an attr object doesn't incorrectly stand in as a document object + // Chrome and Firefox seem to allow this to occur and will throw exception + // Fixes #8950 + if ( !doc.createDocumentFragment ) { + doc = document; + } + + // Only cache "small" (1/2 KB) HTML strings that are associated with the main document + // Cloning options loses the selected state, so don't cache them + // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment + // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache + // Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501 + if ( args.length === 1 && typeof first === "string" && first.length < 512 && doc === document && + first.charAt(0) === "<" && !rnocache.test( first ) && + (jQuery.support.checkClone || !rchecked.test( first )) && + (jQuery.support.html5Clone || !rnoshimcache.test( first )) ) { + + cacheable = true; + + cacheresults = jQuery.fragments[ first ]; + if ( cacheresults && cacheresults !== 1 ) { + fragment = cacheresults; + } + } + + if ( !fragment ) { + fragment = doc.createDocumentFragment(); + jQuery.clean( args, doc, fragment, scripts ); + } + + if ( cacheable ) { + jQuery.fragments[ first ] = cacheresults ? fragment : 1; + } + + return { fragment: fragment, cacheable: cacheable }; +}; + +jQuery.fragments = {}; + +jQuery.each({ + appendTo: "append", + prependTo: "prepend", + insertBefore: "before", + insertAfter: "after", + replaceAll: "replaceWith" +}, function( name, original ) { + jQuery.fn[ name ] = function( selector ) { + var ret = [], + insert = jQuery( selector ), + parent = this.length === 1 && this[0].parentNode; + + if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) { + insert[ original ]( this[0] ); + return this; + + } else { + for ( var i = 0, l = insert.length; i < l; i++ ) { + var elems = ( i > 0 ? this.clone(true) : this ).get(); + jQuery( insert[i] )[ original ]( elems ); + ret = ret.concat( elems ); + } + + return this.pushStack( ret, name, insert.selector ); + } + }; +}); + +function getAll( elem ) { + if ( typeof elem.getElementsByTagName !== "undefined" ) { + return elem.getElementsByTagName( "*" ); + + } else if ( typeof elem.querySelectorAll !== "undefined" ) { + return elem.querySelectorAll( "*" ); + + } else { + return []; + } +} + +// Used in clean, fixes the defaultChecked property +function fixDefaultChecked( elem ) { + if ( elem.type === "checkbox" || elem.type === "radio" ) { + elem.defaultChecked = elem.checked; + } +} +// Finds all inputs and passes them to fixDefaultChecked +function findInputs( elem ) { + var nodeName = ( elem.nodeName || "" ).toLowerCase(); + if ( nodeName === "input" ) { + fixDefaultChecked( elem ); + // Skip scripts, get other children + } else if ( nodeName !== "script" && typeof elem.getElementsByTagName !== "undefined" ) { + jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked ); + } +} + +// Derived From: http://www.iecss.com/shimprove/javascript/shimprove.1-0-1.js +function shimCloneNode( elem ) { + var div = document.createElement( "div" ); + safeFragment.appendChild( div ); + + div.innerHTML = elem.outerHTML; + return div.firstChild; +} + +jQuery.extend({ + clone: function( elem, dataAndEvents, deepDataAndEvents ) { + var srcElements, + destElements, + i, + // IE<=8 does not properly clone detached, unknown element nodes + clone = jQuery.support.html5Clone || !rnoshimcache.test( "<" + elem.nodeName ) ? + elem.cloneNode( true ) : + shimCloneNode( elem ); + + if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && + (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { + // IE copies events bound via attachEvent when using cloneNode. + // Calling detachEvent on the clone will also remove the events + // from the original. In order to get around this, we use some + // proprietary methods to clear the events. Thanks to MooTools + // guys for this hotness. + + cloneFixAttributes( elem, clone ); + + // Using Sizzle here is crazy slow, so we use getElementsByTagName instead + srcElements = getAll( elem ); + destElements = getAll( clone ); + + // Weird iteration because IE will replace the length property + // with an element if you are cloning the body and one of the + // elements on the page has a name or id of "length" + for ( i = 0; srcElements[i]; ++i ) { + // Ensure that the destination node is not null; Fixes #9587 + if ( destElements[i] ) { + cloneFixAttributes( srcElements[i], destElements[i] ); + } + } + } + + // Copy the events from the original to the clone + if ( dataAndEvents ) { + cloneCopyEvent( elem, clone ); + + if ( deepDataAndEvents ) { + srcElements = getAll( elem ); + destElements = getAll( clone ); + + for ( i = 0; srcElements[i]; ++i ) { + cloneCopyEvent( srcElements[i], destElements[i] ); + } + } + } + + srcElements = destElements = null; + + // Return the cloned set + return clone; + }, + + clean: function( elems, context, fragment, scripts ) { + var checkScriptType; + + context = context || document; + + // !context.createElement fails in IE with an error but returns typeof 'object' + if ( typeof context.createElement === "undefined" ) { + context = context.ownerDocument || context[0] && context[0].ownerDocument || document; + } + + var ret = [], j; + + for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { + if ( typeof elem === "number" ) { + elem += ""; + } + + if ( !elem ) { + continue; + } + + // Convert html string into DOM nodes + if ( typeof elem === "string" ) { + if ( !rhtml.test( elem ) ) { + elem = context.createTextNode( elem ); + } else { + // Fix "XHTML"-style tags in all browsers + elem = elem.replace(rxhtmlTag, "<$1></$2>"); + + // Trim whitespace, otherwise indexOf won't work as expected + var tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(), + wrap = wrapMap[ tag ] || wrapMap._default, + depth = wrap[0], + div = context.createElement("div"); + + // Append wrapper element to unknown element safe doc fragment + if ( context === document ) { + // Use the fragment we've already created for this document + safeFragment.appendChild( div ); + } else { + // Use a fragment created with the owner document + createSafeFragment( context ).appendChild( div ); + } + + // Go to html and back, then peel off extra wrappers + div.innerHTML = wrap[1] + elem + wrap[2]; + + // Move to the right depth + while ( depth-- ) { + div = div.lastChild; + } + + // Remove IE's autoinserted <tbody> from table fragments + if ( !jQuery.support.tbody ) { + + // String was a <table>, *may* have spurious <tbody> + var hasBody = rtbody.test(elem), + tbody = tag === "table" && !hasBody ? + div.firstChild && div.firstChild.childNodes : + + // String was a bare <thead> or <tfoot> + wrap[1] === "<table>" && !hasBody ? + div.childNodes : + []; + + for ( j = tbody.length - 1; j >= 0 ; --j ) { + if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) { + tbody[ j ].parentNode.removeChild( tbody[ j ] ); + } + } + } + + // IE completely kills leading whitespace when innerHTML is used + if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { + div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild ); + } + + elem = div.childNodes; + } + } + + // Resets defaultChecked for any radios and checkboxes + // about to be appended to the DOM in IE 6/7 (#8060) + var len; + if ( !jQuery.support.appendChecked ) { + if ( elem[0] && typeof (len = elem.length) === "number" ) { + for ( j = 0; j < len; j++ ) { + findInputs( elem[j] ); + } + } else { + findInputs( elem ); + } + } + + if ( elem.nodeType ) { + ret.push( elem ); + } else { + ret = jQuery.merge( ret, elem ); + } + } + + if ( fragment ) { + checkScriptType = function( elem ) { + return !elem.type || rscriptType.test( elem.type ); + }; + for ( i = 0; ret[i]; i++ ) { + if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) { + scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] ); + + } else { + if ( ret[i].nodeType === 1 ) { + var jsTags = jQuery.grep( ret[i].getElementsByTagName( "script" ), checkScriptType ); + + ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) ); + } + fragment.appendChild( ret[i] ); + } + } + } + + return ret; + }, + + cleanData: function( elems ) { + var data, id, + cache = jQuery.cache, + special = jQuery.event.special, + deleteExpando = jQuery.support.deleteExpando; + + for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { + if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) { + continue; + } + + id = elem[ jQuery.expando ]; + + if ( id ) { + data = cache[ id ]; + + if ( data && data.events ) { + for ( var type in data.events ) { + if ( special[ type ] ) { + jQuery.event.remove( elem, type ); + + // This is a shortcut to avoid jQuery.event.remove's overhead + } else { + jQuery.removeEvent( elem, type, data.handle ); + } + } + + // Null the DOM reference to avoid IE6/7/8 leak (#7054) + if ( data.handle ) { + data.handle.elem = null; + } + } + + if ( deleteExpando ) { + delete elem[ jQuery.expando ]; + + } else if ( elem.removeAttribute ) { + elem.removeAttribute( jQuery.expando ); + } + + delete cache[ id ]; + } + } + } +}); + +function evalScript( i, elem ) { + if ( elem.src ) { + jQuery.ajax({ + url: elem.src, + async: false, + dataType: "script" + }); + } else { + jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "/*$0*/" ) ); + } + + if ( elem.parentNode ) { + elem.parentNode.removeChild( elem ); + } +} + + + + +var ralpha = /alpha([^)]*)/i, + ropacity = /opacity=([^)]*)/, + // fixed for IE9, see #8346 + rupper = /([A-Z]|^ms)/g, + rnumpx = /^-?\d+(?:px)?$/i, + rnum = /^-?\d/, + rrelNum = /^([-+])=([-+.\de]+)/, + + cssShow = { position: "absolute", visibility: "hidden", display: "block" }, + cssWidth = [ "Left", "Right" ], + cssHeight = [ "Top", "Bottom" ], + curCSS, + + getComputedStyle, + currentStyle; + +jQuery.fn.css = function( name, value ) { + // Setting 'undefined' is a no-op + if ( arguments.length === 2 && value === undefined ) { + return this; + } + + return jQuery.access( this, name, value, true, function( elem, name, value ) { + return value !== undefined ? + jQuery.style( elem, name, value ) : + jQuery.css( elem, name ); + }); +}; + +jQuery.extend({ + // Add in style property hooks for overriding the default + // behavior of getting and setting a style property + cssHooks: { + opacity: { + get: function( elem, computed ) { + if ( computed ) { + // We should always get a number back from opacity + var ret = curCSS( elem, "opacity", "opacity" ); + return ret === "" ? "1" : ret; + + } else { + return elem.style.opacity; + } + } + } + }, + + // Exclude the following css properties to add px + cssNumber: { + "fillOpacity": true, + "fontWeight": true, + "lineHeight": true, + "opacity": true, + "orphans": true, + "widows": true, + "zIndex": true, + "zoom": true + }, + + // Add in properties whose names you wish to fix before + // setting or getting the value + cssProps: { + // normalize float css property + "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat" + }, + + // Get and set the style property on a DOM Node + style: function( elem, name, value, extra ) { + // Don't set styles on text and comment nodes + if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { + return; + } + + // Make sure that we're working with the right name + var ret, type, origName = jQuery.camelCase( name ), + style = elem.style, hooks = jQuery.cssHooks[ origName ]; + + name = jQuery.cssProps[ origName ] || origName; + + // Check if we're setting a value + if ( value !== undefined ) { + type = typeof value; + + // convert relative number strings (+= or -=) to relative numbers. #7345 + if ( type === "string" && (ret = rrelNum.exec( value )) ) { + value = ( +( ret[1] + 1) * +ret[2] ) + parseFloat( jQuery.css( elem, name ) ); + // Fixes bug #9237 + type = "number"; + } + + // Make sure that NaN and null values aren't set. See: #7116 + if ( value == null || type === "number" && isNaN( value ) ) { + return; + } + + // If a number was passed in, add 'px' to the (except for certain CSS properties) + if ( type === "number" && !jQuery.cssNumber[ origName ] ) { + value += "px"; + } + + // If a hook was provided, use that value, otherwise just set the specified value + if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) { + // Wrapped to prevent IE from throwing errors when 'invalid' values are provided + // Fixes bug #5509 + try { + style[ name ] = value; + } catch(e) {} + } + + } else { + // If a hook was provided get the non-computed value from there + if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { + return ret; + } + + // Otherwise just get the value from the style object + return style[ name ]; + } + }, + + css: function( elem, name, extra ) { + var ret, hooks; + + // Make sure that we're working with the right name + name = jQuery.camelCase( name ); + hooks = jQuery.cssHooks[ name ]; + name = jQuery.cssProps[ name ] || name; + + // cssFloat needs a special treatment + if ( name === "cssFloat" ) { + name = "float"; + } + + // If a hook was provided get the computed value from there + if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) { + return ret; + + // Otherwise, if a way to get the computed value exists, use that + } else if ( curCSS ) { + return curCSS( elem, name ); + } + }, + + // A method for quickly swapping in/out CSS properties to get correct calculations + swap: function( elem, options, callback ) { + var old = {}; + + // Remember the old values, and insert the new ones + for ( var name in options ) { + old[ name ] = elem.style[ name ]; + elem.style[ name ] = options[ name ]; + } + + callback.call( elem ); + + // Revert the old values + for ( name in options ) { + elem.style[ name ] = old[ name ]; + } + } +}); + +// DEPRECATED, Use jQuery.css() instead +jQuery.curCSS = jQuery.css; + +jQuery.each(["height", "width"], function( i, name ) { + jQuery.cssHooks[ name ] = { + get: function( elem, computed, extra ) { + var val; + + if ( computed ) { + if ( elem.offsetWidth !== 0 ) { + return getWH( elem, name, extra ); + } else { + jQuery.swap( elem, cssShow, function() { + val = getWH( elem, name, extra ); + }); + } + + return val; + } + }, + + set: function( elem, value ) { + if ( rnumpx.test( value ) ) { + // ignore negative width and height values #1599 + value = parseFloat( value ); + + if ( value >= 0 ) { + return value + "px"; + } + + } else { + return value; + } + } + }; +}); + +if ( !jQuery.support.opacity ) { + jQuery.cssHooks.opacity = { + get: function( elem, computed ) { + // IE uses filters for opacity + return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ? + ( parseFloat( RegExp.$1 ) / 100 ) + "" : + computed ? "1" : ""; + }, + + set: function( elem, value ) { + var style = elem.style, + currentStyle = elem.currentStyle, + opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "", + filter = currentStyle && currentStyle.filter || style.filter || ""; + + // IE has trouble with opacity if it does not have layout + // Force it by setting the zoom level + style.zoom = 1; + + // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652 + if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" ) { + + // Setting style.filter to null, "" & " " still leave "filter:" in the cssText + // if "filter:" is present at all, clearType is disabled, we want to avoid this + // style.removeAttribute is IE Only, but so apparently is this code path... + style.removeAttribute( "filter" ); + + // if there there is no filter style applied in a css rule, we are done + if ( currentStyle && !currentStyle.filter ) { + return; + } + } + + // otherwise, set new filter values + style.filter = ralpha.test( filter ) ? + filter.replace( ralpha, opacity ) : + filter + " " + opacity; + } + }; +} + +jQuery(function() { + // This hook cannot be added until DOM ready because the support test + // for it is not run until after DOM ready + if ( !jQuery.support.reliableMarginRight ) { + jQuery.cssHooks.marginRight = { + get: function( elem, computed ) { + // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right + // Work around by temporarily setting element display to inline-block + var ret; + jQuery.swap( elem, { "display": "inline-block" }, function() { + if ( computed ) { + ret = curCSS( elem, "margin-right", "marginRight" ); + } else { + ret = elem.style.marginRight; + } + }); + return ret; + } + }; + } +}); + +if ( document.defaultView && document.defaultView.getComputedStyle ) { + getComputedStyle = function( elem, name ) { + var ret, defaultView, computedStyle; + + name = name.replace( rupper, "-$1" ).toLowerCase(); + + if ( (defaultView = elem.ownerDocument.defaultView) && + (computedStyle = defaultView.getComputedStyle( elem, null )) ) { + ret = computedStyle.getPropertyValue( name ); + if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) { + ret = jQuery.style( elem, name ); + } + } + + return ret; + }; +} + +if ( document.documentElement.currentStyle ) { + currentStyle = function( elem, name ) { + var left, rsLeft, uncomputed, + ret = elem.currentStyle && elem.currentStyle[ name ], + style = elem.style; + + // Avoid setting ret to empty string here + // so we don't default to auto + if ( ret === null && style && (uncomputed = style[ name ]) ) { + ret = uncomputed; + } + + // From the awesome hack by Dean Edwards + // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 + + // If we're not dealing with a regular pixel number + // but a number that has a weird ending, we need to convert it to pixels + if ( !rnumpx.test( ret ) && rnum.test( ret ) ) { + + // Remember the original values + left = style.left; + rsLeft = elem.runtimeStyle && elem.runtimeStyle.left; + + // Put in the new values to get a computed value out + if ( rsLeft ) { + elem.runtimeStyle.left = elem.currentStyle.left; + } + style.left = name === "fontSize" ? "1em" : ( ret || 0 ); + ret = style.pixelLeft + "px"; + + // Revert the changed values + style.left = left; + if ( rsLeft ) { + elem.runtimeStyle.left = rsLeft; + } + } + + return ret === "" ? "auto" : ret; + }; +} + +curCSS = getComputedStyle || currentStyle; + +function getWH( elem, name, extra ) { + + // Start with offset property + var val = name === "width" ? elem.offsetWidth : elem.offsetHeight, + which = name === "width" ? cssWidth : cssHeight, + i = 0, + len = which.length; + + if ( val > 0 ) { + if ( extra !== "border" ) { + for ( ; i < len; i++ ) { + if ( !extra ) { + val -= parseFloat( jQuery.css( elem, "padding" + which[ i ] ) ) || 0; + } + if ( extra === "margin" ) { + val += parseFloat( jQuery.css( elem, extra + which[ i ] ) ) || 0; + } else { + val -= parseFloat( jQuery.css( elem, "border" + which[ i ] + "Width" ) ) || 0; + } + } + } + + return val + "px"; + } + + // Fall back to computed then uncomputed css if necessary + val = curCSS( elem, name, name ); + if ( val < 0 || val == null ) { + val = elem.style[ name ] || 0; + } + // Normalize "", auto, and prepare for extra + val = parseFloat( val ) || 0; + + // Add padding, border, margin + if ( extra ) { + for ( ; i < len; i++ ) { + val += parseFloat( jQuery.css( elem, "padding" + which[ i ] ) ) || 0; + if ( extra !== "padding" ) { + val += parseFloat( jQuery.css( elem, "border" + which[ i ] + "Width" ) ) || 0; + } + if ( extra === "margin" ) { + val += parseFloat( jQuery.css( elem, extra + which[ i ] ) ) || 0; + } + } + } + + return val + "px"; +} + +if ( jQuery.expr && jQuery.expr.filters ) { + jQuery.expr.filters.hidden = function( elem ) { + var width = elem.offsetWidth, + height = elem.offsetHeight; + + return ( width === 0 && height === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none"); + }; + + jQuery.expr.filters.visible = function( elem ) { + return !jQuery.expr.filters.hidden( elem ); + }; +} + + + + +var r20 = /%20/g, + rbracket = /[]$/, + rCRLF = /\r?\n/g, + rhash = /#.*$/, + rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL + rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i, + // #7653, #8125, #8152: local protocol detection + rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, + rnoContent = /^(?:GET|HEAD)$/, + rprotocol = /^///, + rquery = /?/, + rscript = /<script\b[^<]*(?:(?!</script>)<[^<]*)*</script>/gi, + rselectTextarea = /^(?:select|textarea)/i, + rspacesAjax = /\s+/, + rts = /([?&])_=[^&]*/, + rurl = /^([\w+.-]+:)(?://([^/?#:]*)(?::(\d+))?)?/, + + // Keep a copy of the old load method + _load = jQuery.fn.load, + + /* Prefilters + * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) + * 2) These are called: + * - BEFORE asking for a transport + * - AFTER param serialization (s.data is a string if s.processData is true) + * 3) key is the dataType + * 4) the catchall symbol "*" can be used + * 5) execution will start with transport dataType and THEN continue down to "*" if needed + */ + prefilters = {}, + + /* Transports bindings + * 1) key is the dataType + * 2) the catchall symbol "*" can be used + * 3) selection will start with transport dataType and THEN go to "*" if needed + */ + transports = {}, + + // Document location + ajaxLocation, + + // Document location segments + ajaxLocParts, + + // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression + allTypes = ["*/"] + ["*"]; + +// #8138, IE may throw an exception when accessing +// a field from window.location if document.domain has been set +try { + ajaxLocation = location.href; +} catch( e ) { + // Use the href attribute of an A element + // since IE will modify it given document.location + ajaxLocation = document.createElement( "a" ); + ajaxLocation.href = ""; + ajaxLocation = ajaxLocation.href; +} + +// Segment location into parts +ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || []; + +// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport +function addToPrefiltersOrTransports( structure ) { + + // dataTypeExpression is optional and defaults to "*" + return function( dataTypeExpression, func ) { + + if ( typeof dataTypeExpression !== "string" ) { + func = dataTypeExpression; + dataTypeExpression = "*"; + } + + if ( jQuery.isFunction( func ) ) { + var dataTypes = dataTypeExpression.toLowerCase().split( rspacesAjax ), + i = 0, + length = dataTypes.length, + dataType, + list, + placeBefore; + + // For each dataType in the dataTypeExpression + for ( ; i < length; i++ ) { + dataType = dataTypes[ i ]; + // We control if we're asked to add before + // any existing element + placeBefore = /^+/.test( dataType ); + if ( placeBefore ) { + dataType = dataType.substr( 1 ) || "*"; + } + list = structure[ dataType ] = structure[ dataType ] || []; + // then we add to the structure accordingly + list[ placeBefore ? "unshift" : "push" ]( func ); + } + } + }; +} + +// Base inspection function for prefilters and transports +function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR, + dataType /* internal */, inspected /* internal */ ) { + + dataType = dataType || options.dataTypes[ 0 ]; + inspected = inspected || {}; + + inspected[ dataType ] = true; + + var list = structure[ dataType ], + i = 0, + length = list ? list.length : 0, + executeOnly = ( structure === prefilters ), + selection; + + for ( ; i < length && ( executeOnly || !selection ); i++ ) { + selection = list[ i ]( options, originalOptions, jqXHR ); + // If we got redirected to another dataType + // we try there if executing only and not done already + if ( typeof selection === "string" ) { + if ( !executeOnly || inspected[ selection ] ) { + selection = undefined; + } else { + options.dataTypes.unshift( selection ); + selection = inspectPrefiltersOrTransports( + structure, options, originalOptions, jqXHR, selection, inspected ); + } + } + } + // If we're only executing or nothing was selected + // we try the catchall dataType if not done already + if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) { + selection = inspectPrefiltersOrTransports( + structure, options, originalOptions, jqXHR, "*", inspected ); + } + // unnecessary when only executing (prefilters) + // but it'll be ignored by the caller in that case + return selection; +} + +// A special extend for ajax options +// that takes "flat" options (not to be deep extended) +// Fixes #9887 +function ajaxExtend( target, src ) { + var key, deep, + flatOptions = jQuery.ajaxSettings.flatOptions || {}; + for ( key in src ) { + if ( src[ key ] !== undefined ) { + ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; + } + } + if ( deep ) { + jQuery.extend( true, target, deep ); + } +} + +jQuery.fn.extend({ + load: function( url, params, callback ) { + if ( typeof url !== "string" && _load ) { + return _load.apply( this, arguments ); + + // Don't do a request if no elements are being requested + } else if ( !this.length ) { + return this; + } + + var off = url.indexOf( " " ); + if ( off >= 0 ) { + var selector = url.slice( off, url.length ); + url = url.slice( 0, off ); + } + + // Default to a GET request + var type = "GET"; + + // If the second parameter was provided + if ( params ) { + // If it's a function + if ( jQuery.isFunction( params ) ) { + // We assume that it's the callback + callback = params; + params = undefined; + + // Otherwise, build a param string + } else if ( typeof params === "object" ) { + params = jQuery.param( params, jQuery.ajaxSettings.traditional ); + type = "POST"; + } + } + + var self = this; + + // Request the remote document + jQuery.ajax({ + url: url, + type: type, + dataType: "html", + data: params, + // Complete callback (responseText is used internally) + complete: function( jqXHR, status, responseText ) { + // Store the response as specified by the jqXHR object + responseText = jqXHR.responseText; + // If successful, inject the HTML into all the matched elements + if ( jqXHR.isResolved() ) { + // #4825: Get the actual response in case + // a dataFilter is present in ajaxSettings + jqXHR.done(function( r ) { + responseText = r; + }); + // See if a selector was specified + self.html( selector ? + // Create a dummy div to hold the results + jQuery("<div>") + // inject the contents of the document in, removing the scripts + // to avoid any 'Permission Denied' errors in IE + .append(responseText.replace(rscript, "")) + + // Locate the specified elements + .find(selector) : + + // If not, just inject the full result + responseText ); + } + + if ( callback ) { + self.each( callback, [ responseText, status, jqXHR ] ); + } + } + }); + + return this; + }, + + serialize: function() { + return jQuery.param( this.serializeArray() ); + }, + + serializeArray: function() { + return this.map(function(){ + return this.elements ? jQuery.makeArray( this.elements ) : this; + }) + .filter(function(){ + return this.name && !this.disabled && + ( this.checked || rselectTextarea.test( this.nodeName ) || + rinput.test( this.type ) ); + }) + .map(function( i, elem ){ + var val = jQuery( this ).val(); + + return val == null ? + null : + jQuery.isArray( val ) ? + jQuery.map( val, function( val, i ){ + return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; + }) : + { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; + }).get(); + } +}); + +// Attach a bunch of functions for handling common AJAX events +jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){ + jQuery.fn[ o ] = function( f ){ + return this.on( o, f ); + }; +}); + +jQuery.each( [ "get", "post" ], function( i, method ) { + jQuery[ method ] = function( url, data, callback, type ) { + // shift arguments if data argument was omitted + if ( jQuery.isFunction( data ) ) { + type = type || callback; + callback = data; + data = undefined; + } + + return jQuery.ajax({ + type: method, + url: url, + data: data, + success: callback, + dataType: type + }); + }; +}); + +jQuery.extend({ + + getScript: function( url, callback ) { + return jQuery.get( url, undefined, callback, "script" ); + }, + + getJSON: function( url, data, callback ) { + return jQuery.get( url, data, callback, "json" ); + }, + + // Creates a full fledged settings object into target + // with both ajaxSettings and settings fields. + // If target is omitted, writes into ajaxSettings. + ajaxSetup: function( target, settings ) { + if ( settings ) { + // Building a settings object + ajaxExtend( target, jQuery.ajaxSettings ); + } else { + // Extending ajaxSettings + settings = target; + target = jQuery.ajaxSettings; + } + ajaxExtend( target, settings ); + return target; + }, + + ajaxSettings: { + url: ajaxLocation, + isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ), + global: true, + type: "GET", + contentType: "application/x-www-form-urlencoded", + processData: true, + async: true, + /* + timeout: 0, + data: null, + dataType: null, + username: null, + password: null, + cache: null, + traditional: false, + headers: {}, + */ + + accepts: { + xml: "application/xml, text/xml", + html: "text/html", + text: "text/plain", + json: "application/json, text/javascript", + "*": allTypes + }, + + contents: { + xml: /xml/, + html: /html/, + json: /json/ + }, + + responseFields: { + xml: "responseXML", + text: "responseText" + }, + + // List of data converters + // 1) key format is "source_type destination_type" (a single space in-between) + // 2) the catchall symbol "*" can be used for source_type + converters: { + + // Convert anything to text + "* text": window.String, + + // Text to html (true = no transformation) + "text html": true, + + // Evaluate text as a json expression + "text json": jQuery.parseJSON, + + // Parse text as xml + "text xml": jQuery.parseXML + }, + + // For options that shouldn't be deep extended: + // you can add your own custom options here if + // and when you create one that shouldn't be + // deep extended (see ajaxExtend) + flatOptions: { + context: true, + url: true + } + }, + + ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), + ajaxTransport: addToPrefiltersOrTransports( transports ), + + // Main method + ajax: function( url, options ) { + + // If url is an object, simulate pre-1.5 signature + if ( typeof url === "object" ) { + options = url; + url = undefined; + } + + // Force options to be an object + options = options || {}; + + var // Create the final options object + s = jQuery.ajaxSetup( {}, options ), + // Callbacks context + callbackContext = s.context || s, + // Context for global events + // It's the callbackContext if one was provided in the options + // and if it's a DOM node or a jQuery collection + globalEventContext = callbackContext !== s && + ( callbackContext.nodeType || callbackContext instanceof jQuery ) ? + jQuery( callbackContext ) : jQuery.event, + // Deferreds + deferred = jQuery.Deferred(), + completeDeferred = jQuery.Callbacks( "once memory" ), + // Status-dependent callbacks + statusCode = s.statusCode || {}, + // ifModified key + ifModifiedKey, + // Headers (they are sent all at once) + requestHeaders = {}, + requestHeadersNames = {}, + // Response headers + responseHeadersString, + responseHeaders, + // transport + transport, + // timeout handle + timeoutTimer, + // Cross-domain detection vars + parts, + // The jqXHR state + state = 0, + // To know if global events are to be dispatched + fireGlobals, + // Loop variable + i, + // Fake xhr + jqXHR = { + + readyState: 0, + + // Caches the header + setRequestHeader: function( name, value ) { + if ( !state ) { + var lname = name.toLowerCase(); + name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name; + requestHeaders[ name ] = value; + } + return this; + }, + + // Raw string + getAllResponseHeaders: function() { + return state === 2 ? responseHeadersString : null; + }, + + // Builds headers hashtable if needed + getResponseHeader: function( key ) { + var match; + if ( state === 2 ) { + if ( !responseHeaders ) { + responseHeaders = {}; + while( ( match = rheaders.exec( responseHeadersString ) ) ) { + responseHeaders[ match[1].toLowerCase() ] = match[ 2 ]; + } + } + match = responseHeaders[ key.toLowerCase() ]; + } + return match === undefined ? null : match; + }, + + // Overrides response content-type header + overrideMimeType: function( type ) { + if ( !state ) { + s.mimeType = type; + } + return this; + }, + + // Cancel the request + abort: function( statusText ) { + statusText = statusText || "abort"; + if ( transport ) { + transport.abort( statusText ); + } + done( 0, statusText ); + return this; + } + }; + + // Callback for when everything is done + // It is defined here because jslint complains if it is declared + // at the end of the function (which would be more logical and readable) + function done( status, nativeStatusText, responses, headers ) { + + // Called once + if ( state === 2 ) { + return; + } + + // State is "done" now + state = 2; + + // Clear timeout if it exists + if ( timeoutTimer ) { + clearTimeout( timeoutTimer ); + } + + // Dereference transport for early garbage collection + // (no matter how long the jqXHR object will be used) + transport = undefined; + + // Cache response headers + responseHeadersString = headers || ""; + + // Set readyState + jqXHR.readyState = status > 0 ? 4 : 0; + + var isSuccess, + success, + error, + statusText = nativeStatusText, + response = responses ? ajaxHandleResponses( s, jqXHR, responses ) : undefined, + lastModified, + etag; + + // If successful, handle type chaining + if ( status >= 200 && status < 300 || status === 304 ) { + + // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. + if ( s.ifModified ) { + + if ( ( lastModified = jqXHR.getResponseHeader( "Last-Modified" ) ) ) { + jQuery.lastModified[ ifModifiedKey ] = lastModified; + } + if ( ( etag = jqXHR.getResponseHeader( "Etag" ) ) ) { + jQuery.etag[ ifModifiedKey ] = etag; + } + } + + // If not modified + if ( status === 304 ) { + + statusText = "notmodified"; + isSuccess = true; + + // If we have data + } else { + + try { + success = ajaxConvert( s, response ); + statusText = "success"; + isSuccess = true; + } catch(e) { + // We have a parsererror + statusText = "parsererror"; + error = e; + } + } + } else { + // We extract error from statusText + // then normalize statusText and status for non-aborts + error = statusText; + if ( !statusText || status ) { + statusText = "error"; + if ( status < 0 ) { + status = 0; + } + } + } + + // Set data for the fake xhr object + jqXHR.status = status; + jqXHR.statusText = "" + ( nativeStatusText || statusText ); + + // Success/Error + if ( isSuccess ) { + deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); + } else { + deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); + } + + // Status-dependent callbacks + jqXHR.statusCode( statusCode ); + statusCode = undefined; + + if ( fireGlobals ) { + globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ), + [ jqXHR, s, isSuccess ? success : error ] ); + } + + // Complete + completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); + + if ( fireGlobals ) { + globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); + // Handle the global AJAX counter + if ( !( --jQuery.active ) ) { + jQuery.event.trigger( "ajaxStop" ); + } + } + } + + // Attach deferreds + deferred.promise( jqXHR ); + jqXHR.success = jqXHR.done; + jqXHR.error = jqXHR.fail; + jqXHR.complete = completeDeferred.add; + + // Status-dependent callbacks + jqXHR.statusCode = function( map ) { + if ( map ) { + var tmp; + if ( state < 2 ) { + for ( tmp in map ) { + statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ]; + } + } else { + tmp = map[ jqXHR.status ]; + jqXHR.then( tmp, tmp ); + } + } + return this; + }; + + // Remove hash character (#7531: and string promotion) + // Add protocol if not provided (#5866: IE7 issue with protocol-less urls) + // We also use the url parameter if available + s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" ); + + // Extract dataTypes list + s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( rspacesAjax ); + + // Determine if a cross-domain request is in order + if ( s.crossDomain == null ) { + parts = rurl.exec( s.url.toLowerCase() ); + s.crossDomain = !!( parts && + ( parts[ 1 ] != ajaxLocParts[ 1 ] || parts[ 2 ] != ajaxLocParts[ 2 ] || + ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) != + ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) ) + ); + } + + // Convert data if not already a string + if ( s.data && s.processData && typeof s.data !== "string" ) { + s.data = jQuery.param( s.data, s.traditional ); + } + + // Apply prefilters + inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); + + // If request was aborted inside a prefiler, stop there + if ( state === 2 ) { + return false; + } + + // We can fire global events as of now if asked to + fireGlobals = s.global; + + // Uppercase the type + s.type = s.type.toUpperCase(); + + // Determine if request has content + s.hasContent = !rnoContent.test( s.type ); + + // Watch for a new set of requests + if ( fireGlobals && jQuery.active++ === 0 ) { + jQuery.event.trigger( "ajaxStart" ); + } + + // More options handling for requests with no content + if ( !s.hasContent ) { + + // If data is available, append data to url + if ( s.data ) { + s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data; + // #9682: remove data so that it's not used in an eventual retry + delete s.data; + } + + // Get ifModifiedKey before adding the anti-cache parameter + ifModifiedKey = s.url; + + // Add anti-cache in url if needed + if ( s.cache === false ) { + + var ts = jQuery.now(), + // try replacing _= if it is there + ret = s.url.replace( rts, "$1_=" + ts ); + + // if nothing was replaced, add timestamp to the end + s.url = ret + ( ( ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" ); + } + } + + // Set the correct header, if data is being sent + if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { + jqXHR.setRequestHeader( "Content-Type", s.contentType ); + } + + // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. + if ( s.ifModified ) { + ifModifiedKey = ifModifiedKey || s.url; + if ( jQuery.lastModified[ ifModifiedKey ] ) { + jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ ifModifiedKey ] ); + } + if ( jQuery.etag[ ifModifiedKey ] ) { + jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ ifModifiedKey ] ); + } + } + + // Set the Accepts header for the server, depending on the dataType + jqXHR.setRequestHeader( + "Accept", + s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ? + s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : + s.accepts[ "*" ] + ); + + // Check for headers option + for ( i in s.headers ) { + jqXHR.setRequestHeader( i, s.headers[ i ] ); + } + + // Allow custom headers/mimetypes and early abort + if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) { + // Abort if not done already + jqXHR.abort(); + return false; + + } + + // Install callbacks on deferreds + for ( i in { success: 1, error: 1, complete: 1 } ) { + jqXHR[ i ]( s[ i ] ); + } + + // Get transport + transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); + + // If no transport, we auto-abort + if ( !transport ) { + done( -1, "No Transport" ); + } else { + jqXHR.readyState = 1; + // Send global event + if ( fireGlobals ) { + globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); + } + // Timeout + if ( s.async && s.timeout > 0 ) { + timeoutTimer = setTimeout( function(){ + jqXHR.abort( "timeout" ); + }, s.timeout ); + } + + try { + state = 1; + transport.send( requestHeaders, done ); + } catch (e) { + // Propagate exception as error if not done + if ( state < 2 ) { + done( -1, e ); + // Simply rethrow otherwise + } else { + throw e; + } + } + } + + return jqXHR; + }, + + // Serialize an array of form elements or a set of + // key/values into a query string + param: function( a, traditional ) { + var s = [], + add = function( key, value ) { + // If value is a function, invoke it and return its value + value = jQuery.isFunction( value ) ? value() : value; + s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value ); + }; + + // Set traditional to true for jQuery <= 1.3.2 behavior. + if ( traditional === undefined ) { + traditional = jQuery.ajaxSettings.traditional; + } + + // If an array was passed in, assume that it is an array of form elements. + if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { + // Serialize the form elements + jQuery.each( a, function() { + add( this.name, this.value ); + }); + + } else { + // If traditional, encode the "old" way (the way 1.3.2 or older + // did it), otherwise encode params recursively. + for ( var prefix in a ) { + buildParams( prefix, a[ prefix ], traditional, add ); + } + } + + // Return the resulting serialization + return s.join( "&" ).replace( r20, "+" ); + } +}); + +function buildParams( prefix, obj, traditional, add ) { + if ( jQuery.isArray( obj ) ) { + // Serialize array item. + jQuery.each( obj, function( i, v ) { + if ( traditional || rbracket.test( prefix ) ) { + // Treat each array item as a scalar. + add( prefix, v ); + + } else { + // If array item is non-scalar (array or object), encode its + // numeric index to resolve deserialization ambiguity issues. + // Note that rack (as of 1.0.0) can't currently deserialize + // nested arrays properly, and attempting to do so may cause + // a server error. Possible fixes are to modify rack's + // deserialization algorithm or to provide an option or flag + // to force array serialization to be shallow. + buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v, traditional, add ); + } + }); + + } else if ( !traditional && obj != null && typeof obj === "object" ) { + // Serialize object item. + for ( var name in obj ) { + buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); + } + + } else { + // Serialize scalar item. + add( prefix, obj ); + } +} + +// This is still on the jQuery object... for now +// Want to move this to jQuery.ajax some day +jQuery.extend({ + + // Counter for holding the number of active queries + active: 0, + + // Last-Modified header cache for next request + lastModified: {}, + etag: {} + +}); + +/* Handles responses to an ajax request: + * - sets all responseXXX fields accordingly + * - finds the right dataType (mediates between content-type and expected dataType) + * - returns the corresponding response + */ +function ajaxHandleResponses( s, jqXHR, responses ) { + + var contents = s.contents, + dataTypes = s.dataTypes, + responseFields = s.responseFields, + ct, + type, + finalDataType, + firstDataType; + + // Fill responseXXX fields + for ( type in responseFields ) { + if ( type in responses ) { + jqXHR[ responseFields[type] ] = responses[ type ]; + } + } + + // Remove auto dataType and get content-type in the process + while( dataTypes[ 0 ] === "*" ) { + dataTypes.shift(); + if ( ct === undefined ) { + ct = s.mimeType || jqXHR.getResponseHeader( "content-type" ); + } + } + + // Check if we're dealing with a known content-type + if ( ct ) { + for ( type in contents ) { + if ( contents[ type ] && contents[ type ].test( ct ) ) { + dataTypes.unshift( type ); + break; + } + } + } + + // Check to see if we have a response for the expected dataType + if ( dataTypes[ 0 ] in responses ) { + finalDataType = dataTypes[ 0 ]; + } else { + // Try convertible dataTypes + for ( type in responses ) { + if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) { + finalDataType = type; + break; + } + if ( !firstDataType ) { + firstDataType = type; + } + } + // Or just use first one + finalDataType = finalDataType || firstDataType; + } + + // If we found a dataType + // We add the dataType to the list if needed + // and return the corresponding response + if ( finalDataType ) { + if ( finalDataType !== dataTypes[ 0 ] ) { + dataTypes.unshift( finalDataType ); + } + return responses[ finalDataType ]; + } +} + +// Chain conversions given the request and the original response +function ajaxConvert( s, response ) { + + // Apply the dataFilter if provided + if ( s.dataFilter ) { + response = s.dataFilter( response, s.dataType ); + } + + var dataTypes = s.dataTypes, + converters = {}, + i, + key, + length = dataTypes.length, + tmp, + // Current and previous dataTypes + current = dataTypes[ 0 ], + prev, + // Conversion expression + conversion, + // Conversion function + conv, + // Conversion functions (transitive conversion) + conv1, + conv2; + + // For each dataType in the chain + for ( i = 1; i < length; i++ ) { + + // Create converters map + // with lowercased keys + if ( i === 1 ) { + for ( key in s.converters ) { + if ( typeof key === "string" ) { + converters[ key.toLowerCase() ] = s.converters[ key ]; + } + } + } + + // Get the dataTypes + prev = current; + current = dataTypes[ i ]; + + // If current is auto dataType, update it to prev + if ( current === "*" ) { + current = prev; + // If no auto and dataTypes are actually different + } else if ( prev !== "*" && prev !== current ) { + + // Get the converter + conversion = prev + " " + current; + conv = converters[ conversion ] || converters[ "* " + current ]; + + // If there is no direct converter, search transitively + if ( !conv ) { + conv2 = undefined; + for ( conv1 in converters ) { + tmp = conv1.split( " " ); + if ( tmp[ 0 ] === prev || tmp[ 0 ] === "*" ) { + conv2 = converters[ tmp[1] + " " + current ]; + if ( conv2 ) { + conv1 = converters[ conv1 ]; + if ( conv1 === true ) { + conv = conv2; + } else if ( conv2 === true ) { + conv = conv1; + } + break; + } + } + } + } + // If we found no converter, dispatch an error + if ( !( conv || conv2 ) ) { + jQuery.error( "No conversion from " + conversion.replace(" "," to ") ); + } + // If found converter is not an equivalence + if ( conv !== true ) { + // Convert with 1 or 2 converters accordingly + response = conv ? conv( response ) : conv2( conv1(response) ); + } + } + } + return response; +} + + + + +var jsc = jQuery.now(), + jsre = /(=)?(&|$)|??/i; + +// Default jsonp settings +jQuery.ajaxSetup({ + jsonp: "callback", + jsonpCallback: function() { + return jQuery.expando + "_" + ( jsc++ ); + } +}); + +// Detect, normalize options and install callbacks for jsonp requests +jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { + + var inspectData = s.contentType === "application/x-www-form-urlencoded" && + ( typeof s.data === "string" ); + + if ( s.dataTypes[ 0 ] === "jsonp" || + s.jsonp !== false && ( jsre.test( s.url ) || + inspectData && jsre.test( s.data ) ) ) { + + var responseContainer, + jsonpCallback = s.jsonpCallback = + jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback, + previous = window[ jsonpCallback ], + url = s.url, + data = s.data, + replace = "$1" + jsonpCallback + "$2"; + + if ( s.jsonp !== false ) { + url = url.replace( jsre, replace ); + if ( s.url === url ) { + if ( inspectData ) { + data = data.replace( jsre, replace ); + } + if ( s.data === data ) { + // Add callback manually + url += (/?/.test( url ) ? "&" : "?") + s.jsonp + "=" + jsonpCallback; + } + } + } + + s.url = url; + s.data = data; + + // Install callback + window[ jsonpCallback ] = function( response ) { + responseContainer = [ response ]; + }; + + // Clean-up function + jqXHR.always(function() { + // Set callback back to previous value + window[ jsonpCallback ] = previous; + // Call if it was a function and we have a response + if ( responseContainer && jQuery.isFunction( previous ) ) { + window[ jsonpCallback ]( responseContainer[ 0 ] ); + } + }); + + // Use data converter to retrieve json after script execution + s.converters["script json"] = function() { + if ( !responseContainer ) { + jQuery.error( jsonpCallback + " was not called" ); + } + return responseContainer[ 0 ]; + }; + + // force json dataType + s.dataTypes[ 0 ] = "json"; + + // Delegate to script + return "script"; + } +}); + + + + +// Install script dataType +jQuery.ajaxSetup({ + accepts: { + script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" + }, + contents: { + script: /javascript|ecmascript/ + }, + converters: { + "text script": function( text ) { + jQuery.globalEval( text ); + return text; + } + } +}); + +// Handle cache's special case and global +jQuery.ajaxPrefilter( "script", function( s ) { + if ( s.cache === undefined ) { + s.cache = false; + } + if ( s.crossDomain ) { + s.type = "GET"; + s.global = false; + } +}); + +// Bind script tag hack transport +jQuery.ajaxTransport( "script", function(s) { + + // This transport only deals with cross domain requests + if ( s.crossDomain ) { + + var script, + head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement; + + return { + + send: function( _, callback ) { + + script = document.createElement( "script" ); + + script.async = "async"; + + if ( s.scriptCharset ) { + script.charset = s.scriptCharset; + } + + script.src = s.url; + + // Attach handlers for all browsers + script.onload = script.onreadystatechange = function( _, isAbort ) { + + if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) { + + // Handle memory leak in IE + script.onload = script.onreadystatechange = null; + + // Remove the script + if ( head && script.parentNode ) { + head.removeChild( script ); + } + + // Dereference the script + script = undefined; + + // Callback if not abort + if ( !isAbort ) { + callback( 200, "success" ); + } + } + }; + // Use insertBefore instead of appendChild to circumvent an IE6 bug. + // This arises when a base node is used (#2709 and #4378). + head.insertBefore( script, head.firstChild ); + }, + + abort: function() { + if ( script ) { + script.onload( 0, 1 ); + } + } + }; + } +}); + + + + +var // #5280: Internet Explorer will keep connections alive if we don't abort on unload + xhrOnUnloadAbort = window.ActiveXObject ? function() { + // Abort all pending requests + for ( var key in xhrCallbacks ) { + xhrCallbacks[ key ]( 0, 1 ); + } + } : false, + xhrId = 0, + xhrCallbacks; + +// Functions to create xhrs +function createStandardXHR() { + try { + return new window.XMLHttpRequest(); + } catch( e ) {} +} + +function createActiveXHR() { + try { + return new window.ActiveXObject( "Microsoft.XMLHTTP" ); + } catch( e ) {} +} + +// Create the request object +// (This is still attached to ajaxSettings for backward compatibility) +jQuery.ajaxSettings.xhr = window.ActiveXObject ? + /* Microsoft failed to properly + * implement the XMLHttpRequest in IE7 (can't request local files), + * so we use the ActiveXObject when it is available + * Additionally XMLHttpRequest can be disabled in IE7/IE8 so + * we need a fallback. + */ + function() { + return !this.isLocal && createStandardXHR() || createActiveXHR(); + } : + // For all other browsers, use the standard XMLHttpRequest object + createStandardXHR; + +// Determine support properties +(function( xhr ) { + jQuery.extend( jQuery.support, { + ajax: !!xhr, + cors: !!xhr && ( "withCredentials" in xhr ) + }); +})( jQuery.ajaxSettings.xhr() ); + +// Create transport if the browser can provide an xhr +if ( jQuery.support.ajax ) { + + jQuery.ajaxTransport(function( s ) { + // Cross domain only allowed if supported through XMLHttpRequest + if ( !s.crossDomain || jQuery.support.cors ) { + + var callback; + + return { + send: function( headers, complete ) { + + // Get a new xhr + var xhr = s.xhr(), + handle, + i; + + // Open the socket + // Passing null username, generates a login popup on Opera (#2865) + if ( s.username ) { + xhr.open( s.type, s.url, s.async, s.username, s.password ); + } else { + xhr.open( s.type, s.url, s.async ); + } + + // Apply custom fields if provided + if ( s.xhrFields ) { + for ( i in s.xhrFields ) { + xhr[ i ] = s.xhrFields[ i ]; + } + } + + // Override mime type if needed + if ( s.mimeType && xhr.overrideMimeType ) { + xhr.overrideMimeType( s.mimeType ); + } + + // X-Requested-With header + // For cross-domain requests, seeing as conditions for a preflight are + // akin to a jigsaw puzzle, we simply never set it to be sure. + // (it can always be set on a per-request basis or even using ajaxSetup) + // For same-domain requests, won't change header if already provided. + if ( !s.crossDomain && !headers["X-Requested-With"] ) { + headers[ "X-Requested-With" ] = "XMLHttpRequest"; + } + + // Need an extra try/catch for cross domain requests in Firefox 3 + try { + for ( i in headers ) { + xhr.setRequestHeader( i, headers[ i ] ); + } + } catch( _ ) {} + + // Do send the request + // This may raise an exception which is actually + // handled in jQuery.ajax (so no try/catch here) + xhr.send( ( s.hasContent && s.data ) || null ); + + // Listener + callback = function( _, isAbort ) { + + var status, + statusText, + responseHeaders, + responses, + xml; + + // Firefox throws exceptions when accessing properties + // of an xhr when a network error occured + // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x...) + try { + + // Was never called and is aborted or complete + if ( callback && ( isAbort || xhr.readyState === 4 ) ) { + + // Only called once + callback = undefined; + + // Do not keep as active anymore + if ( handle ) { + xhr.onreadystatechange = jQuery.noop; + if ( xhrOnUnloadAbort ) { + delete xhrCallbacks[ handle ]; + } + } + + // If it's an abort + if ( isAbort ) { + // Abort it manually if needed + if ( xhr.readyState !== 4 ) { + xhr.abort(); + } + } else { + status = xhr.status; + responseHeaders = xhr.getAllResponseHeaders(); + responses = {}; + xml = xhr.responseXML; + + // Construct response list + if ( xml && xml.documentElement /* #4958 */ ) { + responses.xml = xml; + } + responses.text = xhr.responseText; + + // Firefox throws an exception when accessing + // statusText for faulty cross-domain requests + try { + statusText = xhr.statusText; + } catch( e ) { + // We normalize with Webkit giving an empty statusText + statusText = ""; + } + + // Filter status for non standard behaviors + + // If the request is local and we have data: assume a success + // (success with no data won't get notified, that's the best we + // can do given current implementations) + if ( !status && s.isLocal && !s.crossDomain ) { + status = responses.text ? 200 : 404; + // IE - #1450: sometimes returns 1223 when it should be 204 + } else if ( status === 1223 ) { + status = 204; + } + } + } + } catch( firefoxAccessException ) { + if ( !isAbort ) { + complete( -1, firefoxAccessException ); + } + } + + // Call complete if needed + if ( responses ) { + complete( status, statusText, responses, responseHeaders ); + } + }; + + // if we're in sync mode or it's in cache + // and has been retrieved directly (IE6 & IE7) + // we need to manually fire the callback + if ( !s.async || xhr.readyState === 4 ) { + callback(); + } else { + handle = ++xhrId; + if ( xhrOnUnloadAbort ) { + // Create the active xhrs callbacks list if needed + // and attach the unload handler + if ( !xhrCallbacks ) { + xhrCallbacks = {}; + jQuery( window ).unload( xhrOnUnloadAbort ); + } + // Add to list of active xhrs callbacks + xhrCallbacks[ handle ] = callback; + } + xhr.onreadystatechange = callback; + } + }, + + abort: function() { + if ( callback ) { + callback(0,1); + } + } + }; + } + }); +} + + + + +var elemdisplay = {}, + iframe, iframeDoc, + rfxtypes = /^(?:toggle|show|hide)$/, + rfxnum = /^([+-]=)?([\d+.-]+)([a-z%]*)$/i, + timerId, + fxAttrs = [ + // height animations + [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ], + // width animations + [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ], + // opacity animations + [ "opacity" ] + ], + fxNow; + +jQuery.fn.extend({ + show: function( speed, easing, callback ) { + var elem, display; + + if ( speed || speed === 0 ) { + return this.animate( genFx("show", 3), speed, easing, callback ); + + } else { + for ( var i = 0, j = this.length; i < j; i++ ) { + elem = this[ i ]; + + if ( elem.style ) { + display = elem.style.display; + + // Reset the inline display of this element to learn if it is + // being hidden by cascaded rules or not + if ( !jQuery._data(elem, "olddisplay") && display === "none" ) { + display = elem.style.display = ""; + } + + // Set elements which have been overridden with display: none + // in a stylesheet to whatever the default browser style is + // for such an element + if ( display === "" && jQuery.css(elem, "display") === "none" ) { + jQuery._data( elem, "olddisplay", defaultDisplay(elem.nodeName) ); + } + } + } + + // Set the display of most of the elements in a second loop + // to avoid the constant reflow + for ( i = 0; i < j; i++ ) { + elem = this[ i ]; + + if ( elem.style ) { + display = elem.style.display; + + if ( display === "" || display === "none" ) { + elem.style.display = jQuery._data( elem, "olddisplay" ) || ""; + } + } + } + + return this; + } + }, + + hide: function( speed, easing, callback ) { + if ( speed || speed === 0 ) { + return this.animate( genFx("hide", 3), speed, easing, callback); + + } else { + var elem, display, + i = 0, + j = this.length; + + for ( ; i < j; i++ ) { + elem = this[i]; + if ( elem.style ) { + display = jQuery.css( elem, "display" ); + + if ( display !== "none" && !jQuery._data( elem, "olddisplay" ) ) { + jQuery._data( elem, "olddisplay", display ); + } + } + } + + // Set the display of the elements in a second loop + // to avoid the constant reflow + for ( i = 0; i < j; i++ ) { + if ( this[i].style ) { + this[i].style.display = "none"; + } + } + + return this; + } + }, + + // Save the old toggle function + _toggle: jQuery.fn.toggle, + + toggle: function( fn, fn2, callback ) { + var bool = typeof fn === "boolean"; + + if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) { + this._toggle.apply( this, arguments ); + + } else if ( fn == null || bool ) { + this.each(function() { + var state = bool ? fn : jQuery(this).is(":hidden"); + jQuery(this)[ state ? "show" : "hide" ](); + }); + + } else { + this.animate(genFx("toggle", 3), fn, fn2, callback); + } + + return this; + }, + + fadeTo: function( speed, to, easing, callback ) { + return this.filter(":hidden").css("opacity", 0).show().end() + .animate({opacity: to}, speed, easing, callback); + }, + + animate: function( prop, speed, easing, callback ) { + var optall = jQuery.speed( speed, easing, callback ); + + if ( jQuery.isEmptyObject( prop ) ) { + return this.each( optall.complete, [ false ] ); + } + + // Do not change referenced properties as per-property easing will be lost + prop = jQuery.extend( {}, prop ); + + function doAnimation() { + // XXX 'this' does not always have a nodeName when running the + // test suite + + if ( optall.queue === false ) { + jQuery._mark( this ); + } + + var opt = jQuery.extend( {}, optall ), + isElement = this.nodeType === 1, + hidden = isElement && jQuery(this).is(":hidden"), + name, val, p, e, + parts, start, end, unit, + method; + + // will store per property easing and be used to determine when an animation is complete + opt.animatedProperties = {}; + + for ( p in prop ) { + + // property name normalization + name = jQuery.camelCase( p ); + if ( p !== name ) { + prop[ name ] = prop[ p ]; + delete prop[ p ]; + } + + val = prop[ name ]; + + // easing resolution: per property > opt.specialEasing > opt.easing > 'swing' (default) + if ( jQuery.isArray( val ) ) { + opt.animatedProperties[ name ] = val[ 1 ]; + val = prop[ name ] = val[ 0 ]; + } else { + opt.animatedProperties[ name ] = opt.specialEasing && opt.specialEasing[ name ] || opt.easing || 'swing'; + } + + if ( val === "hide" && hidden || val === "show" && !hidden ) { + return opt.complete.call( this ); + } + + if ( isElement && ( name === "height" || name === "width" ) ) { + // Make sure that nothing sneaks out + // Record all 3 overflow attributes because IE does not + // change the overflow attribute when overflowX and + // overflowY are set to the same value + opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ]; + + // Set display property to inline-block for height/width + // animations on inline elements that are having width/height animated + if ( jQuery.css( this, "display" ) === "inline" && + jQuery.css( this, "float" ) === "none" ) { + + // inline-level elements accept inline-block; + // block-level elements need to be inline with layout + if ( !jQuery.support.inlineBlockNeedsLayout || defaultDisplay( this.nodeName ) === "inline" ) { + this.style.display = "inline-block"; + + } else { + this.style.zoom = 1; + } + } + } + } + + if ( opt.overflow != null ) { + this.style.overflow = "hidden"; + } + + for ( p in prop ) { + e = new jQuery.fx( this, opt, p ); + val = prop[ p ]; + + if ( rfxtypes.test( val ) ) { + + // Tracks whether to show or hide based on private + // data attached to the element + method = jQuery._data( this, "toggle" + p ) || ( val === "toggle" ? hidden ? "show" : "hide" : 0 ); + if ( method ) { + jQuery._data( this, "toggle" + p, method === "show" ? "hide" : "show" ); + e[ method ](); + } else { + e[ val ](); + } + + } else { + parts = rfxnum.exec( val ); + start = e.cur(); + + if ( parts ) { + end = parseFloat( parts[2] ); + unit = parts[3] || ( jQuery.cssNumber[ p ] ? "" : "px" ); + + // We need to compute starting value + if ( unit !== "px" ) { + jQuery.style( this, p, (end || 1) + unit); + start = ( (end || 1) / e.cur() ) * start; + jQuery.style( this, p, start + unit); + } + + // If a +=/-= token was provided, we're doing a relative animation + if ( parts[1] ) { + end = ( (parts[ 1 ] === "-=" ? -1 : 1) * end ) + start; + } + + e.custom( start, end, unit ); + + } else { + e.custom( start, val, "" ); + } + } + } + + // For JS strict compliance + return true; + } + + return optall.queue === false ? + this.each( doAnimation ) : + this.queue( optall.queue, doAnimation ); + }, + + stop: function( type, clearQueue, gotoEnd ) { + if ( typeof type !== "string" ) { + gotoEnd = clearQueue; + clearQueue = type; + type = undefined; + } + if ( clearQueue && type !== false ) { + this.queue( type || "fx", [] ); + } + + return this.each(function() { + var index, + hadTimers = false, + timers = jQuery.timers, + data = jQuery._data( this ); + + // clear marker counters if we know they won't be + if ( !gotoEnd ) { + jQuery._unmark( true, this ); + } + + function stopQueue( elem, data, index ) { + var hooks = data[ index ]; + jQuery.removeData( elem, index, true ); + hooks.stop( gotoEnd ); + } + + if ( type == null ) { + for ( index in data ) { + if ( data[ index ] && data[ index ].stop && index.indexOf(".run") === index.length - 4 ) { + stopQueue( this, data, index ); + } + } + } else if ( data[ index = type + ".run" ] && data[ index ].stop ){ + stopQueue( this, data, index ); + } + + for ( index = timers.length; index--; ) { + if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) { + if ( gotoEnd ) { + + // force the next step to be the last + timers[ index ]( true ); + } else { + timers[ index ].saveState(); + } + hadTimers = true; + timers.splice( index, 1 ); + } + } + + // start the next in the queue if the last step wasn't forced + // timers currently will call their complete callbacks, which will dequeue + // but only if they were gotoEnd + if ( !( gotoEnd && hadTimers ) ) { + jQuery.dequeue( this, type ); + } + }); + } + +}); + +// Animations created synchronously will run synchronously +function createFxNow() { + setTimeout( clearFxNow, 0 ); + return ( fxNow = jQuery.now() ); +} + +function clearFxNow() { + fxNow = undefined; +} + +// Generate parameters to create a standard animation +function genFx( type, num ) { + var obj = {}; + + jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice( 0, num )), function() { + obj[ this ] = type; + }); + + return obj; +} + +// Generate shortcuts for custom animations +jQuery.each({ + slideDown: genFx( "show", 1 ), + slideUp: genFx( "hide", 1 ), + slideToggle: genFx( "toggle", 1 ), + fadeIn: { opacity: "show" }, + fadeOut: { opacity: "hide" }, + fadeToggle: { opacity: "toggle" } +}, function( name, props ) { + jQuery.fn[ name ] = function( speed, easing, callback ) { + return this.animate( props, speed, easing, callback ); + }; +}); + +jQuery.extend({ + speed: function( speed, easing, fn ) { + var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { + complete: fn || !fn && easing || + jQuery.isFunction( speed ) && speed, + duration: speed, + easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing + }; + + opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : + opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default; + + // normalize opt.queue - true/undefined/null -> "fx" + if ( opt.queue == null || opt.queue === true ) { + opt.queue = "fx"; + } + + // Queueing + opt.old = opt.complete; + + opt.complete = function( noUnmark ) { + if ( jQuery.isFunction( opt.old ) ) { + opt.old.call( this ); + } + + if ( opt.queue ) { + jQuery.dequeue( this, opt.queue ); + } else if ( noUnmark !== false ) { + jQuery._unmark( this ); + } + }; + + return opt; + }, + + easing: { + linear: function( p, n, firstNum, diff ) { + return firstNum + diff * p; + }, + swing: function( p, n, firstNum, diff ) { + return ( ( -Math.cos( p*Math.PI ) / 2 ) + 0.5 ) * diff + firstNum; + } + }, + + timers: [], + + fx: function( elem, options, prop ) { + this.options = options; + this.elem = elem; + this.prop = prop; + + options.orig = options.orig || {}; + } + +}); + +jQuery.fx.prototype = { + // Simple function for setting a style value + update: function() { + if ( this.options.step ) { + this.options.step.call( this.elem, this.now, this ); + } + + ( jQuery.fx.step[ this.prop ] || jQuery.fx.step._default )( this ); + }, + + // Get the current size + cur: function() { + if ( this.elem[ this.prop ] != null && (!this.elem.style || this.elem.style[ this.prop ] == null) ) { + return this.elem[ this.prop ]; + } + + var parsed, + r = jQuery.css( this.elem, this.prop ); + // Empty strings, null, undefined and "auto" are converted to 0, + // complex values such as "rotate(1rad)" are returned as is, + // simple values such as "10px" are parsed to Float. + return isNaN( parsed = parseFloat( r ) ) ? !r || r === "auto" ? 0 : r : parsed; + }, + + // Start an animation from one number to another + custom: function( from, to, unit ) { + var self = this, + fx = jQuery.fx; + + this.startTime = fxNow || createFxNow(); + this.end = to; + this.now = this.start = from; + this.pos = this.state = 0; + this.unit = unit || this.unit || ( jQuery.cssNumber[ this.prop ] ? "" : "px" ); + + function t( gotoEnd ) { + return self.step( gotoEnd ); + } + + t.queue = this.options.queue; + t.elem = this.elem; + t.saveState = function() { + if ( self.options.hide && jQuery._data( self.elem, "fxshow" + self.prop ) === undefined ) { + jQuery._data( self.elem, "fxshow" + self.prop, self.start ); + } + }; + + if ( t() && jQuery.timers.push(t) && !timerId ) { + timerId = setInterval( fx.tick, fx.interval ); + } + }, + + // Simple 'show' function + show: function() { + var dataShow = jQuery._data( this.elem, "fxshow" + this.prop ); + + // Remember where we started, so that we can go back to it later + this.options.orig[ this.prop ] = dataShow || jQuery.style( this.elem, this.prop ); + this.options.show = true; + + // Begin the animation + // Make sure that we start at a small width/height to avoid any flash of content + if ( dataShow !== undefined ) { + // This show is picking up where a previous hide or show left off + this.custom( this.cur(), dataShow ); + } else { + this.custom( this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur() ); + } + + // Start by showing the element + jQuery( this.elem ).show(); + }, + + // Simple 'hide' function + hide: function() { + // Remember where we started, so that we can go back to it later + this.options.orig[ this.prop ] = jQuery._data( this.elem, "fxshow" + this.prop ) || jQuery.style( this.elem, this.prop ); + this.options.hide = true; + + // Begin the animation + this.custom( this.cur(), 0 ); + }, + + // Each step of an animation + step: function( gotoEnd ) { + var p, n, complete, + t = fxNow || createFxNow(), + done = true, + elem = this.elem, + options = this.options; + + if ( gotoEnd || t >= options.duration + this.startTime ) { + this.now = this.end; + this.pos = this.state = 1; + this.update(); + + options.animatedProperties[ this.prop ] = true; + + for ( p in options.animatedProperties ) { + if ( options.animatedProperties[ p ] !== true ) { + done = false; + } + } + + if ( done ) { + // Reset the overflow + if ( options.overflow != null && !jQuery.support.shrinkWrapBlocks ) { + + jQuery.each( [ "", "X", "Y" ], function( index, value ) { + elem.style[ "overflow" + value ] = options.overflow[ index ]; + }); + } + + // Hide the element if the "hide" operation was done + if ( options.hide ) { + jQuery( elem ).hide(); + } + + // Reset the properties, if the item has been hidden or shown + if ( options.hide || options.show ) { + for ( p in options.animatedProperties ) { + jQuery.style( elem, p, options.orig[ p ] ); + jQuery.removeData( elem, "fxshow" + p, true ); + // Toggle data is no longer needed + jQuery.removeData( elem, "toggle" + p, true ); + } + } + + // Execute the complete function + // in the event that the complete function throws an exception + // we must ensure it won't be called twice. #5684 + + complete = options.complete; + if ( complete ) { + + options.complete = false; + complete.call( elem ); + } + } + + return false; + + } else { + // classical easing cannot be used with an Infinity duration + if ( options.duration == Infinity ) { + this.now = t; + } else { + n = t - this.startTime; + this.state = n / options.duration; + + // Perform the easing function, defaults to swing + this.pos = jQuery.easing[ options.animatedProperties[this.prop] ]( this.state, n, 0, 1, options.duration ); + this.now = this.start + ( (this.end - this.start) * this.pos ); + } + // Perform the next step of the animation + this.update(); + } + + return true; + } +}; + +jQuery.extend( jQuery.fx, { + tick: function() { + var timer, + timers = jQuery.timers, + i = 0; + + for ( ; i < timers.length; i++ ) { + timer = timers[ i ]; + // Checks the timer has not already been removed + if ( !timer() && timers[ i ] === timer ) { + timers.splice( i--, 1 ); + } + } + + if ( !timers.length ) { + jQuery.fx.stop(); + } + }, + + interval: 13, + + stop: function() { + clearInterval( timerId ); + timerId = null; + }, + + speeds: { + slow: 600, + fast: 200, + // Default speed + _default: 400 + }, + + step: { + opacity: function( fx ) { + jQuery.style( fx.elem, "opacity", fx.now ); + }, + + _default: function( fx ) { + if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) { + fx.elem.style[ fx.prop ] = fx.now + fx.unit; + } else { + fx.elem[ fx.prop ] = fx.now; + } + } + } +}); + +// Adds width/height step functions +// Do not set anything below 0 +jQuery.each([ "width", "height" ], function( i, prop ) { + jQuery.fx.step[ prop ] = function( fx ) { + jQuery.style( fx.elem, prop, Math.max(0, fx.now) + fx.unit ); + }; +}); + +if ( jQuery.expr && jQuery.expr.filters ) { + jQuery.expr.filters.animated = function( elem ) { + return jQuery.grep(jQuery.timers, function( fn ) { + return elem === fn.elem; + }).length; + }; +} + +// Try to restore the default display value of an element +function defaultDisplay( nodeName ) { + + if ( !elemdisplay[ nodeName ] ) { + + var body = document.body, + elem = jQuery( "<" + nodeName + ">" ).appendTo( body ), + display = elem.css( "display" ); + elem.remove(); + + // If the simple way fails, + // get element's real default display by attaching it to a temp iframe + if ( display === "none" || display === "" ) { + // No iframe to use yet, so create it + if ( !iframe ) { + iframe = document.createElement( "iframe" ); + iframe.frameBorder = iframe.width = iframe.height = 0; + } + + body.appendChild( iframe ); + + // Create a cacheable copy of the iframe document on first call. + // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML + // document to it; WebKit & Firefox won't allow reusing the iframe document. + if ( !iframeDoc || !iframe.createElement ) { + iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document; + iframeDoc.write( ( document.compatMode === "CSS1Compat" ? "<!doctype html>" : "" ) + "<html><body>" ); + iframeDoc.close(); + } + + elem = iframeDoc.createElement( nodeName ); + + iframeDoc.body.appendChild( elem ); + + display = jQuery.css( elem, "display" ); + body.removeChild( iframe ); + } + + // Store the correct default display + elemdisplay[ nodeName ] = display; + } + + return elemdisplay[ nodeName ]; +} + + + + +var rtable = /^t(?:able|d|h)$/i, + rroot = /^(?:body|html)$/i; + +if ( "getBoundingClientRect" in document.documentElement ) { + jQuery.fn.offset = function( options ) { + var elem = this[0], box; + + if ( options ) { + return this.each(function( i ) { + jQuery.offset.setOffset( this, options, i ); + }); + } + + if ( !elem || !elem.ownerDocument ) { + return null; + } + + if ( elem === elem.ownerDocument.body ) { + return jQuery.offset.bodyOffset( elem ); + } + + try { + box = elem.getBoundingClientRect(); + } catch(e) {} + + var doc = elem.ownerDocument, + docElem = doc.documentElement; + + // Make sure we're not dealing with a disconnected DOM node + if ( !box || !jQuery.contains( docElem, elem ) ) { + return box ? { top: box.top, left: box.left } : { top: 0, left: 0 }; + } + + var body = doc.body, + win = getWindow(doc), + clientTop = docElem.clientTop || body.clientTop || 0, + clientLeft = docElem.clientLeft || body.clientLeft || 0, + scrollTop = win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop, + scrollLeft = win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft, + top = box.top + scrollTop - clientTop, + left = box.left + scrollLeft - clientLeft; + + return { top: top, left: left }; + }; + +} else { + jQuery.fn.offset = function( options ) { + var elem = this[0]; + + if ( options ) { + return this.each(function( i ) { + jQuery.offset.setOffset( this, options, i ); + }); + } + + if ( !elem || !elem.ownerDocument ) { + return null; + } + + if ( elem === elem.ownerDocument.body ) { + return jQuery.offset.bodyOffset( elem ); + } + + var computedStyle, + offsetParent = elem.offsetParent, + prevOffsetParent = elem, + doc = elem.ownerDocument, + docElem = doc.documentElement, + body = doc.body, + defaultView = doc.defaultView, + prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle, + top = elem.offsetTop, + left = elem.offsetLeft; + + while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) { + if ( jQuery.support.fixedPosition && prevComputedStyle.position === "fixed" ) { + break; + } + + computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle; + top -= elem.scrollTop; + left -= elem.scrollLeft; + + if ( elem === offsetParent ) { + top += elem.offsetTop; + left += elem.offsetLeft; + + if ( jQuery.support.doesNotAddBorder && !(jQuery.support.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) { + top += parseFloat( computedStyle.borderTopWidth ) || 0; + left += parseFloat( computedStyle.borderLeftWidth ) || 0; + } + + prevOffsetParent = offsetParent; + offsetParent = elem.offsetParent; + } + + if ( jQuery.support.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) { + top += parseFloat( computedStyle.borderTopWidth ) || 0; + left += parseFloat( computedStyle.borderLeftWidth ) || 0; + } + + prevComputedStyle = computedStyle; + } + + if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) { + top += body.offsetTop; + left += body.offsetLeft; + } + + if ( jQuery.support.fixedPosition && prevComputedStyle.position === "fixed" ) { + top += Math.max( docElem.scrollTop, body.scrollTop ); + left += Math.max( docElem.scrollLeft, body.scrollLeft ); + } + + return { top: top, left: left }; + }; +} + +jQuery.offset = { + + bodyOffset: function( body ) { + var top = body.offsetTop, + left = body.offsetLeft; + + if ( jQuery.support.doesNotIncludeMarginInBodyOffset ) { + top += parseFloat( jQuery.css(body, "marginTop") ) || 0; + left += parseFloat( jQuery.css(body, "marginLeft") ) || 0; + } + + return { top: top, left: left }; + }, + + setOffset: function( elem, options, i ) { + var position = jQuery.css( elem, "position" ); + + // set position first, in-case top/left are set even on static elem + if ( position === "static" ) { + elem.style.position = "relative"; + } + + var curElem = jQuery( elem ), + curOffset = curElem.offset(), + curCSSTop = jQuery.css( elem, "top" ), + curCSSLeft = jQuery.css( elem, "left" ), + calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1, + props = {}, curPosition = {}, curTop, curLeft; + + // need to be able to calculate position if either top or left is auto and position is either absolute or fixed + if ( calculatePosition ) { + curPosition = curElem.position(); + curTop = curPosition.top; + curLeft = curPosition.left; + } else { + curTop = parseFloat( curCSSTop ) || 0; + curLeft = parseFloat( curCSSLeft ) || 0; + } + + if ( jQuery.isFunction( options ) ) { + options = options.call( elem, i, curOffset ); + } + + if ( options.top != null ) { + props.top = ( options.top - curOffset.top ) + curTop; + } + if ( options.left != null ) { + props.left = ( options.left - curOffset.left ) + curLeft; + } + + if ( "using" in options ) { + options.using.call( elem, props ); + } else { + curElem.css( props ); + } + } +}; + + +jQuery.fn.extend({ + + position: function() { + if ( !this[0] ) { + return null; + } + + var elem = this[0], + + // Get *real* offsetParent + offsetParent = this.offsetParent(), + + // Get correct offsets + offset = this.offset(), + parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset(); + + // Subtract element margins + // note: when an element has margin: auto the offsetLeft and marginLeft + // are the same in Safari causing offset.left to incorrectly be 0 + offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0; + offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0; + + // Add offsetParent borders + parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0; + parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0; + + // Subtract the two offsets + return { + top: offset.top - parentOffset.top, + left: offset.left - parentOffset.left + }; + }, + + offsetParent: function() { + return this.map(function() { + var offsetParent = this.offsetParent || document.body; + while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) { + offsetParent = offsetParent.offsetParent; + } + return offsetParent; + }); + } +}); + + +// Create scrollLeft and scrollTop methods +jQuery.each( ["Left", "Top"], function( i, name ) { + var method = "scroll" + name; + + jQuery.fn[ method ] = function( val ) { + var elem, win; + + if ( val === undefined ) { + elem = this[ 0 ]; + + if ( !elem ) { + return null; + } + + win = getWindow( elem ); + + // Return the scroll offset + return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] : + jQuery.support.boxModel && win.document.documentElement[ method ] || + win.document.body[ method ] : + elem[ method ]; + } + + // Set the scroll offset + return this.each(function() { + win = getWindow( this ); + + if ( win ) { + win.scrollTo( + !i ? val : jQuery( win ).scrollLeft(), + i ? val : jQuery( win ).scrollTop() + ); + + } else { + this[ method ] = val; + } + }); + }; +}); + +function getWindow( elem ) { + return jQuery.isWindow( elem ) ? + elem : + elem.nodeType === 9 ? + elem.defaultView || elem.parentWindow : + false; +} + + + + +// Create width, height, innerHeight, innerWidth, outerHeight and outerWidth methods +jQuery.each([ "Height", "Width" ], function( i, name ) { + + var type = name.toLowerCase(); + + // innerHeight and innerWidth + jQuery.fn[ "inner" + name ] = function() { + var elem = this[0]; + return elem ? + elem.style ? + parseFloat( jQuery.css( elem, type, "padding" ) ) : + this[ type ]() : + null; + }; + + // outerHeight and outerWidth + jQuery.fn[ "outer" + name ] = function( margin ) { + var elem = this[0]; + return elem ? + elem.style ? + parseFloat( jQuery.css( elem, type, margin ? "margin" : "border" ) ) : + this[ type ]() : + null; + }; + + jQuery.fn[ type ] = function( size ) { + // Get window width or height + var elem = this[0]; + if ( !elem ) { + return size == null ? null : this; + } + + if ( jQuery.isFunction( size ) ) { + return this.each(function( i ) { + var self = jQuery( this ); + self[ type ]( size.call( this, i, self[ type ]() ) ); + }); + } + + if ( jQuery.isWindow( elem ) ) { + // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode + // 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat + var docElemProp = elem.document.documentElement[ "client" + name ], + body = elem.document.body; + return elem.document.compatMode === "CSS1Compat" && docElemProp || + body && body[ "client" + name ] || docElemProp; + + // Get document width or height + } else if ( elem.nodeType === 9 ) { + // Either scroll[Width/Height] or offset[Width/Height], whichever is greater + return Math.max( + elem.documentElement["client" + name], + elem.body["scroll" + name], elem.documentElement["scroll" + name], + elem.body["offset" + name], elem.documentElement["offset" + name] + ); + + // Get or set width or height on the element + } else if ( size === undefined ) { + var orig = jQuery.css( elem, type ), + ret = parseFloat( orig ); + + return jQuery.isNumeric( ret ) ? ret : orig; + + // Set the width or height on the element (default to pixels if value is unitless) + } else { + return this.css( type, typeof size === "string" ? size : size + "px" ); + } + }; + +}); + + + + +// Expose jQuery to the global object +window.jQuery = window.$ = jQuery; + +// Expose jQuery as an AMD module, but only for AMD loaders that +// understand the issues with loading multiple versions of jQuery +// in a page that all might call define(). The loader will indicate +// they have special allowances for multiple jQuery versions by +// specifying define.amd.jQuery = true. Register as a named module, +// since jQuery can be concatenated with other files that may use define, +// but not use a proper concatenation script that understands anonymous +// AMD modules. A named AMD is safest and most robust way to register. +// Lowercase jquery is used because AMD module names are derived from +// file names, and jQuery is normally delivered in a lowercase file name. +// Do this after creating the global so that if an AMD module wants to call +// noConflict to hide this version of jQuery, it will work. +if ( typeof define === "function" && define.amd && define.amd.jQuery ) { + define( "jquery", [], function () { return jQuery; } ); +} + + + +})( window ); diff --git a/modules/enterprise/gui/rest-examples-war/src/main/webapp/js/resource_tree.js b/modules/enterprise/gui/rest-examples-war/src/main/webapp/js/resource_tree.js new file mode 100644 index 0000000..9dbb957 --- /dev/null +++ b/modules/enterprise/gui/rest-examples-war/src/main/webapp/js/resource_tree.js @@ -0,0 +1,65 @@ +function resourceTree(resourceId,anchor) { + +var r = 960 / 2; + + var tree = d3.layout.tree() + .size([360, r - 120]) + .separation(function(a, b) { return (a.parent == b.parent ? 1 : 2) / a.depth; }); + + var diagonal = d3.svg.diagonal.radial() + .projection(function(d) { return [d.y, d.x / 180 * Math.PI]; }); + + var vis = d3.select("#"+anchor).append("svg:svg") + .attr("width", r * 2) + .attr("height", r * 2 - 150) + .append("svg:g") + .attr("transform", "translate(" + r + "," + r + ")"); + +// d3.json("/rest/resource/10702/hierarchy.json", function(json) { + d3.json("/rest/resource/" + resourceId + "/hierarchy.json", function(json) { + var nodes = tree.nodes(json); + + var link = vis.selectAll("path.link") + .data(tree.links(nodes)) + .enter().append("svg:path") + .attr("class", "link") + .attr("d", diagonal); + + var node = vis.selectAll("g.node") + .data(nodes) + .enter().append("svg:g") + .attr("class", "node") + .attr("transform", function(d) { return "rotate(" + (d.x - 90) + ")translate(" + d.y + ")"; }); + + node.append("svg:circle") + .attr("r", function(d) { + if (d.depth==0) return 10 ; + else if (d.depth==1) return 8; + else return 5 + }) + .style("stroke", function(d){ + if (d.depth==0) return "darkblue"; + else if (d.depth==1) return "steelblue"; + else return "lightblue" + }) + .style("stroke-width", function(d){ + if (d.depth==0) return 3; + else if (d.depth==1) return 2; + else return 1.5 + }); + +// var hyperLink = node.append("a") // TODO works in adding to tree, but +// .attr("xlink:href",function(d) { return "/rest/resource/" + d.id; }); + + node.append("svg:text") + .attr("dx", function(d) { return d.x < 180 ? 8 : -8; }) + .attr("dy", ".31em") + .attr("text-anchor", function(d) { return d.x < 180 ? "start" : "end"; }) + .attr("transform", function(d) { return d.x < 180 ? null : "rotate(180)"; }) + .text(function(d) { return d.name; }) + .on("mousedown",function(d) { window.location= "/rest/resource/" + d.id; }) + .on("mouseover", function() {d3.select(this).style("fill","red").style("font-size","20px");}) + .on("mouseout", function() {d3.select(this).style("fill","black").style("font-size","10px");}); + + }); +} \ No newline at end of file diff --git a/modules/enterprise/gui/rest-examples-war/src/main/webapp/js/rhq.js b/modules/enterprise/gui/rest-examples-war/src/main/webapp/js/rhq.js new file mode 100644 index 0000000..870c423 --- /dev/null +++ b/modules/enterprise/gui/rest-examples-war/src/main/webapp/js/rhq.js @@ -0,0 +1,120 @@ +var rhq = { + +dashboard : function() { + // get all platforms + $.get('/rest/resource/platforms', function(data) { + + var table = $("#table"); + for (var i = 0; i < data.length ; i++ ) { + var resource = data[i]; + + var rowId = "tr" + i ; + table.append('<tr id="'+ rowId + '">'); + + // Now get the schedules for this resource + var resId = resource.resourceId; + console.log(resId); + + $.getJSON("/rest/resource/"+resId+"/schedules.json?type=metric&enabledOnly=true", function (json2) { + + var tr = $("#" + rowId); + for ( var n = 0 ; n < json2.length ; n ++ ) { + var tdid = "td_" + i + "_" + n; + var schedule = json2[n]; + var td = tr.append('<td id="'+tdid+'">'); + $("#"+tdid).html(schedule.displayName + " (" + schedule.scheduleId + ')<br/><div id="d' + tdid +'"/>'); + rhq.whisker(schedule.scheduleId,tdid,180,90); + } + }) + } + }) + }, +whisker: function(scheduleId,divId,w,h) { + + d3.json( + '/rest/metric/data/'+scheduleId+'.json?hideEmpty=true', + function (jsondata) { +// console.log(scheduleId +", "+ divId); + var svg = d3.select("body").select("#"+divId); + svg=svg.append("svg:svg") + .attr("width", w) + .attr("height", h); + + var points = jsondata.dataPoints; + var minVal = jsondata.min; + var maxVal = jsondata.max; + var avgVal = jsondata.avg; + var minTs = jsondata.minTimeStamp; + var maxTs = jsondata.maxTimeStamp; + + var minTsD = new Date(minTs); + var maxTsD = new Date(maxTs); + + // X axis goes from lowest to highest timestamp + var x = d3.time.scale().domain([minTsD,maxTsD]).range([0,w]); + // Y axis goes from lowest to highest value + var y = d3.scale.linear().domain([minVal, maxVal]).rangeRound([0,h]); + + + // Line for the average + var avgLine = svg.append("svg:line") + .attr("x1", x(new Date(minTs))) + .attr("y1", h - y(avgVal)) + .attr("x2", x(new Date(maxTs))) + .attr("y2", h - y(avgVal)) + .attr("stroke", "lightgrey") + .attr("stroke-dasharray", "2,4"); + + // TODO if present add lines for baselines + + // data() loops over all entries in 'points' above for the remaining statements + var bars = svg.selectAll("bars").data(points); + + var currX = function(d) { + return x(new Date(d.timeStamp)) + }; + + var group = bars.enter().append("svg:g"); + + var line = group.append("svg:line") + .attr("x1", currX) + .attr("x2", currX) + .attr("y1", function(d) { + return h - y(d.low) + }) + .attr("y2", function(d) { + return h - y(d.high) + }) + .attr("stroke", "lightblue"); + + var circleLow = group.append("svg:circle") + .attr("cx", currX) + .attr("cy", function(d) { + return h - y(d.low) + }) + .attr("r", 1) + .attr("stroke", "green") + .attr("fill", "lightgreen"); + + var circleHigh = group.append("svg:circle") + .attr("cx", currX) + .attr("cy", function(d) { + return h - y(d.high) + }) + .attr("r", 1) + .attr("stroke", "green") + .attr("fill", "lightblue"); + + var circleVal = group.append("svg:circle") + .attr("cx", currX) + .attr("cy", function(d) { + return h - y(d.value) + }) + .attr("r", 1.5) + .attr("stroke", "blue") + .attr("fill", "lightpink"); + + }); +} // whisker + +};//var rhq diff --git a/modules/enterprise/gui/rest-examples-war/src/main/webapp/raw_graph.html b/modules/enterprise/gui/rest-examples-war/src/main/webapp/raw_graph.html new file mode 100644 index 0000000..58161f7 --- /dev/null +++ b/modules/enterprise/gui/rest-examples-war/src/main/webapp/raw_graph.html @@ -0,0 +1,184 @@ +<!DOCTYPE html> +<html> + <head> + <title>Raw mertic last 7 days</title> + <script type="text/javascript" src="js/d3.js"></script> + <script type="text/javascript" src="js/d3.layout.js"></script> + <script type="text/javascript" src="js/d3.time.js"></script> + <script type="text/javascript" src="js/jquery.js"></script> + <style type="text/css"> + +svg { + width: 960px; + height: 600px; + border: solid 1px #ccc; + font: 10px sans-serif; + shape-rendering: crispEdges; +} +.axis text +{ + fill: #333; + font-family: sans-serif; + font-size: 10px; +} +.axis .domain +{ + opacity: 0; +} +.tick +{ + stroke: #ccc; + stroke-dasharray: 1 5; +} + +path { + stroke: steelblue; + stroke-width: 2; + fill: none; +} + +line { + stroke: black; +} + + </style> + </head> + <body> + <h1 id="resId">Resource</h1> + <h2 id="header">Schedule</h2> +<button id="dotsButton" onClick="transitionDots()">Dots</button> +<button id="lineButton" onClick="transitionLine()">Lines</button> +<button id="bothButton" onClick="transitionBoth()">Both</button> + + <div id="one"></div> + <script type="text/javascript"> + +// Width and height of the chart to print +var w = 960, + h = 600; + +// Get the platforms and then the first one +$.getJSON('/rest/resource/platforms.json', function (json) { + var res = json[0]; + var rid = res.resourceId; + $("#resId").text("Resource " + rid + " (" + res.resourceName + ")"); + + // Now get the metrical schedules of the platform + $.getJSON("/rest/resource/"+rid+"/schedules.json?type=metric", function (json2) { + + // Take the first and render it + var schId = json2[0].scheduleId; + $("#header").text("Schedule " + schId + " (" + json2[0].scheduleName + "), base unit: " + json2[0].unit); + + d3.json( + '/rest/metric/data/' + schId + '/raw.json?duration=604800', + function (jsondata) { + + var w = 960, + h = 600; + // compute min/max values for x and y + var minVal = d3.min(jsondata,function(d) { return d.value;}); + var maxVal = d3.max(jsondata,function(d) { return d.value;}); + var minTsD = d3.min(jsondata,function(d) { return d.timeStamp;}); + var maxTsD = d3.max(jsondata,function(d) { return d.timeStamp;}); + + var avg = d3.sum(jsondata,function(d) { return d.value;}) / jsondata.length; + + + WIDTH = w; + HEIGHT = h; + MARGINS = {top: 10, right: 10, bottom: 20, left: 10}; + + var xRange = d3.time.scale().range ([MARGINS.left, WIDTH - MARGINS.right]).domain([new Date(minTsD),new Date(maxTsD)]); + var yRange = d3.scale.linear().range ([HEIGHT - MARGINS.top, MARGINS.bottom]).domain([minVal, maxVal]); + + // X axis range goes from lowest to highest timestamp + var x = d3.time.scale().domain([new Date(minTsD),new Date(maxTsD)]).range([50, w-10]); // 50-> make room for label + var y = yRange; + // Y axis range goes from lowest to highest value + // var y = d3.scale.linear().domain([minVal, maxVal]).rangeRound([0, h]); + format = d3.time.format("%H:%M"); + + + xAxis = d3.svg.axis() // generate an axis + .scale(x) // set the range of the axis + .tickSize(580) // height of the ticks + .tickSubdivide(true); // display ticks between text labels + yAxis = d3.svg.axis() // generate an axis + .scale(yRange) // set the range of the axis + .tickSize(3) // width of the ticks + .orient("right") // have the text labels on the right hand side + .tickFormat(d3.format("0e")) + .tickSubdivide(true); // display ticks between text labels + + // create the SVG + var svg = d3.select("body").append("svg:svg") + .attr("width", w) + .attr("height", h); + + // Create axes + svg.append("svg:g") + .attr("class","x axis") + .call(xAxis); + + svg.append("svg:g") + .attr("class","y axis") + .attr("transform", "translate(" + (MARGINS.left) + ",0)") + .call(yAxis); + + // create horizontal line for avg + svg.append("svg:line") + .attr("x1","50") + .attr("x2","950") + .attr("y1",y(avg)) + .attr("y2",y(avg)) + .style("stroke","red") + .attr("style","stroke-dasharray:2 2; stroke:red") + ; + + + // Now lets "loop" over the data and show the dots + var lines = svg.append("svg:g").attr("class","linechart") + .attr("opacity","0"); + + var line = d3.svg.line() + .x(function(d,i) { return x(d.timeStamp); }) + .y(function(d) { return y(d.value); }); + + lines.append("svg:path").attr("d", line(jsondata)); + + + var dot = svg.append("svg:g").attr("class","dotschart") + .selectAll("dot").data(jsondata); + + dot.enter().append("svg:circle") + .attr("cx", function (d) { + return x(d.timeStamp); + }) + .attr("cy", function (d) { + return y(d.value); + }) + .style("stroke", "blue") + .attr("r", 1) + + + }); + }) +}); + +function transitionDots() { + $(".linechart").attr("opacity",0); + $(".dotschart").attr("opacity",1); +} + +function transitionLine() { + $(".linechart").attr("opacity",1); + $(".dotschart").attr("opacity",0); +} +function transitionBoth() { + $(".linechart").attr("opacity",1); + $(".dotschart").attr("opacity",1); +} + </script> + </body> +</html> diff --git a/modules/enterprise/gui/rest-examples-war/src/main/webapp/raw_graph7.html b/modules/enterprise/gui/rest-examples-war/src/main/webapp/raw_graph7.html new file mode 100644 index 0000000..749090d --- /dev/null +++ b/modules/enterprise/gui/rest-examples-war/src/main/webapp/raw_graph7.html @@ -0,0 +1,225 @@ +<!DOCTYPE html> +<html> + <head> + <title>Raw mertic last 7 days</title> + <script type="text/javascript" src="js/d3.js"></script> + <script type="text/javascript" src="js/d3.layout.js"></script> + <script type="text/javascript" src="js/d3.time.js"></script> + <script type="text/javascript" src="js/jquery.js"></script> + <style type="text/css"> + +svg { + width: 960px; + height: 600px; + border: solid 1px #ccc; + font: 10px sans-serif; + shape-rendering: crispEdges; +} +.axis text +{ + fill: #333; + font-family: sans-serif; + font-size: 10px; +} +.axis .domain +{ + opacity: 0; +} +.tick +{ + stroke: #ccc; + stroke-dasharray: 1 5; +} + +path { + stroke: steelblue; + stroke-width: 2; + fill: none; +} + +line { + stroke: black; +} + + </style> + </head> + <body> + <h1 id="resId">Resource</h1> + <h2 id="header">Schedule</h2> +<button id="dotsButton" onClick="transitionDots() ">Dots</button> +<button id="lineButton" onClick="transitionLine()"/>Lines</button> +<button id="bothButton" onClick="transitionBoth()"/>Both</button> + + <div id="one"></div> + <script type="text/javascript"> + +// Width and height of the chart to print +var w = 960, + h = 600; + +// Get the platforms and then the first one +$.getJSON('/rest/resource/platforms.json', function (json) { + var res = json[0]; + var rid = res.resourceId; + $("#resId").text("Resource " + rid + " (" + res.resourceName + ")"); + + // Now get the metrical schedules of the platform + $.getJSON("/rest/resource/"+rid+"/schedules.json?type=metric", function (json2) { + + // Take the first and render it + var schId = json2[0].scheduleId; + $("#header").text("Schedule " + schId + " (" + json2[0].scheduleName + "), base unit: " + json2[0].unit); + + var now = new Date().getTime(); + var startTime = now - (7 * 86400*1000); + d3.json( + '/rest/metric/data/' + schId + '/raw.json?duration=604800', + function (jsondata) { + + + + var w = 960, + h = 600; + // compute min/max values for x and y a + var minVal = d3.min(jsondata,function(d) { return d.value;}); + var maxVal = d3.max(jsondata,function(d) { return d.value;}); + var minTsD = 0; + var maxTsD = 86400*1000; + + var minTimestamp = d3.min(jsondata,function(d) { return d.timeStamp;}); + + var avg = d3.sum(jsondata,function(d) { return d.value;}) / jsondata.length; + + + + WIDTH = w; + HEIGHT = h; + MARGINS = {top: 10, right: 10, bottom: 20, left: 10}; + + var xRange = d3.time.scale().range ([MARGINS.left, WIDTH - MARGINS.right]).domain([new Date(minTsD),new Date(maxTsD)]); + var yRange = d3.scale.linear().range ([HEIGHT - MARGINS.top, MARGINS.bottom]).domain([minVal, maxVal]); + + // X axis range goes from lowest to highest timestamp + var x = d3.time.scale().domain([new Date(0),new Date(86400*1000)]).range([50, w-10]); // 50-> make room for label +//var x = xRange; + var y = yRange; + // Y axis range goes from lowest to highest value + // var y = d3.scale.linear().domain([minVal, maxVal]).rangeRound([0, h]); + format = d3.time.format("%H:%M"); + + + xAxis = d3.svg.axis() // generate an axis + .scale(x) // set the range of the axis + .tickSize(580) // height of the ticks + .tickSubdivide(true); // display ticks between text labels + yAxis = d3.svg.axis() // generate an axis + .scale(yRange) // set the range of the axis + .tickSize(3) // width of the ticks + .orient("right") // have the text labels on the right hand side + .tickFormat(d3.format("0e")) + .tickSubdivide(true); // display ticks between text labels + + // create the SVG + var svg = d3.select("body").append("svg:svg") + .attr("width", w) + .attr("height", h); + + // Create axes + svg.append("svg:g") + .attr("class","x axis") + .call(xAxis); + + svg.append("svg:g") + .attr("class","y axis") + .attr("transform", "translate(" + (MARGINS.left) + ",0)") + .call(yAxis); + + svg.append("svg:line") + .attr("x1","50") + .attr("x2","950") + .attr("y1",y(avg)) + .attr("y2",y(avg)) + .style("stroke","red") + .attr("style","stroke-dasharray:2 2; stroke:red") + ; + + var colors = ["black","blue","green","cyan","red","orange","yellow"]; + + + // split the data into 7 data sets (1 per day) + var dat = putToBuckets(jsondata,7,now); + + // loop over the buckets and create the graph + for (day = 0 ; day < 7 ; day ++ ) { + var daydat = dat[day]; + // Now lets "loop" over the data of a bucket and show the lines and dots + var lines = svg.append("svg:g").attr("class","linechart") + .attr("opacity","1"); + + var dayMinTs = startTime + day * (86400*1000); + + var line = d3.svg.line() + .x(function(d,i) { return x(d.timeStamp-dayMinTs); }) + .y(function(d) { return y(d.value); }); + lines.append("svg:path") + .attr("d", line(daydat)) + .style("stroke",colors[day]); + + + var dot = svg.append("svg:g").attr("class","dotschart") + .selectAll("dot").data(jsondata); + + dot.enter().append("svg:circle") + .attr("cx", function (d) { + return x(d.timeStamp-dayMinTs); + }) + .attr("cy", function (d) { + return y(d.value); + }) + .style("stroke", colors[day]) + .attr("r", 1); + + } + }); + }) +}) + +function transitionDots() { + $(".linechart").attr("opacity",0); + $(".dotschart").attr("opacity",1); +} + +function transitionLine() { + $(".linechart").attr("opacity",1); + $(".dotschart").attr("opacity",0); +} +function transitionBoth() { + $(".linechart").attr("opacity",1); + $(".dotschart").attr("opacity",1); +} + +// put the data in d into n buckets +function putToBuckets(data,n,now) { + + var band = d3.extent(data,function(d){ return d.timeStamp;}); + var bs = 86400*1000; + var start = now - n * bs; + + var dat = new Array(n); + for (i = 0; i < n ; i++ ) { + dat[i]=new Array(); + } + + data.forEach(function (d) { + var diff = d.timeStamp-start; + var bucket = parseInt(diff / bs); +// console.log(d.timeStamp + ", " + diff + " buck : " + bucket); + dat[bucket].push(d); + }); + + return dat; +} + + </script> + </body> +</html> diff --git a/modules/enterprise/gui/rest-examples-war/src/main/webapp/stacked1.html b/modules/enterprise/gui/rest-examples-war/src/main/webapp/stacked1.html new file mode 100644 index 0000000..42d1b5d --- /dev/null +++ b/modules/enterprise/gui/rest-examples-war/src/main/webapp/stacked1.html @@ -0,0 +1,145 @@ +<!DOCTYPE html> +<html> + <head> + <title>Stacked metrics (free mem, schedule 10003)</title> + <script type="text/javascript" src="js/d3.js"></script> + <script type="text/javascript" src="js/d3.layout.js"></script> + <script type="text/javascript" src="js/d3.time.js"></script> + <script type="text/javascript" src="js/jquery.js"></script> + <style type="text/css"> + +svg { + width: 960px; + height: 500px; + border: solid 1px #ccc; + font: 10px sans-serif; + shape-rendering: crispEdges; +} + + </style> + </head> + <body> + + +<h1 id="resId">Resource</h1> +Upper edge of green is low, upper edge of blue is the value and upper edge of pink is high. +<br/> +<h2 id="header">Schedule</h2> + <script type="text/javascript"> + +// Get the platforms and then the first one +$.getJSON('/rest/resource/platforms.json', function (json) { + var res = json[0]; + var rid = res.resourceId; + $("#resId").text("Resource " + rid + " (" + res.resourceName + ")"); + + // Now get the metrical schedules of the platform + $.getJSON("/rest/resource/"+rid+"/schedules.json?type=metric", function (json2) { + + // Take the first + var schId = json2[0].scheduleId; + $("#header").text("Schedule " + schId + " (" + json2[0].scheduleName + ")"); + + // And call d3 graphing on it + d3.json( + '/rest/metric/data/'+schId+'.json', + function (jsondata) { + + var w = 960, + h = 500, + p = [20, 50, 30, 20], + x = d3.scale.ordinal().rangeRoundBands([0, w - p[1] - p[3]]), + y = d3.scale.linear().range([0, h - p[0] - p[2]]), + z = d3.scale.ordinal().range(["lightgreen", "darkblue", "lightpink"]), + format = d3.time.format("%H:%M"); + + var svg = d3.select("body").append("svg:svg") + .attr("width", w) + .attr("height", h) + .append("svg:g") + .attr("transform", "translate(" + p[3] + "," + (h - p[2]) + ")"); + + + var points = jsondata.dataPoints; + var min = jsondata.min; + var max = jsondata.max; + + var metrics = d3.layout.stack()(["low","value","high"].map(function (point) { + return points.map(function (d) { + var tmp; + if (point == "low") + tmp = d["low"] - min; + if (point == "value") { + var va = d["value"]; + var lo = d["low"]; + tmp = va-lo; + } + if (point == "high") + tmp = (d["high"]-d["value"]); + + if (tmp < 0 ) { + console.log(point); + tmp=0; + } + + return {x: new Date(d.timeStamp), y: tmp}; + }); + })); + + console.log(metrics); + + + // Compute the x-domain (by date) and y-domain (by top). + x.domain(metrics[0].map(function(d) { return d.x; })); + y.domain([0, d3.max(metrics[metrics.length - 1], function(d) { return d.y0 + d.y; })]); + + // Add a group for each cause. + var cause = svg.selectAll("g.cause") + .data(metrics) + .enter().append("svg:g") + .attr("class", "cause") + .style("fill", function(d, i) { return z(i); }) + .style("stroke", function(d, i) { return d3.rgb(z(i)).darker(); }); + + // Add a rect for each date. + var rect = cause.selectAll("rect") + .data(Object) + .enter().append("svg:rect") + .attr("x", function(d) { return x(d.x); }) + .attr("y", function(d) { return -y(d.y0) - y(d.y); }) + .attr("height", function(d) { return y(d.y); }) + .attr("width", x.rangeBand()); + + // Add a label per date. + var label = svg.selectAll("text") + .data(x.domain()) + .enter().append("svg:text") + .attr("x", function(d) { return x(d) + x.rangeBand() / 2; }) + .attr("y", 6) + .attr("text-anchor", "middle") + .attr("dy", ".71em") + .text(format); + + // Add y-axis rules. + var rule = svg.selectAll("g.rule") + .data(y.ticks(5)) + .enter().append("svg:g") + .attr("class", "rule") + .attr("transform", function(d) { return "translate(0," + -y(d) + ")"; }); + + rule.append("svg:line") + .attr("x2", w - p[1] - p[3]) + .style("stroke", function(d) { return d ? "#fff" : "#000"; }) + .style("stroke-opacity", function(d) { return d ? .7 : null; }); + + rule.append("svg:text") + .attr("x", w - p[1] - p[3] + 6) + .attr("dy", ".35em") + .text(d3.format(",d")); +}); + }); +}); + + </script> + </body> +</html> \ No newline at end of file diff --git a/modules/enterprise/gui/rest-examples-war/src/main/webapp/stacked2.html b/modules/enterprise/gui/rest-examples-war/src/main/webapp/stacked2.html new file mode 100644 index 0000000..9073459 --- /dev/null +++ b/modules/enterprise/gui/rest-examples-war/src/main/webapp/stacked2.html @@ -0,0 +1,139 @@ +<!DOCTYPE html> +<html> + <head> + <title>Stacked metrics (free mem, schedule 10003)</title> + <script type="text/javascript" src="js/d3.js"></script> + <script type="text/javascript" src="js/d3.layout.js"></script> + <script type="text/javascript" src="js/d3.time.js"></script> + <script type="text/javascript" src="js/jquery.js"></script> + <style type="text/css"> + +svg { + width: 960px; + height: 500px; + border: solid 1px #ccc; + font: 10px sans-serif; + shape-rendering: crispEdges; +} + + </style> + </head> + <body> + <h1 id="resId">Resource</h1> + Upper edge of green is low, upper edge of blue is the value and upper edge of pink is high. + <br/> + <h2 id="header">Schedule</h2> + <script type="text/javascript"> + +var w = 960, + h = 500, + p = [20, 50, 30, 20], + x = d3.scale.ordinal().rangeRoundBands([0, w - p[1] - p[3]]), + y = d3.scale.linear().range([0, h - p[0] - p[2]]), + z = d3.scale.ordinal().range(["lightgreen", "darkblue", "lightpink"]), + format = d3.time.format("%H:%M"); + +var svg = d3.select("body").append("svg:svg") + .attr("width", w) + .attr("height", h) + .append("svg:g") + .attr("transform", "translate(" + p[3] + "," + (h - p[2]) + ")"); + +// Get the platforms and then the first one +$.getJSON('/rest/resource/platforms.json', function (json) { + var res = json[0]; + var rid = res.resourceId; + $("#resId").text("Resource " + rid + " (" + res.resourceName + ")"); + + // Now get the metrical schedules of the platform + $.getJSON("/rest/resource/"+rid+"/schedules.json?type=metric", function (json2) { + + // Take the first + var schId = json2[0].scheduleId; + $("#header").text("Schedule " + schId + " (" + json2[0].scheduleName + ")"); + + // And call d3 graphing on it + d3.json( + '/rest/metric/data/'+schId+'.json', + function (jsondata) { + + var points = jsondata.dataPoints; + var min = jsondata.min; + var max = jsondata.max; + + var metrics = d3.layout.stack()(["low","value","high"].map(function (point) { + return points.map(function (d) { + var tmp; + if (point == "low") + tmp = d["low"] - min; + if (point == "value") { + var va = d["value"]; + var lo = d["low"]; + tmp = va-lo; + } + if (point == "high") + tmp = (d["high"]-d["value"]); + + if (tmp < 0 ) { + tmp=0; + } + + return {x: new Date(d.timeStamp), y: tmp}; + }); + })); + + + // Compute the x-domain (by date) and y-domain (by top). + x.domain(metrics[0].map(function(d) { return d.x; })); + y.domain([0, d3.max(metrics[metrics.length - 1], function(d) { return d.y0 + d.y; })]); + + // Add a group for each cause. + var cause = svg.selectAll("g.cause") + .data(metrics) + .enter().append("svg:g") + .attr("class", "cause") + .style("fill", function(d, i) { return z(i); }) + .style("stroke", function(d, i) { return d3.rgb(z(i)).darker(); }); + + // Add a rect for each date. + var rect = cause.selectAll("rect") + .data(Object) + .enter().append("svg:rect") + .attr("x", function(d) { return x(d.x); }) + .attr("y", function(d) { return -y(d.y0) - y(d.y); }) + .attr("height", function(d) { return 5; }) // <<<--- HERE + .attr("width", x.rangeBand()); + + // Add a label per date. + var label = svg.selectAll("text") + .data(x.domain()) + .enter().append("svg:text") + .attr("x", function(d) { return x(d) + x.rangeBand() / 2; }) + .attr("y", 6) + .attr("text-anchor", "middle") + .attr("dy", ".71em") + .text(format); + + // Add y-axis rules. + var rule = svg.selectAll("g.rule") + .data(y.ticks(5)) + .enter().append("svg:g") + .attr("class", "rule") + .attr("transform", function(d) { return "translate(0," + -y(d) + ")"; }); + + rule.append("svg:line") + .attr("x2", w - p[1] - p[3]) + .style("stroke", function(d) { return d ? "#fff" : "#000"; }) + .style("stroke-opacity", function(d) { return d ? .7 : null; }); + + rule.append("svg:text") + .attr("x", w - p[1] - p[3] + 6) + .attr("dy", ".35em") + .text(d3.format(",d")); + }); + + }) +}) + </script> + </body> +</html> \ No newline at end of file diff --git a/modules/enterprise/gui/rest-examples-war/src/main/webapp/stacked3.html b/modules/enterprise/gui/rest-examples-war/src/main/webapp/stacked3.html new file mode 100644 index 0000000..dc64417 --- /dev/null +++ b/modules/enterprise/gui/rest-examples-war/src/main/webapp/stacked3.html @@ -0,0 +1,95 @@ +<!DOCTYPE html> +<html> + <head> + <title>Stacked metrics (free mem, schedule 10003)</title> + <script type="text/javascript" src="js/d3.js"></script> + <script type="text/javascript" src="js/d3.layout.js"></script> + <script type="text/javascript" src="js/d3.time.js"></script> + <script type="text/javascript" src="js/jquery.js"></script> + <style type="text/css"> + + +div.bar { + display: inline-block; + width: 20px; + height: 2px; /* for NaN entries */ +} + + </style> + </head> + <body> + + +<h1 id="resId">Resource</h1> +Those bars show the average value during the respective time slot. Scale is from +min-value to max value. Mouseover the bar to see the actual value. +<br/> +<h2 id="header">Schedule</h2> +<table> + <tr> + <td>Minimum:</td><td id="minval"></td> + </tr> + <tr> + <td>Maximum:</td><td id="maxval"></td> + </tr> +</table> +Value: <span id="currval"></span> +<br/> +<div id="graph"></div> + <script type="text/javascript"> + + // Get the platforms and then the first one + $.getJSON('/rest/resource/platforms.json', function (json) { + var res = json[0]; + var rid = res.resourceId; + $("#resId").text("Resource " + rid + " (" + res.resourceName + ")"); + + // Now get the metrical schedules of the platform + $.getJSON("/rest/resource/" + rid + "/schedules.json?type=metric", function (json2) { + + // Take the first + var schId = json2[0].scheduleId; + $("#header").text("Schedule " + schId + " (" + json2[0].scheduleName + ")"); + + // And call d3 graphing on it + d3.json('/rest/metric/data/' + schId + '.json', + function (jsondata) { + + var theDiv = d3.select("div#graph"); + + var points = jsondata.dataPoints; + var min = jsondata.min; + var max = jsondata.max; + + d3.select("td#minval").text(min); + d3.select("td#maxval").text(max); + + y = d3.scale.linear().range([0, 400]).domain([min,max]); + + // Add a group for each cause. + var bar = theDiv.selectAll("div") + .data(points) + .enter().append("div") + .attr("class", "bar") + .style("background-color","lightblue") + .style("width","10px") + .style("margin-right", "2px") + .style("height", + function (d) { + return (y(d.value) + "px"); + }) + .on('mouseover',function(d){ + d3.select("#currval").append('text') + .text(d.value) + .attr('class','tip'); + }) + .on('mouseout',function(d) { + d3.selectAll(".tip").remove(); + }) + ; + }); + }); + }); + </script> + </body> +</html> \ No newline at end of file diff --git a/modules/enterprise/gui/rest-examples-war/src/main/webapp/tree.html b/modules/enterprise/gui/rest-examples-war/src/main/webapp/tree.html new file mode 100644 index 0000000..8f89993 --- /dev/null +++ b/modules/enterprise/gui/rest-examples-war/src/main/webapp/tree.html @@ -0,0 +1,44 @@ +<!DOCTYPE html> +<html> + <head> + <title>Resource tree</title> + <script type="text/javascript" src="js/d3.js"></script> + <script type="text/javascript" src="js/d3.layout.js"></script> + <script type="text/javascript" src="js/resource_tree.js"></script> + <style type="text/css"> + +body { + font: 10px sans-serif; +} + +/* +svg { + shape-rendering: crispEdges; +} +*/ +.node circle { + fill: #fff; + stroke: steelblue; + stroke-width: 1.5px; +} + +.node { + font: 10px sans-serif; +} + +.link { + fill: none; + stroke: #ccc; + stroke-width: 1.5px; +} + + </style> +</head> +<body> + <h2>Resource tree of resource with id 10001</h2> + + <div class='gallery' id='chart'></div> + + <script>resourceTree(10001,'chart')</script> + </body> +</html> diff --git a/modules/enterprise/gui/rest-examples-war/src/main/webapp/whisker.html b/modules/enterprise/gui/rest-examples-war/src/main/webapp/whisker.html new file mode 100644 index 0000000..417db81 --- /dev/null +++ b/modules/enterprise/gui/rest-examples-war/src/main/webapp/whisker.html @@ -0,0 +1,53 @@ +<!DOCTYPE html> +<html> + <head> + <title>(free mem, schedule 10003)</title> + <script type="text/javascript" src="js/d3.js"></script> + <script type="text/javascript" src="js/d3.layout.js"></script> + <script type="text/javascript" src="js/d3.time.js"></script> + <script type="text/javascript" src="js/jquery.js"></script> + <script type="text/javascript" src="js/rhq.js"></script> + <style type="text/css"> + +svg { + width: 800px; + height: 600px; + border: solid 1px #ccc; + font: 10px sans-serif; + shape-rendering: crispEdges; +} + + </style> + </head> + <body> + <h1 id="resId">Resource</h1> + <h2 id="header">Schedule</h2> + + <div id="one"></div> + <script type="text/javascript"> + +// Width and height of the chart to print +var w = 800, + h = 600; + +// Get the platforms and then the first one +$.getJSON('/rest/resource/platforms.json', function (json) { + var res = json[0]; + var rid = res.resourceId; + $("#resId").text("Resource " + rid + " (" + res.resourceName + ")"); + + // Now get the metrical schedules of the platform + $.getJSON("/rest/resource/"+rid+"/schedules.json?type=metric", function (json2) { + + // Take the first and render it + var schId = json2[0].scheduleId; + $("#header").text("Schedule " + schId + " (" + json2[0].scheduleName + ")"); + rhq.whisker(schId,"one",w,h); + }) +}) + + + + </script> + </body> +</html> \ No newline at end of file diff --git a/modules/enterprise/gui/rest-examples-war/src/main/webapp/whisker2.html b/modules/enterprise/gui/rest-examples-war/src/main/webapp/whisker2.html new file mode 100644 index 0000000..67340d5 --- /dev/null +++ b/modules/enterprise/gui/rest-examples-war/src/main/webapp/whisker2.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<html> + <head> + <title>Dashboard</title> + <script type="text/javascript" src="js/d3.js"></script> + <script type="text/javascript" src="js/d3.layout.js"></script> + <script type="text/javascript" src="js/d3.time.js"></script> + <script type="text/javascript" src="js/jquery.js"></script> + <script type="text/javascript" src="js/rhq.js"></script> + + <style type="text/css"> + +svg { + width: 182px; + height: 92px; + border: solid 1px #ccc; + font: 10px sans-serif; + shape-rendering: crispEdges; +} + + </style> + </head> + <body> + <h2>Dashboard</h2> +<script> + $(document).ready(function() { + rhq.dashboard(); + }) +</script> + <table id="table"> + </table> + + + </body> +</html> diff --git a/modules/enterprise/gui/rest-war/pom.xml b/modules/enterprise/gui/rest-war/pom.xml index 0664930..f09fa41 100644 --- a/modules/enterprise/gui/rest-war/pom.xml +++ b/modules/enterprise/gui/rest-war/pom.xml @@ -45,6 +45,11 @@ <version>${resteasy.version}</version> <scope>provided</scope> </dependency> + <dependency> + <groupId>org.jboss.spec.javax.ejb</groupId> + <artifactId>jboss-ejb-api_3.1_spec</artifactId> + <version>1.0.2.Final</version> + </dependency>
</dependencies> <build> diff --git a/modules/enterprise/gui/rest-war/src/main/java/org/rhq/enterprise/rest/RHQApplication.java b/modules/enterprise/gui/rest-war/src/main/java/org/rhq/enterprise/rest/RHQApplication.java new file mode 100644 index 0000000..98c316f --- /dev/null +++ b/modules/enterprise/gui/rest-war/src/main/java/org/rhq/enterprise/rest/RHQApplication.java @@ -0,0 +1,41 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2011 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.rest; + +import javax.ws.rs.ApplicationPath; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * JAX-RS application class, defining the base http context. + * This is called upon servlet startup or when the first request hits + * the REST endpoint. + * + * @author Heiko W. Rupp + */ +@ApplicationPath("/") +public class RHQApplication extends javax.ws.rs.core.Application { + + Log log = LogFactory.getLog(RHQApplication.class); + + public RHQApplication() { + log.info("Starting RHQ REST interface"); + } +} diff --git a/modules/enterprise/gui/rest-war/src/main/webapp/WEB-INF/web.xml b/modules/enterprise/gui/rest-war/src/main/webapp/WEB-INF/web.xml index 014c421..f96839d 100644 --- a/modules/enterprise/gui/rest-war/src/main/webapp/WEB-INF/web.xml +++ b/modules/enterprise/gui/rest-war/src/main/webapp/WEB-INF/web.xml @@ -10,6 +10,7 @@ yaml: application/yaml </param-value> </context-param> + <filter> <filter-name>JsonPFilter</filter-name> <filter-class>org.rhq.enterprise.rest.JsonPFilter</filter-class> @@ -35,18 +36,18 @@
<filter-mapping> <filter-name>JsonPFilter</filter-name> - <url-pattern>/1/*</url-pattern> + <url-pattern>/*</url-pattern> </filter-mapping> <!-- <filter-mapping> <filter-name>DumperFilter</filter-name> - <url-pattern>/1/*</url-pattern> + <url-pattern>/*</url-pattern> </filter-mapping> -->
<filter-mapping> <filter-name>RhqRtFilter</filter-name> - <url-pattern>/1/*</url-pattern> + <url-pattern>/*</url-pattern> </filter-mapping>
diff --git a/modules/enterprise/gui/rest-war/src/main/webapp/bars_simple.html b/modules/enterprise/gui/rest-war/src/main/webapp/bars_simple.html deleted file mode 100644 index e4e96d9..0000000 --- a/modules/enterprise/gui/rest-war/src/main/webapp/bars_simple.html +++ /dev/null @@ -1,131 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <title>Bar Chart</title> - <script type="text/javascript" src="js/d3.js"></script> - <script type="text/javascript" src="js/jquery.js"></script> - <style type="text/css"> - -body { - font: 10px sans-serif; -} - -svg { - shape-rendering: crispEdges; -} - - </style> - </head> - <body> - <h1 id="resId">Resource</h1> - <h2 id="header">Schedule</h2> - <script type="text/javascript"> - - // Get the platforms and then the first one - $.getJSON('/rest/1/resource/platforms.json', function (json) { - var res = json[0]; - var rid = res.resourceId; - $("#resId").text("Resource " + rid + " (" + res.resourceName + ")"); - - // Now get the metrical schedules of the platform - $.getJSON("/rest/1/resource/"+rid+"/schedules.json?type=metric", function (json2) { - - // Take the first - var schId = json2[0].scheduleId; - $("#header").text("Schedule " + schId + " (" + json2[0].scheduleName + ")"); - - // And call d3 graphing on it - d3.json( - '/rest/1/metric/data/'+schId+'.json', - function (jsondata) { - - // create the chart here with - // the returned data - - var points = jsondata.dataPoints; - var min = jsondata.min; - var max = jsondata.max; - - var data = points.map(function(d) { - var t = d.value - min; - if (t<0) - t=0; - return t; - }); - - var w = 430, - h = 630, - x = d3.scale.linear().domain([0, max-min]).range([0, w]), - y = d3.scale.ordinal().domain(d3.range(data.length)).rangeBands([0, h], .2); - - var vis = d3.select("body") - .append("svg:svg") - .attr("width", w + 40) - .attr("height", h + 20) - .append("svg:g") - .attr("transform", "translate(20,0)"); - - var bars = vis.selectAll("g.bar") - .data(data) - .enter().append("svg:g") - .attr("class", "bar") - .attr("transform", function(d, i) { return "translate(0," + y(i) + ")"; }); - - bars.append("svg:rect") - .attr("fill", "steelblue") - .attr("width", x) - .attr("height", y.rangeBand()); - - bars.append("svg:text") - .attr("x", x) - .attr("y", y.rangeBand() / 2) - .attr("dx", -6) - .attr("dy", ".35em") - .attr("fill", "white") - .attr("text-anchor", "end") - .text(x.tickFormat(100)); - - bars.append("svg:text") - .attr("x", 0) - .attr("y", y.rangeBand() / 2) - .attr("dx", -6) - .attr("dy", ".35em") - .attr("text-anchor", "end") - .text(function(d, i) { return String.fromCharCode(65 + i); }); - - var rules = vis.selectAll("g.rule") - .data(x.ticks(10)) - .enter().append("svg:g") - .attr("class", "rule") - .attr("transform", function(d) { return "translate(" + x(d) + ",0)"; }); - - rules.append("svg:line") - .attr("y1", h) - .attr("y2", h + 6) - .attr("stroke", "black"); - - rules.append("svg:line") - .attr("y1", 0) - .attr("y2", h) - .attr("stroke", "white") - .attr("stroke-opacity", .3); - - rules.append("svg:text") - .attr("y", h + 9) - .attr("dy", ".71em") - .attr("text-anchor", "middle") - .text(x.tickFormat(10)); - - vis.append("svg:line") - .attr("y1", 0) - .attr("y2", h) - .attr("stroke", "black"); - - }); - - }) - }) - - </script> - </body> -</html> diff --git a/modules/enterprise/gui/rest-war/src/main/webapp/index.html b/modules/enterprise/gui/rest-war/src/main/webapp/index.html deleted file mode 100644 index 1cb29eb..0000000 --- a/modules/enterprise/gui/rest-war/src/main/webapp/index.html +++ /dev/null @@ -1,40 +0,0 @@ -<html> -<body> -<h2>RHQ Rest API</h2> -<strong>Please note: the API is not stable at this point. Do not rely on it.</strong><br/> - -Join us in making it great by providing feedback and contributions of code and examples -that use the api. -See also <a href="http://rhq-project.org/display/RHQ/Design-REST">the RHQ wiki</a> on REST. -Check out the <a href="https://github.com/rhq-project/samples/tree/master/rest-api">RHQ samples project</a> -for samples in various programming languages and -<a href="https://github.com/pilhuhn/RHQpocket">RHQpocket</a> as an example of a -mobile client (Android) of the API. -<ul> - <li><a href="1/resource/platforms.html">Platforms</a></li> - <li><a href="1/group/">Groups</a></li> - <li><a href="1/group/definitions">Group Definitions</a></li> - <li><a href="1/alert/">Alerts</a></li> - <li><a href="1/status.html">System status</a> </li> - <li><a href="1/user/favorites/resource">Favorite resources</a></li> - <li><a href="1/operation/history">Operation histories</a></li> -</ul> -<hr/> -<h2>Misc examples (using <a href="https://github.com/mbostock/d3">D3.js</a>)</h2> -Those examples use the powerful D3 library and are rendering the graphs in SVG. -They expect some resources and schedules being present from an initial import with -an empty database (meaning resource ids and schedule ids starting at 10001). -<ul> - <li><a href="bars_simple.html">Display avg metrics as bars</a></li> - <li><a href="stacked1.html">Metrics as stacked bars</a> in SVG</li> - <li><a href="stacked3.html">Metrics as stacked bars</a> in pure HTML + (a little) CSS</li> - <li><a href="stacked2.html">Metrics as rects using stacked bars from above</a></li> - <li><a href="whisker.html">Whisker chart 1</a></li> - <li><a href="whisker2.html">Multiple Whisker charts</a></li> - <li><a href="tree.html">Resource tree</a></li> - <li><a href="raw_graph.html">7 days of raw metrics as dot- or line- chart</a></li> - <li><a href="raw_graph7.html">7 days of raw metrics as dot- or line- chart - comparing daily values</a></li> - -</ul> -</body> -</html> diff --git a/modules/enterprise/gui/rest-war/src/main/webapp/js/d3.behavior.js b/modules/enterprise/gui/rest-war/src/main/webapp/js/d3.behavior.js deleted file mode 100755 index 8c67949..0000000 --- a/modules/enterprise/gui/rest-war/src/main/webapp/js/d3.behavior.js +++ /dev/null @@ -1,198 +0,0 @@ -(function(){d3.behavior = {}; -// TODO unbind zoom behavior? -// TODO unbind listener? -d3.behavior.zoom = function() { - var xyz = [0, 0, 0], - event = d3.dispatch("zoom"); - - function zoom() { - this - .on("mousedown.zoom", mousedown) - .on("mousewheel.zoom", mousewheel) - .on("DOMMouseScroll.zoom", dblclick) - .on("dblclick.zoom", dblclick) - .on("touchstart.zoom", touchstart); - - d3.select(window) - .on("mousemove.zoom", d3_behavior_zoomMousemove) - .on("mouseup.zoom", d3_behavior_zoomMouseup) - .on("touchmove.zoom", d3_behavior_zoomTouchmove) - .on("touchend.zoom", d3_behavior_zoomTouchup); - } - - // snapshot the local context for subsequent dispatch - function start() { - d3_behavior_zoomXyz = xyz; - d3_behavior_zoomDispatch = event.zoom.dispatch; - d3_behavior_zoomTarget = this; - d3_behavior_zoomArguments = arguments; - } - - function mousedown() { - start.apply(this, arguments); - d3_behavior_zoomPanning = d3_behavior_zoomLocation(d3.svg.mouse(d3_behavior_zoomTarget)); - d3.event.preventDefault(); - window.focus(); - } - - // store starting mouse location - function mousewheel() { - start.apply(this, arguments); - if (!d3_behavior_zoomZooming) d3_behavior_zoomZooming = d3_behavior_zoomLocation(d3.svg.mouse(d3_behavior_zoomTarget)); - d3_behavior_zoomTo(d3_behavior_zoomDelta() + xyz[2], d3.svg.mouse(d3_behavior_zoomTarget), d3_behavior_zoomZooming); - } - - function dblclick() { - start.apply(this, arguments); - var mouse = d3.svg.mouse(d3_behavior_zoomTarget); - d3_behavior_zoomTo(d3.event.shiftKey ? Math.ceil(xyz[2] - 1) : Math.floor(xyz[2] + 1), mouse, d3_behavior_zoomLocation(mouse)); - } - - // doubletap detection - function touchstart() { - start.apply(this, arguments); - var touches = d3_behavior_zoomTouchup(), - touch, - now = Date.now(); - if ((touches.length === 1) && (now - d3_behavior_zoomLast < 300)) { - d3_behavior_zoomTo(1 + Math.floor(xyz[2]), touch = touches[0], d3_behavior_zoomLocations[touch.identifier]); - } - d3_behavior_zoomLast = now; - } - - zoom.on = function(type, listener) { - event[type].add(listener); - return zoom; - }; - - return zoom; -}; - -var d3_behavior_zoomDiv, - d3_behavior_zoomPanning, - d3_behavior_zoomZooming, - d3_behavior_zoomLocations = {}, // identifier -> location - d3_behavior_zoomLast = 0, - d3_behavior_zoomXyz, - d3_behavior_zoomDispatch, - d3_behavior_zoomTarget, - d3_behavior_zoomArguments; - -function d3_behavior_zoomLocation(point) { - return [ - point[0] - d3_behavior_zoomXyz[0], - point[1] - d3_behavior_zoomXyz[1], - d3_behavior_zoomXyz[2] - ]; -} - -// detect the pixels that would be scrolled by this wheel event -function d3_behavior_zoomDelta() { - - // mousewheel events are totally broken! - // https://bugs.webkit.org/show_bug.cgi?id=40441 - // not only that, but Chrome and Safari differ in re. to acceleration! - if (!d3_behavior_zoomDiv) { - d3_behavior_zoomDiv = d3.select("body").append("div") - .style("visibility", "hidden") - .style("top", 0) - .style("height", 0) - .style("width", 0) - .style("overflow-y", "scroll") - .append("div") - .style("height", "2000px") - .node().parentNode; - } - - var e = d3.event, delta; - try { - d3_behavior_zoomDiv.scrollTop = 1000; - d3_behavior_zoomDiv.dispatchEvent(e); - delta = 1000 - d3_behavior_zoomDiv.scrollTop; - } catch (error) { - delta = e.wheelDelta || -e.detail; - } - - return delta * .005; -} - -// Note: Since we don't rotate, it's possible for the touches to become -// slightly detached from their original positions. Thus, we recompute the -// touch points on touchend as well as touchstart! -function d3_behavior_zoomTouchup() { - var touches = d3.svg.touches(d3_behavior_zoomTarget), - i = -1, - n = touches.length, - touch; - while (++i < n) d3_behavior_zoomLocations[(touch = touches[i]).identifier] = d3_behavior_zoomLocation(touch); - return touches; -} - -function d3_behavior_zoomTouchmove() { - var touches = d3.svg.touches(d3_behavior_zoomTarget); - switch (touches.length) { - - // single-touch pan - case 1: { - var touch = touches[0]; - d3_behavior_zoomTo(d3_behavior_zoomXyz[2], touch, d3_behavior_zoomLocations[touch.identifier]); - break; - } - - // double-touch pan + zoom - case 2: { - var p0 = touches[0], - p1 = touches[1], - p2 = [(p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2], - l0 = d3_behavior_zoomLocations[p0.identifier], - l1 = d3_behavior_zoomLocations[p1.identifier], - l2 = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2, l0[2]]; - d3_behavior_zoomTo(Math.log(d3.event.scale) / Math.LN2 + l0[2], p2, l2); - break; - } - } -} - -function d3_behavior_zoomMousemove() { - d3_behavior_zoomZooming = null; - if (d3_behavior_zoomPanning) d3_behavior_zoomTo(d3_behavior_zoomXyz[2], d3.svg.mouse(d3_behavior_zoomTarget), d3_behavior_zoomPanning); -} - -function d3_behavior_zoomMouseup() { - if (d3_behavior_zoomPanning) { - d3_behavior_zoomMousemove(); - d3_behavior_zoomPanning = null; - } -} - -function d3_behavior_zoomTo(z, x0, x1) { - var K = Math.pow(2, (d3_behavior_zoomXyz[2] = z) - x1[2]), - x = d3_behavior_zoomXyz[0] = x0[0] - K * x1[0], - y = d3_behavior_zoomXyz[1] = x0[1] - K * x1[1], - o = d3.event, // Events can be reentrant (e.g., focus). - k = Math.pow(2, z); - - d3.event = { - scale: k, - translate: [x, y], - transform: function(sx, sy) { - if (sx) transform(sx, x); - if (sy) transform(sy, y); - } - }; - - function transform(scale, o) { - var domain = scale.__domain || (scale.__domain = scale.domain()), - range = scale.range().map(function(v) { return (v - o) / k; }); - scale.domain(domain).domain(range.map(scale.invert)); - } - - try { - d3_behavior_zoomDispatch.apply(d3_behavior_zoomTarget, d3_behavior_zoomArguments); - } finally { - d3.event = o; - } - - o.preventDefault(); -} -})(); diff --git a/modules/enterprise/gui/rest-war/src/main/webapp/js/d3.chart.js b/modules/enterprise/gui/rest-war/src/main/webapp/js/d3.chart.js deleted file mode 100755 index 281d007..0000000 --- a/modules/enterprise/gui/rest-war/src/main/webapp/js/d3.chart.js +++ /dev/null @@ -1,984 +0,0 @@ -(function(){d3.chart = {}; -// Inspired by http://informationandvisualization.de/blog/box-plot -d3.chart.box = function() { - var width = 1, - height = 1, - duration = 0, - domain = null, - value = Number, - whiskers = d3_chart_boxWhiskers, - quartiles = d3_chart_boxQuartiles, - tickFormat = null; - - // For each small multiple… - function box(g) { - g.each(function(d, i) { - d = d.map(value).sort(d3.ascending); - var g = d3.select(this), - n = d.length, - min = d[0], - max = d[n - 1]; - - // Compute quartiles. Must return exactly 3 elements. - var quartileData = d.quartiles = quartiles(d); - - // Compute whiskers. Must return exactly 2 elements, or null. - var whiskerIndices = whiskers && whiskers.call(this, d, i), - whiskerData = whiskerIndices && whiskerIndices.map(function(i) { return d[i]; }); - - // Compute outliers. If no whiskers are specified, all data are "outliers". - // We compute the outliers as indices, so that we can join across transitions! - var outlierIndices = whiskerIndices - ? d3.range(0, whiskerIndices[0]).concat(d3.range(whiskerIndices[1] + 1, n)) - : d3.range(n); - - // Compute the new x-scale. - var x1 = d3.scale.linear() - .domain(domain && domain.call(this, d, i) || [min, max]) - .range([height, 0]); - - // Retrieve the old x-scale, if this is an update. - var x0 = this.__chart__ || d3.scale.linear() - .domain([0, Infinity]) - .range(x1.range()); - - // Stash the new scale. - this.__chart__ = x1; - - // Note: the box, median, and box tick elements are fixed in number, - // so we only have to handle enter and update. In contrast, the outliers - // and other elements are variable, so we need to exit them! Variable - // elements also fade in and out. - - // Update center line: the vertical line spanning the whiskers. - var center = g.selectAll("line.center") - .data(whiskerData ? [whiskerData] : []); - - center.enter().insert("svg:line", "rect") - .attr("class", "center") - .attr("x1", width / 2) - .attr("y1", function(d) { return x0(d[0]); }) - .attr("x2", width / 2) - .attr("y2", function(d) { return x0(d[1]); }) - .style("opacity", 1e-6) - .transition() - .duration(duration) - .style("opacity", 1) - .attr("y1", function(d) { return x1(d[0]); }) - .attr("y2", function(d) { return x1(d[1]); }); - - center.transition() - .duration(duration) - .style("opacity", 1) - .attr("y1", function(d) { return x1(d[0]); }) - .attr("y2", function(d) { return x1(d[1]); }); - - center.exit().transition() - .duration(duration) - .style("opacity", 1e-6) - .attr("y1", function(d) { return x1(d[0]); }) - .attr("y2", function(d) { return x1(d[1]); }) - .remove(); - - // Update innerquartile box. - var box = g.selectAll("rect.box") - .data([quartileData]); - - box.enter().append("svg:rect") - .attr("class", "box") - .attr("x", 0) - .attr("y", function(d) { return x0(d[2]); }) - .attr("width", width) - .attr("height", function(d) { return x0(d[0]) - x0(d[2]); }) - .transition() - .duration(duration) - .attr("y", function(d) { return x1(d[2]); }) - .attr("height", function(d) { return x1(d[0]) - x1(d[2]); }); - - box.transition() - .duration(duration) - .attr("y", function(d) { return x1(d[2]); }) - .attr("height", function(d) { return x1(d[0]) - x1(d[2]); }); - - // Update median line. - var medianLine = g.selectAll("line.median") - .data([quartileData[1]]); - - medianLine.enter().append("svg:line") - .attr("class", "median") - .attr("x1", 0) - .attr("y1", x0) - .attr("x2", width) - .attr("y2", x0) - .transition() - .duration(duration) - .attr("y1", x1) - .attr("y2", x1); - - medianLine.transition() - .duration(duration) - .attr("y1", x1) - .attr("y2", x1); - - // Update whiskers. - var whisker = g.selectAll("line.whisker") - .data(whiskerData || []); - - whisker.enter().insert("svg:line", "circle, text") - .attr("class", "whisker") - .attr("x1", 0) - .attr("y1", x0) - .attr("x2", width) - .attr("y2", x0) - .style("opacity", 1e-6) - .transition() - .duration(duration) - .attr("y1", x1) - .attr("y2", x1) - .style("opacity", 1); - - whisker.transition() - .duration(duration) - .attr("y1", x1) - .attr("y2", x1) - .style("opacity", 1); - - whisker.exit().transition() - .duration(duration) - .attr("y1", x1) - .attr("y2", x1) - .style("opacity", 1e-6) - .remove(); - - // Update outliers. - var outlier = g.selectAll("circle.outlier") - .data(outlierIndices, Number); - - outlier.enter().insert("svg:circle", "text") - .attr("class", "outlier") - .attr("r", 5) - .attr("cx", width / 2) - .attr("cy", function(i) { return x0(d[i]); }) - .style("opacity", 1e-6) - .transition() - .duration(duration) - .attr("cy", function(i) { return x1(d[i]); }) - .style("opacity", 1); - - outlier.transition() - .duration(duration) - .attr("cy", function(i) { return x1(d[i]); }) - .style("opacity", 1); - - outlier.exit().transition() - .duration(duration) - .attr("cy", function(i) { return x1(d[i]); }) - .style("opacity", 1e-6) - .remove(); - - // Compute the tick format. - var format = tickFormat || x1.tickFormat(8); - - // Update box ticks. - var boxTick = g.selectAll("text.box") - .data(quartileData); - - boxTick.enter().append("svg:text") - .attr("class", "box") - .attr("dy", ".3em") - .attr("dx", function(d, i) { return i & 1 ? 6 : -6 }) - .attr("x", function(d, i) { return i & 1 ? width : 0 }) - .attr("y", x0) - .attr("text-anchor", function(d, i) { return i & 1 ? "start" : "end"; }) - .text(format) - .transition() - .duration(duration) - .attr("y", x1); - - boxTick.transition() - .duration(duration) - .text(format) - .attr("y", x1); - - // Update whisker ticks. These are handled separately from the box - // ticks because they may or may not exist, and we want don't want - // to join box ticks pre-transition with whisker ticks post-. - var whiskerTick = g.selectAll("text.whisker") - .data(whiskerData || []); - - whiskerTick.enter().append("svg:text") - .attr("class", "whisker") - .attr("dy", ".3em") - .attr("dx", 6) - .attr("x", width) - .attr("y", x0) - .text(format) - .style("opacity", 1e-6) - .transition() - .duration(duration) - .attr("y", x1) - .style("opacity", 1); - - whiskerTick.transition() - .duration(duration) - .text(format) - .attr("y", x1) - .style("opacity", 1); - - whiskerTick.exit().transition() - .duration(duration) - .attr("y", x1) - .style("opacity", 1e-6) - .remove(); - }); - d3.timer.flush(); - } - - box.width = function(x) { - if (!arguments.length) return width; - width = x; - return box; - }; - - box.height = function(x) { - if (!arguments.length) return height; - height = x; - return box; - }; - - box.tickFormat = function(x) { - if (!arguments.length) return tickFormat; - tickFormat = x; - return box; - }; - - box.duration = function(x) { - if (!arguments.length) return duration; - duration = x; - return box; - }; - - box.domain = function(x) { - if (!arguments.length) return domain; - domain = x == null ? x : d3.functor(x); - return box; - }; - - box.value = function(x) { - if (!arguments.length) return value; - value = x; - return box; - }; - - box.whiskers = function(x) { - if (!arguments.length) return whiskers; - whiskers = x; - return box; - }; - - box.quartiles = function(x) { - if (!arguments.length) return quartiles; - quartiles = x; - return box; - }; - - return box; -}; - -function d3_chart_boxWhiskers(d) { - return [0, d.length - 1]; -} - -function d3_chart_boxQuartiles(d) { - return [ - d3.quantile(d, .25), - d3.quantile(d, .5), - d3.quantile(d, .75) - ]; -} -// Chart design based on the recommendations of Stephen Few. Implementation -// based on the work of Clint Ivy, Jamie Love, and Jason Davies. -// http://projects.instantcognition.com/protovis/bulletchart/ -d3.chart.bullet = function() { - var orient = "left", // TODO top & bottom - reverse = false, - duration = 0, - ranges = d3_chart_bulletRanges, - markers = d3_chart_bulletMarkers, - measures = d3_chart_bulletMeasures, - width = 380, - height = 30, - tickFormat = null; - - // For each small multiple… - function bullet(g) { - g.each(function(d, i) { - var rangez = ranges.call(this, d, i).slice().sort(d3.descending), - markerz = markers.call(this, d, i).slice().sort(d3.descending), - measurez = measures.call(this, d, i).slice().sort(d3.descending), - g = d3.select(this); - - // Compute the new x-scale. - var x1 = d3.scale.linear() - .domain([0, Math.max(rangez[0], markerz[0], measurez[0])]) - .range(reverse ? [width, 0] : [0, width]); - - // Retrieve the old x-scale, if this is an update. - var x0 = this.__chart__ || d3.scale.linear() - .domain([0, Infinity]) - .range(x1.range()); - - // Stash the new scale. - this.__chart__ = x1; - - // Derive width-scales from the x-scales. - var w0 = d3_chart_bulletWidth(x0), - w1 = d3_chart_bulletWidth(x1); - - // Update the range rects. - var range = g.selectAll("rect.range") - .data(rangez); - - range.enter().append("svg:rect") - .attr("class", function(d, i) { return "range s" + i; }) - .attr("width", w0) - .attr("height", height) - .attr("x", reverse ? x0 : 0) - .transition() - .duration(duration) - .attr("width", w1) - .attr("x", reverse ? x1 : 0); - - range.transition() - .duration(duration) - .attr("x", reverse ? x1 : 0) - .attr("width", w1) - .attr("height", height); - - // Update the measure rects. - var measure = g.selectAll("rect.measure") - .data(measurez); - - measure.enter().append("svg:rect") - .attr("class", function(d, i) { return "measure s" + i; }) - .attr("width", w0) - .attr("height", height / 3) - .attr("x", reverse ? x0 : 0) - .attr("y", height / 3) - .transition() - .duration(duration) - .attr("width", w1) - .attr("x", reverse ? x1 : 0); - - measure.transition() - .duration(duration) - .attr("width", w1) - .attr("height", height / 3) - .attr("x", reverse ? x1 : 0) - .attr("y", height / 3); - - // Update the marker lines. - var marker = g.selectAll("line.marker") - .data(markerz); - - marker.enter().append("svg:line") - .attr("class", "marker") - .attr("x1", x0) - .attr("x2", x0) - .attr("y1", height / 6) - .attr("y2", height * 5 / 6) - .transition() - .duration(duration) - .attr("x1", x1) - .attr("x2", x1); - - marker.transition() - .duration(duration) - .attr("x1", x1) - .attr("x2", x1) - .attr("y1", height / 6) - .attr("y2", height * 5 / 6); - - // Compute the tick format. - var format = tickFormat || x1.tickFormat(8); - - // Update the tick groups. - var tick = g.selectAll("g.tick") - .data(x1.ticks(8), function(d) { - return this.textContent || format(d); - }); - - // Initialize the ticks with the old scale, x0. - var tickEnter = tick.enter().append("svg:g") - .attr("class", "tick") - .attr("transform", d3_chart_bulletTranslate(x0)) - .style("opacity", 1e-6); - - tickEnter.append("svg:line") - .attr("y1", height) - .attr("y2", height * 7 / 6); - - tickEnter.append("svg:text") - .attr("text-anchor", "middle") - .attr("dy", "1em") - .attr("y", height * 7 / 6) - .text(format); - - // Transition the entering ticks to the new scale, x1. - tickEnter.transition() - .duration(duration) - .attr("transform", d3_chart_bulletTranslate(x1)) - .style("opacity", 1); - - // Transition the updating ticks to the new scale, x1. - var tickUpdate = tick.transition() - .duration(duration) - .attr("transform", d3_chart_bulletTranslate(x1)) - .style("opacity", 1); - - tickUpdate.select("line") - .attr("y1", height) - .attr("y2", height * 7 / 6); - - tickUpdate.select("text") - .attr("y", height * 7 / 6); - - // Transition the exiting ticks to the new scale, x1. - tick.exit().transition() - .duration(duration) - .attr("transform", d3_chart_bulletTranslate(x1)) - .style("opacity", 1e-6) - .remove(); - }); - d3.timer.flush(); - } - - // left, right, top, bottom - bullet.orient = function(x) { - if (!arguments.length) return orient; - orient = x; - reverse = orient == "right" || orient == "bottom"; - return bullet; - }; - - // ranges (bad, satisfactory, good) - bullet.ranges = function(x) { - if (!arguments.length) return ranges; - ranges = x; - return bullet; - }; - - // markers (previous, goal) - bullet.markers = function(x) { - if (!arguments.length) return markers; - markers = x; - return bullet; - }; - - // measures (actual, forecast) - bullet.measures = function(x) { - if (!arguments.length) return measures; - measures = x; - return bullet; - }; - - bullet.width = function(x) { - if (!arguments.length) return width; - width = x; - return bullet; - }; - - bullet.height = function(x) { - if (!arguments.length) return height; - height = x; - return bullet; - }; - - bullet.tickFormat = function(x) { - if (!arguments.length) return tickFormat; - tickFormat = x; - return bullet; - }; - - bullet.duration = function(x) { - if (!arguments.length) return duration; - duration = x; - return bullet; - }; - - return bullet; -}; - -function d3_chart_bulletRanges(d) { - return d.ranges; -} - -function d3_chart_bulletMarkers(d) { - return d.markers; -} - -function d3_chart_bulletMeasures(d) { - return d.measures; -} - -function d3_chart_bulletTranslate(x) { - return function(d) { - return "translate(" + x(d) + ",0)"; - }; -} - -function d3_chart_bulletWidth(x) { - var x0 = x(0); - return function(d) { - return Math.abs(x(d) - x0); - }; -} -// Implements a horizon layout, which is a variation of a single-series -// area chart where the area is folded into multiple bands. Color is used to -// encode band, allowing the size of the chart to be reduced significantly -// without impeding readability. This layout algorithm is based on the work of -// J. Heer, N. Kong and M. Agrawala in "Sizing the Horizon: The Effects of Chart -// Size and Layering on the Graphical Perception of Time Series Visualizations", -// CHI 2009. http://hci.stanford.edu/publications/2009/heer-horizon-chi09.pdf -d3.chart.horizon = function() { - var bands = 1, // between 1 and 5, typically - mode = "offset", // or mirror - interpolate = "linear", // or basis, monotone, step-before, etc. - x = d3_chart_horizonX, - y = d3_chart_horizonY, - w = 960, - h = 40, - duration = 0; - - var color = d3.scale.linear() - .domain([-1, 0, 1]) - .range(["#d62728", "#fff", "#1f77b4"]); - - // For each small multiple… - function horizon(g) { - g.each(function(d, i) { - var g = d3.select(this), - n = 2 * bands + 1, - xMin = Infinity, - xMax = -Infinity, - yMax = -Infinity, - x0, // old x-scale - y0, // old y-scale - id; // unique id for paths - - // Compute x- and y-values along with extents. - var data = d.map(function(d, i) { - var xv = x.call(this, d, i), - yv = y.call(this, d, i); - if (xv < xMin) xMin = xv; - if (xv > xMax) xMax = xv; - if (-yv > yMax) yMax = -yv; - if (yv > yMax) yMax = yv; - return [xv, yv]; - }); - - // Compute the new x- and y-scales. - var x1 = d3.scale.linear().domain([xMin, xMax]).range([0, w]), - y1 = d3.scale.linear().domain([0, yMax]).range([0, h * bands]); - - // Retrieve the old scales, if this is an update. - if (this.__chart__) { - x0 = this.__chart__.x; - y0 = this.__chart__.y; - id = this.__chart__.id; - } else { - x0 = d3.scale.linear().domain([0, Infinity]).range(x1.range()); - y0 = d3.scale.linear().domain([0, Infinity]).range(y1.range()); - id = ++d3_chart_horizonId; - } - - // We'll use a defs to store the area path and the clip path. - var defs = g.selectAll("defs") - .data([data]); - - var defsEnter = defs.enter().append("svg:defs"); - - // The clip path is a simple rect. - defsEnter.append("svg:clipPath") - .attr("id", "d3_chart_horizon_clip" + id) - .append("svg:rect") - .attr("width", w) - .attr("height", h); - - defs.select("rect").transition() - .duration(duration) - .attr("width", w) - .attr("height", h); - - // The area path is rendered with our resuable d3.svg.area. - defsEnter.append("svg:path") - .attr("id", "d3_chart_horizon_path" + id) - .attr("d", d3_chart_horizonArea - .interpolate(interpolate) - .x(function(d) { return x0(d[0]); }) - .y0(h * bands) - .y1(function(d) { return h * bands - y0(d[1]); })) - .transition() - .duration(duration) - .attr("d", d3_chart_horizonArea - .x(function(d) { return x1(d[0]); }) - .y1(function(d) { return h * bands - y1(d[1]); })); - - defs.select("path").transition() - .duration(duration) - .attr("d", d3_chart_horizonArea); - - // We'll use a container to clip all horizon layers at once. - g.selectAll("g") - .data([null]) - .enter().append("svg:g") - .attr("clip-path", "url(#d3_chart_horizon_clip" + id + ")"); - - // Define the transform function based on the mode. - var transform = mode == "offset" - ? function(d) { return "translate(0," + (d + (d < 0) - bands) * h + ")"; } - : function(d) { return (d < 0 ? "scale(1,-1)" : "") + "translate(0," + (d - bands) * h + ")"; }; - - // Instantiate each copy of the path with different transforms. - var u = g.select("g").selectAll("use") - .data(d3.range(-1, -bands - 1, -1).concat(d3.range(1, bands + 1)), Number); - - // TODO don't fudge the enter transition - u.enter().append("svg:use") - .attr("xlink:href", "#d3_chart_horizon_path" + id) - .attr("transform", function(d) { return transform(d + (d > 0 ? 1 : -1)); }) - .style("fill", color) - .transition() - .duration(duration) - .attr("transform", transform); - - u.transition() - .duration(duration) - .attr("transform", transform) - .style("fill", color); - - u.exit().transition() - .duration(duration) - .attr("transform", transform) - .remove(); - - // Stash the new scales. - this.__chart__ = {x: x1, y: y1, id: id}; - }); - d3.timer.flush(); - } - - horizon.duration = function(x) { - if (!arguments.length) return duration; - duration = +x; - return horizon; - }; - - horizon.bands = function(x) { - if (!arguments.length) return bands; - bands = +x; - color.domain([-bands, 0, bands]); - return horizon; - }; - - horizon.mode = function(x) { - if (!arguments.length) return mode; - mode = x + ""; - return horizon; - }; - - horizon.colors = function(x) { - if (!arguments.length) return color.range(); - color.range(x); - return horizon; - }; - - horizon.interpolate = function(x) { - if (!arguments.length) return interpolate; - interpolate = x + ""; - return horizon; - }; - - horizon.x = function(z) { - if (!arguments.length) return x; - x = z; - return horizon; - }; - - horizon.y = function(z) { - if (!arguments.length) return y; - y = z; - return horizon; - }; - - horizon.width = function(x) { - if (!arguments.length) return w; - w = +x; - return horizon; - }; - - horizon.height = function(x) { - if (!arguments.length) return h; - h = +x; - return horizon; - }; - - return horizon; -}; - -var d3_chart_horizonArea = d3.svg.area(), - d3_chart_horizonId = 0; - -function d3_chart_horizonX(d) { - return d[0]; -} - -function d3_chart_horizonY(d) { - return d[1]; -} -// Based on http://vis.stanford.edu/protovis/ex/qqplot.html -d3.chart.qq = function() { - var width = 1, - height = 1, - duration = 0, - domain = null, - tickFormat = null, - n = 100, - x = d3_chart_qqX, - y = d3_chart_qqY; - - // For each small multiple… - function qq(g) { - g.each(function(d, i) { - var g = d3.select(this), - qx = d3_chart_qqQuantiles(n, x.call(this, d, i)), - qy = d3_chart_qqQuantiles(n, y.call(this, d, i)), - xd = domain && domain.call(this, d, i) || [d3.min(qx), d3.max(qx)], // new x-domain - yd = domain && domain.call(this, d, i) || [d3.min(qy), d3.max(qy)], // new y-domain - x0, // old x-scale - y0; // old y-scale - - // Compute the new x-scale. - var x1 = d3.scale.linear() - .domain(xd) - .range([0, width]); - - // Compute the new y-scale. - var y1 = d3.scale.linear() - .domain(yd) - .range([height, 0]); - - // Retrieve the old scales, if this is an update. - if (this.__chart__) { - x0 = this.__chart__.x; - y0 = this.__chart__.y; - } else { - x0 = d3.scale.linear().domain([0, Infinity]).range(x1.range()); - y0 = d3.scale.linear().domain([0, Infinity]).range(y1.range()); - } - - // Stash the new scales. - this.__chart__ = {x: x1, y: y1}; - - // Update diagonal line. - var diagonal = g.selectAll("line.diagonal") - .data([null]); - - diagonal.enter().append("svg:line") - .attr("class", "diagonal") - .attr("x1", x1(yd[0])) - .attr("y1", y1(xd[0])) - .attr("x2", x1(yd[1])) - .attr("y2", y1(xd[1])); - - diagonal.transition() - .duration(duration) - .attr("x1", x1(yd[0])) - .attr("y1", y1(xd[0])) - .attr("x2", x1(yd[1])) - .attr("y2", y1(xd[1])); - - // Update quantile plots. - var circle = g.selectAll("circle") - .data(d3.range(n).map(function(i) { - return {x: qx[i], y: qy[i]}; - })); - - circle.enter().append("svg:circle") - .attr("class", "quantile") - .attr("r", 4.5) - .attr("cx", function(d) { return x0(d.x); }) - .attr("cy", function(d) { return y0(d.y); }) - .style("opacity", 1e-6) - .transition() - .duration(duration) - .attr("cx", function(d) { return x1(d.x); }) - .attr("cy", function(d) { return y1(d.y); }) - .style("opacity", 1); - - circle.transition() - .duration(duration) - .attr("cx", function(d) { return x1(d.x); }) - .attr("cy", function(d) { return y1(d.y); }) - .style("opacity", 1); - - circle.exit().transition() - .duration(duration) - .attr("cx", function(d) { return x1(d.x); }) - .attr("cy", function(d) { return y1(d.y); }) - .style("opacity", 1e-6) - .remove(); - - var xformat = tickFormat || x1.tickFormat(4), - yformat = tickFormat || y1.tickFormat(4), - tx = function(d) { return "translate(" + x1(d) + "," + height + ")"; }, - ty = function(d) { return "translate(0," + y1(d) + ")"; }; - - // Update x-ticks. - var xtick = g.selectAll("g.x.tick") - .data(x1.ticks(4), function(d) { - return this.textContent || xformat(d); - }); - - var xtickEnter = xtick.enter().append("svg:g") - .attr("class", "x tick") - .attr("transform", function(d) { return "translate(" + x0(d) + "," + height + ")"; }) - .style("opacity", 1e-6); - - xtickEnter.append("svg:line") - .attr("y1", 0) - .attr("y2", -6); - - xtickEnter.append("svg:text") - .attr("text-anchor", "middle") - .attr("dy", "1em") - .text(xformat); - - // Transition the entering ticks to the new scale, x1. - xtickEnter.transition() - .duration(duration) - .attr("transform", tx) - .style("opacity", 1); - - // Transition the updating ticks to the new scale, x1. - xtick.transition() - .duration(duration) - .attr("transform", tx) - .style("opacity", 1); - - // Transition the exiting ticks to the new scale, x1. - xtick.exit().transition() - .duration(duration) - .attr("transform", tx) - .style("opacity", 1e-6) - .remove(); - - // Update ticks. - var ytick = g.selectAll("g.y.tick") - .data(y1.ticks(4), function(d) { - return this.textContent || yformat(d); - }); - - var ytickEnter = ytick.enter().append("svg:g") - .attr("class", "y tick") - .attr("transform", function(d) { return "translate(0," + y0(d) + ")"; }) - .style("opacity", 1e-6); - - ytickEnter.append("svg:line") - .attr("x1", 0) - .attr("x2", 6); - - ytickEnter.append("svg:text") - .attr("text-anchor", "end") - .attr("dx", "-.5em") - .attr("dy", ".3em") - .text(yformat); - - // Transition the entering ticks to the new scale, y1. - ytickEnter.transition() - .duration(duration) - .attr("transform", ty) - .style("opacity", 1); - - // Transition the updating ticks to the new scale, y1. - ytick.transition() - .duration(duration) - .attr("transform", ty) - .style("opacity", 1); - - // Transition the exiting ticks to the new scale, y1. - ytick.exit().transition() - .duration(duration) - .attr("transform", ty) - .style("opacity", 1e-6) - .remove(); - }); - } - - qq.width = function(x) { - if (!arguments.length) return width; - width = x; - return qq; - }; - - qq.height = function(x) { - if (!arguments.length) return height; - height = x; - return qq; - }; - - qq.duration = function(x) { - if (!arguments.length) return duration; - duration = x; - return qq; - }; - - qq.domain = function(x) { - if (!arguments.length) return domain; - domain = x == null ? x : d3.functor(x); - return qq; - }; - - qq.count = function(z) { - if (!arguments.length) return n; - n = z; - return qq; - }; - - qq.x = function(z) { - if (!arguments.length) return x; - x = z; - return qq; - }; - - qq.y = function(z) { - if (!arguments.length) return y; - y = z; - return qq; - }; - - qq.tickFormat = function(x) { - if (!arguments.length) return tickFormat; - tickFormat = x; - return qq; - }; - - return qq; -}; - -function d3_chart_qqQuantiles(n, values) { - var m = values.length - 1; - values = values.slice().sort(d3.ascending); - return d3.range(n).map(function(i) { - return values[~~(i * m / n)]; - }); -} - -function d3_chart_qqX(d) { - return d.x; -} - -function d3_chart_qqY(d) { - return d.y; -} -})(); diff --git a/modules/enterprise/gui/rest-war/src/main/webapp/js/d3.csv.js b/modules/enterprise/gui/rest-war/src/main/webapp/js/d3.csv.js deleted file mode 100644 index 7565b83..0000000 --- a/modules/enterprise/gui/rest-war/src/main/webapp/js/d3.csv.js +++ /dev/null @@ -1,92 +0,0 @@ -(function(){d3.csv = function(url, callback) { - d3.text(url, "text/csv", function(text) { - callback(text && d3.csv.parse(text)); - }); -}; -d3.csv.parse = function(text) { - var header; - return d3.csv.parseRows(text, function(row, i) { - if (i) { - var o = {}, j = -1, m = header.length; - while (++j < m) o[header[j]] = row[j]; - return o; - } else { - header = row; - return null; - } - }); -}; - -d3.csv.parseRows = function(text, f) { - var EOL = {}, // sentinel value for end-of-line - EOF = {}, // sentinel value for end-of-file - rows = [], // output rows - re = /\r\n|[,\r\n]/g, // field separator regex - n = 0, // the current line number - t, // the current token - eol; // is the current token followed by EOL? - - re.lastIndex = 0; // work-around bug in FF 3.6 - - /** @private Returns the next token. */ - function token() { - if (re.lastIndex >= text.length) return EOF; // special case: end of file - if (eol) { eol = false; return EOL; } // special case: end of line - - // special case: quotes - var j = re.lastIndex; - if (text.charCodeAt(j) === 34) { - var i = j; - while (i++ < text.length) { - if (text.charCodeAt(i) === 34) { - if (text.charCodeAt(i + 1) !== 34) break; - i++; - } - } - re.lastIndex = i + 2; - var c = text.charCodeAt(i + 1); - if (c === 13) { - eol = true; - if (text.charCodeAt(i + 2) === 10) re.lastIndex++; - } else if (c === 10) { - eol = true; - } - return text.substring(j + 1, i).replace(/""/g, """); - } - - // common case - var m = re.exec(text); - if (m) { - eol = m[0].charCodeAt(0) !== 44; - return text.substring(j, m.index); - } - re.lastIndex = text.length; - return text.substring(j); - } - - while ((t = token()) !== EOF) { - var a = []; - while ((t !== EOL) && (t !== EOF)) { - a.push(t); - t = token(); - } - if (f && !(a = f(a, n++))) continue; - rows.push(a); - } - - return rows; -}; -d3.csv.format = function(rows) { - return rows.map(d3_csv_formatRow).join("\n"); -}; - -function d3_csv_formatRow(row) { - return row.map(d3_csv_formatValue).join(","); -} - -function d3_csv_formatValue(text) { - return /[",\n]/.test(text) - ? """ + text.replace(/"/g, """") + """ - : text; -} -})(); diff --git a/modules/enterprise/gui/rest-war/src/main/webapp/js/d3.geo.js b/modules/enterprise/gui/rest-war/src/main/webapp/js/d3.geo.js deleted file mode 100644 index 2b40252..0000000 --- a/modules/enterprise/gui/rest-war/src/main/webapp/js/d3.geo.js +++ /dev/null @@ -1,938 +0,0 @@ -(function(){d3.geo = {}; - -var d3_geo_radians = Math.PI / 180; -// TODO clip input coordinates on opposite hemisphere -d3.geo.azimuthal = function() { - var mode = "orthographic", // or stereographic, gnomonic, equidistant or equalarea - origin, - scale = 200, - translate = [480, 250], - x0, - y0, - cy0, - sy0; - - function azimuthal(coordinates) { - var x1 = coordinates[0] * d3_geo_radians - x0, - y1 = coordinates[1] * d3_geo_radians, - cx1 = Math.cos(x1), - sx1 = Math.sin(x1), - cy1 = Math.cos(y1), - sy1 = Math.sin(y1), - cc = mode !== "orthographic" ? sy0 * sy1 + cy0 * cy1 * cx1 : null, - c, - k = mode === "stereographic" ? 1 / (1 + cc) - : mode === "gnomonic" ? 1 / cc - : mode === "equidistant" ? (c = Math.acos(cc), c ? c / Math.sin(c) : 0) - : mode === "equalarea" ? Math.sqrt(2 / (1 + cc)) - : 1, - x = k * cy1 * sx1, - y = k * (sy0 * cy1 * cx1 - cy0 * sy1); - return [ - scale * x + translate[0], - scale * y + translate[1] - ]; - } - - azimuthal.invert = function(coordinates) { - var x = (coordinates[0] - translate[0]) / scale, - y = (coordinates[1] - translate[1]) / scale, - p = Math.sqrt(x * x + y * y), - c = mode === "stereographic" ? 2 * Math.atan(p) - : mode === "gnomonic" ? Math.atan(p) - : mode === "equidistant" ? p - : mode === "equalarea" ? 2 * Math.asin(.5 * p) - : Math.asin(p), - sc = Math.sin(c), - cc = Math.cos(c); - return [ - (x0 + Math.atan2(x * sc, p * cy0 * cc + y * sy0 * sc)) / d3_geo_radians, - Math.asin(cc * sy0 - (p ? (y * sc * cy0) / p : 0)) / d3_geo_radians - ]; - }; - - azimuthal.mode = function(x) { - if (!arguments.length) return mode; - mode = x + ""; - return azimuthal; - }; - - azimuthal.origin = function(x) { - if (!arguments.length) return origin; - origin = x; - x0 = origin[0] * d3_geo_radians; - y0 = origin[1] * d3_geo_radians; - cy0 = Math.cos(y0); - sy0 = Math.sin(y0); - return azimuthal; - }; - - azimuthal.scale = function(x) { - if (!arguments.length) return scale; - scale = +x; - return azimuthal; - }; - - azimuthal.translate = function(x) { - if (!arguments.length) return translate; - translate = [+x[0], +x[1]]; - return azimuthal; - }; - - return azimuthal.origin([0, 0]); -}; -// Derived from Tom Carden's Albers implementation for Protovis. -// http://gist.github.com/476238 -// http://mathworld.wolfram.com/AlbersEqual-AreaConicProjection.html - -d3.geo.albers = function() { - var origin = [-98, 38], - parallels = [29.5, 45.5], - scale = 1000, - translate = [480, 250], - lng0, // d3_geo_radians * origin[0] - n, - C, - p0; - - function albers(coordinates) { - var t = n * (d3_geo_radians * coordinates[0] - lng0), - p = Math.sqrt(C - 2 * n * Math.sin(d3_geo_radians * coordinates[1])) / n; - return [ - scale * p * Math.sin(t) + translate[0], - scale * (p * Math.cos(t) - p0) + translate[1] - ]; - } - - albers.invert = function(coordinates) { - var x = (coordinates[0] - translate[0]) / scale, - y = (coordinates[1] - translate[1]) / scale, - p0y = p0 + y, - t = Math.atan2(x, p0y), - p = Math.sqrt(x * x + p0y * p0y); - return [ - (lng0 + t / n) / d3_geo_radians, - Math.asin((C - p * p * n * n) / (2 * n)) / d3_geo_radians - ]; - }; - - function reload() { - var phi1 = d3_geo_radians * parallels[0], - phi2 = d3_geo_radians * parallels[1], - lat0 = d3_geo_radians * origin[1], - s = Math.sin(phi1), - c = Math.cos(phi1); - lng0 = d3_geo_radians * origin[0]; - n = .5 * (s + Math.sin(phi2)); - C = c * c + 2 * n * s; - p0 = Math.sqrt(C - 2 * n * Math.sin(lat0)) / n; - return albers; - } - - albers.origin = function(x) { - if (!arguments.length) return origin; - origin = [+x[0], +x[1]]; - return reload(); - }; - - albers.parallels = function(x) { - if (!arguments.length) return parallels; - parallels = [+x[0], +x[1]]; - return reload(); - }; - - albers.scale = function(x) { - if (!arguments.length) return scale; - scale = +x; - return albers; - }; - - albers.translate = function(x) { - if (!arguments.length) return translate; - translate = [+x[0], +x[1]]; - return albers; - }; - - return reload(); -}; - -// A composite projection for the United States, 960x500. The set of standard -// parallels for each region comes from USGS, which is published here: -// http://egsc.usgs.gov/isb/pubs/MapProjections/projections.html#albers -// TODO allow the composite projection to be rescaled? -d3.geo.albersUsa = function() { - var lower48 = d3.geo.albers(); - - var alaska = d3.geo.albers() - .origin([-160, 60]) - .parallels([55, 65]); - - var hawaii = d3.geo.albers() - .origin([-160, 20]) - .parallels([8, 18]); - - var puertoRico = d3.geo.albers() - .origin([-60, 10]) - .parallels([8, 18]); - - function albersUsa(coordinates) { - var lon = coordinates[0], - lat = coordinates[1]; - return (lat > 50 ? alaska - : lon < -140 ? hawaii - : lat < 21 ? puertoRico - : lower48)(coordinates); - } - - albersUsa.scale = function(x) { - if (!arguments.length) return lower48.scale(); - lower48.scale(x); - alaska.scale(x * .6); - hawaii.scale(x); - puertoRico.scale(x * 1.5); - return albersUsa.translate(lower48.translate()); - }; - - albersUsa.translate = function(x) { - if (!arguments.length) return lower48.translate(); - var dz = lower48.scale() / 1000, - dx = x[0], - dy = x[1]; - lower48.translate(x); - alaska.translate([dx - 400 * dz, dy + 170 * dz]); - hawaii.translate([dx - 190 * dz, dy + 200 * dz]); - puertoRico.translate([dx + 580 * dz, dy + 430 * dz]); - return albersUsa; - }; - - return albersUsa.scale(lower48.scale()); -}; -d3.geo.bonne = function() { - var scale = 200, - translate = [480, 250], - x0, // origin longitude in radians - y0, // origin latitude in radians - y1, // parallel latitude in radians - c1; // cot(y1) - - function bonne(coordinates) { - var x = coordinates[0] * d3_geo_radians - x0, - y = coordinates[1] * d3_geo_radians - y0; - if (y1) { - var p = c1 + y1 - y, E = x * Math.cos(y) / p; - x = p * Math.sin(E); - y = p * Math.cos(E) - c1; - } else { - x *= Math.cos(y); - y *= -1; - } - return [ - scale * x + translate[0], - scale * y + translate[1] - ]; - } - - bonne.invert = function(coordinates) { - var x = (coordinates[0] - translate[0]) / scale, - y = (coordinates[1] - translate[1]) / scale; - if (y1) { - var c = c1 + y, p = Math.sqrt(x * x + c * c); - y = c1 + y1 - p; - x = x0 + p * Math.atan2(x, c) / Math.cos(y); - } else { - y *= -1; - x /= Math.cos(y); - } - return [ - x / d3_geo_radians, - y / d3_geo_radians - ]; - }; - - // 90° for Werner, 0° for Sinusoidal - bonne.parallel = function(x) { - if (!arguments.length) return y1 / d3_geo_radians; - c1 = 1 / Math.tan(y1 = x * d3_geo_radians); - return bonne; - }; - - bonne.origin = function(x) { - if (!arguments.length) return [x0 / d3_geo_radians, y0 / d3_geo_radians]; - x0 = x[0] * d3_geo_radians; - y0 = x[1] * d3_geo_radians; - return bonne; - }; - - bonne.scale = function(x) { - if (!arguments.length) return scale; - scale = +x; - return bonne; - }; - - bonne.translate = function(x) { - if (!arguments.length) return translate; - translate = [+x[0], +x[1]]; - return bonne; - }; - - return bonne.origin([0, 0]).parallel(45); -}; -d3.geo.equirectangular = function() { - var scale = 500, - translate = [480, 250]; - - function equirectangular(coordinates) { - var x = coordinates[0] / 360, - y = -coordinates[1] / 360; - return [ - scale * x + translate[0], - scale * y + translate[1] - ]; - } - - equirectangular.invert = function(coordinates) { - var x = (coordinates[0] - translate[0]) / scale, - y = (coordinates[1] - translate[1]) / scale; - return [ - 360 * x, - -360 * y - ]; - }; - - equirectangular.scale = function(x) { - if (!arguments.length) return scale; - scale = +x; - return equirectangular; - }; - - equirectangular.translate = function(x) { - if (!arguments.length) return translate; - translate = [+x[0], +x[1]]; - return equirectangular; - }; - - return equirectangular; -}; -d3.geo.mercator = function() { - var scale = 500, - translate = [480, 250]; - - function mercator(coordinates) { - var x = coordinates[0] / 360, - y = -(Math.log(Math.tan(Math.PI / 4 + coordinates[1] * d3_geo_radians / 2)) / d3_geo_radians) / 360; - return [ - scale * x + translate[0], - scale * Math.max(-.5, Math.min(.5, y)) + translate[1] - ]; - } - - mercator.invert = function(coordinates) { - var x = (coordinates[0] - translate[0]) / scale, - y = (coordinates[1] - translate[1]) / scale; - return [ - 360 * x, - 2 * Math.atan(Math.exp(-360 * y * d3_geo_radians)) / d3_geo_radians - 90 - ]; - }; - - mercator.scale = function(x) { - if (!arguments.length) return scale; - scale = +x; - return mercator; - }; - - mercator.translate = function(x) { - if (!arguments.length) return translate; - translate = [+x[0], +x[1]]; - return mercator; - }; - - return mercator; -}; -function d3_geo_type(types, defaultValue) { - return function(object) { - return object && object.type in types ? types[object.type](object) : defaultValue; - }; -} -/** - * Returns a function that, given a GeoJSON object (e.g., a feature), returns - * the corresponding SVG path. The function can be customized by overriding the - * projection. Point features are mapped to circles with a default radius of - * 4.5px; the radius can be specified either as a constant or a function that - * is evaluated per object. - */ -d3.geo.path = function() { - var pointRadius = 4.5, - pointCircle = d3_path_circle(pointRadius), - projection = d3.geo.albersUsa(); - - function path(d, i) { - if (typeof pointRadius === "function") { - pointCircle = d3_path_circle(pointRadius.apply(this, arguments)); - } - return pathType(d) || null; - } - - function project(coordinates) { - return projection(coordinates).join(","); - } - - var pathType = d3_geo_type({ - - FeatureCollection: function(o) { - var path = [], - features = o.features, - i = -1, // features.index - n = features.length; - while (++i < n) path.push(pathType(features[i].geometry)); - return path.join(""); - }, - - Feature: function(o) { - return pathType(o.geometry); - }, - - Point: function(o) { - return "M" + project(o.coordinates) + pointCircle; - }, - - MultiPoint: function(o) { - var path = [], - coordinates = o.coordinates, - i = -1, // coordinates.index - n = coordinates.length; - while (++i < n) path.push("M", project(coordinates[i]), pointCircle); - return path.join(""); - }, - - LineString: function(o) { - var path = ["M"], - coordinates = o.coordinates, - i = -1, // coordinates.index - n = coordinates.length; - while (++i < n) path.push(project(coordinates[i]), "L"); - path.pop(); - return path.join(""); - }, - - MultiLineString: function(o) { - var path = [], - coordinates = o.coordinates, - i = -1, // coordinates.index - n = coordinates.length, - subcoordinates, // coordinates[i] - j, // subcoordinates.index - m; // subcoordinates.length - while (++i < n) { - subcoordinates = coordinates[i]; - j = -1; - m = subcoordinates.length; - path.push("M"); - while (++j < m) path.push(project(subcoordinates[j]), "L"); - path.pop(); - } - return path.join(""); - }, - - Polygon: function(o) { - var path = [], - coordinates = o.coordinates, - i = -1, // coordinates.index - n = coordinates.length, - subcoordinates, // coordinates[i] - j, // subcoordinates.index - m; // subcoordinates.length - while (++i < n) { - subcoordinates = coordinates[i]; - j = -1; - if ((m = subcoordinates.length - 1) > 0) { - path.push("M"); - while (++j < m) path.push(project(subcoordinates[j]), "L"); - path[path.length - 1] = "Z"; - } - } - return path.join(""); - }, - - MultiPolygon: function(o) { - var path = [], - coordinates = o.coordinates, - i = -1, // coordinates index - n = coordinates.length, - subcoordinates, // coordinates[i] - j, // subcoordinates index - m, // subcoordinates.length - subsubcoordinates, // subcoordinates[j] - k, // subsubcoordinates index - p; // subsubcoordinates.length - while (++i < n) { - subcoordinates = coordinates[i]; - j = -1; - m = subcoordinates.length; - while (++j < m) { - subsubcoordinates = subcoordinates[j]; - k = -1; - if ((p = subsubcoordinates.length - 1) > 0) { - path.push("M"); - while (++k < p) path.push(project(subsubcoordinates[k]), "L"); - path[path.length - 1] = "Z"; - } - } - } - return path.join(""); - }, - - GeometryCollection: function(o) { - var path = [], - geometries = o.geometries, - i = -1, // geometries index - n = geometries.length; - while (++i < n) path.push(pathType(geometries[i])); - return path.join(""); - } - - }); - - var areaType = path.area = d3_geo_type({ - - FeatureCollection: function(o) { - var area = 0, - features = o.features, - i = -1, // features.index - n = features.length; - while (++i < n) area += areaType(features[i]); - return area; - }, - - Feature: function(o) { - return areaType(o.geometry); - }, - - Polygon: function(o) { - return polygonArea(o.coordinates); - }, - - MultiPolygon: function(o) { - var sum = 0, - coordinates = o.coordinates, - i = -1, // coordinates index - n = coordinates.length; - while (++i < n) sum += polygonArea(coordinates[i]); - return sum; - }, - - GeometryCollection: function(o) { - var sum = 0, - geometries = o.geometries, - i = -1, // geometries index - n = geometries.length; - while (++i < n) sum += areaType(geometries[i]); - return sum; - } - - }, 0); - - function polygonArea(coordinates) { - var sum = area(coordinates[0]), // exterior ring - i = 0, // coordinates.index - n = coordinates.length; - while (++i < n) sum -= area(coordinates[i]); // holes - return sum; - } - - function polygonCentroid(coordinates) { - var polygon = d3.geom.polygon(coordinates[0].map(projection)), // exterior ring - area = polygon.area(), - centroid = polygon.centroid(area < 0 ? (area *= -1, 1) : -1), - x = centroid[0], - y = centroid[1], - z = area, - i = 0, // coordinates index - n = coordinates.length; - while (++i < n) { - polygon = d3.geom.polygon(coordinates[i].map(projection)); // holes - area = polygon.area(); - centroid = polygon.centroid(area < 0 ? (area *= -1, 1) : -1); - x -= centroid[0]; - y -= centroid[1]; - z -= area; - } - return [x, y, 6 * z]; // weighted centroid - } - - var centroidType = path.centroid = d3_geo_type({ - - // TODO FeatureCollection - // TODO Point - // TODO MultiPoint - // TODO LineString - // TODO MultiLineString - // TODO GeometryCollection - - Feature: function(o) { - return centroidType(o.geometry); - }, - - Polygon: function(o) { - var centroid = polygonCentroid(o.coordinates); - return [centroid[0] / centroid[2], centroid[1] / centroid[2]]; - }, - - MultiPolygon: function(o) { - var area = 0, - coordinates = o.coordinates, - centroid, - x = 0, - y = 0, - z = 0, - i = -1, // coordinates index - n = coordinates.length; - while (++i < n) { - centroid = polygonCentroid(coordinates[i]); - x += centroid[0]; - y += centroid[1]; - z += centroid[2]; - } - return [x / z, y / z]; - } - - }); - - function area(coordinates) { - return Math.abs(d3.geom.polygon(coordinates.map(projection)).area()); - } - - path.projection = function(x) { - projection = x; - return path; - }; - - path.pointRadius = function(x) { - if (typeof x === "function") pointRadius = x; - else { - pointRadius = +x; - pointCircle = d3_path_circle(pointRadius); - } - return path; - }; - - return path; -}; - -function d3_path_circle(radius) { - return "m0," + radius - + "a" + radius + "," + radius + " 0 1,1 0," + (-2 * radius) - + "a" + radius + "," + radius + " 0 1,1 0," + (+2 * radius) - + "z"; -} -/** - * Given a GeoJSON object, returns the corresponding bounding box. The bounding - * box is represented by a two-dimensional array: [[left, bottom], [right, - * top]], where left is the minimum longitude, bottom is the minimum latitude, - * right is maximum longitude, and top is the maximum latitude. - */ -d3.geo.bounds = function(feature) { - var left = Infinity, - bottom = Infinity, - right = -Infinity, - top = -Infinity; - d3_geo_bounds(feature, function(x, y) { - if (x < left) left = x; - if (x > right) right = x; - if (y < bottom) bottom = y; - if (y > top) top = y; - }); - return [[left, bottom], [right, top]]; -}; - -function d3_geo_bounds(o, f) { - if (o.type in d3_geo_boundsTypes) d3_geo_boundsTypes[o.type](o, f); -} - -var d3_geo_boundsTypes = { - Feature: d3_geo_boundsFeature, - FeatureCollection: d3_geo_boundsFeatureCollection, - GeometryCollection: d3_geo_boundsGeometryCollection, - LineString: d3_geo_boundsLineString, - MultiLineString: d3_geo_boundsMultiLineString, - MultiPoint: d3_geo_boundsLineString, - MultiPolygon: d3_geo_boundsMultiPolygon, - Point: d3_geo_boundsPoint, - Polygon: d3_geo_boundsPolygon -}; - -function d3_geo_boundsFeature(o, f) { - d3_geo_bounds(o.geometry, f); -} - -function d3_geo_boundsFeatureCollection(o, f) { - for (var a = o.features, i = 0, n = a.length; i < n; i++) { - d3_geo_bounds(a[i].geometry, f); - } -} - -function d3_geo_boundsGeometryCollection(o, f) { - for (var a = o.geometries, i = 0, n = a.length; i < n; i++) { - d3_geo_bounds(a[i], f); - } -} - -function d3_geo_boundsLineString(o, f) { - for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) { - f.apply(null, a[i]); - } -} - -function d3_geo_boundsMultiLineString(o, f) { - for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) { - for (var b = a[i], j = 0, m = b.length; j < m; j++) { - f.apply(null, b[j]); - } - } -} - -function d3_geo_boundsMultiPolygon(o, f) { - for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) { - for (var b = a[i][0], j = 0, m = b.length; j < m; j++) { - f.apply(null, b[j]); - } - } -} - -function d3_geo_boundsPoint(o, f) { - f.apply(null, o.coordinates); -} - -function d3_geo_boundsPolygon(o, f) { - for (var a = o.coordinates[0], i = 0, n = a.length; i < n; i++) { - f.apply(null, a[i]); - } -} -// TODO breakAtDateLine? - -d3.geo.circle = function() { - var origin = [0, 0], - degrees = 90 - 1e-2, - radians = degrees * d3_geo_radians, - arc = d3.geo.greatArc().target(Object); - - function circle() { - // TODO render a circle as a Polygon - } - - function visible(point) { - return arc.distance(point) < radians; - } - - circle.clip = function(d) { - arc.source(typeof origin === "function" ? origin.apply(this, arguments) : origin); - return clipType(d); - }; - - var clipType = d3_geo_type({ - - FeatureCollection: function(o) { - var features = o.features.map(clipType).filter(Object); - return features && (o = Object.create(o), o.features = features, o); - }, - - Feature: function(o) { - var geometry = clipType(o.geometry); - return geometry && (o = Object.create(o), o.geometry = geometry, o); - }, - - Point: function(o) { - return visible(o.coordinates) && o; - }, - - MultiPoint: function(o) { - var coordinates = o.coordinates.filter(visible); - return coordinates.length && { - type: o.type, - coordinates: coordinates - }; - }, - - LineString: function(o) { - var coordinates = clip(o.coordinates); - return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o); - }, - - MultiLineString: function(o) { - var coordinates = o.coordinates.map(clip).filter(function(d) { return d.length; }); - return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o); - }, - - Polygon: function(o) { - var coordinates = o.coordinates.map(clip); - return coordinates[0].length && (o = Object.create(o), o.coordinates = coordinates, o); - }, - - MultiPolygon: function(o) { - var coordinates = o.coordinates.map(function(d) { return d.map(clip); }).filter(function(d) { return d[0].length; }); - return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o); - }, - - GeometryCollection: function(o) { - var geometries = o.geometries.map(clipType).filter(Object); - return geometries.length && (o = Object.create(o), o.geometries = geometries, o); - } - - }); - - function clip(coordinates) { - var i = -1, - n = coordinates.length, - clipped = [], - p0, - p1, - p2, - d0, - d1; - - while (++i < n) { - d1 = arc.distance(p2 = coordinates[i]); - if (d1 < radians) { - if (p1) clipped.push(d3_geo_greatArcInterpolate(p1, p2)((d0 - radians) / (d0 - d1))); - clipped.push(p2); - p0 = p1 = null; - } else { - p1 = p2; - if (!p0 && clipped.length) { - clipped.push(d3_geo_greatArcInterpolate(clipped[clipped.length - 1], p1)((radians - d0) / (d1 - d0))); - p0 = p1; - } - } - d0 = d1; - } - - if (p1 && clipped.length) { - d1 = arc.distance(p2 = clipped[0]); - clipped.push(d3_geo_greatArcInterpolate(p1, p2)((d0 - radians) / (d0 - d1))); - } - - return resample(clipped); - } - - // Resample coordinates, creating great arcs between each. - function resample(coordinates) { - var i = 0, - n = coordinates.length, - j, - m, - resampled = n ? [coordinates[0]] : coordinates, - resamples, - origin = arc.source(); - - while (++i < n) { - resamples = arc.source(coordinates[i - 1])(coordinates[i]).coordinates; - for (j = 0, m = resamples.length; ++j < m;) resampled.push(resamples[j]); - } - - arc.source(origin); - return resampled; - } - - circle.origin = function(x) { - if (!arguments.length) return origin; - origin = x; - return circle; - }; - - circle.angle = function(x) { - if (!arguments.length) return degrees; - radians = (degrees = +x) * d3_geo_radians; - return circle; - }; - - // Precision is specified in degrees. - circle.precision = function(x) { - if (!arguments.length) return arc.precision(); - arc.precision(x); - return circle; - }; - - return circle; -} -d3.geo.greatArc = function() { - var source = d3_geo_greatArcSource, - target = d3_geo_greatArcTarget, - precision = 6 * d3_geo_radians; - - function greatArc() { - var a = typeof source === "function" ? source.apply(this, arguments) : source, - b = typeof target === "function" ? target.apply(this, arguments) : target, - i = d3_geo_greatArcInterpolate(a, b), - dt = precision / i.d, - t = 0, - coordinates = [a]; - while ((t += dt) < 1) coordinates.push(i(t)); - coordinates.push(b); - return { - type: "LineString", - coordinates: coordinates - }; - } - - // Length returned in radians; multiply by radius for distance. - greatArc.distance = function() { - var a = typeof source === "function" ? source.apply(this, arguments) : source, - b = typeof target === "function" ? target.apply(this, arguments) : target; - return d3_geo_greatArcInterpolate(a, b).d; - }; - - greatArc.source = function(x) { - if (!arguments.length) return source; - source = x; - return greatArc; - }; - - greatArc.target = function(x) { - if (!arguments.length) return target; - target = x; - return greatArc; - }; - - // Precision is specified in degrees. - greatArc.precision = function(x) { - if (!arguments.length) return precision / d3_geo_radians; - precision = x * d3_geo_radians; - return greatArc; - }; - - return greatArc; -}; - -function d3_geo_greatArcSource(d) { - return d.source; -} - -function d3_geo_greatArcTarget(d) { - return d.target; -} - -function d3_geo_greatArcInterpolate(a, b) { - var x0 = a[0] * d3_geo_radians, cx0 = Math.cos(x0), sx0 = Math.sin(x0), - y0 = a[1] * d3_geo_radians, cy0 = Math.cos(y0), sy0 = Math.sin(y0), - x1 = b[0] * d3_geo_radians, cx1 = Math.cos(x1), sx1 = Math.sin(x1), - y1 = b[1] * d3_geo_radians, cy1 = Math.cos(y1), sy1 = Math.sin(y1), - d = interpolate.d = Math.acos(Math.max(-1, Math.min(1, sy0 * sy1 + cy0 * cy1 * Math.cos(x1 - x0)))), - sd = Math.sin(d); - - // From http://williams.best.vwh.net/avform.htm#Intermediate - function interpolate(t) { - var A = Math.sin(d - (t *= d)) / sd, - B = Math.sin(t) / sd, - x = A * cy0 * cx0 + B * cy1 * cx1, - y = A * cy0 * sx0 + B * cy1 * sx1, - z = A * sy0 + B * sy1; - return [ - Math.atan2(y, x) / d3_geo_radians, - Math.atan2(z, Math.sqrt(x * x + y * y)) / d3_geo_radians - ]; - } - - return interpolate; -} -d3.geo.greatCircle = d3.geo.circle; -})(); diff --git a/modules/enterprise/gui/rest-war/src/main/webapp/js/d3.geom.js b/modules/enterprise/gui/rest-war/src/main/webapp/js/d3.geom.js deleted file mode 100644 index d860c2b..0000000 --- a/modules/enterprise/gui/rest-war/src/main/webapp/js/d3.geom.js +++ /dev/null @@ -1,835 +0,0 @@ -(function(){d3.geom = {}; -/** - * Computes a contour for a given input grid function using the <a - * href="http://en.wikipedia.org/wiki/Marching_squares%22%3Emarching - * squares</a> algorithm. Returns the contour polygon as an array of points. - * - * @param grid a two-input function(x, y) that returns true for values - * inside the contour and false for values outside the contour. - * @param start an optional starting point [x, y] on the grid. - * @returns polygon [[x1, y1], [x2, y2], …] - */ -d3.geom.contour = function(grid, start) { - var s = start || d3_geom_contourStart(grid), // starting point - c = [], // contour polygon - x = s[0], // current x position - y = s[1], // current y position - dx = 0, // next x direction - dy = 0, // next y direction - pdx = NaN, // previous x direction - pdy = NaN, // previous y direction - i = 0; - - do { - // determine marching squares index - i = 0; - if (grid(x-1, y-1)) i += 1; - if (grid(x, y-1)) i += 2; - if (grid(x-1, y )) i += 4; - if (grid(x, y )) i += 8; - - // determine next direction - if (i === 6) { - dx = pdy === -1 ? -1 : 1; - dy = 0; - } else if (i === 9) { - dx = 0; - dy = pdx === 1 ? -1 : 1; - } else { - dx = d3_geom_contourDx[i]; - dy = d3_geom_contourDy[i]; - } - - // update contour polygon - if (dx != pdx && dy != pdy) { - c.push([x, y]); - pdx = dx; - pdy = dy; - } - - x += dx; - y += dy; - } while (s[0] != x || s[1] != y); - - return c; -}; - -// lookup tables for marching directions -var d3_geom_contourDx = [1, 0, 1, 1,-1, 0,-1, 1,0, 0,0,0,-1, 0,-1,NaN], - d3_geom_contourDy = [0,-1, 0, 0, 0,-1, 0, 0,1,-1,1,1, 0,-1, 0,NaN]; - -function d3_geom_contourStart(grid) { - var x = 0, - y = 0; - - // search for a starting point; begin at origin - // and proceed along outward-expanding diagonals - while (true) { - if (grid(x,y)) { - return [x,y]; - } - if (x === 0) { - x = y + 1; - y = 0; - } else { - x = x - 1; - y = y + 1; - } - } -} -/** - * Computes the 2D convex hull of a set of points using Graham's scanning - * algorithm. The algorithm has been implemented as described in Cormen, - * Leiserson, and Rivest's Introduction to Algorithms. The running time of - * this algorithm is O(n log n), where n is the number of input points. - * - * @param vertices [[x1, y1], [x2, y2], …] - * @returns polygon [[x1, y1], [x2, y2], …] - */ -d3.geom.hull = function(vertices) { - if (vertices.length < 3) return []; - - var len = vertices.length, - plen = len - 1, - points = [], - stack = [], - i, j, h = 0, x1, y1, x2, y2, u, v, a, sp; - - // find the starting ref point: leftmost point with the minimum y coord - for (i=1; i<len; ++i) { - if (vertices[i][1] < vertices[h][1]) { - h = i; - } else if (vertices[i][1] == vertices[h][1]) { - h = (vertices[i][0] < vertices[h][0] ? i : h); - } - } - - // calculate polar angles from ref point and sort - for (i=0; i<len; ++i) { - if (i === h) continue; - y1 = vertices[i][1] - vertices[h][1]; - x1 = vertices[i][0] - vertices[h][0]; - points.push({angle: Math.atan2(y1, x1), index: i}); - } - points.sort(function(a, b) { return a.angle - b.angle; }); - - // toss out duplicate angles - a = points[0].angle; - v = points[0].index; - u = 0; - for (i=1; i<plen; ++i) { - j = points[i].index; - if (a == points[i].angle) { - // keep angle for point most distant from the reference - x1 = vertices[v][0] - vertices[h][0]; - y1 = vertices[v][1] - vertices[h][1]; - x2 = vertices[j][0] - vertices[h][0]; - y2 = vertices[j][1] - vertices[h][1]; - if ((x1*x1 + y1*y1) >= (x2*x2 + y2*y2)) { - points[i].index = -1; - } else { - points[u].index = -1; - a = points[i].angle; - u = i; - v = j; - } - } else { - a = points[i].angle; - u = i; - v = j; - } - } - - // initialize the stack - stack.push(h); - for (i=0, j=0; i<2; ++j) { - if (points[j].index !== -1) { - stack.push(points[j].index); - i++; - } - } - sp = stack.length; - - // do graham's scan - for (; j<plen; ++j) { - if (points[j].index === -1) continue; // skip tossed out points - while (!d3_geom_hullCCW(stack[sp-2], stack[sp-1], points[j].index, vertices)) { - --sp; - } - stack[sp++] = points[j].index; - } - - // construct the hull - var poly = []; - for (i=0; i<sp; ++i) { - poly.push(vertices[stack[i]]); - } - return poly; -} - -// are three points in counter-clockwise order? -function d3_geom_hullCCW(i1, i2, i3, v) { - var t, a, b, c, d, e, f; - t = v[i1]; a = t[0]; b = t[1]; - t = v[i2]; c = t[0]; d = t[1]; - t = v[i3]; e = t[0]; f = t[1]; - return ((f-b)*(c-a) - (d-b)*(e-a)) > 0; -} -// Note: requires coordinates to be counterclockwise and convex! -d3.geom.polygon = function(coordinates) { - - coordinates.area = function() { - var i = 0, - n = coordinates.length, - a = coordinates[n - 1][0] * coordinates[0][1], - b = coordinates[n - 1][1] * coordinates[0][0]; - while (++i < n) { - a += coordinates[i - 1][0] * coordinates[i][1]; - b += coordinates[i - 1][1] * coordinates[i][0]; - } - return (b - a) * .5; - }; - - coordinates.centroid = function(k) { - var i = -1, - n = coordinates.length - 1, - x = 0, - y = 0, - a, - b, - c; - if (!arguments.length) k = -1 / (6 * coordinates.area()); - while (++i < n) { - a = coordinates[i]; - b = coordinates[i + 1]; - c = a[0] * b[1] - b[0] * a[1]; - x += (a[0] + b[0]) * c; - y += (a[1] + b[1]) * c; - } - return [x * k, y * k]; - }; - - // The Sutherland-Hodgman clipping algorithm. - coordinates.clip = function(subject) { - var input, - i = -1, - n = coordinates.length, - j, - m, - a = coordinates[n - 1], - b, - c, - d; - while (++i < n) { - input = subject.slice(); - subject.length = 0; - b = coordinates[i]; - c = input[(m = input.length) - 1]; - j = -1; - while (++j < m) { - d = input[j]; - if (d3_geom_polygonInside(d, a, b)) { - if (!d3_geom_polygonInside(c, a, b)) { - subject.push(d3_geom_polygonIntersect(c, d, a, b)); - } - subject.push(d); - } else if (d3_geom_polygonInside(c, a, b)) { - subject.push(d3_geom_polygonIntersect(c, d, a, b)); - } - c = d; - } - a = b; - } - return subject; - }; - - return coordinates; -}; - -function d3_geom_polygonInside(p, a, b) { - return (b[0] - a[0]) * (p[1] - a[1]) < (b[1] - a[1]) * (p[0] - a[0]); -} - -// Intersect two infinite lines cd and ab. -function d3_geom_polygonIntersect(c, d, a, b) { - var x1 = c[0], x2 = d[0], x3 = a[0], x4 = b[0], - y1 = c[1], y2 = d[1], y3 = a[1], y4 = b[1], - x13 = x1 - x3, - x21 = x2 - x1, - x43 = x4 - x3, - y13 = y1 - y3, - y21 = y2 - y1, - y43 = y4 - y3, - ua = (x43 * y13 - y43 * x13) / (y43 * x21 - x43 * y21); - return [x1 + ua * x21, y1 + ua * y21]; -} -// Adapted from Nicolas Garcia Belmonte's JIT implementation: -// http://blog.thejit.org/2010/02/12/voronoi-tessellation/ -// http://blog.thejit.org/assets/voronoijs/voronoi.js -// See lib/jit/LICENSE for details. - -// Notes: -// -// This implementation does not clip the returned polygons, so if you want to -// clip them to a particular shape you will need to do that either in SVG or by -// post-processing with d3.geom.polygon's clip method. -// -// If any vertices are coincident or have NaN positions, the behavior of this -// method is undefined. Most likely invalid polygons will be returned. You -// should filter invalid points, and consolidate coincident points, before -// computing the tessellation. - -/** - * @param vertices [[x1, y1], [x2, y2], …] - * @returns polygons [[[x1, y1], [x2, y2], …], …] - */ -d3.geom.voronoi = function(vertices) { - var polygons = vertices.map(function() { return []; }); - - d3_voronoi_tessellate(vertices, function(e) { - var s1, - s2, - x1, - x2, - y1, - y2; - if (e.a === 1 && e.b >= 0) { - s1 = e.ep.r; - s2 = e.ep.l; - } else { - s1 = e.ep.l; - s2 = e.ep.r; - } - if (e.a === 1) { - y1 = s1 ? s1.y : -1e6; - x1 = e.c - e.b * y1; - y2 = s2 ? s2.y : 1e6; - x2 = e.c - e.b * y2; - } else { - x1 = s1 ? s1.x : -1e6; - y1 = e.c - e.a * x1; - x2 = s2 ? s2.x : 1e6; - y2 = e.c - e.a * x2; - } - var v1 = [x1, y1], - v2 = [x2, y2]; - polygons[e.region.l.index].push(v1, v2); - polygons[e.region.r.index].push(v1, v2); - }); - - // Reconnect the polygon segments into counterclockwise loops. - return polygons.map(function(polygon, i) { - var cx = vertices[i][0], - cy = vertices[i][1]; - polygon.forEach(function(v) { - v.angle = Math.atan2(v[0] - cx, v[1] - cy); - }); - return polygon.sort(function(a, b) { - return a.angle - b.angle; - }).filter(function(d, i) { - return !i || (d.angle - polygon[i - 1].angle > 1e-10); - }); - }); -}; - -var d3_voronoi_opposite = {"l": "r", "r": "l"}; - -function d3_voronoi_tessellate(vertices, callback) { - - var Sites = { - list: vertices - .map(function(v, i) { - return { - index: i, - x: v[0], - y: v[1] - }; - }) - .sort(function(a, b) { - return a.y < b.y ? -1 - : a.y > b.y ? 1 - : a.x < b.x ? -1 - : a.x > b.x ? 1 - : 0; - }), - bottomSite: null - }; - - var EdgeList = { - list: [], - leftEnd: null, - rightEnd: null, - - init: function() { - EdgeList.leftEnd = EdgeList.createHalfEdge(null, "l"); - EdgeList.rightEnd = EdgeList.createHalfEdge(null, "l"); - EdgeList.leftEnd.r = EdgeList.rightEnd; - EdgeList.rightEnd.l = EdgeList.leftEnd; - EdgeList.list.unshift(EdgeList.leftEnd, EdgeList.rightEnd); - }, - - createHalfEdge: function(edge, side) { - return { - edge: edge, - side: side, - vertex: null, - "l": null, - "r": null - }; - }, - - insert: function(lb, he) { - he.l = lb; - he.r = lb.r; - lb.r.l = he; - lb.r = he; - }, - - leftBound: function(p) { - var he = EdgeList.leftEnd; - do { - he = he.r; - } while (he != EdgeList.rightEnd && Geom.rightOf(he, p)); - he = he.l; - return he; - }, - - del: function(he) { - he.l.r = he.r; - he.r.l = he.l; - he.edge = null; - }, - - right: function(he) { - return he.r; - }, - - left: function(he) { - return he.l; - }, - - leftRegion: function(he) { - return he.edge == null - ? Sites.bottomSite - : he.edge.region[he.side]; - }, - - rightRegion: function(he) { - return he.edge == null - ? Sites.bottomSite - : he.edge.region[d3_voronoi_opposite[he.side]]; - } - }; - - var Geom = { - - bisect: function(s1, s2) { - var newEdge = { - region: {"l": s1, "r": s2}, - ep: {"l": null, "r": null} - }; - - var dx = s2.x - s1.x, - dy = s2.y - s1.y, - adx = dx > 0 ? dx : -dx, - ady = dy > 0 ? dy : -dy; - - newEdge.c = s1.x * dx + s1.y * dy - + (dx * dx + dy * dy) * .5; - - if (adx > ady) { - newEdge.a = 1; - newEdge.b = dy / dx; - newEdge.c /= dx; - } else { - newEdge.b = 1; - newEdge.a = dx / dy; - newEdge.c /= dy; - } - - return newEdge; - }, - - intersect: function(el1, el2) { - var e1 = el1.edge, - e2 = el2.edge; - if (!e1 || !e2 || (e1.region.r == e2.region.r)) { - return null; - } - var d = (e1.a * e2.b) - (e1.b * e2.a); - if (Math.abs(d) < 1e-10) { - return null; - } - var xint = (e1.c * e2.b - e2.c * e1.b) / d, - yint = (e2.c * e1.a - e1.c * e2.a) / d, - e1r = e1.region.r, - e2r = e2.region.r, - el, - e; - if ((e1r.y < e2r.y) || - (e1r.y == e2r.y && e1r.x < e2r.x)) { - el = el1; - e = e1; - } else { - el = el2; - e = e2; - } - var rightOfSite = (xint >= e.region.r.x); - if ((rightOfSite && (el.side === "l")) || - (!rightOfSite && (el.side === "r"))) { - return null; - } - return { - x: xint, - y: yint - }; - }, - - rightOf: function(he, p) { - var e = he.edge, - topsite = e.region.r, - rightOfSite = (p.x > topsite.x); - - if (rightOfSite && (he.side === "l")) { - return 1; - } - if (!rightOfSite && (he.side === "r")) { - return 0; - } - if (e.a === 1) { - var dyp = p.y - topsite.y, - dxp = p.x - topsite.x, - fast = 0, - above = 0; - - if ((!rightOfSite && (e.b < 0)) || - (rightOfSite && (e.b >= 0))) { - above = fast = (dyp >= e.b * dxp); - } else { - above = ((p.x + p.y * e.b) > e.c); - if (e.b < 0) { - above = !above; - } - if (!above) { - fast = 1; - } - } - if (!fast) { - var dxs = topsite.x - e.region.l.x; - above = (e.b * (dxp * dxp - dyp * dyp)) < - (dxs * dyp * (1 + 2 * dxp / dxs + e.b * e.b)); - - if (e.b < 0) { - above = !above; - } - } - } else /* e.b == 1 */ { - var yl = e.c - e.a * p.x, - t1 = p.y - yl, - t2 = p.x - topsite.x, - t3 = yl - topsite.y; - - above = (t1 * t1) > (t2 * t2 + t3 * t3); - } - return he.side === "l" ? above : !above; - }, - - endPoint: function(edge, side, site) { - edge.ep[side] = site; - if (!edge.ep[d3_voronoi_opposite[side]]) return; - callback(edge); - }, - - distance: function(s, t) { - var dx = s.x - t.x, - dy = s.y - t.y; - return Math.sqrt(dx * dx + dy * dy); - } - }; - - var EventQueue = { - list: [], - - insert: function(he, site, offset) { - he.vertex = site; - he.ystar = site.y + offset; - for (var i=0, list=EventQueue.list, l=list.length; i<l; i++) { - var next = list[i]; - if (he.ystar > next.ystar || - (he.ystar == next.ystar && - site.x > next.vertex.x)) { - continue; - } else { - break; - } - } - list.splice(i, 0, he); - }, - - del: function(he) { - for (var i=0, ls=EventQueue.list, l=ls.length; i<l && (ls[i] != he); ++i) {} - ls.splice(i, 1); - }, - - empty: function() { return EventQueue.list.length === 0; }, - - nextEvent: function(he) { - for (var i=0, ls=EventQueue.list, l=ls.length; i<l; ++i) { - if (ls[i] == he) return ls[i+1]; - } - return null; - }, - - min: function() { - var elem = EventQueue.list[0]; - return { - x: elem.vertex.x, - y: elem.ystar - }; - }, - - extractMin: function() { - return EventQueue.list.shift(); - } - }; - - EdgeList.init(); - Sites.bottomSite = Sites.list.shift(); - - var newSite = Sites.list.shift(), newIntStar; - var lbnd, rbnd, llbnd, rrbnd, bisector; - var bot, top, temp, p, v; - var e, pm; - - while (true) { - if (!EventQueue.empty()) { - newIntStar = EventQueue.min(); - } - if (newSite && (EventQueue.empty() - || newSite.y < newIntStar.y - || (newSite.y == newIntStar.y - && newSite.x < newIntStar.x))) { //new site is smallest - lbnd = EdgeList.leftBound(newSite); - rbnd = EdgeList.right(lbnd); - bot = EdgeList.rightRegion(lbnd); - e = Geom.bisect(bot, newSite); - bisector = EdgeList.createHalfEdge(e, "l"); - EdgeList.insert(lbnd, bisector); - p = Geom.intersect(lbnd, bisector); - if (p) { - EventQueue.del(lbnd); - EventQueue.insert(lbnd, p, Geom.distance(p, newSite)); - } - lbnd = bisector; - bisector = EdgeList.createHalfEdge(e, "r"); - EdgeList.insert(lbnd, bisector); - p = Geom.intersect(bisector, rbnd); - if (p) { - EventQueue.insert(bisector, p, Geom.distance(p, newSite)); - } - newSite = Sites.list.shift(); - } else if (!EventQueue.empty()) { //intersection is smallest - lbnd = EventQueue.extractMin(); - llbnd = EdgeList.left(lbnd); - rbnd = EdgeList.right(lbnd); - rrbnd = EdgeList.right(rbnd); - bot = EdgeList.leftRegion(lbnd); - top = EdgeList.rightRegion(rbnd); - v = lbnd.vertex; - Geom.endPoint(lbnd.edge, lbnd.side, v); - Geom.endPoint(rbnd.edge, rbnd.side, v); - EdgeList.del(lbnd); - EventQueue.del(rbnd); - EdgeList.del(rbnd); - pm = "l"; - if (bot.y > top.y) { - temp = bot; - bot = top; - top = temp; - pm = "r"; - } - e = Geom.bisect(bot, top); - bisector = EdgeList.createHalfEdge(e, pm); - EdgeList.insert(llbnd, bisector); - Geom.endPoint(e, d3_voronoi_opposite[pm], v); - p = Geom.intersect(llbnd, bisector); - if (p) { - EventQueue.del(llbnd); - EventQueue.insert(llbnd, p, Geom.distance(p, bot)); - } - p = Geom.intersect(bisector, rrbnd); - if (p) { - EventQueue.insert(bisector, p, Geom.distance(p, bot)); - } - } else { - break; - } - }//end while - - for (lbnd = EdgeList.right(EdgeList.leftEnd); - lbnd != EdgeList.rightEnd; - lbnd = EdgeList.right(lbnd)) { - callback(lbnd.edge); - } -} -/** -* @param vertices [[x1, y1], [x2, y2], …] -* @returns triangles [[[x1, y1], [x2, y2], [x3, y3]], …] - */ -d3.geom.delaunay = function(vertices) { - var edges = vertices.map(function() { return []; }), - triangles = []; - - // Use the Voronoi tessellation to determine Delaunay edges. - d3_voronoi_tessellate(vertices, function(e) { - edges[e.region.l.index].push(vertices[e.region.r.index]); - }); - - // Reconnect the edges into counterclockwise triangles. - edges.forEach(function(edge, i) { - var v = vertices[i], - cx = v[0], - cy = v[1]; - edge.forEach(function(v) { - v.angle = Math.atan2(v[0] - cx, v[1] - cy); - }); - edge.sort(function(a, b) { - return a.angle - b.angle; - }); - for (var j = 0, m = edge.length - 1; j < m; j++) { - triangles.push([v, edge[j], edge[j + 1]]); - } - }); - - return triangles; -}; -// Constructs a new quadtree for the specified array of points. A quadtree is a -// two-dimensional recursive spatial subdivision. This implementation uses -// square partitions, dividing each square into four equally-sized squares. Each -// point exists in a unique node; if multiple points are in the same position, -// some points may be stored on internal nodes rather than leaf nodes. Quadtrees -// can be used to accelerate various spatial operations, such as the Barnes-Hut -// approximation for computing n-body forces, or collision detection. -d3.geom.quadtree = function(points, x1, y1, x2, y2) { - var p, - i = -1, - n = points.length; - - // Type conversion for deprecated API. - if (n && isNaN(points[0].x)) points = points.map(d3_geom_quadtreePoint); - - // Allow bounds to be specified explicitly. - if (arguments.length < 5) { - if (arguments.length === 3) { - y2 = x2 = y1; - y1 = x1; - } else { - x1 = y1 = Infinity; - x2 = y2 = -Infinity; - - // Compute bounds. - while (++i < n) { - p = points[i]; - if (p.x < x1) x1 = p.x; - if (p.y < y1) y1 = p.y; - if (p.x > x2) x2 = p.x; - if (p.y > y2) y2 = p.y; - } - - // Squarify the bounds. - var dx = x2 - x1, - dy = y2 - y1; - if (dx > dy) y2 = y1 + dx; - else x2 = x1 + dy; - } - } - - // Recursively inserts the specified point p at the node n or one of its - // descendants. The bounds are defined by [x1, x2] and [y1, y2]. - function insert(n, p, x1, y1, x2, y2) { - if (isNaN(p.x) || isNaN(p.y)) return; // ignore invalid points - if (n.leaf) { - var v = n.point; - if (v) { - // If the point at this leaf node is at the same position as the new - // point we are adding, we leave the point associated with the - // internal node while adding the new point to a child node. This - // avoids infinite recursion. - if ((Math.abs(v.x - p.x) + Math.abs(v.y - p.y)) < .01) { - insertChild(n, p, x1, y1, x2, y2); - } else { - n.point = null; - insertChild(n, v, x1, y1, x2, y2); - insertChild(n, p, x1, y1, x2, y2); - } - } else { - n.point = p; - } - } else { - insertChild(n, p, x1, y1, x2, y2); - } - } - - // Recursively inserts the specified point p into a descendant of node n. The - // bounds are defined by [x1, x2] and [y1, y2]. - function insertChild(n, p, x1, y1, x2, y2) { - // Compute the split point, and the quadrant in which to insert p. - var sx = (x1 + x2) * .5, - sy = (y1 + y2) * .5, - right = p.x >= sx, - bottom = p.y >= sy, - i = (bottom << 1) + right; - - // Recursively insert into the child node. - n.leaf = false; - n = n.nodes[i] || (n.nodes[i] = d3_geom_quadtreeNode()); - - // Update the bounds as we recurse. - if (right) x1 = sx; else x2 = sx; - if (bottom) y1 = sy; else y2 = sy; - insert(n, p, x1, y1, x2, y2); - } - - // Create the root node. - var root = d3_geom_quadtreeNode(); - - root.add = function(p) { - insert(root, p, x1, y1, x2, y2); - }; - - root.visit = function(f) { - d3_geom_quadtreeVisit(f, root, x1, y1, x2, y2); - }; - - // Insert all points. - points.forEach(root.add); - return root; -}; - -function d3_geom_quadtreeNode() { - return { - leaf: true, - nodes: [], - point: null - }; -} - -function d3_geom_quadtreeVisit(f, node, x1, y1, x2, y2) { - if (!f(node, x1, y1, x2, y2)) { - var sx = (x1 + x2) * .5, - sy = (y1 + y2) * .5, - children = node.nodes; - if (children[0]) d3_geom_quadtreeVisit(f, children[0], x1, y1, sx, sy); - if (children[1]) d3_geom_quadtreeVisit(f, children[1], sx, y1, x2, sy); - if (children[2]) d3_geom_quadtreeVisit(f, children[2], x1, sy, sx, y2); - if (children[3]) d3_geom_quadtreeVisit(f, children[3], sx, sy, x2, y2); - } -} - -function d3_geom_quadtreePoint(p) { - return { - x: p[0], - y: p[1] - }; -} -})(); diff --git a/modules/enterprise/gui/rest-war/src/main/webapp/js/d3.js b/modules/enterprise/gui/rest-war/src/main/webapp/js/d3.js deleted file mode 100755 index 77ee372..0000000 --- a/modules/enterprise/gui/rest-war/src/main/webapp/js/d3.js +++ /dev/null @@ -1,4695 +0,0 @@ -(function(){if (!Date.now) Date.now = function() { - return +new Date; -}; -try { - document.createElement("div").style.setProperty("opacity", 0, ""); -} catch (error) { - var d3_style_prototype = CSSStyleDeclaration.prototype, - d3_style_setProperty = d3_style_prototype.setProperty; - d3_style_prototype.setProperty = function(name, value, priority) { - d3_style_setProperty.call(this, name, value + "", priority); - }; -} -d3 = {version: "2.7.1"}; // semver -var d3_array = d3_arraySlice; // conversion for NodeLists - -function d3_arrayCopy(pseudoarray) { - var i = -1, n = pseudoarray.length, array = []; - while (++i < n) array.push(pseudoarray[i]); - return array; -} - -function d3_arraySlice(pseudoarray) { - return Array.prototype.slice.call(pseudoarray); -} - -try { - d3_array(document.documentElement.childNodes)[0].nodeType; -} catch(e) { - d3_array = d3_arrayCopy; -} - -var d3_arraySubclass = [].__proto__? - -// Until ECMAScript supports array subclassing, prototype injection works well. -function(array, prototype) { - array.__proto__ = prototype; -}: - -// And if your browser doesn't support __proto__, we'll use direct extension. -function(array, prototype) { - for (var property in prototype) array[property] = prototype[property]; -}; -function d3_this() { - return this; -} -d3.functor = function(v) { - return typeof v === "function" ? v : function() { return v; }; -}; -// Copies a variable number of methods from source to target. -d3.rebind = function(target, source) { - var i = 1, n = arguments.length, method; - while (++i < n) target[method = arguments[i]] = d3_rebind(target, source, source[method]); - return target; -}; - -// Method is assumed to be a standard D3 getter-setter: -// If passed with no arguments, gets the value. -// If passed with arguments, sets the value and returns the target. -function d3_rebind(target, source, method) { - return function() { - var value = method.apply(source, arguments); - return arguments.length ? target : value; - }; -} -d3.ascending = function(a, b) { - return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; -}; -d3.descending = function(a, b) { - return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; -}; -d3.mean = function(array, f) { - var n = array.length, - a, - m = 0, - i = -1, - j = 0; - if (arguments.length === 1) { - while (++i < n) if (d3_number(a = array[i])) m += (a - m) / ++j; - } else { - while (++i < n) if (d3_number(a = f.call(array, array[i], i))) m += (a - m) / ++j; - } - return j ? m : undefined; -}; -d3.median = function(array, f) { - if (arguments.length > 1) array = array.map(f); - array = array.filter(d3_number); - return array.length ? d3.quantile(array.sort(d3.ascending), .5) : undefined; -}; -d3.min = function(array, f) { - var i = -1, - n = array.length, - a, - b; - if (arguments.length === 1) { - while (++i < n && ((a = array[i]) == null || a != a)) a = undefined; - while (++i < n) if ((b = array[i]) != null && a > b) a = b; - } else { - while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined; - while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b; - } - return a; -}; -d3.max = function(array, f) { - var i = -1, - n = array.length, - a, - b; - if (arguments.length === 1) { - while (++i < n && ((a = array[i]) == null || a != a)) a = undefined; - while (++i < n) if ((b = array[i]) != null && b > a) a = b; - } else { - while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined; - while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b; - } - return a; -}; -d3.extent = function(array, f) { - var i = -1, - n = array.length, - a, - b, - c; - if (arguments.length === 1) { - while (++i < n && ((a = c = array[i]) == null || a != a)) a = c = undefined; - while (++i < n) if ((b = array[i]) != null) { - if (a > b) a = b; - if (c < b) c = b; - } - } else { - while (++i < n && ((a = c = f.call(array, array[i], i)) == null || a != a)) a = undefined; - while (++i < n) if ((b = f.call(array, array[i], i)) != null) { - if (a > b) a = b; - if (c < b) c = b; - } - } - return [a, c]; -}; -d3.random = { - normal: function(mean, deviation) { - if (arguments.length < 2) deviation = 1; - if (arguments.length < 1) mean = 0; - return function() { - var x, y, r; - do { - x = Math.random() * 2 - 1; - y = Math.random() * 2 - 1; - r = x * x + y * y; - } while (!r || r > 1); - return mean + deviation * x * Math.sqrt(-2 * Math.log(r) / r); - }; - } -}; -function d3_number(x) { - return x != null && !isNaN(x); -} -d3.sum = function(array, f) { - var s = 0, - n = array.length, - a, - i = -1; - - if (arguments.length === 1) { - while (++i < n) if (!isNaN(a = +array[i])) s += a; - } else { - while (++i < n) if (!isNaN(a = +f.call(array, array[i], i))) s += a; - } - - return s; -}; -// R-7 per http://en.wikipedia.org/wiki/Quantile -d3.quantile = function(values, p) { - var H = (values.length - 1) * p + 1, - h = Math.floor(H), - v = values[h - 1], - e = H - h; - return e ? v + e * (values[h] - v) : v; -}; -d3.transpose = function(matrix) { - return d3.zip.apply(d3, matrix); -}; -d3.zip = function() { - if (!(n = arguments.length)) return []; - for (var i = -1, m = d3.min(arguments, d3_zipLength), zips = new Array(m); ++i < m;) { - for (var j = -1, n, zip = zips[i] = new Array(n); ++j < n;) { - zip[j] = arguments[j][i]; - } - } - return zips; -}; - -function d3_zipLength(d) { - return d.length; -} -// Locate the insertion point for x in a to maintain sorted order. The -// arguments lo and hi may be used to specify a subset of the array which should -// be considered; by default the entire array is used. If x is already present -// in a, the insertion point will be before (to the left of) any existing -// entries. The return value is suitable for use as the first argument to -// `array.splice` assuming that a is already sorted. -// -// The returned insertion point i partitions the array a into two halves so that -// all v < x for v in a[lo:i] for the left side and all v >= x for v in a[i:hi] -// for the right side. -d3.bisectLeft = function(a, x, lo, hi) { - if (arguments.length < 3) lo = 0; - if (arguments.length < 4) hi = a.length; - while (lo < hi) { - var mid = (lo + hi) >> 1; - if (a[mid] < x) lo = mid + 1; - else hi = mid; - } - return lo; -}; - -// Similar to bisectLeft, but returns an insertion point which comes after (to -// the right of) any existing entries of x in a. -// -// The returned insertion point i partitions the array into two halves so that -// all v <= x for v in a[lo:i] for the left side and all v > x for v in a[i:hi] -// for the right side. -d3.bisect = -d3.bisectRight = function(a, x, lo, hi) { - if (arguments.length < 3) lo = 0; - if (arguments.length < 4) hi = a.length; - while (lo < hi) { - var mid = (lo + hi) >> 1; - if (x < a[mid]) hi = mid; - else lo = mid + 1; - } - return lo; -}; -d3.first = function(array, f) { - var i = 0, - n = array.length, - a = array[0], - b; - if (arguments.length === 1) f = d3.ascending; - while (++i < n) { - if (f.call(array, a, b = array[i]) > 0) { - a = b; - } - } - return a; -}; -d3.last = function(array, f) { - var i = 0, - n = array.length, - a = array[0], - b; - if (arguments.length === 1) f = d3.ascending; - while (++i < n) { - if (f.call(array, a, b = array[i]) <= 0) { - a = b; - } - } - return a; -}; -d3.nest = function() { - var nest = {}, - keys = [], - sortKeys = [], - sortValues, - rollup; - - function map(array, depth) { - if (depth >= keys.length) return rollup - ? rollup.call(nest, array) : (sortValues - ? array.sort(sortValues) - : array); - - var i = -1, - n = array.length, - key = keys[depth++], - keyValue, - object, - o = {}; - - while (++i < n) { - if ((keyValue = key(object = array[i])) in o) { - o[keyValue].push(object); - } else { - o[keyValue] = [object]; - } - } - - for (keyValue in o) { - o[keyValue] = map(o[keyValue], depth); - } - - return o; - } - - function entries(map, depth) { - if (depth >= keys.length) return map; - - var a = [], - sortKey = sortKeys[depth++], - key; - - for (key in map) { - a.push({key: key, values: entries(map[key], depth)}); - } - - if (sortKey) a.sort(function(a, b) { - return sortKey(a.key, b.key); - }); - - return a; - } - - nest.map = function(array) { - return map(array, 0); - }; - - nest.entries = function(array) { - return entries(map(array, 0), 0); - }; - - nest.key = function(d) { - keys.push(d); - return nest; - }; - - // Specifies the order for the most-recently specified key. - // Note: only applies to entries. Map keys are unordered! - nest.sortKeys = function(order) { - sortKeys[keys.length - 1] = order; - return nest; - }; - - // Specifies the order for leaf values. - // Applies to both maps and entries array. - nest.sortValues = function(order) { - sortValues = order; - return nest; - }; - - nest.rollup = function(f) { - rollup = f; - return nest; - }; - - return nest; -}; -d3.keys = function(map) { - var keys = []; - for (var key in map) keys.push(key); - return keys; -}; -d3.values = function(map) { - var values = []; - for (var key in map) values.push(map[key]); - return values; -}; -d3.entries = function(map) { - var entries = []; - for (var key in map) entries.push({key: key, value: map[key]}); - return entries; -}; -d3.permute = function(array, indexes) { - var permutes = [], - i = -1, - n = indexes.length; - while (++i < n) permutes[i] = array[indexes[i]]; - return permutes; -}; -d3.merge = function(arrays) { - return Array.prototype.concat.apply([], arrays); -}; -d3.split = function(array, f) { - var arrays = [], - values = [], - value, - i = -1, - n = array.length; - if (arguments.length < 2) f = d3_splitter; - while (++i < n) { - if (f.call(values, value = array[i], i)) { - values = []; - } else { - if (!values.length) arrays.push(values); - values.push(value); - } - } - return arrays; -}; - -function d3_splitter(d) { - return d == null; -} -function d3_collapse(s) { - return s.replace(/(^\s+)|(\s+$)/g, "").replace(/\s+/g, " "); -} -/** - * @param {number} start - * @param {number=} stop - * @param {number=} step - */ -d3.range = function(start, stop, step) { - if (arguments.length < 3) { - step = 1; - if (arguments.length < 2) { - stop = start; - start = 0; - } - } - if ((stop - start) / step == Infinity) throw new Error("infinite range"); - var range = [], - i = -1, - j; - if (step < 0) while ((j = start + step * ++i) > stop) range.push(j); - else while ((j = start + step * ++i) < stop) range.push(j); - return range; -}; -d3.requote = function(s) { - return s.replace(d3_requote_re, "\$&"); -}; - -var d3_requote_re = /[\^$*+?|[]().{}]/g; -d3.round = function(x, n) { - return n - ? Math.round(x * Math.pow(10, n)) * Math.pow(10, -n) - : Math.round(x); -}; -d3.xhr = function(url, mime, callback) { - var req = new XMLHttpRequest; - if (arguments.length < 3) callback = mime, mime = null; - else if (mime && req.overrideMimeType) req.overrideMimeType(mime); - req.open("GET", url, true); - if (mime) req.setRequestHeader("Accept", mime); - req.onreadystatechange = function() { - if (req.readyState === 4) callback(req.status < 300 ? req : null); - }; - req.send(null); -}; -d3.text = function(url, mime, callback) { - function ready(req) { - callback(req && req.responseText); - } - if (arguments.length < 3) { - callback = mime; - mime = null; - } - d3.xhr(url, mime, ready); -}; -d3.json = function(url, callback) { - d3.text(url, "application/json", function(text) { - callback(text ? JSON.parse(text) : null); - }); -}; -d3.html = function(url, callback) { - d3.text(url, "text/html", function(text) { - if (text != null) { // Treat empty string as valid HTML. - var range = document.createRange(); - range.selectNode(document.body); - text = range.createContextualFragment(text); - } - callback(text); - }); -}; -d3.xml = function(url, mime, callback) { - function ready(req) { - callback(req && req.responseXML); - } - if (arguments.length < 3) { - callback = mime; - mime = null; - } - d3.xhr(url, mime, ready); -}; -var d3_nsPrefix = { - svg: "http://www.w3.org/2000/svg", - xhtml: "http://www.w3.org/1999/xhtml", - xlink: "http://www.w3.org/1999/xlink", - xml: "http://www.w3.org/XML/1998/namespace", - xmlns: "http://www.w3.org/2000/xmlns/" -}; - -d3.ns = { - prefix: d3_nsPrefix, - qualify: function(name) { - var i = name.indexOf(":"); - return i < 0 ? (name in d3_nsPrefix - ? {space: d3_nsPrefix[name], local: name} : name) - : {space: d3_nsPrefix[name.substring(0, i)], local: name.substring(i + 1)}; - } -}; -d3.dispatch = function() { - var dispatch = new d3_dispatch(), - i = -1, - n = arguments.length; - while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(); - return dispatch; -}; - -function d3_dispatch() {} - -d3_dispatch.prototype.on = function(type, listener) { - var i = type.indexOf("."), - name = ""; - - // Extract optional namespace, e.g., "click.foo" - if (i > 0) { - name = type.substring(i + 1); - type = type.substring(0, i); - } - - return arguments.length < 2 - ? this[type].on(name) - : (this[type].on(name, listener), this); -}; - -function d3_dispatch_event() { - var listeners = [], - listenerByName = {}; - - function dispatch() { - var z = listeners, // defensive reference - i = -1, - n = z.length, - l; - while (++i < n) if (l = z[i].on) l.apply(this, arguments); - } - - dispatch.on = function(name, listener) { - var l, i; - - // return the current listener, if any - if (arguments.length < 2) return (l = listenerByName[name]) && l.on; - - // remove the old listener, if any (with copy-on-write) - if (l = listenerByName[name]) { - l.on = null; - listeners = listeners.slice(0, i = listeners.indexOf(l)).concat(listeners.slice(i + 1)); - delete listenerByName[name]; - } - - // add the new listener, if any - if (listener) { - listeners.push(listenerByName[name] = {on: listener}); - } - - return dispatch; - }; - - return dispatch; -}; -// TODO align -d3.format = function(specifier) { - var match = d3_format_re.exec(specifier), - fill = match[1] || " ", - sign = match[3] || "", - zfill = match[5], - width = +match[6], - comma = match[7], - precision = match[8], - type = match[9], - scale = 1, - suffix = "", - integer = false; - - if (precision) precision = +precision.substring(1); - - if (zfill) { - fill = "0"; // TODO align = "="; - if (comma) width -= Math.floor((width - 1) / 4); - } - - switch (type) { - case "n": comma = true; type = "g"; break; - case "%": scale = 100; suffix = "%"; type = "f"; break; - case "p": scale = 100; suffix = "%"; type = "r"; break; - case "d": integer = true; precision = 0; break; - case "s": scale = -1; type = "r"; break; - } - - // If no precision is specified for r, fallback to general notation. - if (type == "r" && !precision) type = "g"; - - type = d3_format_types[type] || d3_format_typeDefault; - - return function(value) { - - // Return the empty string for floats formatted as ints. - if (integer && (value % 1)) return ""; - - // Convert negative to positive, and record the sign prefix. - var negative = (value < 0) && (value = -value) ? "\u2212" : sign; - - // Apply the scale, computing it from the value's exponent for si format. - if (scale < 0) { - var prefix = d3.formatPrefix(value, precision); - value *= prefix.scale; - suffix = prefix.symbol; - } else { - value *= scale; - } - - // Convert to the desired precision. - value = type(value, precision); - - // If the fill character is 0, the sign and group is applied after the fill. - if (zfill) { - var length = value.length + negative.length; - if (length < width) value = new Array(width - length + 1).join(fill) + value; - if (comma) value = d3_format_group(value); - value = negative + value; - } - - // Otherwise (e.g., space-filling), the sign and group is applied before. - else { - if (comma) value = d3_format_group(value); - value = negative + value; - var length = value.length; - if (length < width) value = new Array(width - length + 1).join(fill) + value; - } - - return value + suffix; - }; -}; - -// [[fill]align][sign][#][0][width][,][.precision][type] -var d3_format_re = /(?:([^{])?([<>=^]))?([+- ])?(#)?(0)?([0-9]+)?(,)?(.[0-9]+)?([a-zA-Z%])?/; - -var d3_format_types = { - g: function(x, p) { return x.toPrecision(p); }, - e: function(x, p) { return x.toExponential(p); }, - f: function(x, p) { return x.toFixed(p); }, - r: function(x, p) { return d3.round(x, p = d3_format_precision(x, p)).toFixed(Math.max(0, Math.min(20, p))); } -}; - -function d3_format_precision(x, p) { - return p - (x ? 1 + Math.floor(Math.log(x + Math.pow(10, 1 + Math.floor(Math.log(x) / Math.LN10) - p)) / Math.LN10) : 1); -} - -function d3_format_typeDefault(x) { - return x + ""; -} - -// Apply comma grouping for thousands. -function d3_format_group(value) { - var i = value.lastIndexOf("."), - f = i >= 0 ? value.substring(i) : (i = value.length, ""), - t = []; - while (i > 0) t.push(value.substring(i -= 3, i + 3)); - return t.reverse().join(",") + f; -} -var d3_formatPrefixes = ["y","z","a","f","p","n","μ","m","","k","M","G","T","P","E","Z","Y"].map(d3_formatPrefix); - -d3.formatPrefix = function(value, precision) { - var i = 0; - if (value) { - if (value < 0) value *= -1; - if (precision) value = d3.round(value, d3_format_precision(value, precision)); - i = 1 + Math.floor(1e-12 + Math.log(value) / Math.LN10); - i = Math.max(-24, Math.min(24, Math.floor((i <= 0 ? i + 1 : i - 1) / 3) * 3)); - } - return d3_formatPrefixes[8 + i / 3]; -}; - -function d3_formatPrefix(d, i) { - return { - scale: Math.pow(10, (8 - i) * 3), - symbol: d - }; -} - -/* - * TERMS OF USE - EASING EQUATIONS - * - * Open source under the BSD License. - * - * Copyright 2001 Robert Penner - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * - Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * - Neither the name of the author nor the names of contributors may be used to - * endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -var d3_ease_quad = d3_ease_poly(2), - d3_ease_cubic = d3_ease_poly(3); - -var d3_ease = { - linear: function() { return d3_ease_linear; }, - poly: d3_ease_poly, - quad: function() { return d3_ease_quad; }, - cubic: function() { return d3_ease_cubic; }, - sin: function() { return d3_ease_sin; }, - exp: function() { return d3_ease_exp; }, - circle: function() { return d3_ease_circle; }, - elastic: d3_ease_elastic, - back: d3_ease_back, - bounce: function() { return d3_ease_bounce; } -}; - -var d3_ease_mode = { - "in": function(f) { return f; }, - "out": d3_ease_reverse, - "in-out": d3_ease_reflect, - "out-in": function(f) { return d3_ease_reflect(d3_ease_reverse(f)); } -}; - -d3.ease = function(name) { - var i = name.indexOf("-"), - t = i >= 0 ? name.substring(0, i) : name, - m = i >= 0 ? name.substring(i + 1) : "in"; - return d3_ease_clamp(d3_ease_mode[m](d3_ease[t].apply(null, Array.prototype.slice.call(arguments, 1)))); -}; - -function d3_ease_clamp(f) { - return function(t) { - return t <= 0 ? 0 : t >= 1 ? 1 : f(t); - }; -} - -function d3_ease_reverse(f) { - return function(t) { - return 1 - f(1 - t); - }; -} - -function d3_ease_reflect(f) { - return function(t) { - return .5 * (t < .5 ? f(2 * t) : (2 - f(2 - 2 * t))); - }; -} - -function d3_ease_linear(t) { - return t; -} - -function d3_ease_poly(e) { - return function(t) { - return Math.pow(t, e); - } -} - -function d3_ease_sin(t) { - return 1 - Math.cos(t * Math.PI / 2); -} - -function d3_ease_exp(t) { - return Math.pow(2, 10 * (t - 1)); -} - -function d3_ease_circle(t) { - return 1 - Math.sqrt(1 - t * t); -} - -function d3_ease_elastic(a, p) { - var s; - if (arguments.length < 2) p = 0.45; - if (arguments.length < 1) { a = 1; s = p / 4; } - else s = p / (2 * Math.PI) * Math.asin(1 / a); - return function(t) { - return 1 + a * Math.pow(2, 10 * -t) * Math.sin((t - s) * 2 * Math.PI / p); - }; -} - -function d3_ease_back(s) { - if (!s) s = 1.70158; - return function(t) { - return t * t * ((s + 1) * t - s); - }; -} - -function d3_ease_bounce(t) { - return t < 1 / 2.75 ? 7.5625 * t * t - : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75 - : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375 - : 7.5625 * (t -= 2.625 / 2.75) * t + .984375; -} -d3.event = null; - -function d3_eventCancel() { - d3.event.stopPropagation(); - d3.event.preventDefault(); -} -d3.interpolate = function(a, b) { - var i = d3.interpolators.length, f; - while (--i >= 0 && !(f = d3.interpolators[i](a, b))); - return f; -}; - -d3.interpolateNumber = function(a, b) { - b -= a; - return function(t) { return a + b * t; }; -}; - -d3.interpolateRound = function(a, b) { - b -= a; - return function(t) { return Math.round(a + b * t); }; -}; - -d3.interpolateString = function(a, b) { - var m, // current match - i, // current index - j, // current index (for coallescing) - s0 = 0, // start index of current string prefix - s1 = 0, // end index of current string prefix - s = [], // string constants and placeholders - q = [], // number interpolators - n, // q.length - o; - - // Reset our regular expression! - d3_interpolate_number.lastIndex = 0; - - // Find all numbers in b. - for (i = 0; m = d3_interpolate_number.exec(b); ++i) { - if (m.index) s.push(b.substring(s0, s1 = m.index)); - q.push({i: s.length, x: m[0]}); - s.push(null); - s0 = d3_interpolate_number.lastIndex; - } - if (s0 < b.length) s.push(b.substring(s0)); - - // Find all numbers in a. - for (i = 0, n = q.length; (m = d3_interpolate_number.exec(a)) && i < n; ++i) { - o = q[i]; - if (o.x == m[0]) { // The numbers match, so coallesce. - if (o.i) { - if (s[o.i + 1] == null) { // This match is followed by another number. - s[o.i - 1] += o.x; - s.splice(o.i, 1); - for (j = i + 1; j < n; ++j) q[j].i--; - } else { // This match is followed by a string, so coallesce twice. - s[o.i - 1] += o.x + s[o.i + 1]; - s.splice(o.i, 2); - for (j = i + 1; j < n; ++j) q[j].i -= 2; - } - } else { - if (s[o.i + 1] == null) { // This match is followed by another number. - s[o.i] = o.x; - } else { // This match is followed by a string, so coallesce twice. - s[o.i] = o.x + s[o.i + 1]; - s.splice(o.i + 1, 1); - for (j = i + 1; j < n; ++j) q[j].i--; - } - } - q.splice(i, 1); - n--; - i--; - } else { - o.x = d3.interpolateNumber(parseFloat(m[0]), parseFloat(o.x)); - } - } - - // Remove any numbers in b not found in a. - while (i < n) { - o = q.pop(); - if (s[o.i + 1] == null) { // This match is followed by another number. - s[o.i] = o.x; - } else { // This match is followed by a string, so coallesce twice. - s[o.i] = o.x + s[o.i + 1]; - s.splice(o.i + 1, 1); - } - n--; - } - - // Special optimization for only a single match. - if (s.length === 1) { - return s[0] == null ? q[0].x : function() { return b; }; - } - - // Otherwise, interpolate each of the numbers and rejoin the string. - return function(t) { - for (i = 0; i < n; ++i) s[(o = q[i]).i] = o.x(t); - return s.join(""); - }; -}; - -d3.interpolateTransform = function(a, b) { - return d3.interpolateString(d3.transform(a) + "", d3.transform(b) + ""); -}; - -d3.interpolateRgb = function(a, b) { - a = d3.rgb(a); - b = d3.rgb(b); - var ar = a.r, - ag = a.g, - ab = a.b, - br = b.r - ar, - bg = b.g - ag, - bb = b.b - ab; - return function(t) { - return "#" - + d3_rgb_hex(Math.round(ar + br * t)) - + d3_rgb_hex(Math.round(ag + bg * t)) - + d3_rgb_hex(Math.round(ab + bb * t)); - }; -}; - -// interpolates HSL space, but outputs RGB string (for compatibility) -d3.interpolateHsl = function(a, b) { - a = d3.hsl(a); - b = d3.hsl(b); - var h0 = a.h, - s0 = a.s, - l0 = a.l, - h1 = b.h - h0, - s1 = b.s - s0, - l1 = b.l - l0; - return function(t) { - return d3_hsl_rgb(h0 + h1 * t, s0 + s1 * t, l0 + l1 * t).toString(); - }; -}; - -d3.interpolateArray = function(a, b) { - var x = [], - c = [], - na = a.length, - nb = b.length, - n0 = Math.min(a.length, b.length), - i; - for (i = 0; i < n0; ++i) x.push(d3.interpolate(a[i], b[i])); - for (; i < na; ++i) c[i] = a[i]; - for (; i < nb; ++i) c[i] = b[i]; - return function(t) { - for (i = 0; i < n0; ++i) c[i] = x[i](t); - return c; - }; -}; - -d3.interpolateObject = function(a, b) { - var i = {}, - c = {}, - k; - for (k in a) { - if (k in b) { - i[k] = d3_interpolateByName(k)(a[k], b[k]); - } else { - c[k] = a[k]; - } - } - for (k in b) { - if (!(k in a)) { - c[k] = b[k]; - } - } - return function(t) { - for (k in i) c[k] = i[k](t); - return c; - }; -} - -var d3_interpolate_number = /[-+]?(?:\d*.?\d+)(?:[eE][-+]?\d+)?/g; - -function d3_interpolateByName(n) { - return n == "transform" - ? d3.interpolateTransform - : d3.interpolate; -} - -d3.interpolators = [ - d3.interpolateObject, - function(a, b) { return (b instanceof Array) && d3.interpolateArray(a, b); }, - function(a, b) { return (typeof a === "string" || typeof b === "string") && d3.interpolateString(a + "", b + ""); }, - function(a, b) { return (typeof b === "string" ? b in d3_rgb_names || /^(#|rgb(|hsl()/.test(b) : b instanceof d3_Rgb || b instanceof d3_Hsl) && d3.interpolateRgb(a, b); }, - function(a, b) { return !isNaN(a = +a) && !isNaN(b = +b) && d3.interpolateNumber(a, b); } -]; -function d3_uninterpolateNumber(a, b) { - b = b - (a = +a) ? 1 / (b - a) : 0; - return function(x) { return (x - a) * b; }; -} - -function d3_uninterpolateClamp(a, b) { - b = b - (a = +a) ? 1 / (b - a) : 0; - return function(x) { return Math.max(0, Math.min(1, (x - a) * b)); }; -} -d3.rgb = function(r, g, b) { - return arguments.length === 1 - ? (r instanceof d3_Rgb ? d3_rgb(r.r, r.g, r.b) - : d3_rgb_parse("" + r, d3_rgb, d3_hsl_rgb)) - : d3_rgb(~~r, ~~g, ~~b); -}; - -function d3_rgb(r, g, b) { - return new d3_Rgb(r, g, b); -} - -function d3_Rgb(r, g, b) { - this.r = r; - this.g = g; - this.b = b; -} - -d3_Rgb.prototype.brighter = function(k) { - k = Math.pow(0.7, arguments.length ? k : 1); - var r = this.r, - g = this.g, - b = this.b, - i = 30; - if (!r && !g && !b) return d3_rgb(i, i, i); - if (r && r < i) r = i; - if (g && g < i) g = i; - if (b && b < i) b = i; - return d3_rgb( - Math.min(255, Math.floor(r / k)), - Math.min(255, Math.floor(g / k)), - Math.min(255, Math.floor(b / k))); -}; - -d3_Rgb.prototype.darker = function(k) { - k = Math.pow(0.7, arguments.length ? k : 1); - return d3_rgb( - Math.floor(k * this.r), - Math.floor(k * this.g), - Math.floor(k * this.b)); -}; - -d3_Rgb.prototype.hsl = function() { - return d3_rgb_hsl(this.r, this.g, this.b); -}; - -d3_Rgb.prototype.toString = function() { - return "#" + d3_rgb_hex(this.r) + d3_rgb_hex(this.g) + d3_rgb_hex(this.b); -}; - -function d3_rgb_hex(v) { - return v < 0x10 - ? "0" + Math.max(0, v).toString(16) - : Math.min(255, v).toString(16); -} - -function d3_rgb_parse(format, rgb, hsl) { - var r = 0, // red channel; int in [0, 255] - g = 0, // green channel; int in [0, 255] - b = 0, // blue channel; int in [0, 255] - m1, // CSS color specification match - m2, // CSS color specification type (e.g., rgb) - name; - - /* Handle hsl, rgb. */ - m1 = /([a-z]+)((.*))/i.exec(format); - if (m1) { - m2 = m1[2].split(","); - switch (m1[1]) { - case "hsl": { - return hsl( - parseFloat(m2[0]), // degrees - parseFloat(m2[1]) / 100, // percentage - parseFloat(m2[2]) / 100 // percentage - ); - } - case "rgb": { - return rgb( - d3_rgb_parseNumber(m2[0]), - d3_rgb_parseNumber(m2[1]), - d3_rgb_parseNumber(m2[2]) - ); - } - } - } - - /* Named colors. */ - if (name = d3_rgb_names[format]) return rgb(name.r, name.g, name.b); - - /* Hexadecimal colors: #rgb and #rrggbb. */ - if (format != null && format.charAt(0) === "#") { - if (format.length === 4) { - r = format.charAt(1); r += r; - g = format.charAt(2); g += g; - b = format.charAt(3); b += b; - } else if (format.length === 7) { - r = format.substring(1, 3); - g = format.substring(3, 5); - b = format.substring(5, 7); - } - r = parseInt(r, 16); - g = parseInt(g, 16); - b = parseInt(b, 16); - } - - return rgb(r, g, b); -} - -function d3_rgb_hsl(r, g, b) { - var min = Math.min(r /= 255, g /= 255, b /= 255), - max = Math.max(r, g, b), - d = max - min, - h, - s, - l = (max + min) / 2; - if (d) { - s = l < .5 ? d / (max + min) : d / (2 - max - min); - if (r == max) h = (g - b) / d + (g < b ? 6 : 0); - else if (g == max) h = (b - r) / d + 2; - else h = (r - g) / d + 4; - h *= 60; - } else { - s = h = 0; - } - return d3_hsl(h, s, l); -} - -function d3_rgb_parseNumber(c) { // either integer or percentage - var f = parseFloat(c); - return c.charAt(c.length - 1) === "%" ? Math.round(f * 2.55) : f; -} - -var d3_rgb_names = { - aliceblue: "#f0f8ff", - antiquewhite: "#faebd7", - aqua: "#00ffff", - aquamarine: "#7fffd4", - azure: "#f0ffff", - beige: "#f5f5dc", - bisque: "#ffe4c4", - black: "#000000", - blanchedalmond: "#ffebcd", - blue: "#0000ff", - blueviolet: "#8a2be2", - brown: "#a52a2a", - burlywood: "#deb887", - cadetblue: "#5f9ea0", - chartreuse: "#7fff00", - chocolate: "#d2691e", - coral: "#ff7f50", - cornflowerblue: "#6495ed", - cornsilk: "#fff8dc", - crimson: "#dc143c", - cyan: "#00ffff", - darkblue: "#00008b", - darkcyan: "#008b8b", - darkgoldenrod: "#b8860b", - darkgray: "#a9a9a9", - darkgreen: "#006400", - darkgrey: "#a9a9a9", - darkkhaki: "#bdb76b", - darkmagenta: "#8b008b", - darkolivegreen: "#556b2f", - darkorange: "#ff8c00", - darkorchid: "#9932cc", - darkred: "#8b0000", - darksalmon: "#e9967a", - darkseagreen: "#8fbc8f", - darkslateblue: "#483d8b", - darkslategray: "#2f4f4f", - darkslategrey: "#2f4f4f", - darkturquoise: "#00ced1", - darkviolet: "#9400d3", - deeppink: "#ff1493", - deepskyblue: "#00bfff", - dimgray: "#696969", - dimgrey: "#696969", - dodgerblue: "#1e90ff", - firebrick: "#b22222", - floralwhite: "#fffaf0", - forestgreen: "#228b22", - fuchsia: "#ff00ff", - gainsboro: "#dcdcdc", - ghostwhite: "#f8f8ff", - gold: "#ffd700", - goldenrod: "#daa520", - gray: "#808080", - green: "#008000", - greenyellow: "#adff2f", - grey: "#808080", - honeydew: "#f0fff0", - hotpink: "#ff69b4", - indianred: "#cd5c5c", - indigo: "#4b0082", - ivory: "#fffff0", - khaki: "#f0e68c", - lavender: "#e6e6fa", - lavenderblush: "#fff0f5", - lawngreen: "#7cfc00", - lemonchiffon: "#fffacd", - lightblue: "#add8e6", - lightcoral: "#f08080", - lightcyan: "#e0ffff", - lightgoldenrodyellow: "#fafad2", - lightgray: "#d3d3d3", - lightgreen: "#90ee90", - lightgrey: "#d3d3d3", - lightpink: "#ffb6c1", - lightsalmon: "#ffa07a", - lightseagreen: "#20b2aa", - lightskyblue: "#87cefa", - lightslategray: "#778899", - lightslategrey: "#778899", - lightsteelblue: "#b0c4de", - lightyellow: "#ffffe0", - lime: "#00ff00", - limegreen: "#32cd32", - linen: "#faf0e6", - magenta: "#ff00ff", - maroon: "#800000", - mediumaquamarine: "#66cdaa", - mediumblue: "#0000cd", - mediumorchid: "#ba55d3", - mediumpurple: "#9370db", - mediumseagreen: "#3cb371", - mediumslateblue: "#7b68ee", - mediumspringgreen: "#00fa9a", - mediumturquoise: "#48d1cc", - mediumvioletred: "#c71585", - midnightblue: "#191970", - mintcream: "#f5fffa", - mistyrose: "#ffe4e1", - moccasin: "#ffe4b5", - navajowhite: "#ffdead", - navy: "#000080", - oldlace: "#fdf5e6", - olive: "#808000", - olivedrab: "#6b8e23", - orange: "#ffa500", - orangered: "#ff4500", - orchid: "#da70d6", - palegoldenrod: "#eee8aa", - palegreen: "#98fb98", - paleturquoise: "#afeeee", - palevioletred: "#db7093", - papayawhip: "#ffefd5", - peachpuff: "#ffdab9", - peru: "#cd853f", - pink: "#ffc0cb", - plum: "#dda0dd", - powderblue: "#b0e0e6", - purple: "#800080", - red: "#ff0000", - rosybrown: "#bc8f8f", - royalblue: "#4169e1", - saddlebrown: "#8b4513", - salmon: "#fa8072", - sandybrown: "#f4a460", - seagreen: "#2e8b57", - seashell: "#fff5ee", - sienna: "#a0522d", - silver: "#c0c0c0", - skyblue: "#87ceeb", - slateblue: "#6a5acd", - slategray: "#708090", - slategrey: "#708090", - snow: "#fffafa", - springgreen: "#00ff7f", - steelblue: "#4682b4", - tan: "#d2b48c", - teal: "#008080", - thistle: "#d8bfd8", - tomato: "#ff6347", - turquoise: "#40e0d0", - violet: "#ee82ee", - wheat: "#f5deb3", - white: "#ffffff", - whitesmoke: "#f5f5f5", - yellow: "#ffff00", - yellowgreen: "#9acd32" -}; - -for (var d3_rgb_name in d3_rgb_names) { - d3_rgb_names[d3_rgb_name] = d3_rgb_parse( - d3_rgb_names[d3_rgb_name], - d3_rgb, - d3_hsl_rgb); -} -d3.hsl = function(h, s, l) { - return arguments.length === 1 - ? (h instanceof d3_Hsl ? d3_hsl(h.h, h.s, h.l) - : d3_rgb_parse("" + h, d3_rgb_hsl, d3_hsl)) - : d3_hsl(+h, +s, +l); -}; - -function d3_hsl(h, s, l) { - return new d3_Hsl(h, s, l); -} - -function d3_Hsl(h, s, l) { - this.h = h; - this.s = s; - this.l = l; -} - -d3_Hsl.prototype.brighter = function(k) { - k = Math.pow(0.7, arguments.length ? k : 1); - return d3_hsl(this.h, this.s, this.l / k); -}; - -d3_Hsl.prototype.darker = function(k) { - k = Math.pow(0.7, arguments.length ? k : 1); - return d3_hsl(this.h, this.s, k * this.l); -}; - -d3_Hsl.prototype.rgb = function() { - return d3_hsl_rgb(this.h, this.s, this.l); -}; - -d3_Hsl.prototype.toString = function() { - return this.rgb().toString(); -}; - -function d3_hsl_rgb(h, s, l) { - var m1, - m2; - - /* Some simple corrections for h, s and l. */ - h = h % 360; if (h < 0) h += 360; - s = s < 0 ? 0 : s > 1 ? 1 : s; - l = l < 0 ? 0 : l > 1 ? 1 : l; - - /* From FvD 13.37, CSS Color Module Level 3 */ - m2 = l <= .5 ? l * (1 + s) : l + s - l * s; - m1 = 2 * l - m2; - - function v(h) { - if (h > 360) h -= 360; - else if (h < 0) h += 360; - if (h < 60) return m1 + (m2 - m1) * h / 60; - if (h < 180) return m2; - if (h < 240) return m1 + (m2 - m1) * (240 - h) / 60; - return m1; - } - - function vv(h) { - return Math.round(v(h) * 255); - } - - return d3_rgb(vv(h + 120), vv(h), vv(h - 120)); -} -function d3_selection(groups) { - d3_arraySubclass(groups, d3_selectionPrototype); - return groups; -} - -var d3_select = function(s, n) { return n.querySelector(s); }, - d3_selectAll = function(s, n) { return n.querySelectorAll(s); }, - d3_selectRoot = document.documentElement, - d3_selectMatcher = d3_selectRoot.matchesSelector || d3_selectRoot.webkitMatchesSelector || d3_selectRoot.mozMatchesSelector || d3_selectRoot.msMatchesSelector || d3_selectRoot.oMatchesSelector, - d3_selectMatches = function(n, s) { return d3_selectMatcher.call(n, s); }; - -// Prefer Sizzle, if available. -if (typeof Sizzle === "function") { - d3_select = function(s, n) { return Sizzle(s, n)[0]; }; - d3_selectAll = function(s, n) { return Sizzle.uniqueSort(Sizzle(s, n)); }; - d3_selectMatches = Sizzle.matchesSelector; -} - -var d3_selectionPrototype = []; - -d3.selection = function() { - return d3_selectionRoot; -}; - -d3.selection.prototype = d3_selectionPrototype; -d3_selectionPrototype.select = function(selector) { - var subgroups = [], - subgroup, - subnode, - group, - node; - - if (typeof selector !== "function") selector = d3_selection_selector(selector); - - for (var j = -1, m = this.length; ++j < m;) { - subgroups.push(subgroup = []); - subgroup.parentNode = (group = this[j]).parentNode; - for (var i = -1, n = group.length; ++i < n;) { - if (node = group[i]) { - subgroup.push(subnode = selector.call(node, node.__data__, i)); - if (subnode && "__data__" in node) subnode.__data__ = node.__data__; - } else { - subgroup.push(null); - } - } - } - - return d3_selection(subgroups); -}; - -function d3_selection_selector(selector) { - return function() { - return d3_select(selector, this); - }; -} -d3_selectionPrototype.selectAll = function(selector) { - var subgroups = [], - subgroup, - node; - - if (typeof selector !== "function") selector = d3_selection_selectorAll(selector); - - for (var j = -1, m = this.length; ++j < m;) { - for (var group = this[j], i = -1, n = group.length; ++i < n;) { - if (node = group[i]) { - subgroups.push(subgroup = d3_array(selector.call(node, node.__data__, i))); - subgroup.parentNode = node; - } - } - } - - return d3_selection(subgroups); -}; - -function d3_selection_selectorAll(selector) { - return function() { - return d3_selectAll(selector, this); - }; -} -d3_selectionPrototype.attr = function(name, value) { - name = d3.ns.qualify(name); - - // If no value is specified, return the first value. - if (arguments.length < 2) { - var node = this.node(); - return name.local - ? node.getAttributeNS(name.space, name.local) - : node.getAttribute(name); - } - - function attrNull() { - this.removeAttribute(name); - } - - function attrNullNS() { - this.removeAttributeNS(name.space, name.local); - } - - function attrConstant() { - this.setAttribute(name, value); - } - - function attrConstantNS() { - this.setAttributeNS(name.space, name.local, value); - } - - function attrFunction() { - var x = value.apply(this, arguments); - if (x == null) this.removeAttribute(name); - else this.setAttribute(name, x); - } - - function attrFunctionNS() { - var x = value.apply(this, arguments); - if (x == null) this.removeAttributeNS(name.space, name.local); - else this.setAttributeNS(name.space, name.local, x); - } - - return this.each(value == null - ? (name.local ? attrNullNS : attrNull) : (typeof value === "function" - ? (name.local ? attrFunctionNS : attrFunction) - : (name.local ? attrConstantNS : attrConstant))); -}; -d3_selectionPrototype.classed = function(name, value) { - var names = name.split(d3_selection_classedWhitespace), - n = names.length, - i = -1; - if (arguments.length > 1) { - while (++i < n) d3_selection_classed.call(this, names[i], value); - return this; - } else { - while (++i < n) if (!d3_selection_classed.call(this, names[i])) return false; - return true; - } -}; - -var d3_selection_classedWhitespace = /\s+/g; - -function d3_selection_classed(name, value) { - var re = new RegExp("(^|\s+)" + d3.requote(name) + "(\s+|$)", "g"); - - // If no value is specified, return the first value. - if (arguments.length < 2) { - var node = this.node(); - if (c = node.classList) return c.contains(name); - var c = node.className; - re.lastIndex = 0; - return re.test(c.baseVal != null ? c.baseVal : c); - } - - function classedAdd() { - if (c = this.classList) return c.add(name); - var c = this.className, - cb = c.baseVal != null, - cv = cb ? c.baseVal : c; - re.lastIndex = 0; - if (!re.test(cv)) { - cv = d3_collapse(cv + " " + name); - if (cb) c.baseVal = cv; - else this.className = cv; - } - } - - function classedRemove() { - if (c = this.classList) return c.remove(name); - var c = this.className, - cb = c.baseVal != null, - cv = cb ? c.baseVal : c; - cv = d3_collapse(cv.replace(re, " ")); - if (cb) c.baseVal = cv; - else this.className = cv; - } - - function classedFunction() { - (value.apply(this, arguments) - ? classedAdd - : classedRemove).call(this); - } - - return this.each(typeof value === "function" - ? classedFunction : value - ? classedAdd - : classedRemove); -} -d3_selectionPrototype.style = function(name, value, priority) { - if (arguments.length < 3) priority = ""; - - // If no value is specified, return the first value. - if (arguments.length < 2) return window - .getComputedStyle(this.node(), null) - .getPropertyValue(name); - - function styleNull() { - this.style.removeProperty(name); - } - - function styleConstant() { - this.style.setProperty(name, value, priority); - } - - function styleFunction() { - var x = value.apply(this, arguments); - if (x == null) this.style.removeProperty(name); - else this.style.setProperty(name, x, priority); - } - - return this.each(value == null - ? styleNull : (typeof value === "function" - ? styleFunction : styleConstant)); -}; -d3_selectionPrototype.property = function(name, value) { - - // If no value is specified, return the first value. - if (arguments.length < 2) return this.node()[name]; - - function propertyNull() { - delete this[name]; - } - - function propertyConstant() { - this[name] = value; - } - - function propertyFunction() { - var x = value.apply(this, arguments); - if (x == null) delete this[name]; - else this[name] = x; - } - - return this.each(value == null - ? propertyNull : (typeof value === "function" - ? propertyFunction : propertyConstant)); -}; -d3_selectionPrototype.text = function(value) { - return arguments.length < 1 - ? this.node().textContent : this.each(typeof value === "function" - ? function() { var v = value.apply(this, arguments); this.textContent = v == null ? "" : v; } : value == null - ? function() { this.textContent = ""; } - : function() { this.textContent = value; }); -}; -d3_selectionPrototype.html = function(value) { - return arguments.length < 1 - ? this.node().innerHTML : this.each(typeof value === "function" - ? function() { var v = value.apply(this, arguments); this.innerHTML = v == null ? "" : v; } : value == null - ? function() { this.innerHTML = ""; } - : function() { this.innerHTML = value; }); -}; -// TODO append(node)? -// TODO append(function)? -d3_selectionPrototype.append = function(name) { - name = d3.ns.qualify(name); - - function append() { - return this.appendChild(document.createElementNS(this.namespaceURI, name)); - } - - function appendNS() { - return this.appendChild(document.createElementNS(name.space, name.local)); - } - - return this.select(name.local ? appendNS : append); -}; -// TODO insert(node, function)? -// TODO insert(function, string)? -// TODO insert(function, function)? -d3_selectionPrototype.insert = function(name, before) { - name = d3.ns.qualify(name); - - function insert() { - return this.insertBefore( - document.createElementNS(this.namespaceURI, name), - d3_select(before, this)); - } - - function insertNS() { - return this.insertBefore( - document.createElementNS(name.space, name.local), - d3_select(before, this)); - } - - return this.select(name.local ? insertNS : insert); -}; -// TODO remove(selector)? -// TODO remove(node)? -// TODO remove(function)? -d3_selectionPrototype.remove = function() { - return this.each(function() { - var parent = this.parentNode; - if (parent) parent.removeChild(this); - }); -}; -// TODO data(null) for clearing data? -d3_selectionPrototype.data = function(data, join) { - var enter = [], - update = [], - exit = []; - - function bind(group, groupData) { - var i, - n = group.length, - m = groupData.length, - n0 = Math.min(n, m), - n1 = Math.max(n, m), - updateNodes = [], - enterNodes = [], - exitNodes = [], - node, - nodeData; - - if (join) { - var nodeByKey = {}, - keys = [], - key, - j = groupData.length; - - for (i = -1; ++i < n;) { - key = join.call(node = group[i], node.__data__, i); - if (key in nodeByKey) { - exitNodes[j++] = node; // duplicate key - } else { - nodeByKey[key] = node; - } - keys.push(key); - } - - for (i = -1; ++i < m;) { - node = nodeByKey[key = join.call(groupData, nodeData = groupData[i], i)]; - if (node) { - node.__data__ = nodeData; - updateNodes[i] = node; - enterNodes[i] = exitNodes[i] = null; - } else { - enterNodes[i] = d3_selection_dataNode(nodeData); - updateNodes[i] = exitNodes[i] = null; - } - delete nodeByKey[key]; - } - - for (i = -1; ++i < n;) { - if (keys[i] in nodeByKey) { - exitNodes[i] = group[i]; - } - } - } else { - for (i = -1; ++i < n0;) { - node = group[i]; - nodeData = groupData[i]; - if (node) { - node.__data__ = nodeData; - updateNodes[i] = node; - enterNodes[i] = exitNodes[i] = null; - } else { - enterNodes[i] = d3_selection_dataNode(nodeData); - updateNodes[i] = exitNodes[i] = null; - } - } - for (; i < m; ++i) { - enterNodes[i] = d3_selection_dataNode(groupData[i]); - updateNodes[i] = exitNodes[i] = null; - } - for (; i < n1; ++i) { - exitNodes[i] = group[i]; - enterNodes[i] = updateNodes[i] = null; - } - } - - enterNodes.update - = updateNodes; - - enterNodes.parentNode - = updateNodes.parentNode - = exitNodes.parentNode - = group.parentNode; - - enter.push(enterNodes); - update.push(updateNodes); - exit.push(exitNodes); - } - - var i = -1, - n = this.length, - group; - if (typeof data === "function") { - while (++i < n) { - bind(group = this[i], data.call(group, group.parentNode.__data__, i)); - } - } else { - while (++i < n) { - bind(group = this[i], data); - } - } - - var selection = d3_selection(update); - selection.enter = function() { return d3_selection_enter(enter); }; - selection.exit = function() { return d3_selection(exit); }; - return selection; -}; - -function d3_selection_dataNode(data) { - return {__data__: data}; -} -d3_selectionPrototype.filter = function(filter) { - var subgroups = [], - subgroup, - group, - node; - - if (typeof filter !== "function") filter = d3_selection_filter(filter); - - for (var j = 0, m = this.length; j < m; j++) { - subgroups.push(subgroup = []); - subgroup.parentNode = (group = this[j]).parentNode; - for (var i = 0, n = group.length; i < n; i++) { - if ((node = group[i]) && filter.call(node, node.__data__, i)) { - subgroup.push(node); - } - } - } - - return d3_selection(subgroups); -}; - -function d3_selection_filter(selector) { - return function() { - return d3_selectMatches(this, selector); - }; -} -d3_selectionPrototype.map = function(map) { - return this.each(function() { - this.__data__ = map.apply(this, arguments); - }); -}; -d3_selectionPrototype.order = function() { - for (var j = -1, m = this.length; ++j < m;) { - for (var group = this[j], i = group.length - 1, next = group[i], node; --i >= 0;) { - if (node = group[i]) { - if (next) next.parentNode.insertBefore(node, next); - next = node; - } - } - } - return this; -}; -d3_selectionPrototype.sort = function(comparator) { - comparator = d3_selection_sortComparator.apply(this, arguments); - for (var j = -1, m = this.length; ++j < m;) this[j].sort(comparator); - return this.order(); -}; - -function d3_selection_sortComparator(comparator) { - if (!arguments.length) comparator = d3.ascending; - return function(a, b) { - return comparator(a && a.__data__, b && b.__data__); - }; -} -// type can be namespaced, e.g., "click.foo" -// listener can be null for removal -d3_selectionPrototype.on = function(type, listener, capture) { - if (arguments.length < 3) capture = false; - - // parse the type specifier - var name = "__on" + type, i = type.indexOf("."); - if (i > 0) type = type.substring(0, i); - - // if called with only one argument, return the current listener - if (arguments.length < 2) return (i = this.node()[name]) && i._; - - // remove the old event listener, and add the new event listener - return this.each(function(d, i) { - var node = this; - - if (node[name]) node.removeEventListener(type, node[name], capture); - if (listener) node.addEventListener(type, node[name] = l, capture); - - // wrapped event listener that preserves i - function l(e) { - var o = d3.event; // Events can be reentrant (e.g., focus). - d3.event = e; - try { - listener.call(node, node.__data__, i); - } finally { - d3.event = o; - } - } - - // stash the unwrapped listener for retrieval - l._ = listener; - }); -}; -d3_selectionPrototype.each = function(callback) { - for (var j = -1, m = this.length; ++j < m;) { - for (var group = this[j], i = -1, n = group.length; ++i < n;) { - var node = group[i]; - if (node) callback.call(node, node.__data__, i, j); - } - } - return this; -}; -// -// Note: assigning to the arguments array simultaneously changes the value of -// the corresponding argument! -// -// TODO The `this` argument probably shouldn't be the first argument to the -// callback, anyway, since it's redundant. However, that will require a major -// version bump due to backwards compatibility, so I'm not changing it right -// away. -// -d3_selectionPrototype.call = function(callback) { - callback.apply(this, (arguments[0] = this, arguments)); - return this; -}; -d3_selectionPrototype.empty = function() { - return !this.node(); -}; -d3_selectionPrototype.node = function(callback) { - for (var j = 0, m = this.length; j < m; j++) { - for (var group = this[j], i = 0, n = group.length; i < n; i++) { - var node = group[i]; - if (node) return node; - } - } - return null; -}; -d3_selectionPrototype.transition = function() { - var subgroups = [], - subgroup, - node; - - for (var j = -1, m = this.length; ++j < m;) { - subgroups.push(subgroup = []); - for (var group = this[j], i = -1, n = group.length; ++i < n;) { - subgroup.push((node = group[i]) ? {node: node, delay: 0, duration: 250} : null); - } - } - - return d3_transition(subgroups, d3_transitionInheritId || ++d3_transitionId, Date.now()); -}; -var d3_selectionRoot = d3_selection([[document]]); - -d3_selectionRoot[0].parentNode = d3_selectRoot; - -// TODO fast singleton implementation! -// TODO select(function) -d3.select = function(selector) { - return typeof selector === "string" - ? d3_selectionRoot.select(selector) - : d3_selection([[selector]]); // assume node -}; - -// TODO selectAll(function) -d3.selectAll = function(selector) { - return typeof selector === "string" - ? d3_selectionRoot.selectAll(selector) - : d3_selection([d3_array(selector)]); // assume node[] -}; -function d3_selection_enter(selection) { - d3_arraySubclass(selection, d3_selection_enterPrototype); - return selection; -} - -var d3_selection_enterPrototype = []; - -d3_selection_enterPrototype.append = d3_selectionPrototype.append; -d3_selection_enterPrototype.insert = d3_selectionPrototype.insert; -d3_selection_enterPrototype.empty = d3_selectionPrototype.empty; -d3_selection_enterPrototype.node = d3_selectionPrototype.node; -d3_selection_enterPrototype.select = function(selector) { - var subgroups = [], - subgroup, - subnode, - upgroup, - group, - node; - - for (var j = -1, m = this.length; ++j < m;) { - upgroup = (group = this[j]).update; - subgroups.push(subgroup = []); - subgroup.parentNode = group.parentNode; - for (var i = -1, n = group.length; ++i < n;) { - if (node = group[i]) { - subgroup.push(upgroup[i] = subnode = selector.call(group.parentNode, node.__data__, i)); - subnode.__data__ = node.__data__; - } else { - subgroup.push(null); - } - } - } - - return d3_selection(subgroups); -}; -function d3_transition(groups, id, time) { - d3_arraySubclass(groups, d3_transitionPrototype); - - var tweens = {}, - event = d3.dispatch("start", "end"), - ease = d3_transitionEase; - - groups.id = id; - - groups.time = time; - - groups.tween = function(name, tween) { - if (arguments.length < 2) return tweens[name]; - if (tween == null) delete tweens[name]; - else tweens[name] = tween; - return groups; - }; - - groups.ease = function(value) { - if (!arguments.length) return ease; - ease = typeof value === "function" ? value : d3.ease.apply(d3, arguments); - return groups; - }; - - groups.each = function(type, listener) { - if (arguments.length < 2) return d3_transition_each.call(groups, type); - event.on(type, listener); - return groups; - }; - - d3.timer(function(elapsed) { - groups.each(function(d, i, j) { - var tweened = [], - node = this, - delay = groups[j][i].delay, - duration = groups[j][i].duration, - lock = node.__transition__ || (node.__transition__ = {active: 0, count: 0}); - - ++lock.count; - - delay <= elapsed ? start(elapsed) : d3.timer(start, delay, time); - - function start(elapsed) { - if (lock.active > id) return stop(); - lock.active = id; - - for (var tween in tweens) { - if (tween = tweens[tween].call(node, d, i)) { - tweened.push(tween); - } - } - - event.start.call(node, d, i); - if (!tick(elapsed)) d3.timer(tick, 0, time); - return 1; - } - - function tick(elapsed) { - if (lock.active !== id) return stop(); - - var t = (elapsed - delay) / duration, - e = ease(t), - n = tweened.length; - - while (n > 0) { - tweened[--n].call(node, e); - } - - if (t >= 1) { - stop(); - d3_transitionInheritId = id; - event.end.call(node, d, i); - d3_transitionInheritId = 0; - return 1; - } - } - - function stop() { - if (!--lock.count) delete node.__transition__; - return 1; - } - }); - return 1; - }, 0, time); - - return groups; -} - -var d3_transitionRemove = {}; - -function d3_transitionNull(d, i, a) { - return a != "" && d3_transitionRemove; -} - -function d3_transitionTween(name, b) { - var interpolate = d3_interpolateByName(name); - - function transitionFunction(d, i, a) { - var v = b.call(this, d, i); - return v == null - ? a != "" && d3_transitionRemove - : a != v && interpolate(a, v); - } - - function transitionString(d, i, a) { - return a != b && interpolate(a, b); - } - - return typeof b === "function" ? transitionFunction - : b == null ? d3_transitionNull - : (b += "", transitionString); -} - -var d3_transitionPrototype = [], - d3_transitionId = 0, - d3_transitionInheritId = 0, - d3_transitionEase = d3.ease("cubic-in-out"); - -d3_transitionPrototype.call = d3_selectionPrototype.call; - -d3.transition = function() { - return d3_selectionRoot.transition(); -}; - -d3.transition.prototype = d3_transitionPrototype; -d3_transitionPrototype.select = function(selector) { - var subgroups = [], - subgroup, - subnode, - node; - - if (typeof selector !== "function") selector = d3_selection_selector(selector); - - for (var j = -1, m = this.length; ++j < m;) { - subgroups.push(subgroup = []); - for (var group = this[j], i = -1, n = group.length; ++i < n;) { - if ((node = group[i]) && (subnode = selector.call(node.node, node.node.__data__, i))) { - if ("__data__" in node.node) subnode.__data__ = node.node.__data__; - subgroup.push({node: subnode, delay: node.delay, duration: node.duration}); - } else { - subgroup.push(null); - } - } - } - - return d3_transition(subgroups, this.id, this.time).ease(this.ease()); -}; -d3_transitionPrototype.selectAll = function(selector) { - var subgroups = [], - subgroup, - subnodes, - node; - - if (typeof selector !== "function") selector = d3_selection_selectorAll(selector); - - for (var j = -1, m = this.length; ++j < m;) { - for (var group = this[j], i = -1, n = group.length; ++i < n;) { - if (node = group[i]) { - subnodes = selector.call(node.node, node.node.__data__, i); - subgroups.push(subgroup = []); - for (var k = -1, o = subnodes.length; ++k < o;) { - subgroup.push({node: subnodes[k], delay: node.delay, duration: node.duration}); - } - } - } - } - - return d3_transition(subgroups, this.id, this.time).ease(this.ease()); -}; -d3_transitionPrototype.attr = function(name, value) { - return this.attrTween(name, d3_transitionTween(name, value)); -}; - -d3_transitionPrototype.attrTween = function(nameNS, tween) { - var name = d3.ns.qualify(nameNS); - - function attrTween(d, i) { - var f = tween.call(this, d, i, this.getAttribute(name)); - return f === d3_transitionRemove - ? (this.removeAttribute(name), null) - : f && function(t) { this.setAttribute(name, f(t)); }; - } - - function attrTweenNS(d, i) { - var f = tween.call(this, d, i, this.getAttributeNS(name.space, name.local)); - return f === d3_transitionRemove - ? (this.removeAttributeNS(name.space, name.local), null) - : f && function(t) { this.setAttributeNS(name.space, name.local, f(t)); }; - } - - return this.tween("attr." + nameNS, name.local ? attrTweenNS : attrTween); -}; -d3_transitionPrototype.style = function(name, value, priority) { - if (arguments.length < 3) priority = ""; - return this.styleTween(name, d3_transitionTween(name, value), priority); -}; - -d3_transitionPrototype.styleTween = function(name, tween, priority) { - if (arguments.length < 3) priority = ""; - return this.tween("style." + name, function(d, i) { - var f = tween.call(this, d, i, window.getComputedStyle(this, null).getPropertyValue(name)); - return f === d3_transitionRemove - ? (this.style.removeProperty(name), null) - : f && function(t) { this.style.setProperty(name, f(t), priority); }; - }); -}; -d3_transitionPrototype.text = function(value) { - return this.tween("text", function(d, i) { - this.textContent = typeof value === "function" - ? value.call(this, d, i) - : value; - }); -}; -d3_transitionPrototype.remove = function() { - return this.each("end", function() { - var p; - if (!this.__transition__ && (p = this.parentNode)) p.removeChild(this); - }); -}; -d3_transitionPrototype.delay = function(value) { - var groups = this; - return groups.each(typeof value === "function" - ? function(d, i, j) { groups[j][i].delay = +value.apply(this, arguments); } - : (value = +value, function(d, i, j) { groups[j][i].delay = value; })); -}; -d3_transitionPrototype.duration = function(value) { - var groups = this; - return groups.each(typeof value === "function" - ? function(d, i, j) { groups[j][i].duration = +value.apply(this, arguments); } - : (value = +value, function(d, i, j) { groups[j][i].duration = value; })); -}; -function d3_transition_each(callback) { - for (var j = 0, m = this.length; j < m; j++) { - for (var group = this[j], i = 0, n = group.length; i < n; i++) { - var node = group[i]; - if (node) callback.call(node = node.node, node.__data__, i, j); - } - } - return this; -} -d3_transitionPrototype.transition = function() { - return this.select(d3_this); -}; -var d3_timer_queue = null, - d3_timer_interval, // is an interval (or frame) active? - d3_timer_timeout; // is a timeout active? - -// The timer will continue to fire until callback returns true. -d3.timer = function(callback, delay, then) { - var found = false, - t0, - t1 = d3_timer_queue; - - if (arguments.length < 3) { - if (arguments.length < 2) delay = 0; - else if (!isFinite(delay)) return; - then = Date.now(); - } - - // See if the callback's already in the queue. - while (t1) { - if (t1.callback === callback) { - t1.then = then; - t1.delay = delay; - found = true; - break; - } - t0 = t1; - t1 = t1.next; - } - - // Otherwise, add the callback to the queue. - if (!found) d3_timer_queue = { - callback: callback, - then: then, - delay: delay, - next: d3_timer_queue - }; - - // Start animatin'! - if (!d3_timer_interval) { - d3_timer_timeout = clearTimeout(d3_timer_timeout); - d3_timer_interval = 1; - d3_timer_frame(d3_timer_step); - } -} - -function d3_timer_step() { - var elapsed, - now = Date.now(), - t1 = d3_timer_queue; - - while (t1) { - elapsed = now - t1.then; - if (elapsed >= t1.delay) t1.flush = t1.callback(elapsed); - t1 = t1.next; - } - - var delay = d3_timer_flush() - now; - if (delay > 24) { - if (isFinite(delay)) { - clearTimeout(d3_timer_timeout); - d3_timer_timeout = setTimeout(d3_timer_step, delay); - } - d3_timer_interval = 0; - } else { - d3_timer_interval = 1; - d3_timer_frame(d3_timer_step); - } -} - -d3.timer.flush = function() { - var elapsed, - now = Date.now(), - t1 = d3_timer_queue; - - while (t1) { - elapsed = now - t1.then; - if (!t1.delay) t1.flush = t1.callback(elapsed); - t1 = t1.next; - } - - d3_timer_flush(); -}; - -// Flush after callbacks, to avoid concurrent queue modification. -function d3_timer_flush() { - var t0 = null, - t1 = d3_timer_queue, - then = Infinity; - while (t1) { - if (t1.flush) { - t1 = t0 ? t0.next = t1.next : d3_timer_queue = t1.next; - } else { - then = Math.min(then, t1.then + t1.delay); - t1 = (t0 = t1).next; - } - } - return then; -} - -var d3_timer_frame = window.requestAnimationFrame - || window.webkitRequestAnimationFrame - || window.mozRequestAnimationFrame - || window.oRequestAnimationFrame - || window.msRequestAnimationFrame - || function(callback) { setTimeout(callback, 17); }; -d3.transform = function(string) { - var g = document.createElementNS(d3.ns.prefix.svg, "g"), - identity = {a: 1, b: 0, c: 0, d: 1, e: 0, f: 0}; - return (d3.transform = function(string) { - g.setAttribute("transform", string); - var t = g.transform.baseVal.consolidate(); - return new d3_transform(t ? t.matrix : identity); - })(string); -}; - -// Compute x-scale and normalize the first row. -// Compute shear and make second row orthogonal to first. -// Compute y-scale and normalize the second row. -// Finally, compute the rotation. -function d3_transform(m) { - var r0 = [m.a, m.b], - r1 = [m.c, m.d], - kx = d3_transformNormalize(r0), - kz = d3_transformDot(r0, r1), - ky = d3_transformNormalize(d3_transformCombine(r1, r0, -kz)) || 0; - if (r0[0] * r1[1] < r1[0] * r0[1]) { - r0[0] *= -1; - r0[1] *= -1; - kx *= -1; - kz *= -1; - } - this.rotate = (kx ? Math.atan2(r0[1], r0[0]) : Math.atan2(-r1[0], r1[1])) * d3_transformDegrees; - this.translate = [m.e, m.f]; - this.scale = [kx, ky]; - this.skew = ky ? Math.atan2(kz, ky) * d3_transformDegrees : 0; -}; - -d3_transform.prototype.toString = function() { - return "translate(" + this.translate - + ")rotate(" + this.rotate - + ")skewX(" + this.skew - + ")scale(" + this.scale - + ")"; -}; - -function d3_transformDot(a, b) { - return a[0] * b[0] + a[1] * b[1]; -} - -function d3_transformNormalize(a) { - var k = Math.sqrt(d3_transformDot(a, a)); - if (k) { - a[0] /= k; - a[1] /= k; - } - return k; -} - -function d3_transformCombine(a, b, k) { - a[0] += k * b[0]; - a[1] += k * b[1]; - return a; -} - -var d3_transformDegrees = 180 / Math.PI; -function d3_noop() {} -d3.scale = {}; - -function d3_scaleExtent(domain) { - var start = domain[0], stop = domain[domain.length - 1]; - return start < stop ? [start, stop] : [stop, start]; -} - -function d3_scaleRange(scale) { - return scale.rangeExtent ? scale.rangeExtent() : d3_scaleExtent(scale.range()); -} -function d3_scale_nice(domain, nice) { - var i0 = 0, - i1 = domain.length - 1, - x0 = domain[i0], - x1 = domain[i1], - dx; - - if (x1 < x0) { - dx = i0; i0 = i1; i1 = dx; - dx = x0; x0 = x1; x1 = dx; - } - - if (dx = x1 - x0) { - nice = nice(dx); - domain[i0] = nice.floor(x0); - domain[i1] = nice.ceil(x1); - } - - return domain; -} - -function d3_scale_niceDefault() { - return Math; -} -d3.scale.linear = function() { - return d3_scale_linear([0, 1], [0, 1], d3.interpolate, false); -}; - -function d3_scale_linear(domain, range, interpolate, clamp) { - var output, - input; - - function rescale() { - var linear = domain.length == 2 ? d3_scale_bilinear : d3_scale_polylinear, - uninterpolate = clamp ? d3_uninterpolateClamp : d3_uninterpolateNumber; - output = linear(domain, range, uninterpolate, interpolate); - input = linear(range, domain, uninterpolate, d3.interpolate); - return scale; - } - - function scale(x) { - return output(x); - } - - // Note: requires range is coercible to number! - scale.invert = function(y) { - return input(y); - }; - - scale.domain = function(x) { - if (!arguments.length) return domain; - domain = x.map(Number); - return rescale(); - }; - - scale.range = function(x) { - if (!arguments.length) return range; - range = x; - return rescale(); - }; - - scale.rangeRound = function(x) { - return scale.range(x).interpolate(d3.interpolateRound); - }; - - scale.clamp = function(x) { - if (!arguments.length) return clamp; - clamp = x; - return rescale(); - }; - - scale.interpolate = function(x) { - if (!arguments.length) return interpolate; - interpolate = x; - return rescale(); - }; - - scale.ticks = function(m) { - return d3_scale_linearTicks(domain, m); - }; - - scale.tickFormat = function(m) { - return d3_scale_linearTickFormat(domain, m); - }; - - scale.nice = function() { - d3_scale_nice(domain, d3_scale_linearNice); - return rescale(); - }; - - scale.copy = function() { - return d3_scale_linear(domain, range, interpolate, clamp); - }; - - return rescale(); -}; - -function d3_scale_linearRebind(scale, linear) { - return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp"); -} - -function d3_scale_linearNice(dx) { - dx = Math.pow(10, Math.round(Math.log(dx) / Math.LN10) - 1); - return { - floor: function(x) { return Math.floor(x / dx) * dx; }, - ceil: function(x) { return Math.ceil(x / dx) * dx; } - }; -} - -// TODO Dates? Ugh. -function d3_scale_linearTickRange(domain, m) { - var extent = d3_scaleExtent(domain), - span = extent[1] - extent[0], - step = Math.pow(10, Math.floor(Math.log(span / m) / Math.LN10)), - err = m / span * step; - - // Filter ticks to get closer to the desired count. - if (err <= .15) step *= 10; - else if (err <= .35) step *= 5; - else if (err <= .75) step *= 2; - - // Round start and stop values to step interval. - extent[0] = Math.ceil(extent[0] / step) * step; - extent[1] = Math.floor(extent[1] / step) * step + step * .5; // inclusive - extent[2] = step; - return extent; -} - -function d3_scale_linearTicks(domain, m) { - return d3.range.apply(d3, d3_scale_linearTickRange(domain, m)); -} - -function d3_scale_linearTickFormat(domain, m) { - return d3.format(",." + Math.max(0, -Math.floor(Math.log(d3_scale_linearTickRange(domain, m)[2]) / Math.LN10 + .01)) + "f"); -} -function d3_scale_bilinear(domain, range, uninterpolate, interpolate) { - var u = uninterpolate(domain[0], domain[1]), - i = interpolate(range[0], range[1]); - return function(x) { - return i(u(x)); - }; -} -function d3_scale_polylinear(domain, range, uninterpolate, interpolate) { - var u = [], - i = [], - j = 0, - n = domain.length; - - while (++j < n) { - u.push(uninterpolate(domain[j - 1], domain[j])); - i.push(interpolate(range[j - 1], range[j])); - } - - return function(x) { - var j = d3.bisect(domain, x, 1, domain.length - 1) - 1; - return i[j](u[j](x)); - }; -} -d3.scale.log = function() { - return d3_scale_log(d3.scale.linear(), d3_scale_logp); -}; - -function d3_scale_log(linear, log) { - var pow = log.pow; - - function scale(x) { - return linear(log(x)); - } - - scale.invert = function(x) { - return pow(linear.invert(x)); - }; - - scale.domain = function(x) { - if (!arguments.length) return linear.domain().map(pow); - log = x[0] < 0 ? d3_scale_logn : d3_scale_logp; - pow = log.pow; - linear.domain(x.map(log)); - return scale; - }; - - scale.nice = function() { - linear.domain(d3_scale_nice(linear.domain(), d3_scale_niceDefault)); - return scale; - }; - - scale.ticks = function() { - var extent = d3_scaleExtent(linear.domain()), - ticks = []; - if (extent.every(isFinite)) { - var i = Math.floor(extent[0]), - j = Math.ceil(extent[1]), - u = pow(extent[0]), - v = pow(extent[1]); - if (log === d3_scale_logn) { - ticks.push(pow(i)); - for (; i++ < j;) for (var k = 9; k > 0; k--) ticks.push(pow(i) * k); - } else { - for (; i < j; i++) for (var k = 1; k < 10; k++) ticks.push(pow(i) * k); - ticks.push(pow(i)); - } - for (i = 0; ticks[i] < u; i++) {} // strip small values - for (j = ticks.length; ticks[j - 1] > v; j--) {} // strip big values - ticks = ticks.slice(i, j); - } - return ticks; - }; - - scale.tickFormat = function(n, format) { - if (arguments.length < 2) format = d3_scale_logFormat; - if (arguments.length < 1) return format; - var k = n / scale.ticks().length, - f = log === d3_scale_logn ? (e = -1e-12, Math.floor) : (e = 1e-12, Math.ceil), - e; - return function(d) { - return d / pow(f(log(d) + e)) < k ? format(d) : ""; - }; - }; - - scale.copy = function() { - return d3_scale_log(linear.copy(), log); - }; - - return d3_scale_linearRebind(scale, linear); -}; - -var d3_scale_logFormat = d3.format(".0e"); - -function d3_scale_logp(x) { - return Math.log(x) / Math.LN10; -} - -function d3_scale_logn(x) { - return -Math.log(-x) / Math.LN10; -} - -d3_scale_logp.pow = function(x) { - return Math.pow(10, x); -}; - -d3_scale_logn.pow = function(x) { - return -Math.pow(10, -x); -}; -d3.scale.pow = function() { - return d3_scale_pow(d3.scale.linear(), 1); -}; - -function d3_scale_pow(linear, exponent) { - var powp = d3_scale_powPow(exponent), - powb = d3_scale_powPow(1 / exponent); - - function scale(x) { - return linear(powp(x)); - } - - scale.invert = function(x) { - return powb(linear.invert(x)); - }; - - scale.domain = function(x) { - if (!arguments.length) return linear.domain().map(powb); - linear.domain(x.map(powp)); - return scale; - }; - - scale.ticks = function(m) { - return d3_scale_linearTicks(scale.domain(), m); - }; - - scale.tickFormat = function(m) { - return d3_scale_linearTickFormat(scale.domain(), m); - }; - - scale.nice = function() { - return scale.domain(d3_scale_nice(scale.domain(), d3_scale_linearNice)); - }; - - scale.exponent = function(x) { - if (!arguments.length) return exponent; - var domain = scale.domain(); - powp = d3_scale_powPow(exponent = x); - powb = d3_scale_powPow(1 / exponent); - return scale.domain(domain); - }; - - scale.copy = function() { - return d3_scale_pow(linear.copy(), exponent); - }; - - return d3_scale_linearRebind(scale, linear); -}; - -function d3_scale_powPow(e) { - return function(x) { - return x < 0 ? -Math.pow(-x, e) : Math.pow(x, e); - }; -} -d3.scale.sqrt = function() { - return d3.scale.pow().exponent(.5); -}; -d3.scale.ordinal = function() { - return d3_scale_ordinal([], {t: "range", x: []}); -}; - -function d3_scale_ordinal(domain, ranger) { - var index, - range, - rangeBand; - - function scale(x) { - return range[((index[x] || (index[x] = domain.push(x))) - 1) % range.length]; - } - - function steps(start, step) { - return d3.range(domain.length).map(function(i) { return start + step * i; }); - } - - scale.domain = function(x) { - if (!arguments.length) return domain; - domain = []; - index = {}; - var i = -1, n = x.length, xi; - while (++i < n) if (!index[xi = x[i]]) index[xi] = domain.push(xi); - return scale[ranger.t](ranger.x, ranger.p); - }; - - scale.range = function(x) { - if (!arguments.length) return range; - range = x; - rangeBand = 0; - ranger = {t: "range", x: x}; - return scale; - }; - - scale.rangePoints = function(x, padding) { - if (arguments.length < 2) padding = 0; - var start = x[0], - stop = x[1], - step = (stop - start) / (domain.length - 1 + padding); - range = steps(domain.length < 2 ? (start + stop) / 2 : start + step * padding / 2, step); - rangeBand = 0; - ranger = {t: "rangePoints", x: x, p: padding}; - return scale; - }; - - scale.rangeBands = function(x, padding) { - if (arguments.length < 2) padding = 0; - var start = x[0], - stop = x[1], - step = (stop - start) / (domain.length + padding); - range = steps(start + step * padding, step); - rangeBand = step * (1 - padding); - ranger = {t: "rangeBands", x: x, p: padding}; - return scale; - }; - - scale.rangeRoundBands = function(x, padding) { - if (arguments.length < 2) padding = 0; - var start = x[0], - stop = x[1], - step = Math.floor((stop - start) / (domain.length + padding)); - range = steps(start + Math.round((stop - start - (domain.length - padding) * step) / 2), step); - rangeBand = Math.round(step * (1 - padding)); - ranger = {t: "rangeRoundBands", x: x, p: padding}; - return scale; - }; - - scale.rangeBand = function() { - return rangeBand; - }; - - scale.rangeExtent = function() { - return ranger.t === "range" ? d3_scaleExtent(ranger.x) : ranger.x; - }; - - scale.copy = function() { - return d3_scale_ordinal(domain, ranger); - }; - - return scale.domain(domain); -}; -/* - * This product includes color specifications and designs developed by Cynthia - * Brewer (http://colorbrewer.org/). See lib/colorbrewer for more information. - */ - -d3.scale.category10 = function() { - return d3.scale.ordinal().range(d3_category10); -}; - -d3.scale.category20 = function() { - return d3.scale.ordinal().range(d3_category20); -}; - -d3.scale.category20b = function() { - return d3.scale.ordinal().range(d3_category20b); -}; - -d3.scale.category20c = function() { - return d3.scale.ordinal().range(d3_category20c); -}; - -var d3_category10 = [ - "#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", - "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf" -]; - -var d3_category20 = [ - "#1f77b4", "#aec7e8", - "#ff7f0e", "#ffbb78", - "#2ca02c", "#98df8a", - "#d62728", "#ff9896", - "#9467bd", "#c5b0d5", - "#8c564b", "#c49c94", - "#e377c2", "#f7b6d2", - "#7f7f7f", "#c7c7c7", - "#bcbd22", "#dbdb8d", - "#17becf", "#9edae5" -]; - -var d3_category20b = [ - "#393b79", "#5254a3", "#6b6ecf", "#9c9ede", - "#637939", "#8ca252", "#b5cf6b", "#cedb9c", - "#8c6d31", "#bd9e39", "#e7ba52", "#e7cb94", - "#843c39", "#ad494a", "#d6616b", "#e7969c", - "#7b4173", "#a55194", "#ce6dbd", "#de9ed6" -]; - -var d3_category20c = [ - "#3182bd", "#6baed6", "#9ecae1", "#c6dbef", - "#e6550d", "#fd8d3c", "#fdae6b", "#fdd0a2", - "#31a354", "#74c476", "#a1d99b", "#c7e9c0", - "#756bb1", "#9e9ac8", "#bcbddc", "#dadaeb", - "#636363", "#969696", "#bdbdbd", "#d9d9d9" -]; -d3.scale.quantile = function() { - return d3_scale_quantile([], []); -}; - -function d3_scale_quantile(domain, range) { - var thresholds; - - function rescale() { - var k = 0, - n = domain.length, - q = range.length; - thresholds = []; - while (++k < q) thresholds[k - 1] = d3.quantile(domain, k / q); - return scale; - } - - function scale(x) { - if (isNaN(x = +x)) return NaN; - return range[d3.bisect(thresholds, x)]; - } - - scale.domain = function(x) { - if (!arguments.length) return domain; - domain = x.filter(function(d) { return !isNaN(d); }).sort(d3.ascending); - return rescale(); - }; - - scale.range = function(x) { - if (!arguments.length) return range; - range = x; - return rescale(); - }; - - scale.quantiles = function() { - return thresholds; - }; - - scale.copy = function() { - return d3_scale_quantile(domain, range); // copy on write! - }; - - return rescale(); -}; -d3.scale.quantize = function() { - return d3_scale_quantize(0, 1, [0, 1]); -}; - -function d3_scale_quantize(x0, x1, range) { - var kx, i; - - function scale(x) { - return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x0))))]; - } - - function rescale() { - kx = range.length / (x1 - x0); - i = range.length - 1; - return scale; - } - - scale.domain = function(x) { - if (!arguments.length) return [x0, x1]; - x0 = +x[0]; - x1 = +x[x.length - 1]; - return rescale(); - }; - - scale.range = function(x) { - if (!arguments.length) return range; - range = x; - return rescale(); - }; - - scale.copy = function() { - return d3_scale_quantize(x0, x1, range); // copy on write - }; - - return rescale(); -}; -d3.svg = {}; -d3.svg.arc = function() { - var innerRadius = d3_svg_arcInnerRadius, - outerRadius = d3_svg_arcOuterRadius, - startAngle = d3_svg_arcStartAngle, - endAngle = d3_svg_arcEndAngle; - - function arc() { - var r0 = innerRadius.apply(this, arguments), - r1 = outerRadius.apply(this, arguments), - a0 = startAngle.apply(this, arguments) + d3_svg_arcOffset, - a1 = endAngle.apply(this, arguments) + d3_svg_arcOffset, - da = (a1 < a0 && (da = a0, a0 = a1, a1 = da), a1 - a0), - df = da < Math.PI ? "0" : "1", - c0 = Math.cos(a0), - s0 = Math.sin(a0), - c1 = Math.cos(a1), - s1 = Math.sin(a1); - return da >= d3_svg_arcMax - ? (r0 - ? "M0," + r1 - + "A" + r1 + "," + r1 + " 0 1,1 0," + (-r1) - + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 - + "M0," + r0 - + "A" + r0 + "," + r0 + " 0 1,0 0," + (-r0) - + "A" + r0 + "," + r0 + " 0 1,0 0," + r0 - + "Z" - : "M0," + r1 - + "A" + r1 + "," + r1 + " 0 1,1 0," + (-r1) - + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 - + "Z") - : (r0 - ? "M" + r1 * c0 + "," + r1 * s0 - + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1 - + "L" + r0 * c1 + "," + r0 * s1 - + "A" + r0 + "," + r0 + " 0 " + df + ",0 " + r0 * c0 + "," + r0 * s0 - + "Z" - : "M" + r1 * c0 + "," + r1 * s0 - + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1 - + "L0,0" - + "Z"); - } - - arc.innerRadius = function(v) { - if (!arguments.length) return innerRadius; - innerRadius = d3.functor(v); - return arc; - }; - - arc.outerRadius = function(v) { - if (!arguments.length) return outerRadius; - outerRadius = d3.functor(v); - return arc; - }; - - arc.startAngle = function(v) { - if (!arguments.length) return startAngle; - startAngle = d3.functor(v); - return arc; - }; - - arc.endAngle = function(v) { - if (!arguments.length) return endAngle; - endAngle = d3.functor(v); - return arc; - }; - - arc.centroid = function() { - var r = (innerRadius.apply(this, arguments) - + outerRadius.apply(this, arguments)) / 2, - a = (startAngle.apply(this, arguments) - + endAngle.apply(this, arguments)) / 2 + d3_svg_arcOffset; - return [Math.cos(a) * r, Math.sin(a) * r]; - }; - - return arc; -}; - -var d3_svg_arcOffset = -Math.PI / 2, - d3_svg_arcMax = 2 * Math.PI - 1e-6; - -function d3_svg_arcInnerRadius(d) { - return d.innerRadius; -} - -function d3_svg_arcOuterRadius(d) { - return d.outerRadius; -} - -function d3_svg_arcStartAngle(d) { - return d.startAngle; -} - -function d3_svg_arcEndAngle(d) { - return d.endAngle; -} -function d3_svg_line(projection) { - var x = d3_svg_lineX, - y = d3_svg_lineY, - interpolate = "linear", - interpolator = d3_svg_lineInterpolators[interpolate], - tension = .7; - - function line(d) { - return d.length < 1 ? null : "M" + interpolator(projection(d3_svg_linePoints(this, d, x, y)), tension); - } - - line.x = function(v) { - if (!arguments.length) return x; - x = v; - return line; - }; - - line.y = function(v) { - if (!arguments.length) return y; - y = v; - return line; - }; - - line.interpolate = function(v) { - if (!arguments.length) return interpolate; - interpolator = d3_svg_lineInterpolators[interpolate = v]; - return line; - }; - - line.tension = function(v) { - if (!arguments.length) return tension; - tension = v; - return line; - }; - - return line; -} - -d3.svg.line = function() { - return d3_svg_line(Object); -}; - -// Converts the specified array of data into an array of points -// (x-y tuples), by evaluating the specified `x` and `y` functions on each -// data point. The `this` context of the evaluated functions is the specified -// "self" object; each function is passed the current datum and index. -function d3_svg_linePoints(self, d, x, y) { - var points = [], - i = -1, - n = d.length, - fx = typeof x === "function", - fy = typeof y === "function", - value; - if (fx && fy) { - while (++i < n) points.push([ - x.call(self, value = d[i], i), - y.call(self, value, i) - ]); - } else if (fx) { - while (++i < n) points.push([x.call(self, d[i], i), y]); - } else if (fy) { - while (++i < n) points.push([x, y.call(self, d[i], i)]); - } else { - while (++i < n) points.push([x, y]); - } - return points; -} - -// The default `x` property, which references d[0]. -function d3_svg_lineX(d) { - return d[0]; -} - -// The default `y` property, which references d[1]. -function d3_svg_lineY(d) { - return d[1]; -} - -// The various interpolators supported by the `line` class. -var d3_svg_lineInterpolators = { - "linear": d3_svg_lineLinear, - "step-before": d3_svg_lineStepBefore, - "step-after": d3_svg_lineStepAfter, - "basis": d3_svg_lineBasis, - "basis-open": d3_svg_lineBasisOpen, - "basis-closed": d3_svg_lineBasisClosed, - "bundle": d3_svg_lineBundle, - "cardinal": d3_svg_lineCardinal, - "cardinal-open": d3_svg_lineCardinalOpen, - "cardinal-closed": d3_svg_lineCardinalClosed, - "monotone": d3_svg_lineMonotone -}; - -// Linear interpolation; generates "L" commands. -function d3_svg_lineLinear(points) { - var i = 0, - n = points.length, - p = points[0], - path = [p[0], ",", p[1]]; - while (++i < n) path.push("L", (p = points[i])[0], ",", p[1]); - return path.join(""); -} - -// Step interpolation; generates "H" and "V" commands. -function d3_svg_lineStepBefore(points) { - var i = 0, - n = points.length, - p = points[0], - path = [p[0], ",", p[1]]; - while (++i < n) path.push("V", (p = points[i])[1], "H", p[0]); - return path.join(""); -} - -// Step interpolation; generates "H" and "V" commands. -function d3_svg_lineStepAfter(points) { - var i = 0, - n = points.length, - p = points[0], - path = [p[0], ",", p[1]]; - while (++i < n) path.push("H", (p = points[i])[0], "V", p[1]); - return path.join(""); -} - -// Open cardinal spline interpolation; generates "C" commands. -function d3_svg_lineCardinalOpen(points, tension) { - return points.length < 4 - ? d3_svg_lineLinear(points) - : points[1] + d3_svg_lineHermite(points.slice(1, points.length - 1), - d3_svg_lineCardinalTangents(points, tension)); -} - -// Closed cardinal spline interpolation; generates "C" commands. -function d3_svg_lineCardinalClosed(points, tension) { - return points.length < 3 - ? d3_svg_lineLinear(points) - : points[0] + d3_svg_lineHermite((points.push(points[0]), points), - d3_svg_lineCardinalTangents([points[points.length - 2]] - .concat(points, [points[1]]), tension)); -} - -// Cardinal spline interpolation; generates "C" commands. -function d3_svg_lineCardinal(points, tension, closed) { - return points.length < 3 - ? d3_svg_lineLinear(points) - : points[0] + d3_svg_lineHermite(points, - d3_svg_lineCardinalTangents(points, tension)); -} - -// Hermite spline construction; generates "C" commands. -function d3_svg_lineHermite(points, tangents) { - if (tangents.length < 1 - || (points.length != tangents.length - && points.length != tangents.length + 2)) { - return d3_svg_lineLinear(points); - } - - var quad = points.length != tangents.length, - path = "", - p0 = points[0], - p = points[1], - t0 = tangents[0], - t = t0, - pi = 1; - - if (quad) { - path += "Q" + (p[0] - t0[0] * 2 / 3) + "," + (p[1] - t0[1] * 2 / 3) - + "," + p[0] + "," + p[1]; - p0 = points[1]; - pi = 2; - } - - if (tangents.length > 1) { - t = tangents[1]; - p = points[pi]; - pi++; - path += "C" + (p0[0] + t0[0]) + "," + (p0[1] + t0[1]) - + "," + (p[0] - t[0]) + "," + (p[1] - t[1]) - + "," + p[0] + "," + p[1]; - for (var i = 2; i < tangents.length; i++, pi++) { - p = points[pi]; - t = tangents[i]; - path += "S" + (p[0] - t[0]) + "," + (p[1] - t[1]) - + "," + p[0] + "," + p[1]; - } - } - - if (quad) { - var lp = points[pi]; - path += "Q" + (p[0] + t[0] * 2 / 3) + "," + (p[1] + t[1] * 2 / 3) - + "," + lp[0] + "," + lp[1]; - } - - return path; -} - -// Generates tangents for a cardinal spline. -function d3_svg_lineCardinalTangents(points, tension) { - var tangents = [], - a = (1 - tension) / 2, - p0, - p1 = points[0], - p2 = points[1], - i = 1, - n = points.length; - while (++i < n) { - p0 = p1; - p1 = p2; - p2 = points[i]; - tangents.push([a * (p2[0] - p0[0]), a * (p2[1] - p0[1])]); - } - return tangents; -} - -// B-spline interpolation; generates "C" commands. -function d3_svg_lineBasis(points) { - if (points.length < 3) return d3_svg_lineLinear(points); - var i = 1, - n = points.length, - pi = points[0], - x0 = pi[0], - y0 = pi[1], - px = [x0, x0, x0, (pi = points[1])[0]], - py = [y0, y0, y0, pi[1]], - path = [x0, ",", y0]; - d3_svg_lineBasisBezier(path, px, py); - while (++i < n) { - pi = points[i]; - px.shift(); px.push(pi[0]); - py.shift(); py.push(pi[1]); - d3_svg_lineBasisBezier(path, px, py); - } - i = -1; - while (++i < 2) { - px.shift(); px.push(pi[0]); - py.shift(); py.push(pi[1]); - d3_svg_lineBasisBezier(path, px, py); - } - return path.join(""); -} - -// Open B-spline interpolation; generates "C" commands. -function d3_svg_lineBasisOpen(points) { - if (points.length < 4) return d3_svg_lineLinear(points); - var path = [], - i = -1, - n = points.length, - pi, - px = [0], - py = [0]; - while (++i < 3) { - pi = points[i]; - px.push(pi[0]); - py.push(pi[1]); - } - path.push(d3_svg_lineDot4(d3_svg_lineBasisBezier3, px) - + "," + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py)); - --i; while (++i < n) { - pi = points[i]; - px.shift(); px.push(pi[0]); - py.shift(); py.push(pi[1]); - d3_svg_lineBasisBezier(path, px, py); - } - return path.join(""); -} - -// Closed B-spline interpolation; generates "C" commands. -function d3_svg_lineBasisClosed(points) { - var path, - i = -1, - n = points.length, - m = n + 4, - pi, - px = [], - py = []; - while (++i < 4) { - pi = points[i % n]; - px.push(pi[0]); - py.push(pi[1]); - } - path = [ - d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", - d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) - ]; - --i; while (++i < m) { - pi = points[i % n]; - px.shift(); px.push(pi[0]); - py.shift(); py.push(pi[1]); - d3_svg_lineBasisBezier(path, px, py); - } - return path.join(""); -} - -function d3_svg_lineBundle(points, tension) { - var n = points.length - 1, - x0 = points[0][0], - y0 = points[0][1], - dx = points[n][0] - x0, - dy = points[n][1] - y0, - i = -1, - p, - t; - while (++i <= n) { - p = points[i]; - t = i / n; - p[0] = tension * p[0] + (1 - tension) * (x0 + t * dx); - p[1] = tension * p[1] + (1 - tension) * (y0 + t * dy); - } - return d3_svg_lineBasis(points); -} - -// Returns the dot product of the given four-element vectors. -function d3_svg_lineDot4(a, b) { - return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; -} - -// Matrix to transform basis (b-spline) control points to bezier -// control points. Derived from FvD 11.2.8. -var d3_svg_lineBasisBezier1 = [0, 2/3, 1/3, 0], - d3_svg_lineBasisBezier2 = [0, 1/3, 2/3, 0], - d3_svg_lineBasisBezier3 = [0, 1/6, 2/3, 1/6]; - -// Pushes a "C" Bézier curve onto the specified path array, given the -// two specified four-element arrays which define the control points. -function d3_svg_lineBasisBezier(path, x, y) { - path.push( - "C", d3_svg_lineDot4(d3_svg_lineBasisBezier1, x), - ",", d3_svg_lineDot4(d3_svg_lineBasisBezier1, y), - ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, x), - ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, y), - ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, x), - ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, y)); -} - -// Computes the slope from points p0 to p1. -function d3_svg_lineSlope(p0, p1) { - return (p1[1] - p0[1]) / (p1[0] - p0[0]); -} - -// Compute three-point differences for the given points. -// http://en.wikipedia.org/wiki/Cubic_Hermite_spline#Finite_difference -function d3_svg_lineFiniteDifferences(points) { - var i = 0, - j = points.length - 1, - m = [], - p0 = points[0], - p1 = points[1], - d = m[0] = d3_svg_lineSlope(p0, p1); - while (++i < j) { - m[i] = d + (d = d3_svg_lineSlope(p0 = p1, p1 = points[i + 1])); - } - m[i] = d; - return m; -} - -// Interpolates the given points using Fritsch-Carlson Monotone cubic Hermite -// interpolation. Returns an array of tangent vectors. For details, see -// http://en.wikipedia.org/wiki/Monotone_cubic_interpolation -function d3_svg_lineMonotoneTangents(points) { - var tangents = [], - d, - a, - b, - s, - m = d3_svg_lineFiniteDifferences(points), - i = -1, - j = points.length - 1; - - // The first two steps are done by computing finite-differences: - // 1. Compute the slopes of the secant lines between successive points. - // 2. Initialize the tangents at every point as the average of the secants. - - // Then, for each segment… - while (++i < j) { - d = d3_svg_lineSlope(points[i], points[i + 1]); - - // 3. If two successive yk = y{k + 1} are equal (i.e., d is zero), then set - // mk = m{k + 1} = 0 as the spline connecting these points must be flat to - // preserve monotonicity. Ignore step 4 and 5 for those k. - - if (Math.abs(d) < 1e-6) { - m[i] = m[i + 1] = 0; - } else { - // 4. Let ak = mk / dk and bk = m{k + 1} / dk. - a = m[i] / d; - b = m[i + 1] / d; - - // 5. Prevent overshoot and ensure monotonicity by restricting the - // magnitude of vector <ak, bk> to a circle of radius 3. - s = a * a + b * b; - if (s > 9) { - s = d * 3 / Math.sqrt(s); - m[i] = s * a; - m[i + 1] = s * b; - } - } - } - - // Compute the normalized tangent vector from the slopes. Note that if x is - // not monotonic, it's possible that the slope will be infinite, so we protect - // against NaN by setting the coordinate to zero. - i = -1; while (++i <= j) { - s = (points[Math.min(j, i + 1)][0] - points[Math.max(0, i - 1)][0]) - / (6 * (1 + m[i] * m[i])); - tangents.push([s || 0, m[i] * s || 0]); - } - - return tangents; -} - -function d3_svg_lineMonotone(points) { - return points.length < 3 - ? d3_svg_lineLinear(points) - : points[0] + - d3_svg_lineHermite(points, d3_svg_lineMonotoneTangents(points)); -} -d3.svg.line.radial = function() { - var line = d3_svg_line(d3_svg_lineRadial); - line.radius = line.x, delete line.x; - line.angle = line.y, delete line.y; - return line; -}; - -function d3_svg_lineRadial(points) { - var point, - i = -1, - n = points.length, - r, - a; - while (++i < n) { - point = points[i]; - r = point[0]; - a = point[1] + d3_svg_arcOffset; - point[0] = r * Math.cos(a); - point[1] = r * Math.sin(a); - } - return points; -} -function d3_svg_area(projection) { - var x0 = d3_svg_lineX, - x1 = d3_svg_lineX, - y0 = 0, - y1 = d3_svg_lineY, - interpolate, - i0, - i1, - tension = .7; - - function area(d) { - if (d.length < 1) return null; - var points0 = d3_svg_linePoints(this, d, x0, y0), - points1 = d3_svg_linePoints(this, d, x0 === x1 ? d3_svg_areaX(points0) : x1, y0 === y1 ? d3_svg_areaY(points0) : y1); - return "M" + i0(projection(points1), tension) - + "L" + i1(projection(points0.reverse()), tension) - + "Z"; - } - - area.x = function(x) { - if (!arguments.length) return x1; - x0 = x1 = x; - return area; - }; - - area.x0 = function(x) { - if (!arguments.length) return x0; - x0 = x; - return area; - }; - - area.x1 = function(x) { - if (!arguments.length) return x1; - x1 = x; - return area; - }; - - area.y = function(y) { - if (!arguments.length) return y1; - y0 = y1 = y; - return area; - }; - - area.y0 = function(y) { - if (!arguments.length) return y0; - y0 = y; - return area; - }; - - area.y1 = function(y) { - if (!arguments.length) return y1; - y1 = y; - return area; - }; - - area.interpolate = function(x) { - if (!arguments.length) return interpolate; - i0 = d3_svg_lineInterpolators[interpolate = x]; - i1 = i0.reverse || i0; - return area; - }; - - area.tension = function(x) { - if (!arguments.length) return tension; - tension = x; - return area; - }; - - return area.interpolate("linear"); -} - -d3_svg_lineStepBefore.reverse = d3_svg_lineStepAfter; -d3_svg_lineStepAfter.reverse = d3_svg_lineStepBefore; - -d3.svg.area = function() { - return d3_svg_area(Object); -}; - -function d3_svg_areaX(points) { - return function(d, i) { - return points[i][0]; - }; -} - -function d3_svg_areaY(points) { - return function(d, i) { - return points[i][1]; - }; -} -d3.svg.area.radial = function() { - var area = d3_svg_area(d3_svg_lineRadial); - area.radius = area.x, delete area.x; - area.innerRadius = area.x0, delete area.x0; - area.outerRadius = area.x1, delete area.x1; - area.angle = area.y, delete area.y; - area.startAngle = area.y0, delete area.y0; - area.endAngle = area.y1, delete area.y1; - return area; -}; -d3.svg.chord = function() { - var source = d3_svg_chordSource, - target = d3_svg_chordTarget, - radius = d3_svg_chordRadius, - startAngle = d3_svg_arcStartAngle, - endAngle = d3_svg_arcEndAngle; - - // TODO Allow control point to be customized. - - function chord(d, i) { - var s = subgroup(this, source, d, i), - t = subgroup(this, target, d, i); - return "M" + s.p0 - + arc(s.r, s.p1, s.a1 - s.a0) + (equals(s, t) - ? curve(s.r, s.p1, s.r, s.p0) - : curve(s.r, s.p1, t.r, t.p0) - + arc(t.r, t.p1, t.a1 - t.a0) - + curve(t.r, t.p1, s.r, s.p0)) - + "Z"; - } - - function subgroup(self, f, d, i) { - var subgroup = f.call(self, d, i), - r = radius.call(self, subgroup, i), - a0 = startAngle.call(self, subgroup, i) + d3_svg_arcOffset, - a1 = endAngle.call(self, subgroup, i) + d3_svg_arcOffset; - return { - r: r, - a0: a0, - a1: a1, - p0: [r * Math.cos(a0), r * Math.sin(a0)], - p1: [r * Math.cos(a1), r * Math.sin(a1)] - }; - } - - function equals(a, b) { - return a.a0 == b.a0 && a.a1 == b.a1; - } - - function arc(r, p, a) { - return "A" + r + "," + r + " 0 " + +(a > Math.PI) + ",1 " + p; - } - - function curve(r0, p0, r1, p1) { - return "Q 0,0 " + p1; - } - - chord.radius = function(v) { - if (!arguments.length) return radius; - radius = d3.functor(v); - return chord; - }; - - chord.source = function(v) { - if (!arguments.length) return source; - source = d3.functor(v); - return chord; - }; - - chord.target = function(v) { - if (!arguments.length) return target; - target = d3.functor(v); - return chord; - }; - - chord.startAngle = function(v) { - if (!arguments.length) return startAngle; - startAngle = d3.functor(v); - return chord; - }; - - chord.endAngle = function(v) { - if (!arguments.length) return endAngle; - endAngle = d3.functor(v); - return chord; - }; - - return chord; -}; - -function d3_svg_chordSource(d) { - return d.source; -} - -function d3_svg_chordTarget(d) { - return d.target; -} - -function d3_svg_chordRadius(d) { - return d.radius; -} - -function d3_svg_chordStartAngle(d) { - return d.startAngle; -} - -function d3_svg_chordEndAngle(d) { - return d.endAngle; -} -d3.svg.diagonal = function() { - var source = d3_svg_chordSource, - target = d3_svg_chordTarget, - projection = d3_svg_diagonalProjection; - - function diagonal(d, i) { - var p0 = source.call(this, d, i), - p3 = target.call(this, d, i), - m = (p0.y + p3.y) / 2, - p = [p0, {x: p0.x, y: m}, {x: p3.x, y: m}, p3]; - p = p.map(projection); - return "M" + p[0] + "C" + p[1] + " " + p[2] + " " + p[3]; - } - - diagonal.source = function(x) { - if (!arguments.length) return source; - source = d3.functor(x); - return diagonal; - }; - - diagonal.target = function(x) { - if (!arguments.length) return target; - target = d3.functor(x); - return diagonal; - }; - - diagonal.projection = function(x) { - if (!arguments.length) return projection; - projection = x; - return diagonal; - }; - - return diagonal; -}; - -function d3_svg_diagonalProjection(d) { - return [d.x, d.y]; -} -d3.svg.diagonal.radial = function() { - var diagonal = d3.svg.diagonal(), - projection = d3_svg_diagonalProjection, - projection_ = diagonal.projection; - - diagonal.projection = function(x) { - return arguments.length - ? projection_(d3_svg_diagonalRadialProjection(projection = x)) - : projection; - }; - - return diagonal; -}; - -function d3_svg_diagonalRadialProjection(projection) { - return function() { - var d = projection.apply(this, arguments), - r = d[0], - a = d[1] + d3_svg_arcOffset; - return [r * Math.cos(a), r * Math.sin(a)]; - }; -} -d3.svg.mouse = function(container) { - return d3_svg_mousePoint(container, d3.event); -}; - -// https://bugs.webkit.org/show_bug.cgi?id=44083 -var d3_mouse_bug44083 = /WebKit/.test(navigator.userAgent) ? -1 : 0; - -function d3_svg_mousePoint(container, e) { - var point = (container.ownerSVGElement || container).createSVGPoint(); - if ((d3_mouse_bug44083 < 0) && (window.scrollX || window.scrollY)) { - var svg = d3.select(document.body) - .append("svg") - .style("position", "absolute") - .style("top", 0) - .style("left", 0); - var ctm = svg[0][0].getScreenCTM(); - d3_mouse_bug44083 = !(ctm.f || ctm.e); - svg.remove(); - } - if (d3_mouse_bug44083) { - point.x = e.pageX; - point.y = e.pageY; - } else { - point.x = e.clientX; - point.y = e.clientY; - } - point = point.matrixTransform(container.getScreenCTM().inverse()); - return [point.x, point.y]; -}; -d3.svg.touches = function(container, touches) { - if (arguments.length < 2) touches = d3.event.touches; - - return touches ? d3_array(touches).map(function(touch) { - var point = d3_svg_mousePoint(container, touch); - point.identifier = touch.identifier; - return point; - }) : []; -}; -d3.svg.symbol = function() { - var type = d3_svg_symbolType, - size = d3_svg_symbolSize; - - function symbol(d, i) { - return (d3_svg_symbols[type.call(this, d, i)] - || d3_svg_symbols.circle) - (size.call(this, d, i)); - } - - symbol.type = function(x) { - if (!arguments.length) return type; - type = d3.functor(x); - return symbol; - }; - - // size of symbol in square pixels - symbol.size = function(x) { - if (!arguments.length) return size; - size = d3.functor(x); - return symbol; - }; - - return symbol; -}; - -function d3_svg_symbolSize() { - return 64; -} - -function d3_svg_symbolType() { - return "circle"; -} - -// TODO cross-diagonal? -var d3_svg_symbols = { - "circle": function(size) { - var r = Math.sqrt(size / Math.PI); - return "M0," + r - + "A" + r + "," + r + " 0 1,1 0," + (-r) - + "A" + r + "," + r + " 0 1,1 0," + r - + "Z"; - }, - "cross": function(size) { - var r = Math.sqrt(size / 5) / 2; - return "M" + -3 * r + "," + -r - + "H" + -r - + "V" + -3 * r - + "H" + r - + "V" + -r - + "H" + 3 * r - + "V" + r - + "H" + r - + "V" + 3 * r - + "H" + -r - + "V" + r - + "H" + -3 * r - + "Z"; - }, - "diamond": function(size) { - var ry = Math.sqrt(size / (2 * d3_svg_symbolTan30)), - rx = ry * d3_svg_symbolTan30; - return "M0," + -ry - + "L" + rx + ",0" - + " 0," + ry - + " " + -rx + ",0" - + "Z"; - }, - "square": function(size) { - var r = Math.sqrt(size) / 2; - return "M" + -r + "," + -r - + "L" + r + "," + -r - + " " + r + "," + r - + " " + -r + "," + r - + "Z"; - }, - "triangle-down": function(size) { - var rx = Math.sqrt(size / d3_svg_symbolSqrt3), - ry = rx * d3_svg_symbolSqrt3 / 2; - return "M0," + ry - + "L" + rx +"," + -ry - + " " + -rx + "," + -ry - + "Z"; - }, - "triangle-up": function(size) { - var rx = Math.sqrt(size / d3_svg_symbolSqrt3), - ry = rx * d3_svg_symbolSqrt3 / 2; - return "M0," + -ry - + "L" + rx +"," + ry - + " " + -rx + "," + ry - + "Z"; - } -}; - -d3.svg.symbolTypes = d3.keys(d3_svg_symbols); - -var d3_svg_symbolSqrt3 = Math.sqrt(3), - d3_svg_symbolTan30 = Math.tan(30 * Math.PI / 180); -d3.svg.axis = function() { - var scale = d3.scale.linear(), - orient = "bottom", - tickMajorSize = 6, - tickMinorSize = 6, - tickEndSize = 6, - tickPadding = 3, - tickArguments_ = [10], - tickFormat_, - tickSubdivide = 0; - - function axis(selection) { - selection.each(function(d, i, j) { - var g = d3.select(this); - - // If selection is a transition, create subtransitions. - var transition = selection.delay ? function(o) { - var id = d3_transitionInheritId; - try { - d3_transitionInheritId = selection.id; - return o.transition() - .delay(selection[j][i].delay) - .duration(selection[j][i].duration) - .ease(selection.ease()); - } finally { - d3_transitionInheritId = id; - } - } : Object; - - // Ticks, or domain values for ordinal scales. - var ticks = scale.ticks ? scale.ticks.apply(scale, tickArguments_) : scale.domain(), - tickFormat = tickFormat_ == null ? (scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments_) : String) : tickFormat_; - - // Minor ticks. - var subticks = d3_svg_axisSubdivide(scale, ticks, tickSubdivide), - subtick = g.selectAll(".minor").data(subticks, String), - subtickEnter = subtick.enter().insert("line", "g").attr("class", "tick minor").style("opacity", 1e-6), - subtickExit = transition(subtick.exit()).style("opacity", 1e-6).remove(), - subtickUpdate = transition(subtick).style("opacity", 1); - - // Major ticks. - var tick = g.selectAll("g").data(ticks, String), - tickEnter = tick.enter().insert("g", "path").style("opacity", 1e-6), - tickExit = transition(tick.exit()).style("opacity", 1e-6).remove(), - tickUpdate = transition(tick).style("opacity", 1), - tickTransform; - - // Domain. - var range = d3_scaleRange(scale), - path = g.selectAll(".domain").data([0]), - pathEnter = path.enter().append("path").attr("class", "domain"), - pathUpdate = transition(path); - - // Stash a snapshot of the new scale, and retrieve the old snapshot. - var scale1 = scale.copy(), - scale0 = this.__chart__ || scale1; - this.__chart__ = scale1; - - tickEnter.append("line").attr("class", "tick"); - tickEnter.append("text"); - tickUpdate.select("text").text(tickFormat); - - switch (orient) { - case "bottom": { - tickTransform = d3_svg_axisX; - subtickUpdate.attr("x2", 0).attr("y2", tickMinorSize); - tickUpdate.select("line").attr("x2", 0).attr("y2", tickMajorSize); - tickUpdate.select("text").attr("x", 0).attr("y", Math.max(tickMajorSize, 0) + tickPadding).attr("dy", ".71em").attr("text-anchor", "middle"); - pathUpdate.attr("d", "M" + range[0] + "," + tickEndSize + "V0H" + range[1] + "V" + tickEndSize); - break; - } - case "top": { - tickTransform = d3_svg_axisX; - subtickUpdate.attr("x2", 0).attr("y2", -tickMinorSize); - tickUpdate.select("line").attr("x2", 0).attr("y2", -tickMajorSize); - tickUpdate.select("text").attr("x", 0).attr("y", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("dy", "0em").attr("text-anchor", "middle"); - pathUpdate.attr("d", "M" + range[0] + "," + -tickEndSize + "V0H" + range[1] + "V" + -tickEndSize); - break; - } - case "left": { - tickTransform = d3_svg_axisY; - subtickUpdate.attr("x2", -tickMinorSize).attr("y2", 0); - tickUpdate.select("line").attr("x2", -tickMajorSize).attr("y2", 0); - tickUpdate.select("text").attr("x", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("y", 0).attr("dy", ".32em").attr("text-anchor", "end"); - pathUpdate.attr("d", "M" + -tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + -tickEndSize); - break; - } - case "right": { - tickTransform = d3_svg_axisY; - subtickUpdate.attr("x2", tickMinorSize).attr("y2", 0); - tickUpdate.select("line").attr("x2", tickMajorSize).attr("y2", 0); - tickUpdate.select("text").attr("x", Math.max(tickMajorSize, 0) + tickPadding).attr("y", 0).attr("dy", ".32em").attr("text-anchor", "start"); - pathUpdate.attr("d", "M" + tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + tickEndSize); - break; - } - } - - // For quantitative scales: - // - enter new ticks from the old scale - // - exit old ticks to the new scale - if (scale.ticks) { - tickEnter.call(tickTransform, scale0); - tickUpdate.call(tickTransform, scale1); - tickExit.call(tickTransform, scale1); - subtickEnter.call(tickTransform, scale0); - subtickUpdate.call(tickTransform, scale1); - subtickExit.call(tickTransform, scale1); - } - - // For ordinal scales: - // - any entering ticks are undefined in the old scale - // - any exiting ticks are undefined in the new scale - // Therefore, we only need to transition updating ticks. - else { - var dx = scale1.rangeBand() / 2, x = function(d) { return scale1(d) + dx; }; - tickEnter.call(tickTransform, x); - tickUpdate.call(tickTransform, x); - } - }); - } - - axis.scale = function(x) { - if (!arguments.length) return scale; - scale = x; - return axis; - }; - - axis.orient = function(x) { - if (!arguments.length) return orient; - orient = x; - return axis; - }; - - axis.ticks = function() { - if (!arguments.length) return tickArguments_; - tickArguments_ = arguments; - return axis; - }; - - axis.tickFormat = function(x) { - if (!arguments.length) return tickFormat_; - tickFormat_ = x; - return axis; - }; - - axis.tickSize = function(x, y, z) { - if (!arguments.length) return tickMajorSize; - var n = arguments.length - 1; - tickMajorSize = +x; - tickMinorSize = n > 1 ? +y : tickMajorSize; - tickEndSize = n > 0 ? +arguments[n] : tickMajorSize; - return axis; - }; - - axis.tickPadding = function(x) { - if (!arguments.length) return tickPadding; - tickPadding = +x; - return axis; - }; - - axis.tickSubdivide = function(x) { - if (!arguments.length) return tickSubdivide; - tickSubdivide = +x; - return axis; - }; - - return axis; -}; - -function d3_svg_axisX(selection, x) { - selection.attr("transform", function(d) { return "translate(" + x(d) + ",0)"; }); -} - -function d3_svg_axisY(selection, y) { - selection.attr("transform", function(d) { return "translate(0," + y(d) + ")"; }); -} - -function d3_svg_axisSubdivide(scale, ticks, m) { - subticks = []; - if (m && ticks.length > 1) { - var extent = d3_scaleExtent(scale.domain()), - subticks, - i = -1, - n = ticks.length, - d = (ticks[1] - ticks[0]) / ++m, - j, - v; - while (++i < n) { - for (j = m; --j > 0;) { - if ((v = +ticks[i] - j * d) >= extent[0]) { - subticks.push(v); - } - } - } - for (--i, j = 0; ++j < m && (v = +ticks[i] + j * d) < extent[1];) { - subticks.push(v); - } - } - return subticks; -} -d3.svg.brush = function() { - var event = d3.dispatch("brushstart", "brush", "brushend"), - x, // x-scale, optional - y, // y-scale, optional - extent = [[0, 0], [0, 0]]; // [x0, y0], [x1, y1] - - function brush(g) { - var resizes = x && y ? ["n", "e", "s", "w", "nw", "ne", "se", "sw"] - : x ? ["e", "w"] - : y ? ["n", "s"] - : []; - - g.each(function() { - var g = d3.select(this).on("mousedown.brush", down), - bg = g.selectAll(".background").data([,]), - fg = g.selectAll(".extent").data([,]), - tz = g.selectAll(".resize").data(resizes, String), - e; - - // An invisible, mouseable area for starting a new brush. - bg.enter().append("rect") - .attr("class", "background") - .style("visibility", "hidden") - .style("pointer-events", "all") - .style("cursor", "crosshair"); - - // The visible brush extent; style this as you like! - fg.enter().append("rect") - .attr("class", "extent") - .style("cursor", "move"); - - // More invisible rects for resizing the extent. - tz.enter().append("rect") - .attr("class", function(d) { return "resize " + d; }) - .attr("width", 6) - .attr("height", 6) - .style("visibility", "hidden") - .style("pointer-events", brush.empty() ? "none" : "all") - .style("cursor", function(d) { return d3_svg_brushCursor[d]; }); - - // Remove any superfluous resizers. - tz.exit().remove(); - - // Initialize the background to fill the defined range. - // If the range isn't defined, you can post-process. - if (x) { - e = d3_scaleRange(x); - bg.attr("x", e[0]).attr("width", e[1] - e[0]); - d3_svg_brushRedrawX(g, extent); - } - if (y) { - e = d3_scaleRange(y); - bg.attr("y", e[0]).attr("height", e[1] - e[0]); - d3_svg_brushRedrawY(g, extent); - } - }); - } - - function down() { - var target = d3.select(d3.event.target); - - // Store some global state for the duration of the brush gesture. - d3_svg_brush = brush; - d3_svg_brushTarget = this; - d3_svg_brushExtent = extent; - d3_svg_brushOffset = d3.svg.mouse(d3_svg_brushTarget); - - // If the extent was clicked on, drag rather than brush; - // store the offset between the mouse and extent origin instead. - if (d3_svg_brushDrag = target.classed("extent")) { - d3_svg_brushOffset[0] = extent[0][0] - d3_svg_brushOffset[0]; - d3_svg_brushOffset[1] = extent[0][1] - d3_svg_brushOffset[1]; - } - - // If a resizer was clicked on, record which side is to be resized. - // Also, set the offset to the opposite side. - else if (target.classed("resize")) { - d3_svg_brushResize = d3.event.target.__data__; - d3_svg_brushOffset[0] = extent[+/w$/.test(d3_svg_brushResize)][0]; - d3_svg_brushOffset[1] = extent[+/^n/.test(d3_svg_brushResize)][1]; - } - - // If the ALT key is down when starting a brush, the center is at the mouse. - else if (d3.event.altKey) { - d3_svg_brushCenter = d3_svg_brushOffset.slice(); - } - - // Restrict which dimensions are resized. - d3_svg_brushX = !/^(n|s)$/.test(d3_svg_brushResize) && x; - d3_svg_brushY = !/^(e|w)$/.test(d3_svg_brushResize) && y; - - // Notify listeners. - d3_svg_brushDispatch = dispatcher(this, arguments); - d3_svg_brushDispatch("brushstart"); - d3_svg_brushMove(); - d3_eventCancel(); - } - - function dispatcher(that, argumentz) { - return function(type) { - var e = d3.event; - try { - d3.event = {type: type, target: brush}; - event[type].apply(that, argumentz); - } finally { - d3.event = e; - } - }; - } - - brush.x = function(z) { - if (!arguments.length) return x; - x = z; - return brush; - }; - - brush.y = function(z) { - if (!arguments.length) return y; - y = z; - return brush; - }; - - brush.extent = function(z) { - var x0, x1, y0, y1, t; - - // Invert the pixel extent to data-space. - if (!arguments.length) { - if (x) { - x0 = extent[0][0], x1 = extent[1][0]; - if (x.invert) x0 = x.invert(x0), x1 = x.invert(x1); - if (x1 < x0) t = x0, x0 = x1, x1 = t; - } - if (y) { - y0 = extent[0][1], y1 = extent[1][1]; - if (y.invert) y0 = y.invert(y0), y1 = y.invert(y1); - if (y1 < y0) t = y0, y0 = y1, y1 = t; - } - return x && y ? [[x0, y0], [x1, y1]] : x ? [x0, x1] : y && [y0, y1]; - } - - // Scale the data-space extent to pixels. - if (x) { - x0 = z[0], x1 = z[1]; - if (y) x0 = x0[0], x1 = x1[0]; - if (x.invert) x0 = x(x0), x1 = x(x1); - if (x1 < x0) t = x0, x0 = x1, x1 = t; - extent[0][0] = x0, extent[1][0] = x1; - } - if (y) { - y0 = z[0], y1 = z[1]; - if (x) y0 = y0[1], y1 = y1[1]; - if (y.invert) y0 = y(y0), y1 = y(y1); - if (y1 < y0) t = y0, y0 = y1, y1 = t; - extent[0][1] = y0, extent[1][1] = y1; - } - - return brush; - }; - - brush.clear = function() { - extent[0][0] = - extent[0][1] = - extent[1][0] = - extent[1][1] = 0; - return brush; - }; - - brush.empty = function() { - return (x && extent[0][0] === extent[1][0]) - || (y && extent[0][1] === extent[1][1]); - }; - - d3.select(window) - .on("mousemove.brush", d3_svg_brushMove) - .on("mouseup.brush", d3_svg_brushUp) - .on("keydown.brush", d3_svg_brushKeydown) - .on("keyup.brush", d3_svg_brushKeyup); - - return d3.rebind(brush, event, "on"); -}; - -var d3_svg_brush, - d3_svg_brushDispatch, - d3_svg_brushTarget, - d3_svg_brushX, - d3_svg_brushY, - d3_svg_brushExtent, - d3_svg_brushDrag, - d3_svg_brushResize, - d3_svg_brushCenter, - d3_svg_brushOffset; - -function d3_svg_brushRedrawX(g, extent) { - g.select(".extent").attr("x", extent[0][0]); - g.selectAll(".n,.s,.w,.nw,.sw").attr("x", extent[0][0] - 2); - g.selectAll(".e,.ne,.se").attr("x", extent[1][0] - 3); - g.selectAll(".extent,.n,.s").attr("width", extent[1][0] - extent[0][0]); -} - -function d3_svg_brushRedrawY(g, extent) { - g.select(".extent").attr("y", extent[0][1]); - g.selectAll(".n,.e,.w,.nw,.ne").attr("y", extent[0][1] - 3); - g.selectAll(".s,.se,.sw").attr("y", extent[1][1] - 4); - g.selectAll(".extent,.e,.w").attr("height", extent[1][1] - extent[0][1]); -} - -function d3_svg_brushKeydown() { - if (d3.event.keyCode == 32 && d3_svg_brushTarget && !d3_svg_brushDrag) { - d3_svg_brushCenter = null; - d3_svg_brushOffset[0] -= d3_svg_brushExtent[1][0]; - d3_svg_brushOffset[1] -= d3_svg_brushExtent[1][1]; - d3_svg_brushDrag = 2; - d3_eventCancel(); - } -} - -function d3_svg_brushKeyup() { - if (d3.event.keyCode == 32 && d3_svg_brushDrag == 2) { - d3_svg_brushOffset[0] += d3_svg_brushExtent[1][0]; - d3_svg_brushOffset[1] += d3_svg_brushExtent[1][1]; - d3_svg_brushDrag = 0; - d3_eventCancel(); - } -} - -function d3_svg_brushMove() { - if (d3_svg_brushOffset) { - var mouse = d3.svg.mouse(d3_svg_brushTarget), - g = d3.select(d3_svg_brushTarget); - - if (!d3_svg_brushDrag) { - - // If needed, determine the center from the current extent. - if (d3.event.altKey) { - if (!d3_svg_brushCenter) { - d3_svg_brushCenter = [ - (d3_svg_brushExtent[0][0] + d3_svg_brushExtent[1][0]) / 2, - (d3_svg_brushExtent[0][1] + d3_svg_brushExtent[1][1]) / 2 - ]; - } - - // Update the offset, for when the ALT key is released. - d3_svg_brushOffset[0] = d3_svg_brushExtent[+(mouse[0] < d3_svg_brushCenter[0])][0]; - d3_svg_brushOffset[1] = d3_svg_brushExtent[+(mouse[1] < d3_svg_brushCenter[1])][1]; - } - - // When the ALT key is released, we clear the center. - else d3_svg_brushCenter = null; - } - - // Update the brush extent for each dimension. - if (d3_svg_brushX) { - d3_svg_brushMove1(mouse, d3_svg_brushX, 0); - d3_svg_brushRedrawX(g, d3_svg_brushExtent); - } - if (d3_svg_brushY) { - d3_svg_brushMove1(mouse, d3_svg_brushY, 1); - d3_svg_brushRedrawY(g, d3_svg_brushExtent); - } - - // Notify listeners. - d3_svg_brushDispatch("brush"); - } -} - -function d3_svg_brushMove1(mouse, scale, i) { - var range = d3_scaleRange(scale), - r0 = range[0], - r1 = range[1], - offset = d3_svg_brushOffset[i], - size = d3_svg_brushExtent[1][i] - d3_svg_brushExtent[0][i], - min, - max; - - // When dragging, reduce the range by the extent size and offset. - if (d3_svg_brushDrag) { - r0 -= offset; - r1 -= size + offset; - } - - // Clamp the mouse so that the extent fits within the range extent. - min = Math.max(r0, Math.min(r1, mouse[i])); - - // Compute the new extent bounds. - if (d3_svg_brushDrag) { - max = (min += offset) + size; - } else { - - // If the ALT key is pressed, then preserve the center of the extent. - if (d3_svg_brushCenter) offset = Math.max(r0, Math.min(r1, 2 * d3_svg_brushCenter[i] - min)); - - // Compute the min and max of the offset and mouse. - if (offset < min) { - max = min; - min = offset; - } else { - max = offset; - } - } - - // Update the stored bounds. - d3_svg_brushExtent[0][i] = min; - d3_svg_brushExtent[1][i] = max; -} - -function d3_svg_brushUp() { - if (d3_svg_brushOffset) { - d3_svg_brushMove(); - d3.select(d3_svg_brushTarget).selectAll(".resize").style("pointer-events", d3_svg_brush.empty() ? "none" : "all"); - d3_svg_brushDispatch("brushend"); - d3_svg_brush = - d3_svg_brushDispatch = - d3_svg_brushTarget = - d3_svg_brushX = - d3_svg_brushY = - d3_svg_brushExtent = - d3_svg_brushDrag = - d3_svg_brushResize = - d3_svg_brushCenter = - d3_svg_brushOffset = null; - d3_eventCancel(); - } -} - -var d3_svg_brushCursor = { - n: "ns-resize", - e: "ew-resize", - s: "ns-resize", - w: "ew-resize", - nw: "nwse-resize", - ne: "nesw-resize", - se: "nwse-resize", - sw: "nesw-resize" -}; -d3.behavior = {}; -// TODO Track touch points by identifier. - -d3.behavior.drag = function() { - var event = d3.dispatch("drag", "dragstart", "dragend"), - origin = null; - - function drag() { - this - .on("mousedown.drag", mousedown) - .on("touchstart.drag", mousedown); - - d3.select(window) - .on("mousemove.drag", d3_behavior_dragMove) - .on("touchmove.drag", d3_behavior_dragMove) - .on("mouseup.drag", d3_behavior_dragUp, true) - .on("touchend.drag", d3_behavior_dragUp, true) - .on("click.drag", d3_behavior_dragClick, true); - } - - // snapshot the local context for subsequent dispatch - function start() { - d3_behavior_dragEvent = event; - d3_behavior_dragEventTarget = d3.event.target; - d3_behavior_dragTarget = this; - d3_behavior_dragArguments = arguments; - d3_behavior_dragOrigin = d3_behavior_dragPoint(); - if (origin) { - d3_behavior_dragOffset = origin.apply(d3_behavior_dragTarget, d3_behavior_dragArguments); - d3_behavior_dragOffset = [d3_behavior_dragOffset.x - d3_behavior_dragOrigin[0], d3_behavior_dragOffset.y - d3_behavior_dragOrigin[1]]; - } else { - d3_behavior_dragOffset = [0, 0]; - } - d3_behavior_dragMoved = 0; - } - - function mousedown() { - start.apply(this, arguments); - d3_behavior_dragDispatch("dragstart"); - } - - drag.origin = function(x) { - if (!arguments.length) return origin; - origin = x; - return drag; - }; - - return d3.rebind(drag, event, "on"); -}; - -var d3_behavior_dragEvent, - d3_behavior_dragEventTarget, - d3_behavior_dragTarget, - d3_behavior_dragArguments, - d3_behavior_dragOffset, - d3_behavior_dragOrigin, - d3_behavior_dragMoved; - -function d3_behavior_dragDispatch(type) { - var p = d3_behavior_dragPoint(), - o = d3.event, - e = d3.event = {type: type}; - - if (p) { - e.x = p[0] + d3_behavior_dragOffset[0]; - e.y = p[1] + d3_behavior_dragOffset[1]; - e.dx = p[0] - d3_behavior_dragOrigin[0]; - e.dy = p[1] - d3_behavior_dragOrigin[1]; - d3_behavior_dragMoved |= e.dx | e.dy; - d3_behavior_dragOrigin = p; - } - - try { - d3_behavior_dragEvent[type].apply(d3_behavior_dragTarget, d3_behavior_dragArguments); - } finally { - d3.event = o; - } - - o.stopPropagation(); - o.preventDefault(); -} - -function d3_behavior_dragPoint() { - var p = d3_behavior_dragTarget.parentNode, - t = d3.event.changedTouches; - return p && (t - ? d3.svg.touches(p, t)[0] - : d3.svg.mouse(p)); -} - -function d3_behavior_dragMove() { - if (!d3_behavior_dragTarget) return; - var parent = d3_behavior_dragTarget.parentNode; - - // O NOES! The drag element was removed from the DOM. - if (!parent) return d3_behavior_dragUp(); - - d3_behavior_dragDispatch("drag"); - d3_eventCancel(); -} - -function d3_behavior_dragUp() { - if (!d3_behavior_dragTarget) return; - d3_behavior_dragDispatch("dragend"); - - // If the node was moved, prevent the mouseup from propagating. - // Also prevent the subsequent click from propagating (e.g., for anchors). - if (d3_behavior_dragMoved) { - d3_eventCancel(); - d3_behavior_dragMoved = d3.event.target === d3_behavior_dragEventTarget; - } - - d3_behavior_dragEvent = - d3_behavior_dragEventTarget = - d3_behavior_dragTarget = - d3_behavior_dragArguments = - d3_behavior_dragOffset = - d3_behavior_dragOrigin = null; -} - -function d3_behavior_dragClick() { - if (d3_behavior_dragMoved) { - d3_eventCancel(); - d3_behavior_dragMoved = 0; - } -} -// TODO unbind zoom behavior? -d3.behavior.zoom = function() { - var xyz = [0, 0, 0], - event = d3.dispatch("zoom"), - extent = d3_behavior_zoomInfiniteExtent; - - function zoom() { - this - .on("mousedown.zoom", mousedown) - .on("mousewheel.zoom", mousewheel) - .on("DOMMouseScroll.zoom", mousewheel) - .on("dblclick.zoom", dblclick) - .on("touchstart.zoom", touchstart); - - d3.select(window) - .on("mousemove.zoom", d3_behavior_zoomMousemove) - .on("mouseup.zoom", d3_behavior_zoomMouseup) - .on("touchmove.zoom", d3_behavior_zoomTouchmove) - .on("touchend.zoom", d3_behavior_zoomTouchup) - .on("click.zoom", d3_behavior_zoomClick, true); - } - - // snapshot the local context for subsequent dispatch - function start() { - d3_behavior_zoomXyz = xyz; - d3_behavior_zoomExtent = extent; - d3_behavior_zoomDispatch = event.zoom; - d3_behavior_zoomEventTarget = d3.event.target; - d3_behavior_zoomTarget = this; - d3_behavior_zoomArguments = arguments; - } - - function mousedown() { - start.apply(this, arguments); - d3_behavior_zoomPanning = d3_behavior_zoomLocation(d3.svg.mouse(d3_behavior_zoomTarget)); - d3_behavior_zoomMoved = 0; - d3.event.preventDefault(); - window.focus(); - } - - // store starting mouse location - function mousewheel() { - start.apply(this, arguments); - if (!d3_behavior_zoomZooming) d3_behavior_zoomZooming = d3_behavior_zoomLocation(d3.svg.mouse(d3_behavior_zoomTarget)); - d3_behavior_zoomTo(d3_behavior_zoomDelta() + xyz[2], d3.svg.mouse(d3_behavior_zoomTarget), d3_behavior_zoomZooming); - } - - function dblclick() { - start.apply(this, arguments); - var mouse = d3.svg.mouse(d3_behavior_zoomTarget); - d3_behavior_zoomTo(d3.event.shiftKey ? Math.ceil(xyz[2] - 1) : Math.floor(xyz[2] + 1), mouse, d3_behavior_zoomLocation(mouse)); - } - - // doubletap detection - function touchstart() { - start.apply(this, arguments); - var touches = d3_behavior_zoomTouchup(), - touch, - now = Date.now(); - if ((touches.length === 1) && (now - d3_behavior_zoomLast < 300)) { - d3_behavior_zoomTo(1 + Math.floor(xyz[2]), touch = touches[0], d3_behavior_zoomLocations[touch.identifier]); - } - d3_behavior_zoomLast = now; - } - - zoom.extent = function(x) { - if (!arguments.length) return extent; - extent = x == null ? d3_behavior_zoomInfiniteExtent : x; - return zoom; - }; - - return d3.rebind(zoom, event, "on"); -}; - -var d3_behavior_zoomDiv, - d3_behavior_zoomPanning, - d3_behavior_zoomZooming, - d3_behavior_zoomLocations = {}, // identifier -> location - d3_behavior_zoomLast = 0, - d3_behavior_zoomXyz, - d3_behavior_zoomExtent, - d3_behavior_zoomDispatch, - d3_behavior_zoomEventTarget, - d3_behavior_zoomTarget, - d3_behavior_zoomArguments, - d3_behavior_zoomMoved; - -function d3_behavior_zoomLocation(point) { - return [ - point[0] - d3_behavior_zoomXyz[0], - point[1] - d3_behavior_zoomXyz[1], - d3_behavior_zoomXyz[2] - ]; -} - -// detect the pixels that would be scrolled by this wheel event -function d3_behavior_zoomDelta() { - - // mousewheel events are totally broken! - // https://bugs.webkit.org/show_bug.cgi?id=40441 - // not only that, but Chrome and Safari differ in re. to acceleration! - if (!d3_behavior_zoomDiv) { - d3_behavior_zoomDiv = d3.select("body").append("div") - .style("visibility", "hidden") - .style("top", 0) - .style("height", 0) - .style("width", 0) - .style("overflow-y", "scroll") - .append("div") - .style("height", "2000px") - .node().parentNode; - } - - var e = d3.event, delta; - try { - d3_behavior_zoomDiv.scrollTop = 1000; - d3_behavior_zoomDiv.dispatchEvent(e); - delta = 1000 - d3_behavior_zoomDiv.scrollTop; - } catch (error) { - delta = e.wheelDelta || (-e.detail * 5); - } - - return delta * .005; -} - -// Note: Since we don't rotate, it's possible for the touches to become -// slightly detached from their original positions. Thus, we recompute the -// touch points on touchend as well as touchstart! -function d3_behavior_zoomTouchup() { - var touches = d3.svg.touches(d3_behavior_zoomTarget), - i = -1, - n = touches.length, - touch; - while (++i < n) d3_behavior_zoomLocations[(touch = touches[i]).identifier] = d3_behavior_zoomLocation(touch); - return touches; -} - -function d3_behavior_zoomTouchmove() { - var touches = d3.svg.touches(d3_behavior_zoomTarget); - switch (touches.length) { - - // single-touch pan - case 1: { - var touch = touches[0]; - d3_behavior_zoomTo(d3_behavior_zoomXyz[2], touch, d3_behavior_zoomLocations[touch.identifier]); - break; - } - - // double-touch pan + zoom - case 2: { - var p0 = touches[0], - p1 = touches[1], - p2 = [(p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2], - l0 = d3_behavior_zoomLocations[p0.identifier], - l1 = d3_behavior_zoomLocations[p1.identifier], - l2 = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2, l0[2]]; - d3_behavior_zoomTo(Math.log(d3.event.scale) / Math.LN2 + l0[2], p2, l2); - break; - } - } -} - -function d3_behavior_zoomMousemove() { - d3_behavior_zoomZooming = null; - if (d3_behavior_zoomPanning) { - d3_behavior_zoomMoved = 1; - d3_behavior_zoomTo(d3_behavior_zoomXyz[2], d3.svg.mouse(d3_behavior_zoomTarget), d3_behavior_zoomPanning); - } -} - -function d3_behavior_zoomMouseup() { - if (d3_behavior_zoomPanning) { - if (d3_behavior_zoomMoved) { - d3_eventCancel(); - d3_behavior_zoomMoved = d3_behavior_zoomEventTarget === d3.event.target; - } - - d3_behavior_zoomXyz = - d3_behavior_zoomExtent = - d3_behavior_zoomDispatch = - d3_behavior_zoomEventTarget = - d3_behavior_zoomTarget = - d3_behavior_zoomArguments = - d3_behavior_zoomPanning = null; - } -} - -function d3_behavior_zoomClick() { - if (d3_behavior_zoomMoved) { - d3_eventCancel(); - d3_behavior_zoomMoved = 0; - } -} - -function d3_behavior_zoomTo(z, x0, x1) { - z = d3_behavior_zoomExtentClamp(z, 2); - var j = Math.pow(2, d3_behavior_zoomXyz[2]), - k = Math.pow(2, z), - K = Math.pow(2, (d3_behavior_zoomXyz[2] = z) - x1[2]), - x_ = d3_behavior_zoomXyz[0], - y_ = d3_behavior_zoomXyz[1], - x = d3_behavior_zoomXyz[0] = d3_behavior_zoomExtentClamp((x0[0] - x1[0] * K), 0, k), - y = d3_behavior_zoomXyz[1] = d3_behavior_zoomExtentClamp((x0[1] - x1[1] * K), 1, k), - o = d3.event; // Events can be reentrant (e.g., focus). - - d3.event = { - scale: k, - translate: [x, y], - transform: function(sx, sy) { - if (sx) transform(sx, x_, x); - if (sy) transform(sy, y_, y); - } - }; - - function transform(scale, a, b) { - scale.domain(scale.range().map(function(v) { return scale.invert(((v - b) * j) / k + a); })); - } - - try { - d3_behavior_zoomDispatch.apply(d3_behavior_zoomTarget, d3_behavior_zoomArguments); - } finally { - d3.event = o; - } - - o.preventDefault(); -} - -var d3_behavior_zoomInfiniteExtent = [ - [-Infinity, Infinity], - [-Infinity, Infinity], - [-Infinity, Infinity] -]; - -function d3_behavior_zoomExtentClamp(x, i, k) { - var range = d3_behavior_zoomExtent[i], - r0 = range[0], - r1 = range[1]; - return arguments.length === 3 - ? Math.max(r1 * (r1 === Infinity ? -Infinity : 1 / k - 1), - Math.min(r0 === -Infinity ? Infinity : r0, x / k)) * k - : Math.max(r0, Math.min(r1, x)); -} -})(); diff --git a/modules/enterprise/gui/rest-war/src/main/webapp/js/d3.layout.js b/modules/enterprise/gui/rest-war/src/main/webapp/js/d3.layout.js deleted file mode 100755 index 24bcc42..0000000 --- a/modules/enterprise/gui/rest-war/src/main/webapp/js/d3.layout.js +++ /dev/null @@ -1,1889 +0,0 @@ -(function(){d3.layout = {}; -// Implements hierarchical edge bundling using Holten's algorithm. For each -// input link, a path is computed that travels through the tree, up the parent -// hierarchy to the least common ancestor, and then back down to the destination -// node. Each path is simply an array of nodes. -d3.layout.bundle = function() { - return function(links) { - var paths = [], - i = -1, - n = links.length; - while (++i < n) paths.push(d3_layout_bundlePath(links[i])); - return paths; - }; -}; - -function d3_layout_bundlePath(link) { - var start = link.source, - end = link.target, - lca = d3_layout_bundleLeastCommonAncestor(start, end), - points = [start]; - while (start !== lca) { - start = start.parent; - points.push(start); - } - var k = points.length; - while (end !== lca) { - points.splice(k, 0, end); - end = end.parent; - } - return points; -} - -function d3_layout_bundleAncestors(node) { - var ancestors = [], - parent = node.parent; - while (parent != null) { - ancestors.push(node); - node = parent; - parent = parent.parent; - } - ancestors.push(node); - return ancestors; -} - -function d3_layout_bundleLeastCommonAncestor(a, b) { - if (a === b) return a; - var aNodes = d3_layout_bundleAncestors(a), - bNodes = d3_layout_bundleAncestors(b), - aNode = aNodes.pop(), - bNode = bNodes.pop(), - sharedNode = null; - while (aNode === bNode) { - sharedNode = aNode; - aNode = aNodes.pop(); - bNode = bNodes.pop(); - } - return sharedNode; -} -d3.layout.chord = function() { - var chord = {}, - chords, - groups, - matrix, - n, - padding = 0, - sortGroups, - sortSubgroups, - sortChords; - - function relayout() { - var subgroups = {}, - groupSums = [], - groupIndex = d3.range(n), - subgroupIndex = [], - k, - x, - x0, - i, - j; - - chords = []; - groups = []; - - // Compute the sum. - k = 0, i = -1; while (++i < n) { - x = 0, j = -1; while (++j < n) { - x += matrix[i][j]; - } - groupSums.push(x); - subgroupIndex.push(d3.range(n)); - k += x; - } - - // Sort groups… - if (sortGroups) { - groupIndex.sort(function(a, b) { - return sortGroups(groupSums[a], groupSums[b]); - }); - } - - // Sort subgroups… - if (sortSubgroups) { - subgroupIndex.forEach(function(d, i) { - d.sort(function(a, b) { - return sortSubgroups(matrix[i][a], matrix[i][b]); - }); - }); - } - - // Convert the sum to scaling factor for [0, 2pi]. - // TODO Allow start and end angle to be specified. - // TODO Allow padding to be specified as percentage? - k = (2 * Math.PI - padding * n) / k; - - // Compute the start and end angle for each group and subgroup. - // Note: Opera has a bug reordering object literal properties! - x = 0, i = -1; while (++i < n) { - x0 = x, j = -1; while (++j < n) { - var di = groupIndex[i], - dj = subgroupIndex[di][j], - v = matrix[di][dj], - a0 = x, - a1 = x += v * k; - subgroups[di + "-" + dj] = { - index: di, - subindex: dj, - startAngle: a0, - endAngle: a1, - value: v - }; - } - groups.push({ - index: di, - startAngle: x0, - endAngle: x, - value: (x - x0) / k - }); - x += padding; - } - - // Generate chords for each (non-empty) subgroup-subgroup link. - i = -1; while (++i < n) { - j = i - 1; while (++j < n) { - var source = subgroups[i + "-" + j], - target = subgroups[j + "-" + i]; - if (source.value || target.value) { - chords.push(source.value < target.value - ? {source: target, target: source} - : {source: source, target: target}); - } - } - } - - if (sortChords) resort(); - } - - function resort() { - chords.sort(function(a, b) { - return sortChords( - (a.source.value + a.target.value) / 2, - (b.source.value + b.target.value) / 2); - }); - } - - chord.matrix = function(x) { - if (!arguments.length) return matrix; - n = (matrix = x) && matrix.length; - chords = groups = null; - return chord; - }; - - chord.padding = function(x) { - if (!arguments.length) return padding; - padding = x; - chords = groups = null; - return chord; - }; - - chord.sortGroups = function(x) { - if (!arguments.length) return sortGroups; - sortGroups = x; - chords = groups = null; - return chord; - }; - - chord.sortSubgroups = function(x) { - if (!arguments.length) return sortSubgroups; - sortSubgroups = x; - chords = null; - return chord; - }; - - chord.sortChords = function(x) { - if (!arguments.length) return sortChords; - sortChords = x; - if (chords) resort(); - return chord; - }; - - chord.chords = function() { - if (!chords) relayout(); - return chords; - }; - - chord.groups = function() { - if (!groups) relayout(); - return groups; - }; - - return chord; -}; -// A rudimentary force layout using Gauss-Seidel. -d3.layout.force = function() { - var force = {}, - event = d3.dispatch("tick"), - size = [1, 1], - drag, - alpha, - friction = .9, - linkDistance = d3_layout_forceLinkDistance, - linkStrength = d3_layout_forceLinkStrength, - charge = -30, - gravity = .1, - theta = .8, - interval, - nodes = [], - links = [], - distances, - strengths, - charges; - - function repulse(node) { - return function(quad, x1, y1, x2, y2) { - if (quad.point !== node) { - var dx = quad.cx - node.x, - dy = quad.cy - node.y, - dn = 1 / Math.sqrt(dx * dx + dy * dy); - - /* Barnes-Hut criterion. */ - if ((x2 - x1) * dn < theta) { - var k = quad.charge * dn * dn; - node.px -= dx * k; - node.py -= dy * k; - return true; - } - - if (quad.point && isFinite(dn)) { - var k = quad.pointCharge * dn * dn; - node.px -= dx * k; - node.py -= dy * k; - } - } - return !quad.charge; - }; - } - - function tick() { - var n = nodes.length, - m = links.length, - q, - i, // current index - o, // current object - s, // current source - t, // current target - l, // current distance - k, // current force - x, // x-distance - y; // y-distance - - // gauss-seidel relaxation for links - for (i = 0; i < m; ++i) { - o = links[i]; - s = o.source; - t = o.target; - x = t.x - s.x; - y = t.y - s.y; - if (l = (x * x + y * y)) { - l = alpha * strengths[i] * ((l = Math.sqrt(l)) - distances[i]) / l; - x *= l; - y *= l; - t.x -= x * (k = s.weight / (t.weight + s.weight)); - t.y -= y * k; - s.x += x * (k = 1 - k); - s.y += y * k; - } - } - - // apply gravity forces - if (k = alpha * gravity) { - x = size[0] / 2; - y = size[1] / 2; - i = -1; if (k) while (++i < n) { - o = nodes[i]; - o.x += (x - o.x) * k; - o.y += (y - o.y) * k; - } - } - - // compute quadtree center of mass and apply charge forces - if (charge) { - d3_layout_forceAccumulate(q = d3.geom.quadtree(nodes), alpha, charges); - i = -1; while (++i < n) { - if (!(o = nodes[i]).fixed) { - q.visit(repulse(o)); - } - } - } - - // position verlet integration - i = -1; while (++i < n) { - o = nodes[i]; - if (o.fixed) { - o.x = o.px; - o.y = o.py; - } else { - o.x -= (o.px - (o.px = o.x)) * friction; - o.y -= (o.py - (o.py = o.y)) * friction; - } - } - - event.tick({type: "tick", alpha: alpha}); - - // simulated annealing, basically - return (alpha *= .99) < .005; - } - - force.nodes = function(x) { - if (!arguments.length) return nodes; - nodes = x; - return force; - }; - - force.links = function(x) { - if (!arguments.length) return links; - links = x; - return force; - }; - - force.size = function(x) { - if (!arguments.length) return size; - size = x; - return force; - }; - - force.linkDistance = function(x) { - if (!arguments.length) return linkDistance; - linkDistance = d3.functor(x); - return force; - }; - - // For backwards-compatibility. - force.distance = force.linkDistance; - - force.linkStrength = function(x) { - if (!arguments.length) return linkStrength; - linkStrength = d3.functor(x); - return force; - }; - - force.friction = function(x) { - if (!arguments.length) return friction; - friction = x; - return force; - }; - - force.charge = function(x) { - if (!arguments.length) return charge; - charge = typeof x === "function" ? x : +x; - return force; - }; - - force.gravity = function(x) { - if (!arguments.length) return gravity; - gravity = x; - return force; - }; - - force.theta = function(x) { - if (!arguments.length) return theta; - theta = x; - return force; - }; - - force.start = function() { - var i, - j, - n = nodes.length, - m = links.length, - w = size[0], - h = size[1], - neighbors, - o; - - for (i = 0; i < n; ++i) { - (o = nodes[i]).index = i; - o.weight = 0; - } - - distances = []; - strengths = []; - for (i = 0; i < m; ++i) { - o = links[i]; - if (typeof o.source == "number") o.source = nodes[o.source]; - if (typeof o.target == "number") o.target = nodes[o.target]; - distances[i] = linkDistance.call(this, o, i); - strengths[i] = linkStrength.call(this, o, i); - ++o.source.weight; - ++o.target.weight; - } - - for (i = 0; i < n; ++i) { - o = nodes[i]; - if (isNaN(o.x)) o.x = position("x", w); - if (isNaN(o.y)) o.y = position("y", h); - if (isNaN(o.px)) o.px = o.x; - if (isNaN(o.py)) o.py = o.y; - } - - charges = []; - if (typeof charge === "function") { - for (i = 0; i < n; ++i) { - charges[i] = +charge.call(this, nodes[i], i); - } - } else { - for (i = 0; i < n; ++i) { - charges[i] = charge; - } - } - - // initialize node position based on first neighbor - function position(dimension, size) { - var neighbors = neighbor(i), - j = -1, - m = neighbors.length, - x; - while (++j < m) if (!isNaN(x = neighbors[j][dimension])) return x; - return Math.random() * size; - } - - // initialize neighbors lazily - function neighbor() { - if (!neighbors) { - neighbors = []; - for (j = 0; j < n; ++j) { - neighbors[j] = []; - } - for (j = 0; j < m; ++j) { - var o = links[j]; - neighbors[o.source.index].push(o.target); - neighbors[o.target.index].push(o.source); - } - } - return neighbors[i]; - } - - return force.resume(); - }; - - force.resume = function() { - alpha = .1; - d3.timer(tick); - return force; - }; - - force.stop = function() { - alpha = 0; - return force; - }; - - // use `node.call(force.drag)` to make nodes draggable - force.drag = function() { - if (!drag) drag = d3.behavior.drag() - .origin(Object) - .on("dragstart", dragstart) - .on("drag", d3_layout_forceDrag) - .on("dragend", d3_layout_forceDragEnd); - - this.on("mouseover.force", d3_layout_forceDragOver) - .on("mouseout.force", d3_layout_forceDragOut) - .call(drag); - }; - - function dragstart(d) { - d3_layout_forceDragOver(d3_layout_forceDragNode = d); - d3_layout_forceDragForce = force; - } - - return d3.rebind(force, event, "on"); -}; - -var d3_layout_forceDragForce, - d3_layout_forceDragNode; - -function d3_layout_forceDragOver(d) { - d.fixed |= 2; -} - -function d3_layout_forceDragOut(d) { - if (d !== d3_layout_forceDragNode) d.fixed &= 1; -} - -function d3_layout_forceDragEnd() { - d3_layout_forceDrag(); - d3_layout_forceDragNode.fixed &= 1; - d3_layout_forceDragForce = d3_layout_forceDragNode = null; -} - -function d3_layout_forceDrag() { - d3_layout_forceDragNode.px = d3.event.x; - d3_layout_forceDragNode.py = d3.event.y; - d3_layout_forceDragForce.resume(); // restart annealing -} - -function d3_layout_forceAccumulate(quad, alpha, charges) { - var cx = 0, - cy = 0; - quad.charge = 0; - if (!quad.leaf) { - var nodes = quad.nodes, - n = nodes.length, - i = -1, - c; - while (++i < n) { - c = nodes[i]; - if (c == null) continue; - d3_layout_forceAccumulate(c, alpha, charges); - quad.charge += c.charge; - cx += c.charge * c.cx; - cy += c.charge * c.cy; - } - } - if (quad.point) { - // jitter internal nodes that are coincident - if (!quad.leaf) { - quad.point.x += Math.random() - .5; - quad.point.y += Math.random() - .5; - } - var k = alpha * charges[quad.point.index]; - quad.charge += quad.pointCharge = k; - cx += k * quad.point.x; - cy += k * quad.point.y; - } - quad.cx = cx / quad.charge; - quad.cy = cy / quad.charge; -} - -function d3_layout_forceLinkDistance(link) { - return 20; -} - -function d3_layout_forceLinkStrength(link) { - return 1; -} -d3.layout.partition = function() { - var hierarchy = d3.layout.hierarchy(), - size = [1, 1]; // width, height - - function position(node, x, dx, dy) { - var children = node.children; - node.x = x; - node.y = node.depth * dy; - node.dx = dx; - node.dy = dy; - if (children && (n = children.length)) { - var i = -1, - n, - c, - d; - dx = node.value ? dx / node.value : 0; - while (++i < n) { - position(c = children[i], x, d = c.value * dx, dy); - x += d; - } - } - } - - function depth(node) { - var children = node.children, - d = 0; - if (children && (n = children.length)) { - var i = -1, - n; - while (++i < n) d = Math.max(d, depth(children[i])); - } - return 1 + d; - } - - function partition(d, i) { - var nodes = hierarchy.call(this, d, i); - position(nodes[0], 0, size[0], size[1] / depth(nodes[0])); - return nodes; - } - - partition.size = function(x) { - if (!arguments.length) return size; - size = x; - return partition; - }; - - return d3_layout_hierarchyRebind(partition, hierarchy); -}; -d3.layout.pie = function() { - var value = Number, - sort = d3_layout_pieSortByValue, - startAngle = 0, - endAngle = 2 * Math.PI; - - function pie(data, i) { - - // Compute the numeric values for each data element. - var values = data.map(function(d, i) { return +value.call(pie, d, i); }); - - // Compute the start angle. - var a = +(typeof startAngle === "function" - ? startAngle.apply(this, arguments) - : startAngle); - - // Compute the angular scale factor: from value to radians. - var k = ((typeof endAngle === "function" - ? endAngle.apply(this, arguments) - : endAngle) - startAngle) - / d3.sum(values); - - // Optionally sort the data. - var index = d3.range(data.length); - if (sort != null) index.sort(sort === d3_layout_pieSortByValue - ? function(i, j) { return values[j] - values[i]; } - : function(i, j) { return sort(data[i], data[j]); }); - - // Compute the arcs! - // They are stored in the original data's order. - var arcs = []; - index.forEach(function(i) { - arcs[i] = { - data: data[i], - value: d = values[i], - startAngle: a, - endAngle: a += d * k - }; - }); - return arcs; - } - - /** - * Specifies the value function *x*, which returns a nonnegative numeric value - * for each datum. The default value function is `Number`. The value function - * is passed two arguments: the current datum and the current index. - */ - pie.value = function(x) { - if (!arguments.length) return value; - value = x; - return pie; - }; - - /** - * Specifies a sort comparison operator *x*. The comparator is passed two data - * elements from the data array, a and b; it returns a negative value if a is - * less than b, a positive value if a is greater than b, and zero if a equals - * b. - */ - pie.sort = function(x) { - if (!arguments.length) return sort; - sort = x; - return pie; - }; - - /** - * Specifies the overall start angle of the pie chart. Defaults to 0. The - * start angle can be specified either as a constant or as a function; in the - * case of a function, it is evaluated once per array (as opposed to per - * element). - */ - pie.startAngle = function(x) { - if (!arguments.length) return startAngle; - startAngle = x; - return pie; - }; - - /** - * Specifies the overall end angle of the pie chart. Defaults to 2π. The - * end angle can be specified either as a constant or as a function; in the - * case of a function, it is evaluated once per array (as opposed to per - * element). - */ - pie.endAngle = function(x) { - if (!arguments.length) return endAngle; - endAngle = x; - return pie; - }; - - return pie; -}; - -var d3_layout_pieSortByValue = {}; -// data is two-dimensional array of x,y; we populate y0 -d3.layout.stack = function() { - var values = Object, - order = d3_layout_stackOrders["default"], - offset = d3_layout_stackOffsets["zero"], - out = d3_layout_stackOut, - x = d3_layout_stackX, - y = d3_layout_stackY; - - function stack(data, index) { - - // Convert series to canonical two-dimensional representation. - var series = data.map(function(d, i) { - return values.call(stack, d, i); - }); - - // Convert each series to canonical [[x,y]] representation. - var points = series.map(function(d, i) { - return d.map(function(v, i) { - return [x.call(stack, v, i), y.call(stack, v, i)]; - }); - }); - - // Compute the order of series, and permute them. - var orders = order.call(stack, points, index); - series = d3.permute(series, orders); - points = d3.permute(points, orders); - - // Compute the baseline… - var offsets = offset.call(stack, points, index); - - // And propagate it to other series. - var n = series.length, - m = series[0].length, - i, - j, - o; - for (j = 0; j < m; ++j) { - out.call(stack, series[0][j], o = offsets[j], points[0][j][1]); - for (i = 1; i < n; ++i) { - out.call(stack, series[i][j], o += points[i - 1][j][1], points[i][j][1]); - } - } - - return data; - } - - stack.values = function(x) { - if (!arguments.length) return values; - values = x; - return stack; - }; - - stack.order = function(x) { - if (!arguments.length) return order; - order = typeof x === "function" ? x : d3_layout_stackOrders[x]; - return stack; - }; - - stack.offset = function(x) { - if (!arguments.length) return offset; - offset = typeof x === "function" ? x : d3_layout_stackOffsets[x]; - return stack; - }; - - stack.x = function(z) { - if (!arguments.length) return x; - x = z; - return stack; - }; - - stack.y = function(z) { - if (!arguments.length) return y; - y = z; - return stack; - }; - - stack.out = function(z) { - if (!arguments.length) return out; - out = z; - return stack; - }; - - return stack; -} - -function d3_layout_stackX(d) { - return d.x; -} - -function d3_layout_stackY(d) { - return d.y; -} - -function d3_layout_stackOut(d, y0, y) { - d.y0 = y0; - d.y = y; -} - -var d3_layout_stackOrders = { - - "inside-out": function(data) { - var n = data.length, - i, - j, - max = data.map(d3_layout_stackMaxIndex), - sums = data.map(d3_layout_stackReduceSum), - index = d3.range(n).sort(function(a, b) { return max[a] - max[b]; }), - top = 0, - bottom = 0, - tops = [], - bottoms = []; - for (i = 0; i < n; ++i) { - j = index[i]; - if (top < bottom) { - top += sums[j]; - tops.push(j); - } else { - bottom += sums[j]; - bottoms.push(j); - } - } - return bottoms.reverse().concat(tops); - }, - - "reverse": function(data) { - return d3.range(data.length).reverse(); - }, - - "default": function(data) { - return d3.range(data.length); - } - -}; - -var d3_layout_stackOffsets = { - - "silhouette": function(data) { - var n = data.length, - m = data[0].length, - sums = [], - max = 0, - i, - j, - o, - y0 = []; - for (j = 0; j < m; ++j) { - for (i = 0, o = 0; i < n; i++) o += data[i][j][1]; - if (o > max) max = o; - sums.push(o); - } - for (j = 0; j < m; ++j) { - y0[j] = (max - sums[j]) / 2; - } - return y0; - }, - - "wiggle": function(data) { - var n = data.length, - x = data[0], - m = x.length, - max = 0, - i, - j, - k, - s1, - s2, - s3, - dx, - o, - o0, - y0 = []; - y0[0] = o = o0 = 0; - for (j = 1; j < m; ++j) { - for (i = 0, s1 = 0; i < n; ++i) s1 += data[i][j][1]; - for (i = 0, s2 = 0, dx = x[j][0] - x[j - 1][0]; i < n; ++i) { - for (k = 0, s3 = (data[i][j][1] - data[i][j - 1][1]) / (2 * dx); k < i; ++k) { - s3 += (data[k][j][1] - data[k][j - 1][1]) / dx; - } - s2 += s3 * data[i][j][1]; - } - y0[j] = o -= s1 ? s2 / s1 * dx : 0; - if (o < o0) o0 = o; - } - for (j = 0; j < m; ++j) y0[j] -= o0; - return y0; - }, - - "expand": function(data) { - var n = data.length, - m = data[0].length, - k = 1 / n, - i, - j, - o, - y0 = []; - for (j = 0; j < m; ++j) { - for (i = 0, o = 0; i < n; i++) o += data[i][j][1]; - if (o) for (i = 0; i < n; i++) data[i][j][1] /= o; - else for (i = 0; i < n; i++) data[i][j][1] = k; - } - for (j = 0; j < m; ++j) y0[j] = 0; - return y0; - }, - - "zero": function(data) { - var j = -1, - m = data[0].length, - y0 = []; - while (++j < m) y0[j] = 0; - return y0; - } - -}; - -function d3_layout_stackMaxIndex(array) { - var i = 1, - j = 0, - v = array[0][1], - k, - n = array.length; - for (; i < n; ++i) { - if ((k = array[i][1]) > v) { - j = i; - v = k; - } - } - return j; -} - -function d3_layout_stackReduceSum(d) { - return d.reduce(d3_layout_stackSum, 0); -} - -function d3_layout_stackSum(p, d) { - return p + d[1]; -} -d3.layout.histogram = function() { - var frequency = true, - valuer = Number, - ranger = d3_layout_histogramRange, - binner = d3_layout_histogramBinSturges; - - function histogram(data, i) { - var bins = [], - values = data.map(valuer, this), - range = ranger.call(this, values, i), - thresholds = binner.call(this, range, values, i), - bin, - i = -1, - n = values.length, - m = thresholds.length - 1, - k = frequency ? 1 : 1 / n, - x; - - // Initialize the bins. - while (++i < m) { - bin = bins[i] = []; - bin.dx = thresholds[i + 1] - (bin.x = thresholds[i]); - bin.y = 0; - } - - // Fill the bins, ignoring values outside the range. - i = -1; while(++i < n) { - x = values[i]; - if ((x >= range[0]) && (x <= range[1])) { - bin = bins[d3.bisect(thresholds, x, 1, m) - 1]; - bin.y += k; - bin.push(data[i]); - } - } - - return bins; - } - - // Specifies how to extract a value from the associated data. The default - // value function is `Number`, which is equivalent to the identity function. - histogram.value = function(x) { - if (!arguments.length) return valuer; - valuer = x; - return histogram; - }; - - // Specifies the range of the histogram. Values outside the specified range - // will be ignored. The argument `x` may be specified either as a two-element - // array representing the minimum and maximum value of the range, or as a - // function that returns the range given the array of values and the current - // index `i`. The default range is the extent (minimum and maximum) of the - // values. - histogram.range = function(x) { - if (!arguments.length) return ranger; - ranger = d3.functor(x); - return histogram; - }; - - // Specifies how to bin values in the histogram. The argument `x` may be - // specified as a number, in which case the range of values will be split - // uniformly into the given number of bins. Or, `x` may be an array of - // threshold values, defining the bins; the specified array must contain the - // rightmost (upper) value, thus specifying n + 1 values for n bins. Or, `x` - // may be a function which is evaluated, being passed the range, the array of - // values, and the current index `i`, returning an array of thresholds. The - // default bin function will divide the values into uniform bins using - // Sturges' formula. - histogram.bins = function(x) { - if (!arguments.length) return binner; - binner = typeof x === "number" - ? function(range) { return d3_layout_histogramBinFixed(range, x); } - : d3.functor(x); - return histogram; - }; - - // Specifies whether the histogram's `y` value is a count (frequency) or a - // probability (density). The default value is true. - histogram.frequency = function(x) { - if (!arguments.length) return frequency; - frequency = !!x; - return histogram; - }; - - return histogram; -}; - -function d3_layout_histogramBinSturges(range, values) { - return d3_layout_histogramBinFixed(range, Math.ceil(Math.log(values.length) / Math.LN2 + 1)); -} - -function d3_layout_histogramBinFixed(range, n) { - var x = -1, - b = +range[0], - m = (range[1] - b) / n, - f = []; - while (++x <= n) f[x] = m * x + b; - return f; -} - -function d3_layout_histogramRange(values) { - return [d3.min(values), d3.max(values)]; -} -d3.layout.hierarchy = function() { - var sort = d3_layout_hierarchySort, - children = d3_layout_hierarchyChildren, - value = d3_layout_hierarchyValue; - - // Recursively compute the node depth and value. - // Also converts the data representation into a standard hierarchy structure. - function recurse(data, depth, nodes) { - var childs = children.call(hierarchy, data, depth), - node = d3_layout_hierarchyInline ? data : {data: data}; - node.depth = depth; - nodes.push(node); - if (childs && (n = childs.length)) { - var i = -1, - n, - c = node.children = [], - v = 0, - j = depth + 1; - while (++i < n) { - d = recurse(childs[i], j, nodes); - d.parent = node; - c.push(d); - v += d.value; - } - if (sort) c.sort(sort); - if (value) node.value = v; - } else if (value) { - node.value = +value.call(hierarchy, data, depth) || 0; - } - return node; - } - - // Recursively re-evaluates the node value. - function revalue(node, depth) { - var children = node.children, - v = 0; - if (children && (n = children.length)) { - var i = -1, - n, - j = depth + 1; - while (++i < n) v += revalue(children[i], j); - } else if (value) { - v = +value.call(hierarchy, d3_layout_hierarchyInline ? node : node.data, depth) || 0; - } - if (value) node.value = v; - return v; - } - - function hierarchy(d) { - var nodes = []; - recurse(d, 0, nodes); - return nodes; - } - - hierarchy.sort = function(x) { - if (!arguments.length) return sort; - sort = x; - return hierarchy; - }; - - hierarchy.children = function(x) { - if (!arguments.length) return children; - children = x; - return hierarchy; - }; - - hierarchy.value = function(x) { - if (!arguments.length) return value; - value = x; - return hierarchy; - }; - - // Re-evaluates the `value` property for the specified hierarchy. - hierarchy.revalue = function(root) { - revalue(root, 0); - return root; - }; - - return hierarchy; -}; - -// A method assignment helper for hierarchy subclasses. -function d3_layout_hierarchyRebind(object, hierarchy) { - d3.rebind(object, hierarchy, "sort", "children", "value"); - - // Add an alias for links, for convenience. - object.links = d3_layout_hierarchyLinks; - - // If the new API is used, enabling inlining. - object.nodes = function(d) { - d3_layout_hierarchyInline = true; - return (object.nodes = object)(d); - }; - - return object; -} - -function d3_layout_hierarchyChildren(d) { - return d.children; -} - -function d3_layout_hierarchyValue(d) { - return d.value; -} - -function d3_layout_hierarchySort(a, b) { - return b.value - a.value; -} - -// Returns an array source+target objects for the specified nodes. -function d3_layout_hierarchyLinks(nodes) { - return d3.merge(nodes.map(function(parent) { - return (parent.children || []).map(function(child) { - return {source: parent, target: child}; - }); - })); -} - -// For backwards-compatibility, don't enable inlining by default. -var d3_layout_hierarchyInline = false; -d3.layout.pack = function() { - var hierarchy = d3.layout.hierarchy().sort(d3_layout_packSort), - size = [1, 1]; - - function pack(d, i) { - var nodes = hierarchy.call(this, d, i), - root = nodes[0]; - - // Recursively compute the layout. - root.x = 0; - root.y = 0; - d3_layout_packTree(root); - - // Scale the layout to fit the requested size. - var w = size[0], - h = size[1], - k = 1 / Math.max(2 * root.r / w, 2 * root.r / h); - d3_layout_packTransform(root, w / 2, h / 2, k); - - return nodes; - } - - pack.size = function(x) { - if (!arguments.length) return size; - size = x; - return pack; - }; - - return d3_layout_hierarchyRebind(pack, hierarchy); -}; - -function d3_layout_packSort(a, b) { - return a.value - b.value; -} - -function d3_layout_packInsert(a, b) { - var c = a._pack_next; - a._pack_next = b; - b._pack_prev = a; - b._pack_next = c; - c._pack_prev = b; -} - -function d3_layout_packSplice(a, b) { - a._pack_next = b; - b._pack_prev = a; -} - -function d3_layout_packIntersects(a, b) { - var dx = b.x - a.x, - dy = b.y - a.y, - dr = a.r + b.r; - return (dr * dr - dx * dx - dy * dy) > .001; // within epsilon -} - -function d3_layout_packCircle(nodes) { - var xMin = Infinity, - xMax = -Infinity, - yMin = Infinity, - yMax = -Infinity, - n = nodes.length, - a, b, c, j, k; - - function bound(node) { - xMin = Math.min(node.x - node.r, xMin); - xMax = Math.max(node.x + node.r, xMax); - yMin = Math.min(node.y - node.r, yMin); - yMax = Math.max(node.y + node.r, yMax); - } - - // Create node links. - nodes.forEach(d3_layout_packLink); - - // Create first node. - a = nodes[0]; - a.x = -a.r; - a.y = 0; - bound(a); - - // Create second node. - if (n > 1) { - b = nodes[1]; - b.x = b.r; - b.y = 0; - bound(b); - - // Create third node and build chain. - if (n > 2) { - c = nodes[2]; - d3_layout_packPlace(a, b, c); - bound(c); - d3_layout_packInsert(a, c); - a._pack_prev = c; - d3_layout_packInsert(c, b); - b = a._pack_next; - - // Now iterate through the rest. - for (var i = 3; i < n; i++) { - d3_layout_packPlace(a, b, c = nodes[i]); - - // Search for the closest intersection. - var isect = 0, s1 = 1, s2 = 1; - for (j = b._pack_next; j !== b; j = j._pack_next, s1++) { - if (d3_layout_packIntersects(j, c)) { - isect = 1; - break; - } - } - if (isect == 1) { - for (k = a._pack_prev; k !== j._pack_prev; k = k._pack_prev, s2++) { - if (d3_layout_packIntersects(k, c)) { - if (s2 < s1) { - isect = -1; - j = k; - } - break; - } - } - } - - // Update node chain. - if (isect == 0) { - d3_layout_packInsert(a, c); - b = c; - bound(c); - } else if (isect > 0) { - d3_layout_packSplice(a, j); - b = j; - i--; - } else { // isect < 0 - d3_layout_packSplice(j, b); - a = j; - i--; - } - } - } - } - - // Re-center the circles and return the encompassing radius. - var cx = (xMin + xMax) / 2, - cy = (yMin + yMax) / 2, - cr = 0; - for (var i = 0; i < n; i++) { - var node = nodes[i]; - node.x -= cx; - node.y -= cy; - cr = Math.max(cr, node.r + Math.sqrt(node.x * node.x + node.y * node.y)); - } - - // Remove node links. - nodes.forEach(d3_layout_packUnlink); - - return cr; -} - -function d3_layout_packLink(node) { - node._pack_next = node._pack_prev = node; -} - -function d3_layout_packUnlink(node) { - delete node._pack_next; - delete node._pack_prev; -} - -function d3_layout_packTree(node) { - var children = node.children; - if (children && children.length) { - children.forEach(d3_layout_packTree); - node.r = d3_layout_packCircle(children); - } else { - node.r = Math.sqrt(node.value); - } -} - -function d3_layout_packTransform(node, x, y, k) { - var children = node.children; - node.x = (x += k * node.x); - node.y = (y += k * node.y); - node.r *= k; - if (children) { - var i = -1, n = children.length; - while (++i < n) d3_layout_packTransform(children[i], x, y, k); - } -} - -function d3_layout_packPlace(a, b, c) { - var db = a.r + c.r, - dx = b.x - a.x, - dy = b.y - a.y; - if (db && (dx || dy)) { - var da = b.r + c.r, - dc = Math.sqrt(dx * dx + dy * dy), - cos = Math.max(-1, Math.min(1, (db * db + dc * dc - da * da) / (2 * db * dc))), - theta = Math.acos(cos), - x = cos * (db /= dc), - y = Math.sin(theta) * db; - c.x = a.x + x * dx + y * dy; - c.y = a.y + x * dy - y * dx; - } else { - c.x = a.x + db; - c.y = a.y; - } -} -// Implements a hierarchical layout using the cluster (or dendogram) algorithm. -d3.layout.cluster = function() { - var hierarchy = d3.layout.hierarchy().sort(null).value(null), - separation = d3_layout_treeSeparation, - size = [1, 1]; // width, height - - function cluster(d, i) { - var nodes = hierarchy.call(this, d, i), - root = nodes[0], - previousNode, - x = 0, - kx, - ky; - - // First walk, computing the initial x & y values. - d3_layout_treeVisitAfter(root, function(node) { - var children = node.children; - if (children && children.length) { - node.x = d3_layout_clusterX(children); - node.y = d3_layout_clusterY(children); - } else { - node.x = previousNode ? x += separation(node, previousNode) : 0; - node.y = 0; - previousNode = node; - } - }); - - // Compute the left-most, right-most, and depth-most nodes for extents. - var left = d3_layout_clusterLeft(root), - right = d3_layout_clusterRight(root), - x0 = left.x - separation(left, right) / 2, - x1 = right.x + separation(right, left) / 2; - - // Second walk, normalizing x & y to the desired size. - d3_layout_treeVisitAfter(root, function(node) { - node.x = (node.x - x0) / (x1 - x0) * size[0]; - node.y = (1 - (root.y ? node.y / root.y : 1)) * size[1]; - }); - - return nodes; - } - - cluster.separation = function(x) { - if (!arguments.length) return separation; - separation = x; - return cluster; - }; - - cluster.size = function(x) { - if (!arguments.length) return size; - size = x; - return cluster; - }; - - return d3_layout_hierarchyRebind(cluster, hierarchy); -}; - -function d3_layout_clusterY(children) { - return 1 + d3.max(children, function(child) { - return child.y; - }); -} - -function d3_layout_clusterX(children) { - return children.reduce(function(x, child) { - return x + child.x; - }, 0) / children.length; -} - -function d3_layout_clusterLeft(node) { - var children = node.children; - return children && children.length ? d3_layout_clusterLeft(children[0]) : node; -} - -function d3_layout_clusterRight(node) { - var children = node.children, n; - return children && (n = children.length) ? d3_layout_clusterRight(children[n - 1]) : node; -} -// Node-link tree diagram using the Reingold-Tilford "tidy" algorithm -d3.layout.tree = function() { - var hierarchy = d3.layout.hierarchy().sort(null).value(null), - separation = d3_layout_treeSeparation, - size = [1, 1]; // width, height - - function tree(d, i) { - var nodes = hierarchy.call(this, d, i), - root = nodes[0]; - - function firstWalk(node, previousSibling) { - var children = node.children, - layout = node._tree; - if (children && (n = children.length)) { - var n, - firstChild = children[0], - previousChild, - ancestor = firstChild, - child, - i = -1; - while (++i < n) { - child = children[i]; - firstWalk(child, previousChild); - ancestor = apportion(child, previousChild, ancestor); - previousChild = child; - } - d3_layout_treeShift(node); - var midpoint = .5 * (firstChild._tree.prelim + child._tree.prelim); - if (previousSibling) { - layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling); - layout.mod = layout.prelim - midpoint; - } else { - layout.prelim = midpoint; - } - } else { - if (previousSibling) { - layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling); - } - } - } - - function secondWalk(node, x) { - node.x = node._tree.prelim + x; - var children = node.children; - if (children && (n = children.length)) { - var i = -1, - n; - x += node._tree.mod; - while (++i < n) { - secondWalk(children[i], x); - } - } - } - - function apportion(node, previousSibling, ancestor) { - if (previousSibling) { - var vip = node, - vop = node, - vim = previousSibling, - vom = node.parent.children[0], - sip = vip._tree.mod, - sop = vop._tree.mod, - sim = vim._tree.mod, - som = vom._tree.mod, - shift; - while (vim = d3_layout_treeRight(vim), vip = d3_layout_treeLeft(vip), vim && vip) { - vom = d3_layout_treeLeft(vom); - vop = d3_layout_treeRight(vop); - vop._tree.ancestor = node; - shift = vim._tree.prelim + sim - vip._tree.prelim - sip + separation(vim, vip); - if (shift > 0) { - d3_layout_treeMove(d3_layout_treeAncestor(vim, node, ancestor), node, shift); - sip += shift; - sop += shift; - } - sim += vim._tree.mod; - sip += vip._tree.mod; - som += vom._tree.mod; - sop += vop._tree.mod; - } - if (vim && !d3_layout_treeRight(vop)) { - vop._tree.thread = vim; - vop._tree.mod += sim - sop; - } - if (vip && !d3_layout_treeLeft(vom)) { - vom._tree.thread = vip; - vom._tree.mod += sip - som; - ancestor = node; - } - } - return ancestor; - } - - // Initialize temporary layout variables. - d3_layout_treeVisitAfter(root, function(node, previousSibling) { - node._tree = { - ancestor: node, - prelim: 0, - mod: 0, - change: 0, - shift: 0, - number: previousSibling ? previousSibling._tree.number + 1 : 0 - }; - }); - - // Compute the layout using Buchheim et al.'s algorithm. - firstWalk(root); - secondWalk(root, -root._tree.prelim); - - // Compute the left-most, right-most, and depth-most nodes for extents. - var left = d3_layout_treeSearch(root, d3_layout_treeLeftmost), - right = d3_layout_treeSearch(root, d3_layout_treeRightmost), - deep = d3_layout_treeSearch(root, d3_layout_treeDeepest), - x0 = left.x - separation(left, right) / 2, - x1 = right.x + separation(right, left) / 2, - y1 = deep.depth || 1; - - // Clear temporary layout variables; transform x and y. - d3_layout_treeVisitAfter(root, function(node) { - node.x = (node.x - x0) / (x1 - x0) * size[0]; - node.y = node.depth / y1 * size[1]; - delete node._tree; - }); - - return nodes; - } - - tree.separation = function(x) { - if (!arguments.length) return separation; - separation = x; - return tree; - }; - - tree.size = function(x) { - if (!arguments.length) return size; - size = x; - return tree; - }; - - return d3_layout_hierarchyRebind(tree, hierarchy); -}; - -function d3_layout_treeSeparation(a, b) { - return a.parent == b.parent ? 1 : 2; -} - -// function d3_layout_treeSeparationRadial(a, b) { -// return (a.parent == b.parent ? 1 : 2) / a.depth; -// } - -function d3_layout_treeLeft(node) { - var children = node.children; - return children && children.length ? children[0] : node._tree.thread; -} - -function d3_layout_treeRight(node) { - var children = node.children, - n; - return children && (n = children.length) ? children[n - 1] : node._tree.thread; -} - -function d3_layout_treeSearch(node, compare) { - var children = node.children; - if (children && (n = children.length)) { - var child, - n, - i = -1; - while (++i < n) { - if (compare(child = d3_layout_treeSearch(children[i], compare), node) > 0) { - node = child; - } - } - } - return node; -} - -function d3_layout_treeRightmost(a, b) { - return a.x - b.x; -} - -function d3_layout_treeLeftmost(a, b) { - return b.x - a.x; -} - -function d3_layout_treeDeepest(a, b) { - return a.depth - b.depth; -} - -function d3_layout_treeVisitAfter(node, callback) { - function visit(node, previousSibling) { - var children = node.children; - if (children && (n = children.length)) { - var child, - previousChild = null, - i = -1, - n; - while (++i < n) { - child = children[i]; - visit(child, previousChild); - previousChild = child; - } - } - callback(node, previousSibling); - } - visit(node, null); -} - -function d3_layout_treeShift(node) { - var shift = 0, - change = 0, - children = node.children, - i = children.length, - child; - while (--i >= 0) { - child = children[i]._tree; - child.prelim += shift; - child.mod += shift; - shift += child.shift + (change += child.change); - } -} - -function d3_layout_treeMove(ancestor, node, shift) { - ancestor = ancestor._tree; - node = node._tree; - var change = shift / (node.number - ancestor.number); - ancestor.change += change; - node.change -= change; - node.shift += shift; - node.prelim += shift; - node.mod += shift; -} - -function d3_layout_treeAncestor(vim, node, ancestor) { - return vim._tree.ancestor.parent == node.parent - ? vim._tree.ancestor - : ancestor; -} -// Squarified Treemaps by Mark Bruls, Kees Huizing, and Jarke J. van Wijk -// Modified to support a target aspect ratio by Jeff Heer -d3.layout.treemap = function() { - var hierarchy = d3.layout.hierarchy(), - round = Math.round, - size = [1, 1], // width, height - padding = null, - pad = d3_layout_treemapPadNull, - sticky = false, - stickies, - ratio = 0.5 * (1 + Math.sqrt(5)); // golden ratio - - // Compute the area for each child based on value & scale. - function scale(children, k) { - var i = -1, - n = children.length, - child, - area; - while (++i < n) { - area = (child = children[i]).value * (k < 0 ? 0 : k); - child.area = isNaN(area) || area <= 0 ? 0 : area; - } - } - - // Recursively arranges the specified node's children into squarified rows. - function squarify(node) { - var children = node.children; - if (children && children.length) { - var rect = pad(node), - row = [], - remaining = children.slice(), // copy-on-write - child, - best = Infinity, // the best row score so far - score, // the current row score - u = Math.min(rect.dx, rect.dy), // initial orientation - n; - scale(remaining, rect.dx * rect.dy / node.value); - row.area = 0; - while ((n = remaining.length) > 0) { - row.push(child = remaining[n - 1]); - row.area += child.area; - if ((score = worst(row, u)) <= best) { // continue with this orientation - remaining.pop(); - best = score; - } else { // abort, and try a different orientation - row.area -= row.pop().area; - position(row, u, rect, false); - u = Math.min(rect.dx, rect.dy); - row.length = row.area = 0; - best = Infinity; - } - } - if (row.length) { - position(row, u, rect, true); - row.length = row.area = 0; - } - children.forEach(squarify); - } - } - - // Recursively resizes the specified node's children into existing rows. - // Preserves the existing layout! - function stickify(node) { - var children = node.children; - if (children && children.length) { - var rect = pad(node), - remaining = children.slice(), // copy-on-write - child, - row = []; - scale(remaining, rect.dx * rect.dy / node.value); - row.area = 0; - while (child = remaining.pop()) { - row.push(child); - row.area += child.area; - if (child.z != null) { - position(row, child.z ? rect.dx : rect.dy, rect, !remaining.length); - row.length = row.area = 0; - } - } - children.forEach(stickify); - } - } - - // Computes the score for the specified row, as the worst aspect ratio. - function worst(row, u) { - var s = row.area, - r, - rmax = 0, - rmin = Infinity, - i = -1, - n = row.length; - while (++i < n) { - if (!(r = row[i].area)) continue; - if (r < rmin) rmin = r; - if (r > rmax) rmax = r; - } - s *= s; - u *= u; - return s - ? Math.max((u * rmax * ratio) / s, s / (u * rmin * ratio)) - : Infinity; - } - - // Positions the specified row of nodes. Modifies `rect`. - function position(row, u, rect, flush) { - var i = -1, - n = row.length, - x = rect.x, - y = rect.y, - v = u ? round(row.area / u) : 0, - o; - if (u == rect.dx) { // horizontal subdivision - if (flush || v > rect.dy) v = v ? rect.dy : 0; // over+underflow - while (++i < n) { - o = row[i]; - o.x = x; - o.y = y; - o.dy = v; - x += o.dx = v ? round(o.area / v) : 0; - } - o.z = true; - o.dx += rect.x + rect.dx - x; // rounding error - rect.y += v; - rect.dy -= v; - } else { // vertical subdivision - if (flush || v > rect.dx) v = v ? rect.dx : 0; // over+underflow - while (++i < n) { - o = row[i]; - o.x = x; - o.y = y; - o.dx = v; - y += o.dy = v ? round(o.area / v) : 0; - } - o.z = false; - o.dy += rect.y + rect.dy - y; // rounding error - rect.x += v; - rect.dx -= v; - } - } - - function treemap(d) { - var nodes = stickies || hierarchy(d), - root = nodes[0]; - root.x = 0; - root.y = 0; - root.dx = size[0]; - root.dy = size[1]; - if (stickies) hierarchy.revalue(root); - scale([root], root.dx * root.dy / root.value); - (stickies ? stickify : squarify)(root); - if (sticky) stickies = nodes; - return nodes; - } - - treemap.size = function(x) { - if (!arguments.length) return size; - size = x; - return treemap; - }; - - treemap.padding = function(x) { - if (!arguments.length) return padding; - - function padFunction(node) { - var p = x.call(treemap, node, node.depth); - return p == null - ? d3_layout_treemapPadNull(node) - : d3_layout_treemapPad(node, typeof p === "number" ? [p, p, p, p] : p); - } - - function padConstant(node) { - return d3_layout_treemapPad(node, x); - } - - var type; - pad = (padding = x) == null ? d3_layout_treemapPadNull - : (type = typeof x) === "function" ? padFunction - : type === "number" ? (x = [x, x, x, x], padConstant) - : padConstant; - return treemap; - }; - - treemap.round = function(x) { - if (!arguments.length) return round != Number; - round = x ? Math.round : Number; - return treemap; - }; - - treemap.sticky = function(x) { - if (!arguments.length) return sticky; - sticky = x; - stickies = null; - return treemap; - }; - - treemap.ratio = function(x) { - if (!arguments.length) return ratio; - ratio = x; - return treemap; - }; - - return d3_layout_hierarchyRebind(treemap, hierarchy); -}; - -function d3_layout_treemapPadNull(node) { - return {x: node.x, y: node.y, dx: node.dx, dy: node.dy}; -} - -function d3_layout_treemapPad(node, padding) { - var x = node.x + padding[3], - y = node.y + padding[0], - dx = node.dx - padding[1] - padding[3], - dy = node.dy - padding[0] - padding[2]; - if (dx < 0) { x += dx / 2; dx = 0; } - if (dy < 0) { y += dy / 2; dy = 0; } - return {x: x, y: y, dx: dx, dy: dy}; -} -})(); diff --git a/modules/enterprise/gui/rest-war/src/main/webapp/js/d3.time.js b/modules/enterprise/gui/rest-war/src/main/webapp/js/d3.time.js deleted file mode 100755 index 4c1cda4..0000000 --- a/modules/enterprise/gui/rest-war/src/main/webapp/js/d3.time.js +++ /dev/null @@ -1,687 +0,0 @@ -(function(){d3.time = {}; - -var d3_time = Date; -d3.time.format = function(template) { - var n = template.length; - - function format(date) { - var string = [], - i = -1, - j = 0, - c, - f; - while (++i < n) { - if (template.charCodeAt(i) == 37) { - string.push( - template.substring(j, i), - (f = d3_time_formats[c = template.charAt(++i)]) - ? f(date) : c); - j = i + 1; - } - } - string.push(template.substring(j, i)); - return string.join(""); - } - - format.parse = function(string) { - var date = new d3_time(1900, 0, 1), - i = d3_time_parse(date, template, string, 0); - if (i != string.length) return null; - if (date.hour12) { - var hours = date.getHours() % 12; - date.setHours(date.hour12pm ? hours + 12 : hours); - } - delete date.hour12; - delete date.hour12pm; - return date; - }; - - format.toString = function() { - return template; - }; - - return format; -}; - -function d3_time_parse(date, template, string, j) { - var c, - p, - i = 0, - n = template.length, - m = string.length; - while (i < n) { - if (j >= m) return -1; - c = template.charCodeAt(i++); - if (c == 37) { - p = d3_time_parsers[template.charAt(i++)]; - if (!p || ((j = p(date, string, j)) < 0)) return -1; - } else if (c != string.charCodeAt(j++)) { - return -1; - } - } - return j; -} - -var d3_time_zfill2 = d3.format("02d"), - d3_time_zfill3 = d3.format("03d"), - d3_time_zfill4 = d3.format("04d"), - d3_time_sfill2 = d3.format("2d"); - -var d3_time_formats = { - a: function(d) { return d3_time_weekdays[d.getDay()].substring(0, 3); }, - A: function(d) { return d3_time_weekdays[d.getDay()]; }, - b: function(d) { return d3_time_months[d.getMonth()].substring(0, 3); }, - B: function(d) { return d3_time_months[d.getMonth()]; }, - c: d3.time.format("%a %b %e %H:%M:%S %Y"), - d: function(d) { return d3_time_zfill2(d.getDate()); }, - e: function(d) { return d3_time_sfill2(d.getDate()); }, - H: function(d) { return d3_time_zfill2(d.getHours()); }, - I: function(d) { return d3_time_zfill2(d.getHours() % 12 || 12); }, - j: d3_time_dayOfYear, - L: function(d) { return d3_time_zfill3(d.getMilliseconds()); }, - m: function(d) { return d3_time_zfill2(d.getMonth() + 1); }, - M: function(d) { return d3_time_zfill2(d.getMinutes()); }, - p: function(d) { return d.getHours() >= 12 ? "PM" : "AM"; }, - S: function(d) { return d3_time_zfill2(d.getSeconds()); }, - U: d3_time_weekNumberSunday, - w: function(d) { return d.getDay(); }, - W: d3_time_weekNumberMonday, - x: d3.time.format("%m/%d/%y"), - X: d3.time.format("%H:%M:%S"), - y: function(d) { return d3_time_zfill2(d.getFullYear() % 100); }, - Y: function(d) { return d3_time_zfill4(d.getFullYear() % 10000); }, - Z: d3_time_zone, - "%": function(d) { return "%"; } -}; - -var d3_time_parsers = { - a: d3_time_parseWeekdayAbbrev, - A: d3_time_parseWeekday, - b: d3_time_parseMonthAbbrev, - B: d3_time_parseMonth, - c: d3_time_parseLocaleFull, - d: d3_time_parseDay, - e: d3_time_parseDay, - H: d3_time_parseHour24, - I: d3_time_parseHour12, - // j: function(d, s, i) { /*TODO day of year [001,366] */ return i; }, - L: d3_time_parseMilliseconds, - m: d3_time_parseMonthNumber, - M: d3_time_parseMinutes, - p: d3_time_parseAmPm, - S: d3_time_parseSeconds, - // U: function(d, s, i) { /*TODO week number (sunday) [00,53] */ return i; }, - // w: function(d, s, i) { /*TODO weekday [0,6] */ return i; }, - // W: function(d, s, i) { /*TODO week number (monday) [00,53] */ return i; }, - x: d3_time_parseLocaleDate, - X: d3_time_parseLocaleTime, - y: d3_time_parseYear, - Y: d3_time_parseFullYear - // , - // Z: function(d, s, i) { /*TODO time zone */ return i; }, - // "%": function(d, s, i) { /*TODO literal % */ return i; } -}; - -// Note: weekday is validated, but does not set the date. -function d3_time_parseWeekdayAbbrev(date, string, i) { - return string.substring(i, i += 3).toLowerCase() in d3_time_weekdayAbbrevLookup ? i : -1; -} - -var d3_time_weekdayAbbrevLookup = { - sun: 3, - mon: 3, - tue: 3, - wed: 3, - thu: 3, - fri: 3, - sat: 3 -}; - -// Note: weekday is validated, but does not set the date. -function d3_time_parseWeekday(date, string, i) { - d3_time_weekdayRe.lastIndex = 0; - var n = d3_time_weekdayRe.exec(string.substring(i, i + 10)); - return n ? i += n[0].length : -1; -} - -var d3_time_weekdayRe = /^(?:Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday)/ig; - -var d3_time_weekdays = [ - "Sunday", - "Monday", - "Tuesday", - "Wednesday", - "Thursday", - "Friday", - "Saturday" -]; - -function d3_time_parseMonthAbbrev(date, string, i) { - var n = d3_time_monthAbbrevLookup[string.substring(i, i += 3).toLowerCase()]; - return n == null ? -1 : (date.setMonth(n), i); -} - -var d3_time_monthAbbrevLookup = { - jan: 0, - feb: 1, - mar: 2, - apr: 3, - may: 4, - jun: 5, - jul: 6, - aug: 7, - sep: 8, - oct: 9, - nov: 10, - dec: 11 -}; - -function d3_time_parseMonth(date, string, i) { - d3_time_monthRe.lastIndex = 0; - var n = d3_time_monthRe.exec(string.substring(i, i + 12)); - return n ? (date.setMonth(d3_time_monthLookup[n[0].toLowerCase()]), i += n[0].length) : -1; -} - -var d3_time_monthRe = /^(?:January|February|March|April|May|June|July|August|September|October|November|December)/ig; - -var d3_time_monthLookup = { - january: 0, - february: 1, - march: 2, - april: 3, - may: 4, - june: 5, - july: 6, - august: 7, - september: 8, - october: 9, - november: 10, - december: 11 -}; - -var d3_time_months = [ - "January", - "February", - "March", - "April", - "May", - "June", - "July", - "August", - "September", - "October", - "November", - "December" -]; - -function d3_time_parseLocaleFull(date, string, i) { - return d3_time_parse(date, d3_time_formats.c.toString(), string, i); -} - -function d3_time_parseLocaleDate(date, string, i) { - return d3_time_parse(date, d3_time_formats.x.toString(), string, i); -} - -function d3_time_parseLocaleTime(date, string, i) { - return d3_time_parse(date, d3_time_formats.X.toString(), string, i); -} - -function d3_time_parseFullYear(date, string, i) { - d3_time_numberRe.lastIndex = 0; - var n = d3_time_numberRe.exec(string.substring(i, i + 4)); - return n ? (date.setFullYear(n[0]), i += n[0].length) : -1; -} - -function d3_time_parseYear(date, string, i) { - d3_time_numberRe.lastIndex = 0; - var n = d3_time_numberRe.exec(string.substring(i, i + 2)); - return n ? (date.setFullYear(d3_time_century() + +n[0]), i += n[0].length) : -1; -} - -function d3_time_century() { - return ~~(new Date().getFullYear() / 1000) * 1000; -} - -function d3_time_parseMonthNumber(date, string, i) { - d3_time_numberRe.lastIndex = 0; - var n = d3_time_numberRe.exec(string.substring(i, i + 2)); - return n ? (date.setMonth(n[0] - 1), i += n[0].length) : -1; -} - -function d3_time_parseDay(date, string, i) { - d3_time_numberRe.lastIndex = 0; - var n = d3_time_numberRe.exec(string.substring(i, i + 2)); - return n ? (date.setDate(+n[0]), i += n[0].length) : -1; -} - -// Note: we don't validate that the hour is in the range [0,23]. -function d3_time_parseHour24(date, string, i) { - d3_time_numberRe.lastIndex = 0; - var n = d3_time_numberRe.exec(string.substring(i, i + 2)); - return n ? (date.setHours(+n[0]), i += n[0].length) : -1; -} - -// Note: we don't validate that the hour is in the range [1,12]. -function d3_time_parseHour12(date, string, i) { - date.hour12 = true; - return d3_time_parseHour24(date, string, i); -} - -function d3_time_parseMinutes(date, string, i) { - d3_time_numberRe.lastIndex = 0; - var n = d3_time_numberRe.exec(string.substring(i, i + 2)); - return n ? (date.setMinutes(+n[0]), i += n[0].length) : -1; -} - -function d3_time_parseSeconds(date, string, i) { - d3_time_numberRe.lastIndex = 0; - var n = d3_time_numberRe.exec(string.substring(i, i + 2)); - return n ? (date.setSeconds(+n[0]), i += n[0].length) : -1; -} - -function d3_time_parseMilliseconds(date, string, i) { - d3_time_numberRe.lastIndex = 0; - var n = d3_time_numberRe.exec(string.substring(i, i + 3)); - return n ? (date.setMilliseconds(+n[0]), i += n[0].length) : -1; -} - -// Note: we don't look at the next directive. -var d3_time_numberRe = /\s*\d+/; - -function d3_time_parseAmPm(date, string, i) { - var n = d3_time_amPmLookup[string.substring(i, i += 2).toLowerCase()]; - return n == null ? -1 : (date.hour12pm = n, i); -} - -var d3_time_amPmLookup = { - am: 0, - pm: 1 -}; - -function d3_time_year(d) { - return new d3_time(d.getFullYear(), 0, 1); -} - -function d3_time_daysElapsed(d0, d1) { - return ~~((d1 - d0) / 864e5 - (d1.getTimezoneOffset() - d0.getTimezoneOffset()) / 1440); -} - -function d3_time_dayOfYear(d) { - return d3_time_zfill3(1 + d3_time_daysElapsed(d3_time_year(d), d)); -} - -function d3_time_weekNumberSunday(d) { - var d0 = d3_time_year(d); - return d3_time_zfill2(~~((d3_time_daysElapsed(d0, d) + d0.getDay()) / 7)); -} - -function d3_time_weekNumberMonday(d) { - var d0 = d3_time_year(d); - return d3_time_zfill2(~~((d3_time_daysElapsed(d0, d) + (d0.getDay() + 6) % 7) / 7)); -} - -// TODO table of time zone offset names? -function d3_time_zone(d) { - var z = d.getTimezoneOffset(), - zs = z > 0 ? "-" : "+", - zh = ~~(Math.abs(z) / 60), - zm = Math.abs(z) % 60; - return zs + d3_time_zfill2(zh) + d3_time_zfill2(zm); -} -d3.time.format.utc = function(template) { - var local = d3.time.format(template); - - function format(date) { - try { - d3_time = d3_time_format_utc; - var utc = new d3_time(); - utc._ = date; - return local(utc); - } finally { - d3_time = Date; - } - } - - format.parse = function(string) { - try { - d3_time = d3_time_format_utc; - var date = local.parse(string); - return date && date._; - } finally { - d3_time = Date; - } - }; - - format.toString = local.toString; - - return format; -}; - -function d3_time_format_utc() { - this._ = new Date(Date.UTC.apply(this, arguments)); -} - -d3_time_format_utc.prototype = { - getDate: function() { return this._.getUTCDate(); }, - getDay: function() { return this._.getUTCDay(); }, - getFullYear: function() { return this._.getUTCFullYear(); }, - getHours: function() { return this._.getUTCHours(); }, - getMilliseconds: function() { return this._.getUTCMilliseconds(); }, - getMinutes: function() { return this._.getUTCMinutes(); }, - getMonth: function() { return this._.getUTCMonth(); }, - getSeconds: function() { return this._.getUTCSeconds(); }, - getTimezoneOffset: function() { return 0; }, - valueOf: function() { return this._.getTime(); }, - setDate: function(x) { this._.setUTCDate(x); }, - setDay: function(x) { this._.setUTCDay(x); }, - setFullYear: function(x) { this._.setUTCFullYear(x); }, - setHours: function(x) { this._.setUTCHours(x); }, - setMilliseconds: function(x) { this._.setUTCMilliseconds(x); }, - setMinutes: function(x) { this._.setUTCMinutes(x); }, - setMonth: function(x) { this._.setUTCMonth(x); }, - setSeconds: function(x) { this._.setUTCSeconds(x); } -}; -var d3_time_formatIso = d3.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ"); - -d3.time.format.iso = Date.prototype.toISOString ? d3_time_formatIsoNative : d3_time_formatIso; - -function d3_time_formatIsoNative(date) { - return date.toISOString(); -} - -d3_time_formatIsoNative.parse = function(string) { - return new Date(string); -}; - -d3_time_formatIsoNative.toString = d3_time_formatIso.toString; -function d3_time_range(floor, step, number) { - return function(t0, t1, dt) { - var time = floor(t0), times = []; - if (time < t0) step(time); - if (dt > 1) { - while (time < t1) { - var date = new Date(+time); - if (!(number(date) % dt)) times.push(date); - step(time); - } - } else { - while (time < t1) times.push(new Date(+time)), step(time); - } - return times; - }; -} -d3.time.second = function(date) { - return new Date(~~(date / 1e3) * 1e3); -}; - -d3.time.second.utc = d3.time.second; -d3.time.seconds = d3_time_range(d3.time.second, function(date) { - date.setTime(date.getTime() + 1e3); -}, function(date) { - return date.getSeconds(); -}); - -d3.time.seconds.utc = d3.time.seconds; -d3.time.minute = function(date) { - return new Date(~~(date / 6e4) * 6e4); -}; - -d3.time.minute.utc = d3.time.minute;d3.time.minutes = d3_time_range(d3.time.minute, d3_time_minutesStep, function(date) { - return date.getMinutes(); -}); - -d3.time.minutes.utc = d3_time_range(d3.time.minute, d3_time_minutesStep, function(date) { - return date.getUTCMinutes(); -}); - -function d3_time_minutesStep(date) { - date.setTime(date.getTime() + 6e4); // assumes no leap seconds -} -d3.time.hour = function(date) { - var offset = date.getTimezoneOffset() / 60; - return new Date((~~(date / 36e5 - offset) + offset) * 36e5); -}; - -d3.time.hour.utc = function(date) { - return new Date(~~(date / 36e5) * 36e5); -}; -d3.time.hours = d3_time_range(d3.time.hour, d3_time_hoursStep, function(date) { - return date.getHours(); -}); - -d3.time.hours.utc = d3_time_range(d3.time.hour.utc, d3_time_hoursStep, function(date) { - return date.getUTCHours(); -}); - -function d3_time_hoursStep(date) { - date.setTime(date.getTime() + 36e5); -} -d3.time.day = function(date) { - return new Date(date.getFullYear(), date.getMonth(), date.getDate()); -}; - -d3.time.day.utc = function(date) { - return new Date(~~(date / 864e5) * 864e5); -}; -d3.time.days = d3_time_range(d3.time.day, function(date) { - date.setDate(date.getDate() + 1); -}, function(date) { - return date.getDate() - 1; -}); - -d3.time.days.utc = d3_time_range(d3.time.day.utc, function(date) { - date.setUTCDate(date.getUTCDate() + 1); -}, function(date) { - return date.getUTCDate() - 1; -}); -d3.time.week = function(date) { - (date = d3.time.day(date)).setDate(date.getDate() - date.getDay()); - return date; -}; - -d3.time.week.utc = function(date) { - (date = d3.time.day.utc(date)).setUTCDate(date.getUTCDate() - date.getUTCDay()); - return date; -}; -d3.time.weeks = d3_time_range(d3.time.week, function(date) { - date.setDate(date.getDate() + 7); -}, function(date) { - return ~~((date - new Date(date.getFullYear(), 0, 1)) / 6048e5); -}); - -d3.time.weeks.utc = d3_time_range(d3.time.week.utc, function(date) { - date.setUTCDate(date.getUTCDate() + 7); -}, function(date) { - return ~~((date - Date.UTC(date.getUTCFullYear(), 0, 1)) / 6048e5); -}); -d3.time.month = function(date) { - return new Date(date.getFullYear(), date.getMonth(), 1); -}; - -d3.time.month.utc = function(date) { - return new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), 1)); -}; -d3.time.months = d3_time_range(d3.time.month, function(date) { - date.setMonth(date.getMonth() + 1); -}, function(date) { - return date.getMonth(); -}); - -d3.time.months.utc = d3_time_range(d3.time.month.utc, function(date) { - date.setUTCMonth(date.getUTCMonth() + 1); -}, function(date) { - return date.getUTCMonth(); -}); -d3.time.year = function(date) { - return new Date(date.getFullYear(), 0, 1); -}; - -d3.time.year.utc = function(date) { - return new Date(Date.UTC(date.getUTCFullYear(), 0, 1)); -}; -d3.time.years = d3_time_range(d3.time.year, function(date) { - date.setFullYear(date.getFullYear() + 1); -}, function(date) { - return date.getFullYear(); -}); - -d3.time.years.utc = d3_time_range(d3.time.year.utc, function(date) { - date.setUTCFullYear(date.getUTCFullYear() + 1); -}, function(date) { - return date.getUTCFullYear(); -}); -// TODO nice -function d3_time_scale(linear, methods, format) { - - function scale(x) { - return linear(x); - } - - scale.invert = function(x) { - return d3_time_scaleDate(linear.invert(x)); - }; - - scale.domain = function(x) { - if (!arguments.length) return linear.domain().map(d3_time_scaleDate); - linear.domain(x); - return scale; - }; - - scale.ticks = function(m, k) { - var extent = d3_time_scaleExtent(scale.domain()); - if (typeof m !== "function") { - var span = extent[1] - extent[0], - target = span / m, - i = d3.bisect(d3_time_scaleSteps, target, 1, d3_time_scaleSteps.length - 1); - if (Math.log(target / d3_time_scaleSteps[i - 1]) < Math.log(d3_time_scaleSteps[i] / target)) --i; - m = methods[i]; - k = m[1]; - m = m[0]; - } - return m(extent[0], extent[1], k); - }; - - scale.tickFormat = function() { - return format; - }; - - scale.copy = function() { - return d3_time_scale(linear.copy(), methods, format); - }; - - // TOOD expose d3_scale_linear_rebind? - return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp"); -} - -// TODO expose d3_scaleExtent? -function d3_time_scaleExtent(domain) { - var start = domain[0], stop = domain[domain.length - 1]; - return start < stop ? [start, stop] : [stop, start]; -} - -function d3_time_scaleDate(t) { - return new Date(t); -} - -function d3_time_scaleFormat(formats) { - return function(date) { - var i = formats.length - 1, f = formats[i]; - while (!f[1](date)) f = formats[--i]; - return f[0](date); - }; -} - -var d3_time_scaleSteps = [ - 1e3, // 1-second - 5e3, // 5-second - 15e3, // 15-second - 3e4, // 30-second - 6e4, // 1-minute - 3e5, // 5-minute - 9e5, // 15-minute - 18e5, // 30-minute - 36e5, // 1-hour - 108e5, // 3-hour - 216e5, // 6-hour - 432e5, // 12-hour - 864e5, // 1-day - 1728e5, // 2-day - 6048e5, // 1-week - 1728e6, // 1-month - 7776e6, // 3-month - 31536e6 // 1-year -]; - -var d3_time_scaleLocalMethods = [ - [d3.time.seconds, 1], - [d3.time.seconds, 5], - [d3.time.seconds, 15], - [d3.time.seconds, 30], - [d3.time.minutes, 1], - [d3.time.minutes, 5], - [d3.time.minutes, 15], - [d3.time.minutes, 30], - [d3.time.hours, 1], - [d3.time.hours, 3], - [d3.time.hours, 6], - [d3.time.hours, 12], - [d3.time.days, 1], - [d3.time.days, 2], - [d3.time.weeks, 1], - [d3.time.months, 1], - [d3.time.months, 3], - [d3.time.years, 1] -]; - -var d3_time_scaleLocalFormats = [ - [d3.time.format("%Y"), function(d) { return true; }], - [d3.time.format("%B"), function(d) { return d.getMonth(); }], - [d3.time.format("%b %d"), function(d) { return d.getDate() != 1; }], - [d3.time.format("%a %d"), function(d) { return d.getDay() && d.getDate() != 1; }], - [d3.time.format("%I %p"), function(d) { return d.getHours(); }], - [d3.time.format("%I:%M"), function(d) { return d.getMinutes(); }], - [d3.time.format(":%S"), function(d) { return d.getSeconds() || d.getMilliseconds(); }] -]; - -var d3_time_scaleLocalFormat = d3_time_scaleFormat(d3_time_scaleLocalFormats); - -d3.time.scale = function() { - return d3_time_scale(d3.scale.linear(), d3_time_scaleLocalMethods, d3_time_scaleLocalFormat); -}; -var d3_time_scaleUTCMethods = [ - [d3.time.seconds.utc, 1], - [d3.time.seconds.utc, 5], - [d3.time.seconds.utc, 15], - [d3.time.seconds.utc, 30], - [d3.time.minutes.utc, 1], - [d3.time.minutes.utc, 5], - [d3.time.minutes.utc, 15], - [d3.time.minutes.utc, 30], - [d3.time.hours.utc, 1], - [d3.time.hours.utc, 3], - [d3.time.hours.utc, 6], - [d3.time.hours.utc, 12], - [d3.time.days.utc, 1], - [d3.time.days.utc, 2], - [d3.time.weeks.utc, 1], - [d3.time.months.utc, 1], - [d3.time.months.utc, 3], - [d3.time.years.utc, 1] -]; - -var d3_time_scaleUTCFormats = [ - [d3.time.format.utc("%Y"), function(d) { return true; }], - [d3.time.format.utc("%B"), function(d) { return d.getUTCMonth(); }], - [d3.time.format.utc("%b %d"), function(d) { return d.getUTCDate() != 1; }], - [d3.time.format.utc("%a %d"), function(d) { return d.getUTCDay() && d.getUTCDate() != 1; }], - [d3.time.format.utc("%I %p"), function(d) { return d.getUTCHours(); }], - [d3.time.format.utc("%I:%M"), function(d) { return d.getUTCMinutes(); }], - [d3.time.format.utc(":%S"), function(d) { return d.getUTCSeconds() || d.getUTCMilliseconds(); }] -]; - -var d3_time_scaleUTCFormat = d3_time_scaleFormat(d3_time_scaleUTCFormats); - -d3.time.scale.utc = function() { - return d3_time_scale(d3.scale.linear(), d3_time_scaleUTCMethods, d3_time_scaleUTCFormat); -}; -})(); diff --git a/modules/enterprise/gui/rest-war/src/main/webapp/js/jquery.js b/modules/enterprise/gui/rest-war/src/main/webapp/js/jquery.js deleted file mode 100644 index 8ccd0ea..0000000 --- a/modules/enterprise/gui/rest-war/src/main/webapp/js/jquery.js +++ /dev/null @@ -1,9266 +0,0 @@ -/*! - * jQuery JavaScript Library v1.7.1 - * http://jquery.com/ - * - * Copyright 2011, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * Copyright 2011, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * - * Date: Mon Nov 21 21:11:03 2011 -0500 - */ -(function( window, undefined ) { - -// Use the correct document accordingly with window argument (sandbox) -var document = window.document, - navigator = window.navigator, - location = window.location; -var jQuery = (function() { - -// Define a local copy of jQuery -var jQuery = function( selector, context ) { - // The jQuery object is actually just the init constructor 'enhanced' - return new jQuery.fn.init( selector, context, rootjQuery ); - }, - - // Map over jQuery in case of overwrite - _jQuery = window.jQuery, - - // Map over the $ in case of overwrite - _$ = window.$, - - // A central reference to the root jQuery(document) - rootjQuery, - - // A simple way to check for HTML strings or ID strings - // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) - quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w-]*)$)/, - - // Check if a string has a non-whitespace character in it - rnotwhite = /\S/, - - // Used for trimming whitespace - trimLeft = /^\s+/, - trimRight = /\s+$/, - - // Match a standalone tag - rsingleTag = /^<(\w+)\s*/?>(?:</\1>)?$/, - - // JSON RegExp - rvalidchars = /^[],:{}\s]*$/, - rvalidescape = /\(?:["\/bfnrt]|u[0-9a-fA-F]{4})/g, - rvalidtokens = /"[^"\\n\r]*"|true|false|null|-?\d+(?:.\d*)?(?:[eE][+-]?\d+)?/g, - rvalidbraces = /(?:^|:|,)(?:\s*[)+/g, - - // Useragent RegExp - rwebkit = /(webkit)[ /]([\w.]+)/, - ropera = /(opera)(?:.*version)?[ /]([\w.]+)/, - rmsie = /(msie) ([\w.]+)/, - rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/, - - // Matches dashed string for camelizing - rdashAlpha = /-([a-z]|[0-9])/ig, - rmsPrefix = /^-ms-/, - - // Used by jQuery.camelCase as callback to replace() - fcamelCase = function( all, letter ) { - return ( letter + "" ).toUpperCase(); - }, - - // Keep a UserAgent string for use with jQuery.browser - userAgent = navigator.userAgent, - - // For matching the engine and version of the browser - browserMatch, - - // The deferred used on DOM ready - readyList, - - // The ready event handler - DOMContentLoaded, - - // Save a reference to some core methods - toString = Object.prototype.toString, - hasOwn = Object.prototype.hasOwnProperty, - push = Array.prototype.push, - slice = Array.prototype.slice, - trim = String.prototype.trim, - indexOf = Array.prototype.indexOf, - - // [[Class]] -> type pairs - class2type = {}; - -jQuery.fn = jQuery.prototype = { - constructor: jQuery, - init: function( selector, context, rootjQuery ) { - var match, elem, ret, doc; - - // Handle $(""), $(null), or $(undefined) - if ( !selector ) { - return this; - } - - // Handle $(DOMElement) - if ( selector.nodeType ) { - this.context = this[0] = selector; - this.length = 1; - return this; - } - - // The body element only exists once, optimize finding it - if ( selector === "body" && !context && document.body ) { - this.context = document; - this[0] = document.body; - this.selector = selector; - this.length = 1; - return this; - } - - // Handle HTML strings - if ( typeof selector === "string" ) { - // Are we dealing with HTML string or an ID? - if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { - // Assume that strings that start and end with <> are HTML and skip the regex check - match = [ null, selector, null ]; - - } else { - match = quickExpr.exec( selector ); - } - - // Verify a match, and that no context was specified for #id - if ( match && (match[1] || !context) ) { - - // HANDLE: $(html) -> $(array) - if ( match[1] ) { - context = context instanceof jQuery ? context[0] : context; - doc = ( context ? context.ownerDocument || context : document ); - - // If a single string is passed in and it's a single tag - // just do a createElement and skip the rest - ret = rsingleTag.exec( selector ); - - if ( ret ) { - if ( jQuery.isPlainObject( context ) ) { - selector = [ document.createElement( ret[1] ) ]; - jQuery.fn.attr.call( selector, context, true ); - - } else { - selector = [ doc.createElement( ret[1] ) ]; - } - - } else { - ret = jQuery.buildFragment( [ match[1] ], [ doc ] ); - selector = ( ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment ).childNodes; - } - - return jQuery.merge( this, selector ); - - // HANDLE: $("#id") - } else { - elem = document.getElementById( match[2] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id !== match[2] ) { - return rootjQuery.find( selector ); - } - - // Otherwise, we inject the element directly into the jQuery object - this.length = 1; - this[0] = elem; - } - - this.context = document; - this.selector = selector; - return this; - } - - // HANDLE: $(expr, $(...)) - } else if ( !context || context.jquery ) { - return ( context || rootjQuery ).find( selector ); - - // HANDLE: $(expr, context) - // (which is just equivalent to: $(context).find(expr) - } else { - return this.constructor( context ).find( selector ); - } - - // HANDLE: $(function) - // Shortcut for document ready - } else if ( jQuery.isFunction( selector ) ) { - return rootjQuery.ready( selector ); - } - - if ( selector.selector !== undefined ) { - this.selector = selector.selector; - this.context = selector.context; - } - - return jQuery.makeArray( selector, this ); - }, - - // Start with an empty selector - selector: "", - - // The current version of jQuery being used - jquery: "1.7.1", - - // The default length of a jQuery object is 0 - length: 0, - - // The number of elements contained in the matched element set - size: function() { - return this.length; - }, - - toArray: function() { - return slice.call( this, 0 ); - }, - - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - return num == null ? - - // Return a 'clean' array - this.toArray() : - - // Return just the object - ( num < 0 ? this[ this.length + num ] : this[ num ] ); - }, - - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems, name, selector ) { - // Build a new jQuery matched element set - var ret = this.constructor(); - - if ( jQuery.isArray( elems ) ) { - push.apply( ret, elems ); - - } else { - jQuery.merge( ret, elems ); - } - - // Add the old object onto the stack (as a reference) - ret.prevObject = this; - - ret.context = this.context; - - if ( name === "find" ) { - ret.selector = this.selector + ( this.selector ? " " : "" ) + selector; - } else if ( name ) { - ret.selector = this.selector + "." + name + "(" + selector + ")"; - } - - // Return the newly-formed element set - return ret; - }, - - // Execute a callback for every element in the matched set. - // (You can seed the arguments with an array of args, but this is - // only used internally.) - each: function( callback, args ) { - return jQuery.each( this, callback, args ); - }, - - ready: function( fn ) { - // Attach the listeners - jQuery.bindReady(); - - // Add the callback - readyList.add( fn ); - - return this; - }, - - eq: function( i ) { - i = +i; - return i === -1 ? - this.slice( i ) : - this.slice( i, i + 1 ); - }, - - first: function() { - return this.eq( 0 ); - }, - - last: function() { - return this.eq( -1 ); - }, - - slice: function() { - return this.pushStack( slice.apply( this, arguments ), - "slice", slice.call(arguments).join(",") ); - }, - - map: function( callback ) { - return this.pushStack( jQuery.map(this, function( elem, i ) { - return callback.call( elem, i, elem ); - })); - }, - - end: function() { - return this.prevObject || this.constructor(null); - }, - - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: push, - sort: [].sort, - splice: [].splice -}; - -// Give the init function the jQuery prototype for later instantiation -jQuery.fn.init.prototype = jQuery.fn; - -jQuery.extend = jQuery.fn.extend = function() { - var options, name, src, copy, copyIsArray, clone, - target = arguments[0] || {}, - i = 1, - length = arguments.length, - deep = false; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - target = arguments[1] || {}; - // skip the boolean and the target - i = 2; - } - - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !jQuery.isFunction(target) ) { - target = {}; - } - - // extend jQuery itself if only one argument is passed - if ( length === i ) { - target = this; - --i; - } - - for ( ; i < length; i++ ) { - // Only deal with non-null/undefined values - if ( (options = arguments[ i ]) != null ) { - // Extend the base object - for ( name in options ) { - src = target[ name ]; - copy = options[ name ]; - - // Prevent never-ending loop - if ( target === copy ) { - continue; - } - - // Recurse if we're merging plain objects or arrays - if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { - if ( copyIsArray ) { - copyIsArray = false; - clone = src && jQuery.isArray(src) ? src : []; - - } else { - clone = src && jQuery.isPlainObject(src) ? src : {}; - } - - // Never move original objects, clone them - target[ name ] = jQuery.extend( deep, clone, copy ); - - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } - } - } - - // Return the modified object - return target; -}; - -jQuery.extend({ - noConflict: function( deep ) { - if ( window.$ === jQuery ) { - window.$ = _$; - } - - if ( deep && window.jQuery === jQuery ) { - window.jQuery = _jQuery; - } - - return jQuery; - }, - - // Is the DOM ready to be used? Set to true once it occurs. - isReady: false, - - // A counter to track how many items to wait for before - // the ready event fires. See #6781 - readyWait: 1, - - // Hold (or release) the ready event - holdReady: function( hold ) { - if ( hold ) { - jQuery.readyWait++; - } else { - jQuery.ready( true ); - } - }, - - // Handle when the DOM is ready - ready: function( wait ) { - // Either a released hold or an DOMready/load event and not yet ready - if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) { - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( !document.body ) { - return setTimeout( jQuery.ready, 1 ); - } - - // Remember that the DOM is ready - jQuery.isReady = true; - - // If a normal DOM Ready event fired, decrement, and wait if need be - if ( wait !== true && --jQuery.readyWait > 0 ) { - return; - } - - // If there are functions bound, to execute - readyList.fireWith( document, [ jQuery ] ); - - // Trigger any bound ready events - if ( jQuery.fn.trigger ) { - jQuery( document ).trigger( "ready" ).off( "ready" ); - } - } - }, - - bindReady: function() { - if ( readyList ) { - return; - } - - readyList = jQuery.Callbacks( "once memory" ); - - // Catch cases where $(document).ready() is called after the - // browser event has already occurred. - if ( document.readyState === "complete" ) { - // Handle it asynchronously to allow scripts the opportunity to delay ready - return setTimeout( jQuery.ready, 1 ); - } - - // Mozilla, Opera and webkit nightlies currently support this event - if ( document.addEventListener ) { - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); - - // A fallback to window.onload, that will always work - window.addEventListener( "load", jQuery.ready, false ); - - // If IE event model is used - } else if ( document.attachEvent ) { - // ensure firing before onload, - // maybe late but safe also for iframes - document.attachEvent( "onreadystatechange", DOMContentLoaded ); - - // A fallback to window.onload, that will always work - window.attachEvent( "onload", jQuery.ready ); - - // If IE and not a frame - // continually check to see if the document is ready - var toplevel = false; - - try { - toplevel = window.frameElement == null; - } catch(e) {} - - if ( document.documentElement.doScroll && toplevel ) { - doScrollCheck(); - } - } - }, - - // See test/unit/core.js for details concerning isFunction. - // Since version 1.3, DOM methods and functions like alert - // aren't supported. They return false on IE (#2968). - isFunction: function( obj ) { - return jQuery.type(obj) === "function"; - }, - - isArray: Array.isArray || function( obj ) { - return jQuery.type(obj) === "array"; - }, - - // A crude way of determining if an object is a window - isWindow: function( obj ) { - return obj && typeof obj === "object" && "setInterval" in obj; - }, - - isNumeric: function( obj ) { - return !isNaN( parseFloat(obj) ) && isFinite( obj ); - }, - - type: function( obj ) { - return obj == null ? - String( obj ) : - class2type[ toString.call(obj) ] || "object"; - }, - - isPlainObject: function( obj ) { - // Must be an Object. - // Because of IE, we also have to check the presence of the constructor property. - // Make sure that DOM nodes and window objects don't pass through, as well - if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { - return false; - } - - try { - // Not own constructor property must be Object - if ( obj.constructor && - !hasOwn.call(obj, "constructor") && - !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { - return false; - } - } catch ( e ) { - // IE8,9 Will throw exceptions on certain host objects #9897 - return false; - } - - // Own properties are enumerated firstly, so to speed up, - // if last one is own, then all properties are own. - - var key; - for ( key in obj ) {} - - return key === undefined || hasOwn.call( obj, key ); - }, - - isEmptyObject: function( obj ) { - for ( var name in obj ) { - return false; - } - return true; - }, - - error: function( msg ) { - throw new Error( msg ); - }, - - parseJSON: function( data ) { - if ( typeof data !== "string" || !data ) { - return null; - } - - // Make sure leading/trailing whitespace is removed (IE can't handle it) - data = jQuery.trim( data ); - - // Attempt to parse using the native JSON parser first - if ( window.JSON && window.JSON.parse ) { - return window.JSON.parse( data ); - } - - // Make sure the incoming data is actual JSON - // Logic borrowed from http://json.org/json2.js - if ( rvalidchars.test( data.replace( rvalidescape, "@" ) - .replace( rvalidtokens, "]" ) - .replace( rvalidbraces, "")) ) { - - return ( new Function( "return " + data ) )(); - - } - jQuery.error( "Invalid JSON: " + data ); - }, - - // Cross-browser xml parsing - parseXML: function( data ) { - var xml, tmp; - try { - if ( window.DOMParser ) { // Standard - tmp = new DOMParser(); - xml = tmp.parseFromString( data , "text/xml" ); - } else { // IE - xml = new ActiveXObject( "Microsoft.XMLDOM" ); - xml.async = "false"; - xml.loadXML( data ); - } - } catch( e ) { - xml = undefined; - } - if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { - jQuery.error( "Invalid XML: " + data ); - } - return xml; - }, - - noop: function() {}, - - // Evaluates a script in a global context - // Workarounds based on findings by Jim Driscoll - // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-glo... - globalEval: function( data ) { - if ( data && rnotwhite.test( data ) ) { - // We use execScript on Internet Explorer - // We use an anonymous function so that context is window - // rather than jQuery in Firefox - ( window.execScript || function( data ) { - window[ "eval" ].call( window, data ); - } )( data ); - } - }, - - // Convert dashed to camelCase; used by the css and data modules - // Microsoft forgot to hump their vendor prefix (#9572) - camelCase: function( string ) { - return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); - }, - - nodeName: function( elem, name ) { - return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); - }, - - // args is for internal usage only - each: function( object, callback, args ) { - var name, i = 0, - length = object.length, - isObj = length === undefined || jQuery.isFunction( object ); - - if ( args ) { - if ( isObj ) { - for ( name in object ) { - if ( callback.apply( object[ name ], args ) === false ) { - break; - } - } - } else { - for ( ; i < length; ) { - if ( callback.apply( object[ i++ ], args ) === false ) { - break; - } - } - } - - // A special, fast, case for the most common use of each - } else { - if ( isObj ) { - for ( name in object ) { - if ( callback.call( object[ name ], name, object[ name ] ) === false ) { - break; - } - } - } else { - for ( ; i < length; ) { - if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) { - break; - } - } - } - } - - return object; - }, - - // Use native String.trim function wherever possible - trim: trim ? - function( text ) { - return text == null ? - "" : - trim.call( text ); - } : - - // Otherwise use our own trimming functionality - function( text ) { - return text == null ? - "" : - text.toString().replace( trimLeft, "" ).replace( trimRight, "" ); - }, - - // results is for internal usage only - makeArray: function( array, results ) { - var ret = results || []; - - if ( array != null ) { - // The window, strings (and functions) also have 'length' - // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 - var type = jQuery.type( array ); - - if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) { - push.call( ret, array ); - } else { - jQuery.merge( ret, array ); - } - } - - return ret; - }, - - inArray: function( elem, array, i ) { - var len; - - if ( array ) { - if ( indexOf ) { - return indexOf.call( array, elem, i ); - } - - len = array.length; - i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; - - for ( ; i < len; i++ ) { - // Skip accessing in sparse arrays - if ( i in array && array[ i ] === elem ) { - return i; - } - } - } - - return -1; - }, - - merge: function( first, second ) { - var i = first.length, - j = 0; - - if ( typeof second.length === "number" ) { - for ( var l = second.length; j < l; j++ ) { - first[ i++ ] = second[ j ]; - } - - } else { - while ( second[j] !== undefined ) { - first[ i++ ] = second[ j++ ]; - } - } - - first.length = i; - - return first; - }, - - grep: function( elems, callback, inv ) { - var ret = [], retVal; - inv = !!inv; - - // Go through the array, only saving the items - // that pass the validator function - for ( var i = 0, length = elems.length; i < length; i++ ) { - retVal = !!callback( elems[ i ], i ); - if ( inv !== retVal ) { - ret.push( elems[ i ] ); - } - } - - return ret; - }, - - // arg is for internal usage only - map: function( elems, callback, arg ) { - var value, key, ret = [], - i = 0, - length = elems.length, - // jquery objects are treated as arrays - isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ; - - // Go through the array, translating each of the items to their - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - - // Go through every key on the object, - } else { - for ( key in elems ) { - value = callback( elems[ key ], key, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - } - - // Flatten any nested arrays - return ret.concat.apply( [], ret ); - }, - - // A global GUID counter for objects - guid: 1, - - // Bind a function to a context, optionally partially applying any - // arguments. - proxy: function( fn, context ) { - if ( typeof context === "string" ) { - var tmp = fn[ context ]; - context = fn; - fn = tmp; - } - - // Quick check to determine if target is callable, in the spec - // this throws a TypeError, but we will just return undefined. - if ( !jQuery.isFunction( fn ) ) { - return undefined; - } - - // Simulated bind - var args = slice.call( arguments, 2 ), - proxy = function() { - return fn.apply( context, args.concat( slice.call( arguments ) ) ); - }; - - // Set the guid of unique handler to the same of original handler, so it can be removed - proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; - - return proxy; - }, - - // Mutifunctional method to get and set values to a collection - // The value/s can optionally be executed if it's a function - access: function( elems, key, value, exec, fn, pass ) { - var length = elems.length; - - // Setting many attributes - if ( typeof key === "object" ) { - for ( var k in key ) { - jQuery.access( elems, k, key[k], exec, fn, value ); - } - return elems; - } - - // Setting one attribute - if ( value !== undefined ) { - // Optionally, function values get executed if exec is true - exec = !pass && exec && jQuery.isFunction(value); - - for ( var i = 0; i < length; i++ ) { - fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); - } - - return elems; - } - - // Getting an attribute - return length ? fn( elems[0], key ) : undefined; - }, - - now: function() { - return ( new Date() ).getTime(); - }, - - // Use of jQuery.browser is frowned upon. - // More details: http://docs.jquery.com/Utilities/jQuery.browser - uaMatch: function( ua ) { - ua = ua.toLowerCase(); - - var match = rwebkit.exec( ua ) || - ropera.exec( ua ) || - rmsie.exec( ua ) || - ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) || - []; - - return { browser: match[1] || "", version: match[2] || "0" }; - }, - - sub: function() { - function jQuerySub( selector, context ) { - return new jQuerySub.fn.init( selector, context ); - } - jQuery.extend( true, jQuerySub, this ); - jQuerySub.superclass = this; - jQuerySub.fn = jQuerySub.prototype = this(); - jQuerySub.fn.constructor = jQuerySub; - jQuerySub.sub = this.sub; - jQuerySub.fn.init = function init( selector, context ) { - if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { - context = jQuerySub( context ); - } - - return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); - }; - jQuerySub.fn.init.prototype = jQuerySub.fn; - var rootjQuerySub = jQuerySub(document); - return jQuerySub; - }, - - browser: {} -}); - -// Populate the class2type map -jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); -}); - -browserMatch = jQuery.uaMatch( userAgent ); -if ( browserMatch.browser ) { - jQuery.browser[ browserMatch.browser ] = true; - jQuery.browser.version = browserMatch.version; -} - -// Deprecated, use jQuery.browser.webkit instead -if ( jQuery.browser.webkit ) { - jQuery.browser.safari = true; -} - -// IE doesn't match non-breaking spaces with \s -if ( rnotwhite.test( "\xA0" ) ) { - trimLeft = /^[\s\xA0]+/; - trimRight = /[\s\xA0]+$/; -} - -// All jQuery objects should point back to these -rootjQuery = jQuery(document); - -// Cleanup functions for the document ready method -if ( document.addEventListener ) { - DOMContentLoaded = function() { - document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); - jQuery.ready(); - }; - -} else if ( document.attachEvent ) { - DOMContentLoaded = function() { - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( document.readyState === "complete" ) { - document.detachEvent( "onreadystatechange", DOMContentLoaded ); - jQuery.ready(); - } - }; -} - -// The DOM ready check for Internet Explorer -function doScrollCheck() { - if ( jQuery.isReady ) { - return; - } - - try { - // If IE is used, use the trick by Diego Perini - // http://javascript.nwbox.com/IEContentLoaded/ - document.documentElement.doScroll("left"); - } catch(e) { - setTimeout( doScrollCheck, 1 ); - return; - } - - // and execute any waiting functions - jQuery.ready(); -} - -return jQuery; - -})(); - - -// String to Object flags format cache -var flagsCache = {}; - -// Convert String-formatted flags into Object-formatted ones and store in cache -function createFlags( flags ) { - var object = flagsCache[ flags ] = {}, - i, length; - flags = flags.split( /\s+/ ); - for ( i = 0, length = flags.length; i < length; i++ ) { - object[ flags[i] ] = true; - } - return object; -} - -/* - * Create a callback list using the following parameters: - * - * flags: an optional list of space-separated flags that will change how - * the callback list behaves - * - * By default a callback list will act like an event callback list and can be - * "fired" multiple times. - * - * Possible flags: - * - * once: will ensure the callback list can only be fired once (like a Deferred) - * - * memory: will keep track of previous values and will call any callback added - * after the list has been fired right away with the latest "memorized" - * values (like a Deferred) - * - * unique: will ensure a callback can only be added once (no duplicate in the list) - * - * stopOnFalse: interrupt callings when a callback returns false - * - */ -jQuery.Callbacks = function( flags ) { - - // Convert flags from String-formatted to Object-formatted - // (we check in cache first) - flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {}; - - var // Actual callback list - list = [], - // Stack of fire calls for repeatable lists - stack = [], - // Last fire value (for non-forgettable lists) - memory, - // Flag to know if list is currently firing - firing, - // First callback to fire (used internally by add and fireWith) - firingStart, - // End of the loop when firing - firingLength, - // Index of currently firing callback (modified by remove if needed) - firingIndex, - // Add one or several callbacks to the list - add = function( args ) { - var i, - length, - elem, - type, - actual; - for ( i = 0, length = args.length; i < length; i++ ) { - elem = args[ i ]; - type = jQuery.type( elem ); - if ( type === "array" ) { - // Inspect recursively - add( elem ); - } else if ( type === "function" ) { - // Add if not in unique mode and callback is not in - if ( !flags.unique || !self.has( elem ) ) { - list.push( elem ); - } - } - } - }, - // Fire callbacks - fire = function( context, args ) { - args = args || []; - memory = !flags.memory || [ context, args ]; - firing = true; - firingIndex = firingStart || 0; - firingStart = 0; - firingLength = list.length; - for ( ; list && firingIndex < firingLength; firingIndex++ ) { - if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) { - memory = true; // Mark as halted - break; - } - } - firing = false; - if ( list ) { - if ( !flags.once ) { - if ( stack && stack.length ) { - memory = stack.shift(); - self.fireWith( memory[ 0 ], memory[ 1 ] ); - } - } else if ( memory === true ) { - self.disable(); - } else { - list = []; - } - } - }, - // Actual Callbacks object - self = { - // Add a callback or a collection of callbacks to the list - add: function() { - if ( list ) { - var length = list.length; - add( arguments ); - // Do we need to add the callbacks to the - // current firing batch? - if ( firing ) { - firingLength = list.length; - // With memory, if we're not firing then - // we should call right away, unless previous - // firing was halted (stopOnFalse) - } else if ( memory && memory !== true ) { - firingStart = length; - fire( memory[ 0 ], memory[ 1 ] ); - } - } - return this; - }, - // Remove a callback from the list - remove: function() { - if ( list ) { - var args = arguments, - argIndex = 0, - argLength = args.length; - for ( ; argIndex < argLength ; argIndex++ ) { - for ( var i = 0; i < list.length; i++ ) { - if ( args[ argIndex ] === list[ i ] ) { - // Handle firingIndex and firingLength - if ( firing ) { - if ( i <= firingLength ) { - firingLength--; - if ( i <= firingIndex ) { - firingIndex--; - } - } - } - // Remove the element - list.splice( i--, 1 ); - // If we have some unicity property then - // we only need to do this once - if ( flags.unique ) { - break; - } - } - } - } - } - return this; - }, - // Control if a given callback is in the list - has: function( fn ) { - if ( list ) { - var i = 0, - length = list.length; - for ( ; i < length; i++ ) { - if ( fn === list[ i ] ) { - return true; - } - } - } - return false; - }, - // Remove all callbacks from the list - empty: function() { - list = []; - return this; - }, - // Have the list do nothing anymore - disable: function() { - list = stack = memory = undefined; - return this; - }, - // Is it disabled? - disabled: function() { - return !list; - }, - // Lock the list in its current state - lock: function() { - stack = undefined; - if ( !memory || memory === true ) { - self.disable(); - } - return this; - }, - // Is it locked? - locked: function() { - return !stack; - }, - // Call all callbacks with the given context and arguments - fireWith: function( context, args ) { - if ( stack ) { - if ( firing ) { - if ( !flags.once ) { - stack.push( [ context, args ] ); - } - } else if ( !( flags.once && memory ) ) { - fire( context, args ); - } - } - return this; - }, - // Call all the callbacks with the given arguments - fire: function() { - self.fireWith( this, arguments ); - return this; - }, - // To know if the callbacks have already been called at least once - fired: function() { - return !!memory; - } - }; - - return self; -}; - - - - -var // Static reference to slice - sliceDeferred = [].slice; - -jQuery.extend({ - - Deferred: function( func ) { - var doneList = jQuery.Callbacks( "once memory" ), - failList = jQuery.Callbacks( "once memory" ), - progressList = jQuery.Callbacks( "memory" ), - state = "pending", - lists = { - resolve: doneList, - reject: failList, - notify: progressList - }, - promise = { - done: doneList.add, - fail: failList.add, - progress: progressList.add, - - state: function() { - return state; - }, - - // Deprecated - isResolved: doneList.fired, - isRejected: failList.fired, - - then: function( doneCallbacks, failCallbacks, progressCallbacks ) { - deferred.done( doneCallbacks ).fail( failCallbacks ).progress( progressCallbacks ); - return this; - }, - always: function() { - deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments ); - return this; - }, - pipe: function( fnDone, fnFail, fnProgress ) { - return jQuery.Deferred(function( newDefer ) { - jQuery.each( { - done: [ fnDone, "resolve" ], - fail: [ fnFail, "reject" ], - progress: [ fnProgress, "notify" ] - }, function( handler, data ) { - var fn = data[ 0 ], - action = data[ 1 ], - returned; - if ( jQuery.isFunction( fn ) ) { - deferred[ handler ](function() { - returned = fn.apply( this, arguments ); - if ( returned && jQuery.isFunction( returned.promise ) ) { - returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.notify ); - } else { - newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] ); - } - }); - } else { - deferred[ handler ]( newDefer[ action ] ); - } - }); - }).promise(); - }, - // Get a promise for this deferred - // If obj is provided, the promise aspect is added to the object - promise: function( obj ) { - if ( obj == null ) { - obj = promise; - } else { - for ( var key in promise ) { - obj[ key ] = promise[ key ]; - } - } - return obj; - } - }, - deferred = promise.promise({}), - key; - - for ( key in lists ) { - deferred[ key ] = lists[ key ].fire; - deferred[ key + "With" ] = lists[ key ].fireWith; - } - - // Handle state - deferred.done( function() { - state = "resolved"; - }, failList.disable, progressList.lock ).fail( function() { - state = "rejected"; - }, doneList.disable, progressList.lock ); - - // Call given func if any - if ( func ) { - func.call( deferred, deferred ); - } - - // All done! - return deferred; - }, - - // Deferred helper - when: function( firstParam ) { - var args = sliceDeferred.call( arguments, 0 ), - i = 0, - length = args.length, - pValues = new Array( length ), - count = length, - pCount = length, - deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ? - firstParam : - jQuery.Deferred(), - promise = deferred.promise(); - function resolveFunc( i ) { - return function( value ) { - args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; - if ( !( --count ) ) { - deferred.resolveWith( deferred, args ); - } - }; - } - function progressFunc( i ) { - return function( value ) { - pValues[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; - deferred.notifyWith( promise, pValues ); - }; - } - if ( length > 1 ) { - for ( ; i < length; i++ ) { - if ( args[ i ] && args[ i ].promise && jQuery.isFunction( args[ i ].promise ) ) { - args[ i ].promise().then( resolveFunc(i), deferred.reject, progressFunc(i) ); - } else { - --count; - } - } - if ( !count ) { - deferred.resolveWith( deferred, args ); - } - } else if ( deferred !== firstParam ) { - deferred.resolveWith( deferred, length ? [ firstParam ] : [] ); - } - return promise; - } -}); - - - - -jQuery.support = (function() { - - var support, - all, - a, - select, - opt, - input, - marginDiv, - fragment, - tds, - events, - eventName, - i, - isSupported, - div = document.createElement( "div" ), - documentElement = document.documentElement; - - // Preliminary tests - div.setAttribute("className", "t"); - div.innerHTML = " <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>"; - - all = div.getElementsByTagName( "*" ); - a = div.getElementsByTagName( "a" )[ 0 ]; - - // Can't get basic test support - if ( !all || !all.length || !a ) { - return {}; - } - - // First batch of supports tests - select = document.createElement( "select" ); - opt = select.appendChild( document.createElement("option") ); - input = div.getElementsByTagName( "input" )[ 0 ]; - - support = { - // IE strips leading whitespace when .innerHTML is used - leadingWhitespace: ( div.firstChild.nodeType === 3 ), - - // Make sure that tbody elements aren't automatically inserted - // IE will insert them into empty tables - tbody: !div.getElementsByTagName("tbody").length, - - // Make sure that link elements get serialized correctly by innerHTML - // This requires a wrapper element in IE - htmlSerialize: !!div.getElementsByTagName("link").length, - - // Get the style information from getAttribute - // (IE uses .cssText instead) - style: /top/.test( a.getAttribute("style") ), - - // Make sure that URLs aren't manipulated - // (IE normalizes it by default) - hrefNormalized: ( a.getAttribute("href") === "/a" ), - - // Make sure that element opacity exists - // (IE uses filter instead) - // Use a regex to work around a WebKit issue. See #5145 - opacity: /^0.55/.test( a.style.opacity ), - - // Verify style float existence - // (IE uses styleFloat instead of cssFloat) - cssFloat: !!a.style.cssFloat, - - // Make sure that if no value is specified for a checkbox - // that it defaults to "on". - // (WebKit defaults to "" instead) - checkOn: ( input.value === "on" ), - - // Make sure that a selected-by-default option has a working selected property. - // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) - optSelected: opt.selected, - - // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) - getSetAttribute: div.className !== "t", - - // Tests for enctype support on a form(#6743) - enctype: !!document.createElement("form").enctype, - - // Makes sure cloning an html5 element does not cause problems - // Where outerHTML is undefined, this still works - html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>", - - // Will be defined later - submitBubbles: true, - changeBubbles: true, - focusinBubbles: false, - deleteExpando: true, - noCloneEvent: true, - inlineBlockNeedsLayout: false, - shrinkWrapBlocks: false, - reliableMarginRight: true - }; - - // Make sure checked status is properly cloned - input.checked = true; - support.noCloneChecked = input.cloneNode( true ).checked; - - // Make sure that the options inside disabled selects aren't marked as disabled - // (WebKit marks them as disabled) - select.disabled = true; - support.optDisabled = !opt.disabled; - - // Test to see if it's possible to delete an expando from an element - // Fails in Internet Explorer - try { - delete div.test; - } catch( e ) { - support.deleteExpando = false; - } - - if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { - div.attachEvent( "onclick", function() { - // Cloning a node shouldn't copy over any - // bound event handlers (IE does this) - support.noCloneEvent = false; - }); - div.cloneNode( true ).fireEvent( "onclick" ); - } - - // Check if a radio maintains its value - // after being appended to the DOM - input = document.createElement("input"); - input.value = "t"; - input.setAttribute("type", "radio"); - support.radioValue = input.value === "t"; - - input.setAttribute("checked", "checked"); - div.appendChild( input ); - fragment = document.createDocumentFragment(); - fragment.appendChild( div.lastChild ); - - // WebKit doesn't clone checked state correctly in fragments - support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; - - // Check if a disconnected checkbox will retain its checked - // value of true after appended to the DOM (IE6/7) - support.appendChecked = input.checked; - - fragment.removeChild( input ); - fragment.appendChild( div ); - - div.innerHTML = ""; - - // Check if div with explicit width and no margin-right incorrectly - // gets computed margin-right based on width of container. For more - // info see bug #3333 - // Fails in WebKit before Feb 2011 nightlies - // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right - if ( window.getComputedStyle ) { - marginDiv = document.createElement( "div" ); - marginDiv.style.width = "0"; - marginDiv.style.marginRight = "0"; - div.style.width = "2px"; - div.appendChild( marginDiv ); - support.reliableMarginRight = - ( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0; - } - - // Technique from Juriy Zaytsev - // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ - // We only care about the case where non-standard event systems - // are used, namely in IE. Short-circuiting here helps us to - // avoid an eval call (in setAttribute) which can cause CSP - // to go haywire. See: https://developer.mozilla.org/en/Security/CSP - if ( div.attachEvent ) { - for( i in { - submit: 1, - change: 1, - focusin: 1 - }) { - eventName = "on" + i; - isSupported = ( eventName in div ); - if ( !isSupported ) { - div.setAttribute( eventName, "return;" ); - isSupported = ( typeof div[ eventName ] === "function" ); - } - support[ i + "Bubbles" ] = isSupported; - } - } - - fragment.removeChild( div ); - - // Null elements to avoid leaks in IE - fragment = select = opt = marginDiv = div = input = null; - - // Run tests that need a body at doc ready - jQuery(function() { - var container, outer, inner, table, td, offsetSupport, - conMarginTop, ptlm, vb, style, html, - body = document.getElementsByTagName("body")[0]; - - if ( !body ) { - // Return for frameset docs that don't have a body - return; - } - - conMarginTop = 1; - ptlm = "position:absolute;top:0;left:0;width:1px;height:1px;margin:0;"; - vb = "visibility:hidden;border:0;"; - style = "style='" + ptlm + "border:5px solid #000;padding:0;'"; - html = "<div " + style + "><div></div></div>" + - "<table " + style + " cellpadding='0' cellspacing='0'>" + - "<tr><td></td></tr></table>"; - - container = document.createElement("div"); - container.style.cssText = vb + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px"; - body.insertBefore( container, body.firstChild ); - - // Construct the test element - div = document.createElement("div"); - container.appendChild( div ); - - // Check if table cells still have offsetWidth/Height when they are set - // to display:none and there are still other visible table cells in a - // table row; if so, offsetWidth/Height are not reliable for use when - // determining if an element has been hidden directly using - // display:none (it is still safe to use offsets if a parent element is - // hidden; don safety goggles and see bug #4512 for more information). - // (only IE 8 fails this test) - div.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>"; - tds = div.getElementsByTagName( "td" ); - isSupported = ( tds[ 0 ].offsetHeight === 0 ); - - tds[ 0 ].style.display = ""; - tds[ 1 ].style.display = "none"; - - // Check if empty table cells still have offsetWidth/Height - // (IE <= 8 fail this test) - support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); - - // Figure out if the W3C box model works as expected - div.innerHTML = ""; - div.style.width = div.style.paddingLeft = "1px"; - jQuery.boxModel = support.boxModel = div.offsetWidth === 2; - - if ( typeof div.style.zoom !== "undefined" ) { - // Check if natively block-level elements act like inline-block - // elements when setting their display to 'inline' and giving - // them layout - // (IE < 8 does this) - div.style.display = "inline"; - div.style.zoom = 1; - support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 ); - - // Check if elements with layout shrink-wrap their children - // (IE 6 does this) - div.style.display = ""; - div.innerHTML = "<div style='width:4px;'></div>"; - support.shrinkWrapBlocks = ( div.offsetWidth !== 2 ); - } - - div.style.cssText = ptlm + vb; - div.innerHTML = html; - - outer = div.firstChild; - inner = outer.firstChild; - td = outer.nextSibling.firstChild.firstChild; - - offsetSupport = { - doesNotAddBorder: ( inner.offsetTop !== 5 ), - doesAddBorderForTableAndCells: ( td.offsetTop === 5 ) - }; - - inner.style.position = "fixed"; - inner.style.top = "20px"; - - // safari subtracts parent border width here which is 5px - offsetSupport.fixedPosition = ( inner.offsetTop === 20 || inner.offsetTop === 15 ); - inner.style.position = inner.style.top = ""; - - outer.style.overflow = "hidden"; - outer.style.position = "relative"; - - offsetSupport.subtractsBorderForOverflowNotVisible = ( inner.offsetTop === -5 ); - offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop ); - - body.removeChild( container ); - div = container = null; - - jQuery.extend( support, offsetSupport ); - }); - - return support; -})(); - - - - -var rbrace = /^(?:{.*}|[.*])$/, - rmultiDash = /([A-Z])/g; - -jQuery.extend({ - cache: {}, - - // Please use with caution - uuid: 0, - - // Unique for each copy of jQuery on the page - // Non-digits removed to match rinlinejQuery - expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ), - - // The following elements throw uncatchable exceptions if you - // attempt to add expando properties to them. - noData: { - "embed": true, - // Ban all objects except for Flash (which handle expandos) - "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", - "applet": true - }, - - hasData: function( elem ) { - elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; - return !!elem && !isEmptyDataObject( elem ); - }, - - data: function( elem, name, data, pvt /* Internal Use Only */ ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var privateCache, thisCache, ret, - internalKey = jQuery.expando, - getByName = typeof name === "string", - - // We have to handle DOM nodes and JS objects differently because IE6-7 - // can't GC object references properly across the DOM-JS boundary - isNode = elem.nodeType, - - // Only DOM nodes need the global jQuery cache; JS object data is - // attached directly to the object so GC can occur automatically - cache = isNode ? jQuery.cache : elem, - - // Only defining an ID for JS objects if its cache already exists allows - // the code to shortcut on the same path as a DOM node with no cache - id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey, - isEvents = name === "events"; - - // Avoid doing any more work than we need to when trying to get data on an - // object that has no data at all - if ( (!id || !cache[id] || (!isEvents && !pvt && !cache[id].data)) && getByName && data === undefined ) { - return; - } - - if ( !id ) { - // Only DOM nodes need a new unique ID for each element since their data - // ends up in the global cache - if ( isNode ) { - elem[ internalKey ] = id = ++jQuery.uuid; - } else { - id = internalKey; - } - } - - if ( !cache[ id ] ) { - cache[ id ] = {}; - - // Avoids exposing jQuery metadata on plain JS objects when the object - // is serialized using JSON.stringify - if ( !isNode ) { - cache[ id ].toJSON = jQuery.noop; - } - } - - // An object can be passed to jQuery.data instead of a key/value pair; this gets - // shallow copied over onto the existing cache - if ( typeof name === "object" || typeof name === "function" ) { - if ( pvt ) { - cache[ id ] = jQuery.extend( cache[ id ], name ); - } else { - cache[ id ].data = jQuery.extend( cache[ id ].data, name ); - } - } - - privateCache = thisCache = cache[ id ]; - - // jQuery data() is stored in a separate object inside the object's internal data - // cache in order to avoid key collisions between internal data and user-defined - // data. - if ( !pvt ) { - if ( !thisCache.data ) { - thisCache.data = {}; - } - - thisCache = thisCache.data; - } - - if ( data !== undefined ) { - thisCache[ jQuery.camelCase( name ) ] = data; - } - - // Users should not attempt to inspect the internal events object using jQuery.data, - // it is undocumented and subject to change. But does anyone listen? No. - if ( isEvents && !thisCache[ name ] ) { - return privateCache.events; - } - - // Check for both converted-to-camel and non-converted data property names - // If a data property was specified - if ( getByName ) { - - // First Try to find as-is property data - ret = thisCache[ name ]; - - // Test for null|undefined property data - if ( ret == null ) { - - // Try to find the camelCased property - ret = thisCache[ jQuery.camelCase( name ) ]; - } - } else { - ret = thisCache; - } - - return ret; - }, - - removeData: function( elem, name, pvt /* Internal Use Only */ ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var thisCache, i, l, - - // Reference to internal data cache key - internalKey = jQuery.expando, - - isNode = elem.nodeType, - - // See jQuery.data for more information - cache = isNode ? jQuery.cache : elem, - - // See jQuery.data for more information - id = isNode ? elem[ internalKey ] : internalKey; - - // If there is already no cache entry for this object, there is no - // purpose in continuing - if ( !cache[ id ] ) { - return; - } - - if ( name ) { - - thisCache = pvt ? cache[ id ] : cache[ id ].data; - - if ( thisCache ) { - - // Support array or space separated string names for data keys - if ( !jQuery.isArray( name ) ) { - - // try the string as a key before any manipulation - if ( name in thisCache ) { - name = [ name ]; - } else { - - // split the camel cased version by spaces unless a key with the spaces exists - name = jQuery.camelCase( name ); - if ( name in thisCache ) { - name = [ name ]; - } else { - name = name.split( " " ); - } - } - } - - for ( i = 0, l = name.length; i < l; i++ ) { - delete thisCache[ name[i] ]; - } - - // If there is no data left in the cache, we want to continue - // and let the cache object itself get destroyed - if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { - return; - } - } - } - - // See jQuery.data for more information - if ( !pvt ) { - delete cache[ id ].data; - - // Don't destroy the parent cache unless the internal data object - // had been the only thing left in it - if ( !isEmptyDataObject(cache[ id ]) ) { - return; - } - } - - // Browsers that fail expando deletion also refuse to delete expandos on - // the window, but it will allow it on all other JS objects; other browsers - // don't care - // Ensure that `cache` is not a window object #10080 - if ( jQuery.support.deleteExpando || !cache.setInterval ) { - delete cache[ id ]; - } else { - cache[ id ] = null; - } - - // We destroyed the cache and need to eliminate the expando on the node to avoid - // false lookups in the cache for entries that no longer exist - if ( isNode ) { - // IE does not allow us to delete expando properties from nodes, - // nor does it have a removeAttribute function on Document nodes; - // we must handle all of these cases - if ( jQuery.support.deleteExpando ) { - delete elem[ internalKey ]; - } else if ( elem.removeAttribute ) { - elem.removeAttribute( internalKey ); - } else { - elem[ internalKey ] = null; - } - } - }, - - // For internal use only. - _data: function( elem, name, data ) { - return jQuery.data( elem, name, data, true ); - }, - - // A method for determining if a DOM node can handle the data expando - acceptData: function( elem ) { - if ( elem.nodeName ) { - var match = jQuery.noData[ elem.nodeName.toLowerCase() ]; - - if ( match ) { - return !(match === true || elem.getAttribute("classid") !== match); - } - } - - return true; - } -}); - -jQuery.fn.extend({ - data: function( key, value ) { - var parts, attr, name, - data = null; - - if ( typeof key === "undefined" ) { - if ( this.length ) { - data = jQuery.data( this[0] ); - - if ( this[0].nodeType === 1 && !jQuery._data( this[0], "parsedAttrs" ) ) { - attr = this[0].attributes; - for ( var i = 0, l = attr.length; i < l; i++ ) { - name = attr[i].name; - - if ( name.indexOf( "data-" ) === 0 ) { - name = jQuery.camelCase( name.substring(5) ); - - dataAttr( this[0], name, data[ name ] ); - } - } - jQuery._data( this[0], "parsedAttrs", true ); - } - } - - return data; - - } else if ( typeof key === "object" ) { - return this.each(function() { - jQuery.data( this, key ); - }); - } - - parts = key.split("."); - parts[1] = parts[1] ? "." + parts[1] : ""; - - if ( value === undefined ) { - data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); - - // Try to fetch any internally stored data first - if ( data === undefined && this.length ) { - data = jQuery.data( this[0], key ); - data = dataAttr( this[0], key, data ); - } - - return data === undefined && parts[1] ? - this.data( parts[0] ) : - data; - - } else { - return this.each(function() { - var self = jQuery( this ), - args = [ parts[0], value ]; - - self.triggerHandler( "setData" + parts[1] + "!", args ); - jQuery.data( this, key, value ); - self.triggerHandler( "changeData" + parts[1] + "!", args ); - }); - } - }, - - removeData: function( key ) { - return this.each(function() { - jQuery.removeData( this, key ); - }); - } -}); - -function dataAttr( elem, key, data ) { - // If nothing was found internally, try to fetch any - // data from the HTML5 data-* attribute - if ( data === undefined && elem.nodeType === 1 ) { - - var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); - - data = elem.getAttribute( name ); - - if ( typeof data === "string" ) { - try { - data = data === "true" ? true : - data === "false" ? false : - data === "null" ? null : - jQuery.isNumeric( data ) ? parseFloat( data ) : - rbrace.test( data ) ? jQuery.parseJSON( data ) : - data; - } catch( e ) {} - - // Make sure we set the data so it isn't changed later - jQuery.data( elem, key, data ); - - } else { - data = undefined; - } - } - - return data; -} - -// checks a cache object for emptiness -function isEmptyDataObject( obj ) { - for ( var name in obj ) { - - // if the public data object is empty, the private is still empty - if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { - continue; - } - if ( name !== "toJSON" ) { - return false; - } - } - - return true; -} - - - - -function handleQueueMarkDefer( elem, type, src ) { - var deferDataKey = type + "defer", - queueDataKey = type + "queue", - markDataKey = type + "mark", - defer = jQuery._data( elem, deferDataKey ); - if ( defer && - ( src === "queue" || !jQuery._data(elem, queueDataKey) ) && - ( src === "mark" || !jQuery._data(elem, markDataKey) ) ) { - // Give room for hard-coded callbacks to fire first - // and eventually mark/queue something else on the element - setTimeout( function() { - if ( !jQuery._data( elem, queueDataKey ) && - !jQuery._data( elem, markDataKey ) ) { - jQuery.removeData( elem, deferDataKey, true ); - defer.fire(); - } - }, 0 ); - } -} - -jQuery.extend({ - - _mark: function( elem, type ) { - if ( elem ) { - type = ( type || "fx" ) + "mark"; - jQuery._data( elem, type, (jQuery._data( elem, type ) || 0) + 1 ); - } - }, - - _unmark: function( force, elem, type ) { - if ( force !== true ) { - type = elem; - elem = force; - force = false; - } - if ( elem ) { - type = type || "fx"; - var key = type + "mark", - count = force ? 0 : ( (jQuery._data( elem, key ) || 1) - 1 ); - if ( count ) { - jQuery._data( elem, key, count ); - } else { - jQuery.removeData( elem, key, true ); - handleQueueMarkDefer( elem, type, "mark" ); - } - } - }, - - queue: function( elem, type, data ) { - var q; - if ( elem ) { - type = ( type || "fx" ) + "queue"; - q = jQuery._data( elem, type ); - - // Speed up dequeue by getting out quickly if this is just a lookup - if ( data ) { - if ( !q || jQuery.isArray(data) ) { - q = jQuery._data( elem, type, jQuery.makeArray(data) ); - } else { - q.push( data ); - } - } - return q || []; - } - }, - - dequeue: function( elem, type ) { - type = type || "fx"; - - var queue = jQuery.queue( elem, type ), - fn = queue.shift(), - hooks = {}; - - // If the fx queue is dequeued, always remove the progress sentinel - if ( fn === "inprogress" ) { - fn = queue.shift(); - } - - if ( fn ) { - // Add a progress sentinel to prevent the fx queue from being - // automatically dequeued - if ( type === "fx" ) { - queue.unshift( "inprogress" ); - } - - jQuery._data( elem, type + ".run", hooks ); - fn.call( elem, function() { - jQuery.dequeue( elem, type ); - }, hooks ); - } - - if ( !queue.length ) { - jQuery.removeData( elem, type + "queue " + type + ".run", true ); - handleQueueMarkDefer( elem, type, "queue" ); - } - } -}); - -jQuery.fn.extend({ - queue: function( type, data ) { - if ( typeof type !== "string" ) { - data = type; - type = "fx"; - } - - if ( data === undefined ) { - return jQuery.queue( this[0], type ); - } - return this.each(function() { - var queue = jQuery.queue( this, type, data ); - - if ( type === "fx" && queue[0] !== "inprogress" ) { - jQuery.dequeue( this, type ); - } - }); - }, - dequeue: function( type ) { - return this.each(function() { - jQuery.dequeue( this, type ); - }); - }, - // Based off of the plugin by Clint Helfers, with permission. - // http://blindsignals.com/index.php/2009/07/jquery-delay/ - delay: function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; - type = type || "fx"; - - return this.queue( type, function( next, hooks ) { - var timeout = setTimeout( next, time ); - hooks.stop = function() { - clearTimeout( timeout ); - }; - }); - }, - clearQueue: function( type ) { - return this.queue( type || "fx", [] ); - }, - // Get a promise resolved when queues of a certain type - // are emptied (fx is the type by default) - promise: function( type, object ) { - if ( typeof type !== "string" ) { - object = type; - type = undefined; - } - type = type || "fx"; - var defer = jQuery.Deferred(), - elements = this, - i = elements.length, - count = 1, - deferDataKey = type + "defer", - queueDataKey = type + "queue", - markDataKey = type + "mark", - tmp; - function resolve() { - if ( !( --count ) ) { - defer.resolveWith( elements, [ elements ] ); - } - } - while( i-- ) { - if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) || - ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) || - jQuery.data( elements[ i ], markDataKey, undefined, true ) ) && - jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) { - count++; - tmp.add( resolve ); - } - } - resolve(); - return defer.promise(); - } -}); - - - - -var rclass = /[\n\t\r]/g, - rspace = /\s+/, - rreturn = /\r/g, - rtype = /^(?:button|input)$/i, - rfocusable = /^(?:button|input|object|select|textarea)$/i, - rclickable = /^a(?:rea)?$/i, - rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, - getSetAttribute = jQuery.support.getSetAttribute, - nodeHook, boolHook, fixSpecified; - -jQuery.fn.extend({ - attr: function( name, value ) { - return jQuery.access( this, name, value, true, jQuery.attr ); - }, - - removeAttr: function( name ) { - return this.each(function() { - jQuery.removeAttr( this, name ); - }); - }, - - prop: function( name, value ) { - return jQuery.access( this, name, value, true, jQuery.prop ); - }, - - removeProp: function( name ) { - name = jQuery.propFix[ name ] || name; - return this.each(function() { - // try/catch handles cases where IE balks (such as removing a property on window) - try { - this[ name ] = undefined; - delete this[ name ]; - } catch( e ) {} - }); - }, - - addClass: function( value ) { - var classNames, i, l, elem, - setClass, c, cl; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).addClass( value.call(this, j, this.className) ); - }); - } - - if ( value && typeof value === "string" ) { - classNames = value.split( rspace ); - - for ( i = 0, l = this.length; i < l; i++ ) { - elem = this[ i ]; - - if ( elem.nodeType === 1 ) { - if ( !elem.className && classNames.length === 1 ) { - elem.className = value; - - } else { - setClass = " " + elem.className + " "; - - for ( c = 0, cl = classNames.length; c < cl; c++ ) { - if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) { - setClass += classNames[ c ] + " "; - } - } - elem.className = jQuery.trim( setClass ); - } - } - } - } - - return this; - }, - - removeClass: function( value ) { - var classNames, i, l, elem, className, c, cl; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).removeClass( value.call(this, j, this.className) ); - }); - } - - if ( (value && typeof value === "string") || value === undefined ) { - classNames = ( value || "" ).split( rspace ); - - for ( i = 0, l = this.length; i < l; i++ ) { - elem = this[ i ]; - - if ( elem.nodeType === 1 && elem.className ) { - if ( value ) { - className = (" " + elem.className + " ").replace( rclass, " " ); - for ( c = 0, cl = classNames.length; c < cl; c++ ) { - className = className.replace(" " + classNames[ c ] + " ", " "); - } - elem.className = jQuery.trim( className ); - - } else { - elem.className = ""; - } - } - } - } - - return this; - }, - - toggleClass: function( value, stateVal ) { - var type = typeof value, - isBool = typeof stateVal === "boolean"; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( i ) { - jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); - }); - } - - return this.each(function() { - if ( type === "string" ) { - // toggle individual class names - var className, - i = 0, - self = jQuery( this ), - state = stateVal, - classNames = value.split( rspace ); - - while ( (className = classNames[ i++ ]) ) { - // check each className given, space seperated list - state = isBool ? state : !self.hasClass( className ); - self[ state ? "addClass" : "removeClass" ]( className ); - } - - } else if ( type === "undefined" || type === "boolean" ) { - if ( this.className ) { - // store className if set - jQuery._data( this, "__className__", this.className ); - } - - // toggle whole className - this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; - } - }); - }, - - hasClass: function( selector ) { - var className = " " + selector + " ", - i = 0, - l = this.length; - for ( ; i < l; i++ ) { - if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { - return true; - } - } - - return false; - }, - - val: function( value ) { - var hooks, ret, isFunction, - elem = this[0]; - - if ( !arguments.length ) { - if ( elem ) { - hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ]; - - if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { - return ret; - } - - ret = elem.value; - - return typeof ret === "string" ? - // handle most common string cases - ret.replace(rreturn, "") : - // handle cases where value is null/undef or number - ret == null ? "" : ret; - } - - return; - } - - isFunction = jQuery.isFunction( value ); - - return this.each(function( i ) { - var self = jQuery(this), val; - - if ( this.nodeType !== 1 ) { - return; - } - - if ( isFunction ) { - val = value.call( this, i, self.val() ); - } else { - val = value; - } - - // Treat null/undefined as ""; convert numbers to string - if ( val == null ) { - val = ""; - } else if ( typeof val === "number" ) { - val += ""; - } else if ( jQuery.isArray( val ) ) { - val = jQuery.map(val, function ( value ) { - return value == null ? "" : value + ""; - }); - } - - hooks = jQuery.valHooks[ this.nodeName.toLowerCase() ] || jQuery.valHooks[ this.type ]; - - // If set returns undefined, fall back to normal setting - if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { - this.value = val; - } - }); - } -}); - -jQuery.extend({ - valHooks: { - option: { - get: function( elem ) { - // attributes.value is undefined in Blackberry 4.7 but - // uses .value. See #6932 - var val = elem.attributes.value; - return !val || val.specified ? elem.value : elem.text; - } - }, - select: { - get: function( elem ) { - var value, i, max, option, - index = elem.selectedIndex, - values = [], - options = elem.options, - one = elem.type === "select-one"; - - // Nothing was selected - if ( index < 0 ) { - return null; - } - - // Loop through all the selected options - i = one ? index : 0; - max = one ? index + 1 : options.length; - for ( ; i < max; i++ ) { - option = options[ i ]; - - // Don't return options that are disabled or in a disabled optgroup - if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && - (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) { - - // Get the specific value for the option - value = jQuery( option ).val(); - - // We don't need an array for one selects - if ( one ) { - return value; - } - - // Multi-Selects return an array - values.push( value ); - } - } - - // Fixes Bug #2551 -- select.val() broken in IE after form.reset() - if ( one && !values.length && options.length ) { - return jQuery( options[ index ] ).val(); - } - - return values; - }, - - set: function( elem, value ) { - var values = jQuery.makeArray( value ); - - jQuery(elem).find("option").each(function() { - this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; - }); - - if ( !values.length ) { - elem.selectedIndex = -1; - } - return values; - } - } - }, - - attrFn: { - val: true, - css: true, - html: true, - text: true, - data: true, - width: true, - height: true, - offset: true - }, - - attr: function( elem, name, value, pass ) { - var ret, hooks, notxml, - nType = elem.nodeType; - - // don't get/set attributes on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - if ( pass && name in jQuery.attrFn ) { - return jQuery( elem )[ name ]( value ); - } - - // Fallback to prop when attributes are not supported - if ( typeof elem.getAttribute === "undefined" ) { - return jQuery.prop( elem, name, value ); - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - // All attributes are lowercase - // Grab necessary hook if one is defined - if ( notxml ) { - name = name.toLowerCase(); - hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); - } - - if ( value !== undefined ) { - - if ( value === null ) { - jQuery.removeAttr( elem, name ); - return; - - } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - elem.setAttribute( name, "" + value ); - return value; - } - - } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - - ret = elem.getAttribute( name ); - - // Non-existent attributes return null, we normalize to undefined - return ret === null ? - undefined : - ret; - } - }, - - removeAttr: function( elem, value ) { - var propName, attrNames, name, l, - i = 0; - - if ( value && elem.nodeType === 1 ) { - attrNames = value.toLowerCase().split( rspace ); - l = attrNames.length; - - for ( ; i < l; i++ ) { - name = attrNames[ i ]; - - if ( name ) { - propName = jQuery.propFix[ name ] || name; - - // See #9699 for explanation of this approach (setting first, then removal) - jQuery.attr( elem, name, "" ); - elem.removeAttribute( getSetAttribute ? name : propName ); - - // Set corresponding property to false for boolean attributes - if ( rboolean.test( name ) && propName in elem ) { - elem[ propName ] = false; - } - } - } - } - }, - - attrHooks: { - type: { - set: function( elem, value ) { - // We can't allow the type property to be changed (since it causes problems in IE) - if ( rtype.test( elem.nodeName ) && elem.parentNode ) { - jQuery.error( "type property can't be changed" ); - } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { - // Setting the type on a radio button after the value resets the value in IE6-9 - // Reset value to it's default in case type is set after value - // This is for element creation - var val = elem.value; - elem.setAttribute( "type", value ); - if ( val ) { - elem.value = val; - } - return value; - } - } - }, - // Use the value property for back compat - // Use the nodeHook for button elements in IE6/7 (#1954) - value: { - get: function( elem, name ) { - if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { - return nodeHook.get( elem, name ); - } - return name in elem ? - elem.value : - null; - }, - set: function( elem, value, name ) { - if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { - return nodeHook.set( elem, value, name ); - } - // Does not return so that setAttribute is also used - elem.value = value; - } - } - }, - - propFix: { - tabindex: "tabIndex", - readonly: "readOnly", - "for": "htmlFor", - "class": "className", - maxlength: "maxLength", - cellspacing: "cellSpacing", - cellpadding: "cellPadding", - rowspan: "rowSpan", - colspan: "colSpan", - usemap: "useMap", - frameborder: "frameBorder", - contenteditable: "contentEditable" - }, - - prop: function( elem, name, value ) { - var ret, hooks, notxml, - nType = elem.nodeType; - - // don't get/set properties on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - if ( notxml ) { - // Fix name and attach hooks - name = jQuery.propFix[ name ] || name; - hooks = jQuery.propHooks[ name ]; - } - - if ( value !== undefined ) { - if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - return ( elem[ name ] = value ); - } - - } else { - if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - return elem[ name ]; - } - } - }, - - propHooks: { - tabIndex: { - get: function( elem ) { - // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set - // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabinde... - var attributeNode = elem.getAttributeNode("tabindex"); - - return attributeNode && attributeNode.specified ? - parseInt( attributeNode.value, 10 ) : - rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? - 0 : - undefined; - } - } - } -}); - -// Add the tabIndex propHook to attrHooks for back-compat (different case is intentional) -jQuery.attrHooks.tabindex = jQuery.propHooks.tabIndex; - -// Hook for boolean attributes -boolHook = { - get: function( elem, name ) { - // Align boolean attributes with corresponding properties - // Fall back to attribute presence where some booleans are not supported - var attrNode, - property = jQuery.prop( elem, name ); - return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ? - name.toLowerCase() : - undefined; - }, - set: function( elem, value, name ) { - var propName; - if ( value === false ) { - // Remove boolean attributes when set to false - jQuery.removeAttr( elem, name ); - } else { - // value is true since we know at this point it's type boolean and not false - // Set boolean attributes to the same name and set the DOM property - propName = jQuery.propFix[ name ] || name; - if ( propName in elem ) { - // Only set the IDL specifically if it already exists on the element - elem[ propName ] = true; - } - - elem.setAttribute( name, name.toLowerCase() ); - } - return name; - } -}; - -// IE6/7 do not support getting/setting some attributes with get/setAttribute -if ( !getSetAttribute ) { - - fixSpecified = { - name: true, - id: true - }; - - // Use this for any attribute in IE6/7 - // This fixes almost every IE6/7 issue - nodeHook = jQuery.valHooks.button = { - get: function( elem, name ) { - var ret; - ret = elem.getAttributeNode( name ); - return ret && ( fixSpecified[ name ] ? ret.nodeValue !== "" : ret.specified ) ? - ret.nodeValue : - undefined; - }, - set: function( elem, value, name ) { - // Set the existing or create a new attribute node - var ret = elem.getAttributeNode( name ); - if ( !ret ) { - ret = document.createAttribute( name ); - elem.setAttributeNode( ret ); - } - return ( ret.nodeValue = value + "" ); - } - }; - - // Apply the nodeHook to tabindex - jQuery.attrHooks.tabindex.set = nodeHook.set; - - // Set width and height to auto instead of 0 on empty string( Bug #8150 ) - // This is for removals - jQuery.each([ "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - set: function( elem, value ) { - if ( value === "" ) { - elem.setAttribute( name, "auto" ); - return value; - } - } - }); - }); - - // Set contenteditable to false on removals(#10429) - // Setting to empty string throws an error as an invalid value - jQuery.attrHooks.contenteditable = { - get: nodeHook.get, - set: function( elem, value, name ) { - if ( value === "" ) { - value = "false"; - } - nodeHook.set( elem, value, name ); - } - }; -} - - -// Some attributes require a special call on IE -if ( !jQuery.support.hrefNormalized ) { - jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - get: function( elem ) { - var ret = elem.getAttribute( name, 2 ); - return ret === null ? undefined : ret; - } - }); - }); -} - -if ( !jQuery.support.style ) { - jQuery.attrHooks.style = { - get: function( elem ) { - // Return undefined in the case of empty string - // Normalize to lowercase since IE uppercases css property names - return elem.style.cssText.toLowerCase() || undefined; - }, - set: function( elem, value ) { - return ( elem.style.cssText = "" + value ); - } - }; -} - -// Safari mis-reports the default selected property of an option -// Accessing the parent's selectedIndex property fixes it -if ( !jQuery.support.optSelected ) { - jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { - get: function( elem ) { - var parent = elem.parentNode; - - if ( parent ) { - parent.selectedIndex; - - // Make sure that it also works with optgroups, see #5701 - if ( parent.parentNode ) { - parent.parentNode.selectedIndex; - } - } - return null; - } - }); -} - -// IE6/7 call enctype encoding -if ( !jQuery.support.enctype ) { - jQuery.propFix.enctype = "encoding"; -} - -// Radios and checkboxes getter/setter -if ( !jQuery.support.checkOn ) { - jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = { - get: function( elem ) { - // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified - return elem.getAttribute("value") === null ? "on" : elem.value; - } - }; - }); -} -jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { - set: function( elem, value ) { - if ( jQuery.isArray( value ) ) { - return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); - } - } - }); -}); - - - - -var rformElems = /^(?:textarea|input|select)$/i, - rtypenamespace = /^([^.]*)?(?:.(.+))?$/, - rhoverHack = /\bhover(.\S+)?\b/, - rkeyEvent = /^key/, - rmouseEvent = /^(?:mouse|contextmenu)|click/, - rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, - rquickIs = /^(\w*)(?:#([\w-]+))?(?:.([\w-]+))?$/, - quickParse = function( selector ) { - var quick = rquickIs.exec( selector ); - if ( quick ) { - // 0 1 2 3 - // [ _, tag, id, class ] - quick[1] = ( quick[1] || "" ).toLowerCase(); - quick[3] = quick[3] && new RegExp( "(?:^|\s)" + quick[3] + "(?:\s|$)" ); - } - return quick; - }, - quickIs = function( elem, m ) { - var attrs = elem.attributes || {}; - return ( - (!m[1] || elem.nodeName.toLowerCase() === m[1]) && - (!m[2] || (attrs.id || {}).value === m[2]) && - (!m[3] || m[3].test( (attrs[ "class" ] || {}).value )) - ); - }, - hoverHack = function( events ) { - return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" ); - }; - -/* - * Helper functions for managing events -- not part of the public interface. - * Props to Dean Edwards' addEvent library for many of the ideas. - */ -jQuery.event = { - - add: function( elem, types, handler, data, selector ) { - - var elemData, eventHandle, events, - t, tns, type, namespaces, handleObj, - handleObjIn, quick, handlers, special; - - // Don't attach events to noData or text/comment nodes (allow plain objects tho) - if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) { - return; - } - - // Caller can pass in an object of custom data in lieu of the handler - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - } - - // Make sure that the handler has a unique ID, used to find/remove it later - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure and main handler, if this is the first - events = elemData.events; - if ( !events ) { - elemData.events = events = {}; - } - eventHandle = elemData.handle; - if ( !eventHandle ) { - elemData.handle = eventHandle = function( e ) { - // Discard the second event of a jQuery.event.trigger() and - // when an event is called after a page has unloaded - return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? - jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : - undefined; - }; - // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events - eventHandle.elem = elem; - } - - // Handle multiple events separated by a space - // jQuery(...).bind("mouseover mouseout", fn); - types = jQuery.trim( hoverHack(types) ).split( " " ); - for ( t = 0; t < types.length; t++ ) { - - tns = rtypenamespace.exec( types[t] ) || []; - type = tns[1]; - namespaces = ( tns[2] || "" ).split( "." ).sort(); - - // If event changes its type, use the special event handlers for the changed type - special = jQuery.event.special[ type ] || {}; - - // If selector defined, determine special event api type, otherwise given type - type = ( selector ? special.delegateType : special.bindType ) || type; - - // Update special based on newly reset type - special = jQuery.event.special[ type ] || {}; - - // handleObj is passed to all event handlers - handleObj = jQuery.extend({ - type: type, - origType: tns[1], - data: data, - handler: handler, - guid: handler.guid, - selector: selector, - quick: quickParse( selector ), - namespace: namespaces.join(".") - }, handleObjIn ); - - // Init the event handler queue if we're the first - handlers = events[ type ]; - if ( !handlers ) { - handlers = events[ type ] = []; - handlers.delegateCount = 0; - - // Only use addEventListener/attachEvent if the special events handler returns false - if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - // Bind the global event handler to the element - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle, false ); - - } else if ( elem.attachEvent ) { - elem.attachEvent( "on" + type, eventHandle ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add to the element's handler list, delegates in front - if ( selector ) { - handlers.splice( handlers.delegateCount++, 0, handleObj ); - } else { - handlers.push( handleObj ); - } - - // Keep track of which events have ever been used, for event optimization - jQuery.event.global[ type ] = true; - } - - // Nullify elem to prevent memory leaks in IE - elem = null; - }, - - global: {}, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, selector, mappedTypes ) { - - var elemData = jQuery.hasData( elem ) && jQuery._data( elem ), - t, tns, type, origType, namespaces, origCount, - j, events, special, handle, eventType, handleObj; - - if ( !elemData || !(events = elemData.events) ) { - return; - } - - // Once for each type.namespace in types; type may be omitted - types = jQuery.trim( hoverHack( types || "" ) ).split(" "); - for ( t = 0; t < types.length; t++ ) { - tns = rtypenamespace.exec( types[t] ) || []; - type = origType = tns[1]; - namespaces = tns[2]; - - // Unbind all events (on this namespace, if provided) for the element - if ( !type ) { - for ( type in events ) { - jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); - } - continue; - } - - special = jQuery.event.special[ type ] || {}; - type = ( selector? special.delegateType : special.bindType ) || type; - eventType = events[ type ] || []; - origCount = eventType.length; - namespaces = namespaces ? new RegExp("(^|\.)" + namespaces.split(".").sort().join("\.(?:.*\.)?") + "(\.|$)") : null; - - // Remove matching events - for ( j = 0; j < eventType.length; j++ ) { - handleObj = eventType[ j ]; - - if ( ( mappedTypes || origType === handleObj.origType ) && - ( !handler || handler.guid === handleObj.guid ) && - ( !namespaces || namespaces.test( handleObj.namespace ) ) && - ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { - eventType.splice( j--, 1 ); - - if ( handleObj.selector ) { - eventType.delegateCount--; - } - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - } - - // Remove generic event handler if we removed something and no more handlers exist - // (avoids potential for endless recursion during removal of special event handlers) - if ( eventType.length === 0 && origCount !== eventType.length ) { - if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { - jQuery.removeEvent( elem, type, elemData.handle ); - } - - delete events[ type ]; - } - } - - // Remove the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - handle = elemData.handle; - if ( handle ) { - handle.elem = null; - } - - // removeData also checks for emptiness and clears the expando if empty - // so use it instead of delete - jQuery.removeData( elem, [ "events", "handle" ], true ); - } - }, - - // Events that are safe to short-circuit if no handlers are attached. - // Native DOM events should not be added, they may have inline handlers. - customEvent: { - "getData": true, - "setData": true, - "changeData": true - }, - - trigger: function( event, data, elem, onlyHandlers ) { - // Don't do events on text and comment nodes - if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) { - return; - } - - // Event object or event type - var type = event.type || event, - namespaces = [], - cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType; - - // focus/blur morphs to focusin/out; ensure we're not firing them right now - if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { - return; - } - - if ( type.indexOf( "!" ) >= 0 ) { - // Exclusive events trigger only for the exact event (no namespaces) - type = type.slice(0, -1); - exclusive = true; - } - - if ( type.indexOf( "." ) >= 0 ) { - // Namespaced trigger; create a regexp to match event type in handle() - namespaces = type.split("."); - type = namespaces.shift(); - namespaces.sort(); - } - - if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) { - // No jQuery handlers for this event type, and it can't have inline handlers - return; - } - - // Caller can pass in an Event, Object, or just an event type string - event = typeof event === "object" ? - // jQuery.Event object - event[ jQuery.expando ] ? event : - // Object literal - new jQuery.Event( type, event ) : - // Just the event type (string) - new jQuery.Event( type ); - - event.type = type; - event.isTrigger = true; - event.exclusive = exclusive; - event.namespace = namespaces.join( "." ); - event.namespace_re = event.namespace? new RegExp("(^|\.)" + namespaces.join("\.(?:.*\.)?") + "(\.|$)") : null; - ontype = type.indexOf( ":" ) < 0 ? "on" + type : ""; - - // Handle a global trigger - if ( !elem ) { - - // TODO: Stop taunting the data cache; remove global events and always attach to document - cache = jQuery.cache; - for ( i in cache ) { - if ( cache[ i ].events && cache[ i ].events[ type ] ) { - jQuery.event.trigger( event, data, cache[ i ].handle.elem, true ); - } - } - return; - } - - // Clean up the event in case it is being reused - event.result = undefined; - if ( !event.target ) { - event.target = elem; - } - - // Clone any incoming data and prepend the event, creating the handler arg list - data = data != null ? jQuery.makeArray( data ) : []; - data.unshift( event ); - - // Allow special events to draw outside the lines - special = jQuery.event.special[ type ] || {}; - if ( special.trigger && special.trigger.apply( elem, data ) === false ) { - return; - } - - // Determine event propagation path in advance, per W3C events spec (#9951) - // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) - eventPath = [[ elem, special.bindType || type ]]; - if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { - - bubbleType = special.delegateType || type; - cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode; - old = null; - for ( ; cur; cur = cur.parentNode ) { - eventPath.push([ cur, bubbleType ]); - old = cur; - } - - // Only add window if we got to document (e.g., not plain obj or detached DOM) - if ( old && old === elem.ownerDocument ) { - eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]); - } - } - - // Fire handlers on the event path - for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) { - - cur = eventPath[i][0]; - event.type = eventPath[i][1]; - - handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); - if ( handle ) { - handle.apply( cur, data ); - } - // Note that this is a bare JS function and not a jQuery handler - handle = ontype && cur[ ontype ]; - if ( handle && jQuery.acceptData( cur ) && handle.apply( cur, data ) === false ) { - event.preventDefault(); - } - } - event.type = type; - - // If nobody prevented the default action, do it now - if ( !onlyHandlers && !event.isDefaultPrevented() ) { - - if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && - !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { - - // Call a native DOM method on the target with the same name name as the event. - // Can't use an .isFunction() check here because IE6/7 fails that test. - // Don't do default actions on window, that's where global variables be (#6170) - // IE<9 dies on focus/blur to hidden element (#1486) - if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) { - - // Don't re-trigger an onFOO event when we call its FOO() method - old = elem[ ontype ]; - - if ( old ) { - elem[ ontype ] = null; - } - - // Prevent re-triggering of the same event, since we already bubbled it above - jQuery.event.triggered = type; - elem[ type ](); - jQuery.event.triggered = undefined; - - if ( old ) { - elem[ ontype ] = old; - } - } - } - } - - return event.result; - }, - - dispatch: function( event ) { - - // Make a writable jQuery.Event from the native event object - event = jQuery.event.fix( event || window.event ); - - var handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []), - delegateCount = handlers.delegateCount, - args = [].slice.call( arguments, 0 ), - run_all = !event.exclusive && !event.namespace, - handlerQueue = [], - i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related; - - // Use the fix-ed jQuery.Event rather than the (read-only) native event - args[0] = event; - event.delegateTarget = this; - - // Determine handlers that should run if there are delegated events - // Avoid disabled elements in IE (#6911) and non-left-click bubbling in Firefox (#3861) - if ( delegateCount && !event.target.disabled && !(event.button && event.type === "click") ) { - - // Pregenerate a single jQuery object for reuse with .is() - jqcur = jQuery(this); - jqcur.context = this.ownerDocument || this; - - for ( cur = event.target; cur != this; cur = cur.parentNode || this ) { - selMatch = {}; - matches = []; - jqcur[0] = cur; - for ( i = 0; i < delegateCount; i++ ) { - handleObj = handlers[ i ]; - sel = handleObj.selector; - - if ( selMatch[ sel ] === undefined ) { - selMatch[ sel ] = ( - handleObj.quick ? quickIs( cur, handleObj.quick ) : jqcur.is( sel ) - ); - } - if ( selMatch[ sel ] ) { - matches.push( handleObj ); - } - } - if ( matches.length ) { - handlerQueue.push({ elem: cur, matches: matches }); - } - } - } - - // Add the remaining (directly-bound) handlers - if ( handlers.length > delegateCount ) { - handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) }); - } - - // Run delegates first; they may want to stop propagation beneath us - for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) { - matched = handlerQueue[ i ]; - event.currentTarget = matched.elem; - - for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) { - handleObj = matched.matches[ j ]; - - // Triggered event must either 1) be non-exclusive and have no namespace, or - // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). - if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) { - - event.data = handleObj.data; - event.handleObj = handleObj; - - ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) - .apply( matched.elem, args ); - - if ( ret !== undefined ) { - event.result = ret; - if ( ret === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - } - } - } - - return event.result; - }, - - // Includes some event props shared by KeyEvent and MouseEvent - // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 *** - props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), - - fixHooks: {}, - - keyHooks: { - props: "char charCode key keyCode".split(" "), - filter: function( event, original ) { - - // Add which for key events - if ( event.which == null ) { - event.which = original.charCode != null ? original.charCode : original.keyCode; - } - - return event; - } - }, - - mouseHooks: { - props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), - filter: function( event, original ) { - var eventDoc, doc, body, - button = original.button, - fromElement = original.fromElement; - - // Calculate pageX/Y if missing and clientX/Y available - if ( event.pageX == null && original.clientX != null ) { - eventDoc = event.target.ownerDocument || document; - doc = eventDoc.documentElement; - body = eventDoc.body; - - event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); - event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); - } - - // Add relatedTarget, if necessary - if ( !event.relatedTarget && fromElement ) { - event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - // Note: button is not normalized, so don't use it - if ( !event.which && button !== undefined ) { - event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); - } - - return event; - } - }, - - fix: function( event ) { - if ( event[ jQuery.expando ] ) { - return event; - } - - // Create a writable copy of the event object and normalize some properties - var i, prop, - originalEvent = event, - fixHook = jQuery.event.fixHooks[ event.type ] || {}, - copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; - - event = jQuery.Event( originalEvent ); - - for ( i = copy.length; i; ) { - prop = copy[ --i ]; - event[ prop ] = originalEvent[ prop ]; - } - - // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2) - if ( !event.target ) { - event.target = originalEvent.srcElement || document; - } - - // Target should not be a text node (#504, Safari) - if ( event.target.nodeType === 3 ) { - event.target = event.target.parentNode; - } - - // For mouse/key events; add metaKey if it's not there (#3368, IE6/7/8) - if ( event.metaKey === undefined ) { - event.metaKey = event.ctrlKey; - } - - return fixHook.filter? fixHook.filter( event, originalEvent ) : event; - }, - - special: { - ready: { - // Make sure the ready event is setup - setup: jQuery.bindReady - }, - - load: { - // Prevent triggered image.load events from bubbling to window.load - noBubble: true - }, - - focus: { - delegateType: "focusin" - }, - blur: { - delegateType: "focusout" - }, - - beforeunload: { - setup: function( data, namespaces, eventHandle ) { - // We only want to do this special case on windows - if ( jQuery.isWindow( this ) ) { - this.onbeforeunload = eventHandle; - } - }, - - teardown: function( namespaces, eventHandle ) { - if ( this.onbeforeunload === eventHandle ) { - this.onbeforeunload = null; - } - } - } - }, - - simulate: function( type, elem, event, bubble ) { - // Piggyback on a donor event to simulate a different one. - // Fake originalEvent to avoid donor's stopPropagation, but if the - // simulated event prevents default then we do the same on the donor. - var e = jQuery.extend( - new jQuery.Event(), - event, - { type: type, - isSimulated: true, - originalEvent: {} - } - ); - if ( bubble ) { - jQuery.event.trigger( e, null, elem ); - } else { - jQuery.event.dispatch.call( elem, e ); - } - if ( e.isDefaultPrevented() ) { - event.preventDefault(); - } - } -}; - -// Some plugins are using, but it's undocumented/deprecated and will be removed. -// The 1.7 special event interface should provide all the hooks needed now. -jQuery.event.handle = jQuery.event.dispatch; - -jQuery.removeEvent = document.removeEventListener ? - function( elem, type, handle ) { - if ( elem.removeEventListener ) { - elem.removeEventListener( type, handle, false ); - } - } : - function( elem, type, handle ) { - if ( elem.detachEvent ) { - elem.detachEvent( "on" + type, handle ); - } - }; - -jQuery.Event = function( src, props ) { - // Allow instantiation without the 'new' keyword - if ( !(this instanceof jQuery.Event) ) { - return new jQuery.Event( src, props ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - - // Events bubbling up the document may have been marked as prevented - // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || - src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; - - // Event type - } else { - this.type = src; - } - - // Put explicitly provided properties onto the event object - if ( props ) { - jQuery.extend( this, props ); - } - - // Create a timestamp if incoming event doesn't have one - this.timeStamp = src && src.timeStamp || jQuery.now(); - - // Mark it as fixed - this[ jQuery.expando ] = true; -}; - -function returnFalse() { - return false; -} -function returnTrue() { - return true; -} - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding... -jQuery.Event.prototype = { - preventDefault: function() { - this.isDefaultPrevented = returnTrue; - - var e = this.originalEvent; - if ( !e ) { - return; - } - - // if preventDefault exists run it on the original event - if ( e.preventDefault ) { - e.preventDefault(); - - // otherwise set the returnValue property of the original event to false (IE) - } else { - e.returnValue = false; - } - }, - stopPropagation: function() { - this.isPropagationStopped = returnTrue; - - var e = this.originalEvent; - if ( !e ) { - return; - } - // if stopPropagation exists run it on the original event - if ( e.stopPropagation ) { - e.stopPropagation(); - } - // otherwise set the cancelBubble property of the original event to true (IE) - e.cancelBubble = true; - }, - stopImmediatePropagation: function() { - this.isImmediatePropagationStopped = returnTrue; - this.stopPropagation(); - }, - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse -}; - -// Create mouseenter/leave events using mouseover/out and event-time checks -jQuery.each({ - mouseenter: "mouseover", - mouseleave: "mouseout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - delegateType: fix, - bindType: fix, - - handle: function( event ) { - var target = this, - related = event.relatedTarget, - handleObj = event.handleObj, - selector = handleObj.selector, - ret; - - // For mousenter/leave call the handler if related is outside the target. - // NB: No relatedTarget if the mouse left/entered the browser window - if ( !related || (related !== target && !jQuery.contains( target, related )) ) { - event.type = handleObj.origType; - ret = handleObj.handler.apply( this, arguments ); - event.type = fix; - } - return ret; - } - }; -}); - -// IE submit delegation -if ( !jQuery.support.submitBubbles ) { - - jQuery.event.special.submit = { - setup: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Lazy-add a submit handler when a descendant form may potentially be submitted - jQuery.event.add( this, "click._submit keypress._submit", function( e ) { - // Node name check avoids a VML-related crash in IE (#9807) - var elem = e.target, - form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; - if ( form && !form._submit_attached ) { - jQuery.event.add( form, "submit._submit", function( event ) { - // If form was submitted by the user, bubble the event up the tree - if ( this.parentNode && !event.isTrigger ) { - jQuery.event.simulate( "submit", this.parentNode, event, true ); - } - }); - form._submit_attached = true; - } - }); - // return undefined since we don't need an event listener - }, - - teardown: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Remove delegated handlers; cleanData eventually reaps submit handlers attached above - jQuery.event.remove( this, "._submit" ); - } - }; -} - -// IE change delegation and checkbox/radio fix -if ( !jQuery.support.changeBubbles ) { - - jQuery.event.special.change = { - - setup: function() { - - if ( rformElems.test( this.nodeName ) ) { - // IE doesn't fire change on a check/radio until blur; trigger it on click - // after a propertychange. Eat the blur-change in special.change.handle. - // This still fires onchange a second time for check/radio after blur. - if ( this.type === "checkbox" || this.type === "radio" ) { - jQuery.event.add( this, "propertychange._change", function( event ) { - if ( event.originalEvent.propertyName === "checked" ) { - this._just_changed = true; - } - }); - jQuery.event.add( this, "click._change", function( event ) { - if ( this._just_changed && !event.isTrigger ) { - this._just_changed = false; - jQuery.event.simulate( "change", this, event, true ); - } - }); - } - return false; - } - // Delegated event; lazy-add a change handler on descendant inputs - jQuery.event.add( this, "beforeactivate._change", function( e ) { - var elem = e.target; - - if ( rformElems.test( elem.nodeName ) && !elem._change_attached ) { - jQuery.event.add( elem, "change._change", function( event ) { - if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { - jQuery.event.simulate( "change", this.parentNode, event, true ); - } - }); - elem._change_attached = true; - } - }); - }, - - handle: function( event ) { - var elem = event.target; - - // Swallow native change events from checkbox/radio, we already triggered them above - if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { - return event.handleObj.handler.apply( this, arguments ); - } - }, - - teardown: function() { - jQuery.event.remove( this, "._change" ); - - return rformElems.test( this.nodeName ); - } - }; -} - -// Create "bubbling" focus and blur events -if ( !jQuery.support.focusinBubbles ) { - jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { - - // Attach a single capturing handler while someone wants focusin/focusout - var attaches = 0, - handler = function( event ) { - jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); - }; - - jQuery.event.special[ fix ] = { - setup: function() { - if ( attaches++ === 0 ) { - document.addEventListener( orig, handler, true ); - } - }, - teardown: function() { - if ( --attaches === 0 ) { - document.removeEventListener( orig, handler, true ); - } - } - }; - }); -} - -jQuery.fn.extend({ - - on: function( types, selector, data, fn, /*INTERNAL*/ one ) { - var origFn, type; - - // Types can be a map of types/handlers - if ( typeof types === "object" ) { - // ( types-Object, selector, data ) - if ( typeof selector !== "string" ) { - // ( types-Object, data ) - data = selector; - selector = undefined; - } - for ( type in types ) { - this.on( type, selector, data, types[ type ], one ); - } - return this; - } - - if ( data == null && fn == null ) { - // ( types, fn ) - fn = selector; - data = selector = undefined; - } else if ( fn == null ) { - if ( typeof selector === "string" ) { - // ( types, selector, fn ) - fn = data; - data = undefined; - } else { - // ( types, data, fn ) - fn = data; - data = selector; - selector = undefined; - } - } - if ( fn === false ) { - fn = returnFalse; - } else if ( !fn ) { - return this; - } - - if ( one === 1 ) { - origFn = fn; - fn = function( event ) { - // Can use an empty set, since event contains the info - jQuery().off( event ); - return origFn.apply( this, arguments ); - }; - // Use same guid so caller can remove using origFn - fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); - } - return this.each( function() { - jQuery.event.add( this, types, fn, data, selector ); - }); - }, - one: function( types, selector, data, fn ) { - return this.on.call( this, types, selector, data, fn, 1 ); - }, - off: function( types, selector, fn ) { - if ( types && types.preventDefault && types.handleObj ) { - // ( event ) dispatched jQuery.Event - var handleObj = types.handleObj; - jQuery( types.delegateTarget ).off( - handleObj.namespace? handleObj.type + "." + handleObj.namespace : handleObj.type, - handleObj.selector, - handleObj.handler - ); - return this; - } - if ( typeof types === "object" ) { - // ( types-object [, selector] ) - for ( var type in types ) { - this.off( type, selector, types[ type ] ); - } - return this; - } - if ( selector === false || typeof selector === "function" ) { - // ( types [, fn] ) - fn = selector; - selector = undefined; - } - if ( fn === false ) { - fn = returnFalse; - } - return this.each(function() { - jQuery.event.remove( this, types, fn, selector ); - }); - }, - - bind: function( types, data, fn ) { - return this.on( types, null, data, fn ); - }, - unbind: function( types, fn ) { - return this.off( types, null, fn ); - }, - - live: function( types, data, fn ) { - jQuery( this.context ).on( types, this.selector, data, fn ); - return this; - }, - die: function( types, fn ) { - jQuery( this.context ).off( types, this.selector || "**", fn ); - return this; - }, - - delegate: function( selector, types, data, fn ) { - return this.on( types, selector, data, fn ); - }, - undelegate: function( selector, types, fn ) { - // ( namespace ) or ( selector, types [, fn] ) - return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector, fn ); - }, - - trigger: function( type, data ) { - return this.each(function() { - jQuery.event.trigger( type, data, this ); - }); - }, - triggerHandler: function( type, data ) { - if ( this[0] ) { - return jQuery.event.trigger( type, data, this[0], true ); - } - }, - - toggle: function( fn ) { - // Save reference to arguments for access in closure - var args = arguments, - guid = fn.guid || jQuery.guid++, - i = 0, - toggler = function( event ) { - // Figure out which function to execute - var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; - jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); - - // Make sure that clicks stop - event.preventDefault(); - - // and execute the function - return args[ lastToggle ].apply( this, arguments ) || false; - }; - - // link all the functions, so any of them can unbind this click handler - toggler.guid = guid; - while ( i < args.length ) { - args[ i++ ].guid = guid; - } - - return this.click( toggler ); - }, - - hover: function( fnOver, fnOut ) { - return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); - } -}); - -jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + - "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + - "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { - - // Handle event binding - jQuery.fn[ name ] = function( data, fn ) { - if ( fn == null ) { - fn = data; - data = null; - } - - return arguments.length > 0 ? - this.on( name, null, data, fn ) : - this.trigger( name ); - }; - - if ( jQuery.attrFn ) { - jQuery.attrFn[ name ] = true; - } - - if ( rkeyEvent.test( name ) ) { - jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks; - } - - if ( rmouseEvent.test( name ) ) { - jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks; - } -}); - - - -/*! - * Sizzle CSS Selector Engine - * Copyright 2011, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * More information: http://sizzlejs.com/ - */ -(function(){ - -var chunker = /((?:((?:([^()]+)|[^()]+)+)|[(?:[[^[]]*]|['"][^'"]*['"]|[^[]'"]+)+]|\.|[^ >+~,([\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, - expando = "sizcache" + (Math.random() + '').replace('.', ''), - done = 0, - toString = Object.prototype.toString, - hasDuplicate = false, - baseHasDuplicate = true, - rBackslash = /\/g, - rReturn = /\r\n/g, - rNonWord = /\W/; - -// Here we check if the JavaScript engine is using some sort of -// optimization where it does not always call our comparision -// function. If that is the case, discard the hasDuplicate value. -// Thus far that includes Google Chrome. -[0, 0].sort(function() { - baseHasDuplicate = false; - return 0; -}); - -var Sizzle = function( selector, context, results, seed ) { - results = results || []; - context = context || document; - - var origContext = context; - - if ( context.nodeType !== 1 && context.nodeType !== 9 ) { - return []; - } - - if ( !selector || typeof selector !== "string" ) { - return results; - } - - var m, set, checkSet, extra, ret, cur, pop, i, - prune = true, - contextXML = Sizzle.isXML( context ), - parts = [], - soFar = selector; - - // Reset the position of the chunker regexp (start from head) - do { - chunker.exec( "" ); - m = chunker.exec( soFar ); - - if ( m ) { - soFar = m[3]; - - parts.push( m[1] ); - - if ( m[2] ) { - extra = m[3]; - break; - } - } - } while ( m ); - - if ( parts.length > 1 && origPOS.exec( selector ) ) { - - if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { - set = posProcess( parts[0] + parts[1], context, seed ); - - } else { - set = Expr.relative[ parts[0] ] ? - [ context ] : - Sizzle( parts.shift(), context ); - - while ( parts.length ) { - selector = parts.shift(); - - if ( Expr.relative[ selector ] ) { - selector += parts.shift(); - } - - set = posProcess( selector, set, seed ); - } - } - - } else { - // Take a shortcut and set the context if the root selector is an ID - // (but not if it'll be faster if the inner selector is an ID) - if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && - Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { - - ret = Sizzle.find( parts.shift(), context, contextXML ); - context = ret.expr ? - Sizzle.filter( ret.expr, ret.set )[0] : - ret.set[0]; - } - - if ( context ) { - ret = seed ? - { expr: parts.pop(), set: makeArray(seed) } : - Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); - - set = ret.expr ? - Sizzle.filter( ret.expr, ret.set ) : - ret.set; - - if ( parts.length > 0 ) { - checkSet = makeArray( set ); - - } else { - prune = false; - } - - while ( parts.length ) { - cur = parts.pop(); - pop = cur; - - if ( !Expr.relative[ cur ] ) { - cur = ""; - } else { - pop = parts.pop(); - } - - if ( pop == null ) { - pop = context; - } - - Expr.relative[ cur ]( checkSet, pop, contextXML ); - } - - } else { - checkSet = parts = []; - } - } - - if ( !checkSet ) { - checkSet = set; - } - - if ( !checkSet ) { - Sizzle.error( cur || selector ); - } - - if ( toString.call(checkSet) === "[object Array]" ) { - if ( !prune ) { - results.push.apply( results, checkSet ); - - } else if ( context && context.nodeType === 1 ) { - for ( i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) { - results.push( set[i] ); - } - } - - } else { - for ( i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && checkSet[i].nodeType === 1 ) { - results.push( set[i] ); - } - } - } - - } else { - makeArray( checkSet, results ); - } - - if ( extra ) { - Sizzle( extra, origContext, results, seed ); - Sizzle.uniqueSort( results ); - } - - return results; -}; - -Sizzle.uniqueSort = function( results ) { - if ( sortOrder ) { - hasDuplicate = baseHasDuplicate; - results.sort( sortOrder ); - - if ( hasDuplicate ) { - for ( var i = 1; i < results.length; i++ ) { - if ( results[i] === results[ i - 1 ] ) { - results.splice( i--, 1 ); - } - } - } - } - - return results; -}; - -Sizzle.matches = function( expr, set ) { - return Sizzle( expr, null, null, set ); -}; - -Sizzle.matchesSelector = function( node, expr ) { - return Sizzle( expr, null, null, [node] ).length > 0; -}; - -Sizzle.find = function( expr, context, isXML ) { - var set, i, len, match, type, left; - - if ( !expr ) { - return []; - } - - for ( i = 0, len = Expr.order.length; i < len; i++ ) { - type = Expr.order[i]; - - if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { - left = match[1]; - match.splice( 1, 1 ); - - if ( left.substr( left.length - 1 ) !== "\" ) { - match[1] = (match[1] || "").replace( rBackslash, "" ); - set = Expr.find[ type ]( match, context, isXML ); - - if ( set != null ) { - expr = expr.replace( Expr.match[ type ], "" ); - break; - } - } - } - } - - if ( !set ) { - set = typeof context.getElementsByTagName !== "undefined" ? - context.getElementsByTagName( "*" ) : - []; - } - - return { set: set, expr: expr }; -}; - -Sizzle.filter = function( expr, set, inplace, not ) { - var match, anyFound, - type, found, item, filter, left, - i, pass, - old = expr, - result = [], - curLoop = set, - isXMLFilter = set && set[0] && Sizzle.isXML( set[0] ); - - while ( expr && set.length ) { - for ( type in Expr.filter ) { - if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) { - filter = Expr.filter[ type ]; - left = match[1]; - - anyFound = false; - - match.splice(1,1); - - if ( left.substr( left.length - 1 ) === "\" ) { - continue; - } - - if ( curLoop === result ) { - result = []; - } - - if ( Expr.preFilter[ type ] ) { - match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); - - if ( !match ) { - anyFound = found = true; - - } else if ( match === true ) { - continue; - } - } - - if ( match ) { - for ( i = 0; (item = curLoop[i]) != null; i++ ) { - if ( item ) { - found = filter( item, match, i, curLoop ); - pass = not ^ found; - - if ( inplace && found != null ) { - if ( pass ) { - anyFound = true; - - } else { - curLoop[i] = false; - } - - } else if ( pass ) { - result.push( item ); - anyFound = true; - } - } - } - } - - if ( found !== undefined ) { - if ( !inplace ) { - curLoop = result; - } - - expr = expr.replace( Expr.match[ type ], "" ); - - if ( !anyFound ) { - return []; - } - - break; - } - } - } - - // Improper expression - if ( expr === old ) { - if ( anyFound == null ) { - Sizzle.error( expr ); - - } else { - break; - } - } - - old = expr; - } - - return curLoop; -}; - -Sizzle.error = function( msg ) { - throw new Error( "Syntax error, unrecognized expression: " + msg ); -}; - -/** - * Utility function for retreiving the text value of an array of DOM nodes - * @param {Array|Element} elem - */ -var getText = Sizzle.getText = function( elem ) { - var i, node, - nodeType = elem.nodeType, - ret = ""; - - if ( nodeType ) { - if ( nodeType === 1 || nodeType === 9 ) { - // Use textContent || innerText for elements - if ( typeof elem.textContent === 'string' ) { - return elem.textContent; - } else if ( typeof elem.innerText === 'string' ) { - // Replace IE's carriage returns - return elem.innerText.replace( rReturn, '' ); - } else { - // Traverse it's children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling) { - ret += getText( elem ); - } - } - } else if ( nodeType === 3 || nodeType === 4 ) { - return elem.nodeValue; - } - } else { - - // If no nodeType, this is expected to be an array - for ( i = 0; (node = elem[i]); i++ ) { - // Do not traverse comment nodes - if ( node.nodeType !== 8 ) { - ret += getText( node ); - } - } - } - return ret; -}; - -var Expr = Sizzle.selectors = { - order: [ "ID", "NAME", "TAG" ], - - match: { - ID: /#((?:[\w\u00c0-\uFFFF-]|\.)+)/, - CLASS: /.((?:[\w\u00c0-\uFFFF-]|\.)+)/, - NAME: /[name=['"]*((?:[\w\u00c0-\uFFFF-]|\.)+)['"]*]/, - ATTR: /[\s*((?:[\w\u00c0-\uFFFF-]|\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF-]|\.)*)|)|)\s*]/, - TAG: /^((?:[\w\u00c0-\uFFFF*-]|\.)+)/, - CHILD: /:(only|nth|last|first)-child(?:(\s*(even|odd|(?:[+-]?\d+|(?:[+-]?\d*)?n\s*(?:[+-]\s*\d+)?))\s*))?/, - POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:((\d*)))?(?=[^-]|$)/, - PSEUDO: /:((?:[\w\u00c0-\uFFFF-]|\.)+)(?:((['"]?)((?:([^)]+)|[^()]*)+)\2))?/ - }, - - leftMatch: {}, - - attrMap: { - "class": "className", - "for": "htmlFor" - }, - - attrHandle: { - href: function( elem ) { - return elem.getAttribute( "href" ); - }, - type: function( elem ) { - return elem.getAttribute( "type" ); - } - }, - - relative: { - "+": function(checkSet, part){ - var isPartStr = typeof part === "string", - isTag = isPartStr && !rNonWord.test( part ), - isPartStrNotTag = isPartStr && !isTag; - - if ( isTag ) { - part = part.toLowerCase(); - } - - for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { - if ( (elem = checkSet[i]) ) { - while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} - - checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ? - elem || false : - elem === part; - } - } - - if ( isPartStrNotTag ) { - Sizzle.filter( part, checkSet, true ); - } - }, - - ">": function( checkSet, part ) { - var elem, - isPartStr = typeof part === "string", - i = 0, - l = checkSet.length; - - if ( isPartStr && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - - for ( ; i < l; i++ ) { - elem = checkSet[i]; - - if ( elem ) { - var parent = elem.parentNode; - checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false; - } - } - - } else { - for ( ; i < l; i++ ) { - elem = checkSet[i]; - - if ( elem ) { - checkSet[i] = isPartStr ? - elem.parentNode : - elem.parentNode === part; - } - } - - if ( isPartStr ) { - Sizzle.filter( part, checkSet, true ); - } - } - }, - - "": function(checkSet, part, isXML){ - var nodeCheck, - doneName = done++, - checkFn = dirCheck; - - if ( typeof part === "string" && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - nodeCheck = part; - checkFn = dirNodeCheck; - } - - checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML ); - }, - - "~": function( checkSet, part, isXML ) { - var nodeCheck, - doneName = done++, - checkFn = dirCheck; - - if ( typeof part === "string" && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - nodeCheck = part; - checkFn = dirNodeCheck; - } - - checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML ); - } - }, - - find: { - ID: function( match, context, isXML ) { - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - return m && m.parentNode ? [m] : []; - } - }, - - NAME: function( match, context ) { - if ( typeof context.getElementsByName !== "undefined" ) { - var ret = [], - results = context.getElementsByName( match[1] ); - - for ( var i = 0, l = results.length; i < l; i++ ) { - if ( results[i].getAttribute("name") === match[1] ) { - ret.push( results[i] ); - } - } - - return ret.length === 0 ? null : ret; - } - }, - - TAG: function( match, context ) { - if ( typeof context.getElementsByTagName !== "undefined" ) { - return context.getElementsByTagName( match[1] ); - } - } - }, - preFilter: { - CLASS: function( match, curLoop, inplace, result, not, isXML ) { - match = " " + match[1].replace( rBackslash, "" ) + " "; - - if ( isXML ) { - return match; - } - - for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { - if ( elem ) { - if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) { - if ( !inplace ) { - result.push( elem ); - } - - } else if ( inplace ) { - curLoop[i] = false; - } - } - } - - return false; - }, - - ID: function( match ) { - return match[1].replace( rBackslash, "" ); - }, - - TAG: function( match, curLoop ) { - return match[1].replace( rBackslash, "" ).toLowerCase(); - }, - - CHILD: function( match ) { - if ( match[1] === "nth" ) { - if ( !match[2] ) { - Sizzle.error( match[0] ); - } - - match[2] = match[2].replace(/^+|\s*/g, ''); - - // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' - var test = /(-?)(\d*)(?:n([+-]?\d*))?/.exec( - match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || - !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); - - // calculate the numbers (first)n+(last) including if they are negative - match[2] = (test[1] + (test[2] || 1)) - 0; - match[3] = test[3] - 0; - } - else if ( match[2] ) { - Sizzle.error( match[0] ); - } - - // TODO: Move to normal caching system - match[0] = done++; - - return match; - }, - - ATTR: function( match, curLoop, inplace, result, not, isXML ) { - var name = match[1] = match[1].replace( rBackslash, "" ); - - if ( !isXML && Expr.attrMap[name] ) { - match[1] = Expr.attrMap[name]; - } - - // Handle if an un-quoted value was used - match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" ); - - if ( match[2] === "~=" ) { - match[4] = " " + match[4] + " "; - } - - return match; - }, - - PSEUDO: function( match, curLoop, inplace, result, not ) { - if ( match[1] === "not" ) { - // If we're dealing with a complex expression, or a simple one - if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { - match[3] = Sizzle(match[3], null, null, curLoop); - - } else { - var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); - - if ( !inplace ) { - result.push.apply( result, ret ); - } - - return false; - } - - } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { - return true; - } - - return match; - }, - - POS: function( match ) { - match.unshift( true ); - - return match; - } - }, - - filters: { - enabled: function( elem ) { - return elem.disabled === false && elem.type !== "hidden"; - }, - - disabled: function( elem ) { - return elem.disabled === true; - }, - - checked: function( elem ) { - return elem.checked === true; - }, - - selected: function( elem ) { - // Accessing this property makes selected-by-default - // options in Safari work properly - if ( elem.parentNode ) { - elem.parentNode.selectedIndex; - } - - return elem.selected === true; - }, - - parent: function( elem ) { - return !!elem.firstChild; - }, - - empty: function( elem ) { - return !elem.firstChild; - }, - - has: function( elem, i, match ) { - return !!Sizzle( match[3], elem ).length; - }, - - header: function( elem ) { - return (/h\d/i).test( elem.nodeName ); - }, - - text: function( elem ) { - var attr = elem.getAttribute( "type" ), type = elem.type; - // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) - // use getAttribute instead to test this case - return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null ); - }, - - radio: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type; - }, - - checkbox: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type; - }, - - file: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "file" === elem.type; - }, - - password: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "password" === elem.type; - }, - - submit: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && "submit" === elem.type; - }, - - image: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "image" === elem.type; - }, - - reset: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && "reset" === elem.type; - }, - - button: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && "button" === elem.type || name === "button"; - }, - - input: function( elem ) { - return (/input|select|textarea|button/i).test( elem.nodeName ); - }, - - focus: function( elem ) { - return elem === elem.ownerDocument.activeElement; - } - }, - setFilters: { - first: function( elem, i ) { - return i === 0; - }, - - last: function( elem, i, match, array ) { - return i === array.length - 1; - }, - - even: function( elem, i ) { - return i % 2 === 0; - }, - - odd: function( elem, i ) { - return i % 2 === 1; - }, - - lt: function( elem, i, match ) { - return i < match[3] - 0; - }, - - gt: function( elem, i, match ) { - return i > match[3] - 0; - }, - - nth: function( elem, i, match ) { - return match[3] - 0 === i; - }, - - eq: function( elem, i, match ) { - return match[3] - 0 === i; - } - }, - filter: { - PSEUDO: function( elem, match, i, array ) { - var name = match[1], - filter = Expr.filters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - - } else if ( name === "contains" ) { - return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0; - - } else if ( name === "not" ) { - var not = match[3]; - - for ( var j = 0, l = not.length; j < l; j++ ) { - if ( not[j] === elem ) { - return false; - } - } - - return true; - - } else { - Sizzle.error( name ); - } - }, - - CHILD: function( elem, match ) { - var first, last, - doneName, parent, cache, - count, diff, - type = match[1], - node = elem; - - switch ( type ) { - case "only": - case "first": - while ( (node = node.previousSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - - if ( type === "first" ) { - return true; - } - - node = elem; - - case "last": - while ( (node = node.nextSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - - return true; - - case "nth": - first = match[2]; - last = match[3]; - - if ( first === 1 && last === 0 ) { - return true; - } - - doneName = match[0]; - parent = elem.parentNode; - - if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) { - count = 0; - - for ( node = parent.firstChild; node; node = node.nextSibling ) { - if ( node.nodeType === 1 ) { - node.nodeIndex = ++count; - } - } - - parent[ expando ] = doneName; - } - - diff = elem.nodeIndex - last; - - if ( first === 0 ) { - return diff === 0; - - } else { - return ( diff % first === 0 && diff / first >= 0 ); - } - } - }, - - ID: function( elem, match ) { - return elem.nodeType === 1 && elem.getAttribute("id") === match; - }, - - TAG: function( elem, match ) { - return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match; - }, - - CLASS: function( elem, match ) { - return (" " + (elem.className || elem.getAttribute("class")) + " ") - .indexOf( match ) > -1; - }, - - ATTR: function( elem, match ) { - var name = match[1], - result = Sizzle.attr ? - Sizzle.attr( elem, name ) : - Expr.attrHandle[ name ] ? - Expr.attrHandle[ name ]( elem ) : - elem[ name ] != null ? - elem[ name ] : - elem.getAttribute( name ), - value = result + "", - type = match[2], - check = match[4]; - - return result == null ? - type === "!=" : - !type && Sizzle.attr ? - result != null : - type === "=" ? - value === check : - type === "*=" ? - value.indexOf(check) >= 0 : - type === "~=" ? - (" " + value + " ").indexOf(check) >= 0 : - !check ? - value && result !== false : - type === "!=" ? - value !== check : - type === "^=" ? - value.indexOf(check) === 0 : - type === "$=" ? - value.substr(value.length - check.length) === check : - type === "|=" ? - value === check || value.substr(0, check.length + 1) === check + "-" : - false; - }, - - POS: function( elem, match, i, array ) { - var name = match[2], - filter = Expr.setFilters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - } - } - } -}; - -var origPOS = Expr.match.POS, - fescape = function(all, num){ - return "\" + (num - 0 + 1); - }; - -for ( var type in Expr.match ) { - Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^[]*])(?![^(]*))/.source) ); - Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\(\d+)/g, fescape) ); -} - -var makeArray = function( array, results ) { - array = Array.prototype.slice.call( array, 0 ); - - if ( results ) { - results.push.apply( results, array ); - return results; - } - - return array; -}; - -// Perform a simple check to determine if the browser is capable of -// converting a NodeList to an array using builtin methods. -// Also verifies that the returned array holds DOM nodes -// (which is not the case in the Blackberry browser) -try { - Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType; - -// Provide a fallback method if it does not work -} catch( e ) { - makeArray = function( array, results ) { - var i = 0, - ret = results || []; - - if ( toString.call(array) === "[object Array]" ) { - Array.prototype.push.apply( ret, array ); - - } else { - if ( typeof array.length === "number" ) { - for ( var l = array.length; i < l; i++ ) { - ret.push( array[i] ); - } - - } else { - for ( ; array[i]; i++ ) { - ret.push( array[i] ); - } - } - } - - return ret; - }; -} - -var sortOrder, siblingCheck; - -if ( document.documentElement.compareDocumentPosition ) { - sortOrder = function( a, b ) { - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { - return a.compareDocumentPosition ? -1 : 1; - } - - return a.compareDocumentPosition(b) & 4 ? -1 : 1; - }; - -} else { - sortOrder = function( a, b ) { - // The nodes are identical, we can exit early - if ( a === b ) { - hasDuplicate = true; - return 0; - - // Fallback to using sourceIndex (in IE) if it's available on both nodes - } else if ( a.sourceIndex && b.sourceIndex ) { - return a.sourceIndex - b.sourceIndex; - } - - var al, bl, - ap = [], - bp = [], - aup = a.parentNode, - bup = b.parentNode, - cur = aup; - - // If the nodes are siblings (or identical) we can do a quick check - if ( aup === bup ) { - return siblingCheck( a, b ); - - // If no parents were found then the nodes are disconnected - } else if ( !aup ) { - return -1; - - } else if ( !bup ) { - return 1; - } - - // Otherwise they're somewhere else in the tree so we need - // to build up a full list of the parentNodes for comparison - while ( cur ) { - ap.unshift( cur ); - cur = cur.parentNode; - } - - cur = bup; - - while ( cur ) { - bp.unshift( cur ); - cur = cur.parentNode; - } - - al = ap.length; - bl = bp.length; - - // Start walking down the tree looking for a discrepancy - for ( var i = 0; i < al && i < bl; i++ ) { - if ( ap[i] !== bp[i] ) { - return siblingCheck( ap[i], bp[i] ); - } - } - - // We ended someplace up the tree so do a sibling check - return i === al ? - siblingCheck( a, bp[i], -1 ) : - siblingCheck( ap[i], b, 1 ); - }; - - siblingCheck = function( a, b, ret ) { - if ( a === b ) { - return ret; - } - - var cur = a.nextSibling; - - while ( cur ) { - if ( cur === b ) { - return -1; - } - - cur = cur.nextSibling; - } - - return 1; - }; -} - -// Check to see if the browser returns elements by name when -// querying by getElementById (and provide a workaround) -(function(){ - // We're going to inject a fake input element with a specified name - var form = document.createElement("div"), - id = "script" + (new Date()).getTime(), - root = document.documentElement; - - form.innerHTML = "<a name='" + id + "'/>"; - - // Inject it into the root element, check its status, and remove it quickly - root.insertBefore( form, root.firstChild ); - - // The workaround has to do additional checks after a getElementById - // Which slows things down for other browsers (hence the branching) - if ( document.getElementById( id ) ) { - Expr.find.ID = function( match, context, isXML ) { - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - - return m ? - m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? - [m] : - undefined : - []; - } - }; - - Expr.filter.ID = function( elem, match ) { - var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); - - return elem.nodeType === 1 && node && node.nodeValue === match; - }; - } - - root.removeChild( form ); - - // release memory in IE - root = form = null; -})(); - -(function(){ - // Check to see if the browser returns only elements - // when doing getElementsByTagName("*") - - // Create a fake element - var div = document.createElement("div"); - div.appendChild( document.createComment("") ); - - // Make sure no comments are found - if ( div.getElementsByTagName("*").length > 0 ) { - Expr.find.TAG = function( match, context ) { - var results = context.getElementsByTagName( match[1] ); - - // Filter out possible comments - if ( match[1] === "*" ) { - var tmp = []; - - for ( var i = 0; results[i]; i++ ) { - if ( results[i].nodeType === 1 ) { - tmp.push( results[i] ); - } - } - - results = tmp; - } - - return results; - }; - } - - // Check to see if an attribute returns normalized href attributes - div.innerHTML = "<a href='#'></a>"; - - if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && - div.firstChild.getAttribute("href") !== "#" ) { - - Expr.attrHandle.href = function( elem ) { - return elem.getAttribute( "href", 2 ); - }; - } - - // release memory in IE - div = null; -})(); - -if ( document.querySelectorAll ) { - (function(){ - var oldSizzle = Sizzle, - div = document.createElement("div"), - id = "__sizzle__"; - - div.innerHTML = "<p class='TEST'></p>"; - - // Safari can't handle uppercase or unicode characters when - // in quirks mode. - if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { - return; - } - - Sizzle = function( query, context, extra, seed ) { - context = context || document; - - // Only use querySelectorAll on non-XML documents - // (ID selectors don't work in non-HTML documents) - if ( !seed && !Sizzle.isXML(context) ) { - // See if we find a selector to speed up - var match = /^(\w+$)|^.([\w-]+$)|^#([\w-]+$)/.exec( query ); - - if ( match && (context.nodeType === 1 || context.nodeType === 9) ) { - // Speed-up: Sizzle("TAG") - if ( match[1] ) { - return makeArray( context.getElementsByTagName( query ), extra ); - - // Speed-up: Sizzle(".CLASS") - } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) { - return makeArray( context.getElementsByClassName( match[2] ), extra ); - } - } - - if ( context.nodeType === 9 ) { - // Speed-up: Sizzle("body") - // The body element only exists once, optimize finding it - if ( query === "body" && context.body ) { - return makeArray( [ context.body ], extra ); - - // Speed-up: Sizzle("#ID") - } else if ( match && match[3] ) { - var elem = context.getElementById( match[3] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id === match[3] ) { - return makeArray( [ elem ], extra ); - } - - } else { - return makeArray( [], extra ); - } - } - - try { - return makeArray( context.querySelectorAll(query), extra ); - } catch(qsaError) {} - - // qSA works strangely on Element-rooted queries - // We can work around this by specifying an extra ID on the root - // and working up from there (Thanks to Andrew Dupont for the technique) - // IE 8 doesn't work on object elements - } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { - var oldContext = context, - old = context.getAttribute( "id" ), - nid = old || id, - hasParent = context.parentNode, - relativeHierarchySelector = /^\s*[+~]/.test( query ); - - if ( !old ) { - context.setAttribute( "id", nid ); - } else { - nid = nid.replace( /'/g, "\$&" ); - } - if ( relativeHierarchySelector && hasParent ) { - context = context.parentNode; - } - - try { - if ( !relativeHierarchySelector || hasParent ) { - return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra ); - } - - } catch(pseudoError) { - } finally { - if ( !old ) { - oldContext.removeAttribute( "id" ); - } - } - } - } - - return oldSizzle(query, context, extra, seed); - }; - - for ( var prop in oldSizzle ) { - Sizzle[ prop ] = oldSizzle[ prop ]; - } - - // release memory in IE - div = null; - })(); -} - -(function(){ - var html = document.documentElement, - matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector; - - if ( matches ) { - // Check to see if it's possible to do matchesSelector - // on a disconnected node (IE 9 fails this) - var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ), - pseudoWorks = false; - - try { - // This should fail with an exception - // Gecko does not error, returns false instead - matches.call( document.documentElement, "[test!='']:sizzle" ); - - } catch( pseudoError ) { - pseudoWorks = true; - } - - Sizzle.matchesSelector = function( node, expr ) { - // Make sure that attribute selectors are quoted - expr = expr.replace(/=\s*([^'"]]*)\s*]/g, "='$1']"); - - if ( !Sizzle.isXML( node ) ) { - try { - if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) { - var ret = matches.call( node, expr ); - - // IE 9's matchesSelector returns false on disconnected nodes - if ( ret || !disconnectedMatch || - // As well, disconnected nodes are said to be in a document - // fragment in IE 9, so check for that - node.document && node.document.nodeType !== 11 ) { - return ret; - } - } - } catch(e) {} - } - - return Sizzle(expr, null, null, [node]).length > 0; - }; - } -})(); - -(function(){ - var div = document.createElement("div"); - - div.innerHTML = "<div class='test e'></div><div class='test'></div>"; - - // Opera can't find a second classname (in 9.6) - // Also, make sure that getElementsByClassName actually exists - if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) { - return; - } - - // Safari caches class attributes, doesn't catch changes (in 3.2) - div.lastChild.className = "e"; - - if ( div.getElementsByClassName("e").length === 1 ) { - return; - } - - Expr.order.splice(1, 0, "CLASS"); - Expr.find.CLASS = function( match, context, isXML ) { - if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { - return context.getElementsByClassName(match[1]); - } - }; - - // release memory in IE - div = null; -})(); - -function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - - if ( elem ) { - var match = false; - - elem = elem[dir]; - - while ( elem ) { - if ( elem[ expando ] === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 && !isXML ){ - elem[ expando ] = doneName; - elem.sizset = i; - } - - if ( elem.nodeName.toLowerCase() === cur ) { - match = elem; - break; - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - - if ( elem ) { - var match = false; - - elem = elem[dir]; - - while ( elem ) { - if ( elem[ expando ] === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 ) { - if ( !isXML ) { - elem[ expando ] = doneName; - elem.sizset = i; - } - - if ( typeof cur !== "string" ) { - if ( elem === cur ) { - match = true; - break; - } - - } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { - match = elem; - break; - } - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -if ( document.documentElement.contains ) { - Sizzle.contains = function( a, b ) { - return a !== b && (a.contains ? a.contains(b) : true); - }; - -} else if ( document.documentElement.compareDocumentPosition ) { - Sizzle.contains = function( a, b ) { - return !!(a.compareDocumentPosition(b) & 16); - }; - -} else { - Sizzle.contains = function() { - return false; - }; -} - -Sizzle.isXML = function( elem ) { - // documentElement is verified for cases where it doesn't yet exist - // (such as loading iframes in IE - #4833) - var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; - - return documentElement ? documentElement.nodeName !== "HTML" : false; -}; - -var posProcess = function( selector, context, seed ) { - var match, - tmpSet = [], - later = "", - root = context.nodeType ? [context] : context; - - // Position selectors must be done after the filter - // And so must :not(positional) so we move all PSEUDOs to the end - while ( (match = Expr.match.PSEUDO.exec( selector )) ) { - later += match[0]; - selector = selector.replace( Expr.match.PSEUDO, "" ); - } - - selector = Expr.relative[selector] ? selector + "*" : selector; - - for ( var i = 0, l = root.length; i < l; i++ ) { - Sizzle( selector, root[i], tmpSet, seed ); - } - - return Sizzle.filter( later, tmpSet ); -}; - -// EXPOSE -// Override sizzle attribute retrieval -Sizzle.attr = jQuery.attr; -Sizzle.selectors.attrMap = {}; -jQuery.find = Sizzle; -jQuery.expr = Sizzle.selectors; -jQuery.expr[":"] = jQuery.expr.filters; -jQuery.unique = Sizzle.uniqueSort; -jQuery.text = Sizzle.getText; -jQuery.isXMLDoc = Sizzle.isXML; -jQuery.contains = Sizzle.contains; - - -})(); - - -var runtil = /Until$/, - rparentsprev = /^(?:parents|prevUntil|prevAll)/, - // Note: This RegExp should be improved, or likely pulled from Sizzle - rmultiselector = /,/, - isSimple = /^.[^:#[.,]*$/, - slice = Array.prototype.slice, - POS = jQuery.expr.match.POS, - // methods guaranteed to produce a unique set when starting from a unique set - guaranteedUnique = { - children: true, - contents: true, - next: true, - prev: true - }; - -jQuery.fn.extend({ - find: function( selector ) { - var self = this, - i, l; - - if ( typeof selector !== "string" ) { - return jQuery( selector ).filter(function() { - for ( i = 0, l = self.length; i < l; i++ ) { - if ( jQuery.contains( self[ i ], this ) ) { - return true; - } - } - }); - } - - var ret = this.pushStack( "", "find", selector ), - length, n, r; - - for ( i = 0, l = this.length; i < l; i++ ) { - length = ret.length; - jQuery.find( selector, this[i], ret ); - - if ( i > 0 ) { - // Make sure that the results are unique - for ( n = length; n < ret.length; n++ ) { - for ( r = 0; r < length; r++ ) { - if ( ret[r] === ret[n] ) { - ret.splice(n--, 1); - break; - } - } - } - } - } - - return ret; - }, - - has: function( target ) { - var targets = jQuery( target ); - return this.filter(function() { - for ( var i = 0, l = targets.length; i < l; i++ ) { - if ( jQuery.contains( this, targets[i] ) ) { - return true; - } - } - }); - }, - - not: function( selector ) { - return this.pushStack( winnow(this, selector, false), "not", selector); - }, - - filter: function( selector ) { - return this.pushStack( winnow(this, selector, true), "filter", selector ); - }, - - is: function( selector ) { - return !!selector && ( - typeof selector === "string" ? - // If this is a positional selector, check membership in the returned set - // so $("p:first").is("p:last") won't return true for a doc with two "p". - POS.test( selector ) ? - jQuery( selector, this.context ).index( this[0] ) >= 0 : - jQuery.filter( selector, this ).length > 0 : - this.filter( selector ).length > 0 ); - }, - - closest: function( selectors, context ) { - var ret = [], i, l, cur = this[0]; - - // Array (deprecated as of jQuery 1.7) - if ( jQuery.isArray( selectors ) ) { - var level = 1; - - while ( cur && cur.ownerDocument && cur !== context ) { - for ( i = 0; i < selectors.length; i++ ) { - - if ( jQuery( cur ).is( selectors[ i ] ) ) { - ret.push({ selector: selectors[ i ], elem: cur, level: level }); - } - } - - cur = cur.parentNode; - level++; - } - - return ret; - } - - // String - var pos = POS.test( selectors ) || typeof selectors !== "string" ? - jQuery( selectors, context || this.context ) : - 0; - - for ( i = 0, l = this.length; i < l; i++ ) { - cur = this[i]; - - while ( cur ) { - if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { - ret.push( cur ); - break; - - } else { - cur = cur.parentNode; - if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) { - break; - } - } - } - } - - ret = ret.length > 1 ? jQuery.unique( ret ) : ret; - - return this.pushStack( ret, "closest", selectors ); - }, - - // Determine the position of an element within - // the matched set of elements - index: function( elem ) { - - // No argument, return index in parent - if ( !elem ) { - return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1; - } - - // index in selector - if ( typeof elem === "string" ) { - return jQuery.inArray( this[0], jQuery( elem ) ); - } - - // Locate the position of the desired element - return jQuery.inArray( - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[0] : elem, this ); - }, - - add: function( selector, context ) { - var set = typeof selector === "string" ? - jQuery( selector, context ) : - jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), - all = jQuery.merge( this.get(), set ); - - return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? - all : - jQuery.unique( all ) ); - }, - - andSelf: function() { - return this.add( this.prevObject ); - } -}); - -// A painfully simple check to see if an element is disconnected -// from a document (should be improved, where feasible). -function isDisconnected( node ) { - return !node || !node.parentNode || node.parentNode.nodeType === 11; -} - -jQuery.each({ - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return jQuery.dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, i, until ) { - return jQuery.dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return jQuery.nth( elem, 2, "nextSibling" ); - }, - prev: function( elem ) { - return jQuery.nth( elem, 2, "previousSibling" ); - }, - nextAll: function( elem ) { - return jQuery.dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return jQuery.dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, i, until ) { - return jQuery.dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, i, until ) { - return jQuery.dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return jQuery.sibling( elem.parentNode.firstChild, elem ); - }, - children: function( elem ) { - return jQuery.sibling( elem.firstChild ); - }, - contents: function( elem ) { - return jQuery.nodeName( elem, "iframe" ) ? - elem.contentDocument || elem.contentWindow.document : - jQuery.makeArray( elem.childNodes ); - } -}, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var ret = jQuery.map( this, fn, until ); - - if ( !runtil.test( name ) ) { - selector = until; - } - - if ( selector && typeof selector === "string" ) { - ret = jQuery.filter( selector, ret ); - } - - ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; - - if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) { - ret = ret.reverse(); - } - - return this.pushStack( ret, name, slice.call( arguments ).join(",") ); - }; -}); - -jQuery.extend({ - filter: function( expr, elems, not ) { - if ( not ) { - expr = ":not(" + expr + ")"; - } - - return elems.length === 1 ? - jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : - jQuery.find.matches(expr, elems); - }, - - dir: function( elem, dir, until ) { - var matched = [], - cur = elem[ dir ]; - - while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { - if ( cur.nodeType === 1 ) { - matched.push( cur ); - } - cur = cur[dir]; - } - return matched; - }, - - nth: function( cur, result, dir, elem ) { - result = result || 1; - var num = 0; - - for ( ; cur; cur = cur[dir] ) { - if ( cur.nodeType === 1 && ++num === result ) { - break; - } - } - - return cur; - }, - - sibling: function( n, elem ) { - var r = []; - - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - r.push( n ); - } - } - - return r; - } -}); - -// Implement the identical functionality for filter and not -function winnow( elements, qualifier, keep ) { - - // Can't pass null or undefined to indexOf in Firefox 4 - // Set to 0 to skip string check - qualifier = qualifier || 0; - - if ( jQuery.isFunction( qualifier ) ) { - return jQuery.grep(elements, function( elem, i ) { - var retVal = !!qualifier.call( elem, i, elem ); - return retVal === keep; - }); - - } else if ( qualifier.nodeType ) { - return jQuery.grep(elements, function( elem, i ) { - return ( elem === qualifier ) === keep; - }); - - } else if ( typeof qualifier === "string" ) { - var filtered = jQuery.grep(elements, function( elem ) { - return elem.nodeType === 1; - }); - - if ( isSimple.test( qualifier ) ) { - return jQuery.filter(qualifier, filtered, !keep); - } else { - qualifier = jQuery.filter( qualifier, filtered ); - } - } - - return jQuery.grep(elements, function( elem, i ) { - return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; - }); -} - - - - -function createSafeFragment( document ) { - var list = nodeNames.split( "|" ), - safeFrag = document.createDocumentFragment(); - - if ( safeFrag.createElement ) { - while ( list.length ) { - safeFrag.createElement( - list.pop() - ); - } - } - return safeFrag; -} - -var nodeNames = "abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|" + - "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", - rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, - rleadingWhitespace = /^\s+/, - rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)/>/ig, - rtagName = /<([\w:]+)/, - rtbody = /<tbody/i, - rhtml = /<|&#?\w+;/, - rnoInnerhtml = /<(?:script|style)/i, - rnocache = /<(?:script|object|embed|option|style)/i, - rnoshimcache = new RegExp("<(?:" + nodeNames + ")", "i"), - // checked="checked" or checked - rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, - rscriptType = //(java|ecma)script/i, - rcleanScript = /^\s*<!(?:[CDATA[|--)/, - wrapMap = { - option: [ 1, "<select multiple='multiple'>", "</select>" ], - legend: [ 1, "<fieldset>", "</fieldset>" ], - thead: [ 1, "<table>", "</table>" ], - tr: [ 2, "<table><tbody>", "</tbody></table>" ], - td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], - col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ], - area: [ 1, "<map>", "</map>" ], - _default: [ 0, "", "" ] - }, - safeFragment = createSafeFragment( document ); - -wrapMap.optgroup = wrapMap.option; -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - -// IE can't serialize <link> and <script> tags normally -if ( !jQuery.support.htmlSerialize ) { - wrapMap._default = [ 1, "div<div>", "</div>" ]; -} - -jQuery.fn.extend({ - text: function( text ) { - if ( jQuery.isFunction(text) ) { - return this.each(function(i) { - var self = jQuery( this ); - - self.text( text.call(this, i, self.text()) ); - }); - } - - if ( typeof text !== "object" && text !== undefined ) { - return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) ); - } - - return jQuery.text( this ); - }, - - wrapAll: function( html ) { - if ( jQuery.isFunction( html ) ) { - return this.each(function(i) { - jQuery(this).wrapAll( html.call(this, i) ); - }); - } - - if ( this[0] ) { - // The elements to wrap the target around - var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); - - if ( this[0].parentNode ) { - wrap.insertBefore( this[0] ); - } - - wrap.map(function() { - var elem = this; - - while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { - elem = elem.firstChild; - } - - return elem; - }).append( this ); - } - - return this; - }, - - wrapInner: function( html ) { - if ( jQuery.isFunction( html ) ) { - return this.each(function(i) { - jQuery(this).wrapInner( html.call(this, i) ); - }); - } - - return this.each(function() { - var self = jQuery( this ), - contents = self.contents(); - - if ( contents.length ) { - contents.wrapAll( html ); - - } else { - self.append( html ); - } - }); - }, - - wrap: function( html ) { - var isFunction = jQuery.isFunction( html ); - - return this.each(function(i) { - jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); - }); - }, - - unwrap: function() { - return this.parent().each(function() { - if ( !jQuery.nodeName( this, "body" ) ) { - jQuery( this ).replaceWith( this.childNodes ); - } - }).end(); - }, - - append: function() { - return this.domManip(arguments, true, function( elem ) { - if ( this.nodeType === 1 ) { - this.appendChild( elem ); - } - }); - }, - - prepend: function() { - return this.domManip(arguments, true, function( elem ) { - if ( this.nodeType === 1 ) { - this.insertBefore( elem, this.firstChild ); - } - }); - }, - - before: function() { - if ( this[0] && this[0].parentNode ) { - return this.domManip(arguments, false, function( elem ) { - this.parentNode.insertBefore( elem, this ); - }); - } else if ( arguments.length ) { - var set = jQuery.clean( arguments ); - set.push.apply( set, this.toArray() ); - return this.pushStack( set, "before", arguments ); - } - }, - - after: function() { - if ( this[0] && this[0].parentNode ) { - return this.domManip(arguments, false, function( elem ) { - this.parentNode.insertBefore( elem, this.nextSibling ); - }); - } else if ( arguments.length ) { - var set = this.pushStack( this, "after", arguments ); - set.push.apply( set, jQuery.clean(arguments) ); - return set; - } - }, - - // keepData is for internal use only--do not document - remove: function( selector, keepData ) { - for ( var i = 0, elem; (elem = this[i]) != null; i++ ) { - if ( !selector || jQuery.filter( selector, [ elem ] ).length ) { - if ( !keepData && elem.nodeType === 1 ) { - jQuery.cleanData( elem.getElementsByTagName("*") ); - jQuery.cleanData( [ elem ] ); - } - - if ( elem.parentNode ) { - elem.parentNode.removeChild( elem ); - } - } - } - - return this; - }, - - empty: function() { - for ( var i = 0, elem; (elem = this[i]) != null; i++ ) { - // Remove element nodes and prevent memory leaks - if ( elem.nodeType === 1 ) { - jQuery.cleanData( elem.getElementsByTagName("*") ); - } - - // Remove any remaining nodes - while ( elem.firstChild ) { - elem.removeChild( elem.firstChild ); - } - } - - return this; - }, - - clone: function( dataAndEvents, deepDataAndEvents ) { - dataAndEvents = dataAndEvents == null ? false : dataAndEvents; - deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; - - return this.map( function () { - return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); - }); - }, - - html: function( value ) { - if ( value === undefined ) { - return this[0] && this[0].nodeType === 1 ? - this[0].innerHTML.replace(rinlinejQuery, "") : - null; - - // See if we can take a shortcut and just use innerHTML - } else if ( typeof value === "string" && !rnoInnerhtml.test( value ) && - (jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) && - !wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) { - - value = value.replace(rxhtmlTag, "<$1></$2>"); - - try { - for ( var i = 0, l = this.length; i < l; i++ ) { - // Remove element nodes and prevent memory leaks - if ( this[i].nodeType === 1 ) { - jQuery.cleanData( this[i].getElementsByTagName("*") ); - this[i].innerHTML = value; - } - } - - // If using innerHTML throws an exception, use the fallback method - } catch(e) { - this.empty().append( value ); - } - - } else if ( jQuery.isFunction( value ) ) { - this.each(function(i){ - var self = jQuery( this ); - - self.html( value.call(this, i, self.html()) ); - }); - - } else { - this.empty().append( value ); - } - - return this; - }, - - replaceWith: function( value ) { - if ( this[0] && this[0].parentNode ) { - // Make sure that the elements are removed from the DOM before they are inserted - // this can help fix replacing a parent with child elements - if ( jQuery.isFunction( value ) ) { - return this.each(function(i) { - var self = jQuery(this), old = self.html(); - self.replaceWith( value.call( this, i, old ) ); - }); - } - - if ( typeof value !== "string" ) { - value = jQuery( value ).detach(); - } - - return this.each(function() { - var next = this.nextSibling, - parent = this.parentNode; - - jQuery( this ).remove(); - - if ( next ) { - jQuery(next).before( value ); - } else { - jQuery(parent).append( value ); - } - }); - } else { - return this.length ? - this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) : - this; - } - }, - - detach: function( selector ) { - return this.remove( selector, true ); - }, - - domManip: function( args, table, callback ) { - var results, first, fragment, parent, - value = args[0], - scripts = []; - - // We can't cloneNode fragments that contain checked, in WebKit - if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) { - return this.each(function() { - jQuery(this).domManip( args, table, callback, true ); - }); - } - - if ( jQuery.isFunction(value) ) { - return this.each(function(i) { - var self = jQuery(this); - args[0] = value.call(this, i, table ? self.html() : undefined); - self.domManip( args, table, callback ); - }); - } - - if ( this[0] ) { - parent = value && value.parentNode; - - // If we're in a fragment, just use that instead of building a new one - if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) { - results = { fragment: parent }; - - } else { - results = jQuery.buildFragment( args, this, scripts ); - } - - fragment = results.fragment; - - if ( fragment.childNodes.length === 1 ) { - first = fragment = fragment.firstChild; - } else { - first = fragment.firstChild; - } - - if ( first ) { - table = table && jQuery.nodeName( first, "tr" ); - - for ( var i = 0, l = this.length, lastIndex = l - 1; i < l; i++ ) { - callback.call( - table ? - root(this[i], first) : - this[i], - // Make sure that we do not leak memory by inadvertently discarding - // the original fragment (which might have attached data) instead of - // using it; in addition, use the original fragment object for the last - // item instead of first because it can end up being emptied incorrectly - // in certain situations (Bug #8070). - // Fragments from the fragment cache must always be cloned and never used - // in place. - results.cacheable || ( l > 1 && i < lastIndex ) ? - jQuery.clone( fragment, true, true ) : - fragment - ); - } - } - - if ( scripts.length ) { - jQuery.each( scripts, evalScript ); - } - } - - return this; - } -}); - -function root( elem, cur ) { - return jQuery.nodeName(elem, "table") ? - (elem.getElementsByTagName("tbody")[0] || - elem.appendChild(elem.ownerDocument.createElement("tbody"))) : - elem; -} - -function cloneCopyEvent( src, dest ) { - - if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { - return; - } - - var type, i, l, - oldData = jQuery._data( src ), - curData = jQuery._data( dest, oldData ), - events = oldData.events; - - if ( events ) { - delete curData.handle; - curData.events = {}; - - for ( type in events ) { - for ( i = 0, l = events[ type ].length; i < l; i++ ) { - jQuery.event.add( dest, type + ( events[ type ][ i ].namespace ? "." : "" ) + events[ type ][ i ].namespace, events[ type ][ i ], events[ type ][ i ].data ); - } - } - } - - // make the cloned public data object a copy from the original - if ( curData.data ) { - curData.data = jQuery.extend( {}, curData.data ); - } -} - -function cloneFixAttributes( src, dest ) { - var nodeName; - - // We do not need to do anything for non-Elements - if ( dest.nodeType !== 1 ) { - return; - } - - // clearAttributes removes the attributes, which we don't want, - // but also removes the attachEvent events, which we *do* want - if ( dest.clearAttributes ) { - dest.clearAttributes(); - } - - // mergeAttributes, in contrast, only merges back on the - // original attributes, not the events - if ( dest.mergeAttributes ) { - dest.mergeAttributes( src ); - } - - nodeName = dest.nodeName.toLowerCase(); - - // IE6-8 fail to clone children inside object elements that use - // the proprietary classid attribute value (rather than the type - // attribute) to identify the type of content to display - if ( nodeName === "object" ) { - dest.outerHTML = src.outerHTML; - - } else if ( nodeName === "input" && (src.type === "checkbox" || src.type === "radio") ) { - // IE6-8 fails to persist the checked state of a cloned checkbox - // or radio button. Worse, IE6-7 fail to give the cloned element - // a checked appearance if the defaultChecked value isn't also set - if ( src.checked ) { - dest.defaultChecked = dest.checked = src.checked; - } - - // IE6-7 get confused and end up setting the value of a cloned - // checkbox/radio button to an empty string instead of "on" - if ( dest.value !== src.value ) { - dest.value = src.value; - } - - // IE6-8 fails to return the selected option to the default selected - // state when cloning options - } else if ( nodeName === "option" ) { - dest.selected = src.defaultSelected; - - // IE6-8 fails to set the defaultValue to the correct value when - // cloning other types of input fields - } else if ( nodeName === "input" || nodeName === "textarea" ) { - dest.defaultValue = src.defaultValue; - } - - // Event data gets referenced instead of copied if the expando - // gets copied too - dest.removeAttribute( jQuery.expando ); -} - -jQuery.buildFragment = function( args, nodes, scripts ) { - var fragment, cacheable, cacheresults, doc, - first = args[ 0 ]; - - // nodes may contain either an explicit document object, - // a jQuery collection or context object. - // If nodes[0] contains a valid object to assign to doc - if ( nodes && nodes[0] ) { - doc = nodes[0].ownerDocument || nodes[0]; - } - - // Ensure that an attr object doesn't incorrectly stand in as a document object - // Chrome and Firefox seem to allow this to occur and will throw exception - // Fixes #8950 - if ( !doc.createDocumentFragment ) { - doc = document; - } - - // Only cache "small" (1/2 KB) HTML strings that are associated with the main document - // Cloning options loses the selected state, so don't cache them - // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment - // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache - // Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501 - if ( args.length === 1 && typeof first === "string" && first.length < 512 && doc === document && - first.charAt(0) === "<" && !rnocache.test( first ) && - (jQuery.support.checkClone || !rchecked.test( first )) && - (jQuery.support.html5Clone || !rnoshimcache.test( first )) ) { - - cacheable = true; - - cacheresults = jQuery.fragments[ first ]; - if ( cacheresults && cacheresults !== 1 ) { - fragment = cacheresults; - } - } - - if ( !fragment ) { - fragment = doc.createDocumentFragment(); - jQuery.clean( args, doc, fragment, scripts ); - } - - if ( cacheable ) { - jQuery.fragments[ first ] = cacheresults ? fragment : 1; - } - - return { fragment: fragment, cacheable: cacheable }; -}; - -jQuery.fragments = {}; - -jQuery.each({ - appendTo: "append", - prependTo: "prepend", - insertBefore: "before", - insertAfter: "after", - replaceAll: "replaceWith" -}, function( name, original ) { - jQuery.fn[ name ] = function( selector ) { - var ret = [], - insert = jQuery( selector ), - parent = this.length === 1 && this[0].parentNode; - - if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) { - insert[ original ]( this[0] ); - return this; - - } else { - for ( var i = 0, l = insert.length; i < l; i++ ) { - var elems = ( i > 0 ? this.clone(true) : this ).get(); - jQuery( insert[i] )[ original ]( elems ); - ret = ret.concat( elems ); - } - - return this.pushStack( ret, name, insert.selector ); - } - }; -}); - -function getAll( elem ) { - if ( typeof elem.getElementsByTagName !== "undefined" ) { - return elem.getElementsByTagName( "*" ); - - } else if ( typeof elem.querySelectorAll !== "undefined" ) { - return elem.querySelectorAll( "*" ); - - } else { - return []; - } -} - -// Used in clean, fixes the defaultChecked property -function fixDefaultChecked( elem ) { - if ( elem.type === "checkbox" || elem.type === "radio" ) { - elem.defaultChecked = elem.checked; - } -} -// Finds all inputs and passes them to fixDefaultChecked -function findInputs( elem ) { - var nodeName = ( elem.nodeName || "" ).toLowerCase(); - if ( nodeName === "input" ) { - fixDefaultChecked( elem ); - // Skip scripts, get other children - } else if ( nodeName !== "script" && typeof elem.getElementsByTagName !== "undefined" ) { - jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked ); - } -} - -// Derived From: http://www.iecss.com/shimprove/javascript/shimprove.1-0-1.js -function shimCloneNode( elem ) { - var div = document.createElement( "div" ); - safeFragment.appendChild( div ); - - div.innerHTML = elem.outerHTML; - return div.firstChild; -} - -jQuery.extend({ - clone: function( elem, dataAndEvents, deepDataAndEvents ) { - var srcElements, - destElements, - i, - // IE<=8 does not properly clone detached, unknown element nodes - clone = jQuery.support.html5Clone || !rnoshimcache.test( "<" + elem.nodeName ) ? - elem.cloneNode( true ) : - shimCloneNode( elem ); - - if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && - (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { - // IE copies events bound via attachEvent when using cloneNode. - // Calling detachEvent on the clone will also remove the events - // from the original. In order to get around this, we use some - // proprietary methods to clear the events. Thanks to MooTools - // guys for this hotness. - - cloneFixAttributes( elem, clone ); - - // Using Sizzle here is crazy slow, so we use getElementsByTagName instead - srcElements = getAll( elem ); - destElements = getAll( clone ); - - // Weird iteration because IE will replace the length property - // with an element if you are cloning the body and one of the - // elements on the page has a name or id of "length" - for ( i = 0; srcElements[i]; ++i ) { - // Ensure that the destination node is not null; Fixes #9587 - if ( destElements[i] ) { - cloneFixAttributes( srcElements[i], destElements[i] ); - } - } - } - - // Copy the events from the original to the clone - if ( dataAndEvents ) { - cloneCopyEvent( elem, clone ); - - if ( deepDataAndEvents ) { - srcElements = getAll( elem ); - destElements = getAll( clone ); - - for ( i = 0; srcElements[i]; ++i ) { - cloneCopyEvent( srcElements[i], destElements[i] ); - } - } - } - - srcElements = destElements = null; - - // Return the cloned set - return clone; - }, - - clean: function( elems, context, fragment, scripts ) { - var checkScriptType; - - context = context || document; - - // !context.createElement fails in IE with an error but returns typeof 'object' - if ( typeof context.createElement === "undefined" ) { - context = context.ownerDocument || context[0] && context[0].ownerDocument || document; - } - - var ret = [], j; - - for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { - if ( typeof elem === "number" ) { - elem += ""; - } - - if ( !elem ) { - continue; - } - - // Convert html string into DOM nodes - if ( typeof elem === "string" ) { - if ( !rhtml.test( elem ) ) { - elem = context.createTextNode( elem ); - } else { - // Fix "XHTML"-style tags in all browsers - elem = elem.replace(rxhtmlTag, "<$1></$2>"); - - // Trim whitespace, otherwise indexOf won't work as expected - var tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(), - wrap = wrapMap[ tag ] || wrapMap._default, - depth = wrap[0], - div = context.createElement("div"); - - // Append wrapper element to unknown element safe doc fragment - if ( context === document ) { - // Use the fragment we've already created for this document - safeFragment.appendChild( div ); - } else { - // Use a fragment created with the owner document - createSafeFragment( context ).appendChild( div ); - } - - // Go to html and back, then peel off extra wrappers - div.innerHTML = wrap[1] + elem + wrap[2]; - - // Move to the right depth - while ( depth-- ) { - div = div.lastChild; - } - - // Remove IE's autoinserted <tbody> from table fragments - if ( !jQuery.support.tbody ) { - - // String was a <table>, *may* have spurious <tbody> - var hasBody = rtbody.test(elem), - tbody = tag === "table" && !hasBody ? - div.firstChild && div.firstChild.childNodes : - - // String was a bare <thead> or <tfoot> - wrap[1] === "<table>" && !hasBody ? - div.childNodes : - []; - - for ( j = tbody.length - 1; j >= 0 ; --j ) { - if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) { - tbody[ j ].parentNode.removeChild( tbody[ j ] ); - } - } - } - - // IE completely kills leading whitespace when innerHTML is used - if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { - div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild ); - } - - elem = div.childNodes; - } - } - - // Resets defaultChecked for any radios and checkboxes - // about to be appended to the DOM in IE 6/7 (#8060) - var len; - if ( !jQuery.support.appendChecked ) { - if ( elem[0] && typeof (len = elem.length) === "number" ) { - for ( j = 0; j < len; j++ ) { - findInputs( elem[j] ); - } - } else { - findInputs( elem ); - } - } - - if ( elem.nodeType ) { - ret.push( elem ); - } else { - ret = jQuery.merge( ret, elem ); - } - } - - if ( fragment ) { - checkScriptType = function( elem ) { - return !elem.type || rscriptType.test( elem.type ); - }; - for ( i = 0; ret[i]; i++ ) { - if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) { - scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] ); - - } else { - if ( ret[i].nodeType === 1 ) { - var jsTags = jQuery.grep( ret[i].getElementsByTagName( "script" ), checkScriptType ); - - ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) ); - } - fragment.appendChild( ret[i] ); - } - } - } - - return ret; - }, - - cleanData: function( elems ) { - var data, id, - cache = jQuery.cache, - special = jQuery.event.special, - deleteExpando = jQuery.support.deleteExpando; - - for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { - if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) { - continue; - } - - id = elem[ jQuery.expando ]; - - if ( id ) { - data = cache[ id ]; - - if ( data && data.events ) { - for ( var type in data.events ) { - if ( special[ type ] ) { - jQuery.event.remove( elem, type ); - - // This is a shortcut to avoid jQuery.event.remove's overhead - } else { - jQuery.removeEvent( elem, type, data.handle ); - } - } - - // Null the DOM reference to avoid IE6/7/8 leak (#7054) - if ( data.handle ) { - data.handle.elem = null; - } - } - - if ( deleteExpando ) { - delete elem[ jQuery.expando ]; - - } else if ( elem.removeAttribute ) { - elem.removeAttribute( jQuery.expando ); - } - - delete cache[ id ]; - } - } - } -}); - -function evalScript( i, elem ) { - if ( elem.src ) { - jQuery.ajax({ - url: elem.src, - async: false, - dataType: "script" - }); - } else { - jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "/*$0*/" ) ); - } - - if ( elem.parentNode ) { - elem.parentNode.removeChild( elem ); - } -} - - - - -var ralpha = /alpha([^)]*)/i, - ropacity = /opacity=([^)]*)/, - // fixed for IE9, see #8346 - rupper = /([A-Z]|^ms)/g, - rnumpx = /^-?\d+(?:px)?$/i, - rnum = /^-?\d/, - rrelNum = /^([-+])=([-+.\de]+)/, - - cssShow = { position: "absolute", visibility: "hidden", display: "block" }, - cssWidth = [ "Left", "Right" ], - cssHeight = [ "Top", "Bottom" ], - curCSS, - - getComputedStyle, - currentStyle; - -jQuery.fn.css = function( name, value ) { - // Setting 'undefined' is a no-op - if ( arguments.length === 2 && value === undefined ) { - return this; - } - - return jQuery.access( this, name, value, true, function( elem, name, value ) { - return value !== undefined ? - jQuery.style( elem, name, value ) : - jQuery.css( elem, name ); - }); -}; - -jQuery.extend({ - // Add in style property hooks for overriding the default - // behavior of getting and setting a style property - cssHooks: { - opacity: { - get: function( elem, computed ) { - if ( computed ) { - // We should always get a number back from opacity - var ret = curCSS( elem, "opacity", "opacity" ); - return ret === "" ? "1" : ret; - - } else { - return elem.style.opacity; - } - } - } - }, - - // Exclude the following css properties to add px - cssNumber: { - "fillOpacity": true, - "fontWeight": true, - "lineHeight": true, - "opacity": true, - "orphans": true, - "widows": true, - "zIndex": true, - "zoom": true - }, - - // Add in properties whose names you wish to fix before - // setting or getting the value - cssProps: { - // normalize float css property - "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat" - }, - - // Get and set the style property on a DOM Node - style: function( elem, name, value, extra ) { - // Don't set styles on text and comment nodes - if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { - return; - } - - // Make sure that we're working with the right name - var ret, type, origName = jQuery.camelCase( name ), - style = elem.style, hooks = jQuery.cssHooks[ origName ]; - - name = jQuery.cssProps[ origName ] || origName; - - // Check if we're setting a value - if ( value !== undefined ) { - type = typeof value; - - // convert relative number strings (+= or -=) to relative numbers. #7345 - if ( type === "string" && (ret = rrelNum.exec( value )) ) { - value = ( +( ret[1] + 1) * +ret[2] ) + parseFloat( jQuery.css( elem, name ) ); - // Fixes bug #9237 - type = "number"; - } - - // Make sure that NaN and null values aren't set. See: #7116 - if ( value == null || type === "number" && isNaN( value ) ) { - return; - } - - // If a number was passed in, add 'px' to the (except for certain CSS properties) - if ( type === "number" && !jQuery.cssNumber[ origName ] ) { - value += "px"; - } - - // If a hook was provided, use that value, otherwise just set the specified value - if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) { - // Wrapped to prevent IE from throwing errors when 'invalid' values are provided - // Fixes bug #5509 - try { - style[ name ] = value; - } catch(e) {} - } - - } else { - // If a hook was provided get the non-computed value from there - if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { - return ret; - } - - // Otherwise just get the value from the style object - return style[ name ]; - } - }, - - css: function( elem, name, extra ) { - var ret, hooks; - - // Make sure that we're working with the right name - name = jQuery.camelCase( name ); - hooks = jQuery.cssHooks[ name ]; - name = jQuery.cssProps[ name ] || name; - - // cssFloat needs a special treatment - if ( name === "cssFloat" ) { - name = "float"; - } - - // If a hook was provided get the computed value from there - if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) { - return ret; - - // Otherwise, if a way to get the computed value exists, use that - } else if ( curCSS ) { - return curCSS( elem, name ); - } - }, - - // A method for quickly swapping in/out CSS properties to get correct calculations - swap: function( elem, options, callback ) { - var old = {}; - - // Remember the old values, and insert the new ones - for ( var name in options ) { - old[ name ] = elem.style[ name ]; - elem.style[ name ] = options[ name ]; - } - - callback.call( elem ); - - // Revert the old values - for ( name in options ) { - elem.style[ name ] = old[ name ]; - } - } -}); - -// DEPRECATED, Use jQuery.css() instead -jQuery.curCSS = jQuery.css; - -jQuery.each(["height", "width"], function( i, name ) { - jQuery.cssHooks[ name ] = { - get: function( elem, computed, extra ) { - var val; - - if ( computed ) { - if ( elem.offsetWidth !== 0 ) { - return getWH( elem, name, extra ); - } else { - jQuery.swap( elem, cssShow, function() { - val = getWH( elem, name, extra ); - }); - } - - return val; - } - }, - - set: function( elem, value ) { - if ( rnumpx.test( value ) ) { - // ignore negative width and height values #1599 - value = parseFloat( value ); - - if ( value >= 0 ) { - return value + "px"; - } - - } else { - return value; - } - } - }; -}); - -if ( !jQuery.support.opacity ) { - jQuery.cssHooks.opacity = { - get: function( elem, computed ) { - // IE uses filters for opacity - return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ? - ( parseFloat( RegExp.$1 ) / 100 ) + "" : - computed ? "1" : ""; - }, - - set: function( elem, value ) { - var style = elem.style, - currentStyle = elem.currentStyle, - opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "", - filter = currentStyle && currentStyle.filter || style.filter || ""; - - // IE has trouble with opacity if it does not have layout - // Force it by setting the zoom level - style.zoom = 1; - - // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652 - if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" ) { - - // Setting style.filter to null, "" & " " still leave "filter:" in the cssText - // if "filter:" is present at all, clearType is disabled, we want to avoid this - // style.removeAttribute is IE Only, but so apparently is this code path... - style.removeAttribute( "filter" ); - - // if there there is no filter style applied in a css rule, we are done - if ( currentStyle && !currentStyle.filter ) { - return; - } - } - - // otherwise, set new filter values - style.filter = ralpha.test( filter ) ? - filter.replace( ralpha, opacity ) : - filter + " " + opacity; - } - }; -} - -jQuery(function() { - // This hook cannot be added until DOM ready because the support test - // for it is not run until after DOM ready - if ( !jQuery.support.reliableMarginRight ) { - jQuery.cssHooks.marginRight = { - get: function( elem, computed ) { - // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right - // Work around by temporarily setting element display to inline-block - var ret; - jQuery.swap( elem, { "display": "inline-block" }, function() { - if ( computed ) { - ret = curCSS( elem, "margin-right", "marginRight" ); - } else { - ret = elem.style.marginRight; - } - }); - return ret; - } - }; - } -}); - -if ( document.defaultView && document.defaultView.getComputedStyle ) { - getComputedStyle = function( elem, name ) { - var ret, defaultView, computedStyle; - - name = name.replace( rupper, "-$1" ).toLowerCase(); - - if ( (defaultView = elem.ownerDocument.defaultView) && - (computedStyle = defaultView.getComputedStyle( elem, null )) ) { - ret = computedStyle.getPropertyValue( name ); - if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) { - ret = jQuery.style( elem, name ); - } - } - - return ret; - }; -} - -if ( document.documentElement.currentStyle ) { - currentStyle = function( elem, name ) { - var left, rsLeft, uncomputed, - ret = elem.currentStyle && elem.currentStyle[ name ], - style = elem.style; - - // Avoid setting ret to empty string here - // so we don't default to auto - if ( ret === null && style && (uncomputed = style[ name ]) ) { - ret = uncomputed; - } - - // From the awesome hack by Dean Edwards - // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 - - // If we're not dealing with a regular pixel number - // but a number that has a weird ending, we need to convert it to pixels - if ( !rnumpx.test( ret ) && rnum.test( ret ) ) { - - // Remember the original values - left = style.left; - rsLeft = elem.runtimeStyle && elem.runtimeStyle.left; - - // Put in the new values to get a computed value out - if ( rsLeft ) { - elem.runtimeStyle.left = elem.currentStyle.left; - } - style.left = name === "fontSize" ? "1em" : ( ret || 0 ); - ret = style.pixelLeft + "px"; - - // Revert the changed values - style.left = left; - if ( rsLeft ) { - elem.runtimeStyle.left = rsLeft; - } - } - - return ret === "" ? "auto" : ret; - }; -} - -curCSS = getComputedStyle || currentStyle; - -function getWH( elem, name, extra ) { - - // Start with offset property - var val = name === "width" ? elem.offsetWidth : elem.offsetHeight, - which = name === "width" ? cssWidth : cssHeight, - i = 0, - len = which.length; - - if ( val > 0 ) { - if ( extra !== "border" ) { - for ( ; i < len; i++ ) { - if ( !extra ) { - val -= parseFloat( jQuery.css( elem, "padding" + which[ i ] ) ) || 0; - } - if ( extra === "margin" ) { - val += parseFloat( jQuery.css( elem, extra + which[ i ] ) ) || 0; - } else { - val -= parseFloat( jQuery.css( elem, "border" + which[ i ] + "Width" ) ) || 0; - } - } - } - - return val + "px"; - } - - // Fall back to computed then uncomputed css if necessary - val = curCSS( elem, name, name ); - if ( val < 0 || val == null ) { - val = elem.style[ name ] || 0; - } - // Normalize "", auto, and prepare for extra - val = parseFloat( val ) || 0; - - // Add padding, border, margin - if ( extra ) { - for ( ; i < len; i++ ) { - val += parseFloat( jQuery.css( elem, "padding" + which[ i ] ) ) || 0; - if ( extra !== "padding" ) { - val += parseFloat( jQuery.css( elem, "border" + which[ i ] + "Width" ) ) || 0; - } - if ( extra === "margin" ) { - val += parseFloat( jQuery.css( elem, extra + which[ i ] ) ) || 0; - } - } - } - - return val + "px"; -} - -if ( jQuery.expr && jQuery.expr.filters ) { - jQuery.expr.filters.hidden = function( elem ) { - var width = elem.offsetWidth, - height = elem.offsetHeight; - - return ( width === 0 && height === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none"); - }; - - jQuery.expr.filters.visible = function( elem ) { - return !jQuery.expr.filters.hidden( elem ); - }; -} - - - - -var r20 = /%20/g, - rbracket = /[]$/, - rCRLF = /\r?\n/g, - rhash = /#.*$/, - rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL - rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i, - // #7653, #8125, #8152: local protocol detection - rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, - rnoContent = /^(?:GET|HEAD)$/, - rprotocol = /^///, - rquery = /?/, - rscript = /<script\b[^<]*(?:(?!</script>)<[^<]*)*</script>/gi, - rselectTextarea = /^(?:select|textarea)/i, - rspacesAjax = /\s+/, - rts = /([?&])_=[^&]*/, - rurl = /^([\w+.-]+:)(?://([^/?#:]*)(?::(\d+))?)?/, - - // Keep a copy of the old load method - _load = jQuery.fn.load, - - /* Prefilters - * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) - * 2) These are called: - * - BEFORE asking for a transport - * - AFTER param serialization (s.data is a string if s.processData is true) - * 3) key is the dataType - * 4) the catchall symbol "*" can be used - * 5) execution will start with transport dataType and THEN continue down to "*" if needed - */ - prefilters = {}, - - /* Transports bindings - * 1) key is the dataType - * 2) the catchall symbol "*" can be used - * 3) selection will start with transport dataType and THEN go to "*" if needed - */ - transports = {}, - - // Document location - ajaxLocation, - - // Document location segments - ajaxLocParts, - - // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression - allTypes = ["*/"] + ["*"]; - -// #8138, IE may throw an exception when accessing -// a field from window.location if document.domain has been set -try { - ajaxLocation = location.href; -} catch( e ) { - // Use the href attribute of an A element - // since IE will modify it given document.location - ajaxLocation = document.createElement( "a" ); - ajaxLocation.href = ""; - ajaxLocation = ajaxLocation.href; -} - -// Segment location into parts -ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || []; - -// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport -function addToPrefiltersOrTransports( structure ) { - - // dataTypeExpression is optional and defaults to "*" - return function( dataTypeExpression, func ) { - - if ( typeof dataTypeExpression !== "string" ) { - func = dataTypeExpression; - dataTypeExpression = "*"; - } - - if ( jQuery.isFunction( func ) ) { - var dataTypes = dataTypeExpression.toLowerCase().split( rspacesAjax ), - i = 0, - length = dataTypes.length, - dataType, - list, - placeBefore; - - // For each dataType in the dataTypeExpression - for ( ; i < length; i++ ) { - dataType = dataTypes[ i ]; - // We control if we're asked to add before - // any existing element - placeBefore = /^+/.test( dataType ); - if ( placeBefore ) { - dataType = dataType.substr( 1 ) || "*"; - } - list = structure[ dataType ] = structure[ dataType ] || []; - // then we add to the structure accordingly - list[ placeBefore ? "unshift" : "push" ]( func ); - } - } - }; -} - -// Base inspection function for prefilters and transports -function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR, - dataType /* internal */, inspected /* internal */ ) { - - dataType = dataType || options.dataTypes[ 0 ]; - inspected = inspected || {}; - - inspected[ dataType ] = true; - - var list = structure[ dataType ], - i = 0, - length = list ? list.length : 0, - executeOnly = ( structure === prefilters ), - selection; - - for ( ; i < length && ( executeOnly || !selection ); i++ ) { - selection = list[ i ]( options, originalOptions, jqXHR ); - // If we got redirected to another dataType - // we try there if executing only and not done already - if ( typeof selection === "string" ) { - if ( !executeOnly || inspected[ selection ] ) { - selection = undefined; - } else { - options.dataTypes.unshift( selection ); - selection = inspectPrefiltersOrTransports( - structure, options, originalOptions, jqXHR, selection, inspected ); - } - } - } - // If we're only executing or nothing was selected - // we try the catchall dataType if not done already - if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) { - selection = inspectPrefiltersOrTransports( - structure, options, originalOptions, jqXHR, "*", inspected ); - } - // unnecessary when only executing (prefilters) - // but it'll be ignored by the caller in that case - return selection; -} - -// A special extend for ajax options -// that takes "flat" options (not to be deep extended) -// Fixes #9887 -function ajaxExtend( target, src ) { - var key, deep, - flatOptions = jQuery.ajaxSettings.flatOptions || {}; - for ( key in src ) { - if ( src[ key ] !== undefined ) { - ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; - } - } - if ( deep ) { - jQuery.extend( true, target, deep ); - } -} - -jQuery.fn.extend({ - load: function( url, params, callback ) { - if ( typeof url !== "string" && _load ) { - return _load.apply( this, arguments ); - - // Don't do a request if no elements are being requested - } else if ( !this.length ) { - return this; - } - - var off = url.indexOf( " " ); - if ( off >= 0 ) { - var selector = url.slice( off, url.length ); - url = url.slice( 0, off ); - } - - // Default to a GET request - var type = "GET"; - - // If the second parameter was provided - if ( params ) { - // If it's a function - if ( jQuery.isFunction( params ) ) { - // We assume that it's the callback - callback = params; - params = undefined; - - // Otherwise, build a param string - } else if ( typeof params === "object" ) { - params = jQuery.param( params, jQuery.ajaxSettings.traditional ); - type = "POST"; - } - } - - var self = this; - - // Request the remote document - jQuery.ajax({ - url: url, - type: type, - dataType: "html", - data: params, - // Complete callback (responseText is used internally) - complete: function( jqXHR, status, responseText ) { - // Store the response as specified by the jqXHR object - responseText = jqXHR.responseText; - // If successful, inject the HTML into all the matched elements - if ( jqXHR.isResolved() ) { - // #4825: Get the actual response in case - // a dataFilter is present in ajaxSettings - jqXHR.done(function( r ) { - responseText = r; - }); - // See if a selector was specified - self.html( selector ? - // Create a dummy div to hold the results - jQuery("<div>") - // inject the contents of the document in, removing the scripts - // to avoid any 'Permission Denied' errors in IE - .append(responseText.replace(rscript, "")) - - // Locate the specified elements - .find(selector) : - - // If not, just inject the full result - responseText ); - } - - if ( callback ) { - self.each( callback, [ responseText, status, jqXHR ] ); - } - } - }); - - return this; - }, - - serialize: function() { - return jQuery.param( this.serializeArray() ); - }, - - serializeArray: function() { - return this.map(function(){ - return this.elements ? jQuery.makeArray( this.elements ) : this; - }) - .filter(function(){ - return this.name && !this.disabled && - ( this.checked || rselectTextarea.test( this.nodeName ) || - rinput.test( this.type ) ); - }) - .map(function( i, elem ){ - var val = jQuery( this ).val(); - - return val == null ? - null : - jQuery.isArray( val ) ? - jQuery.map( val, function( val, i ){ - return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; - }) : - { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; - }).get(); - } -}); - -// Attach a bunch of functions for handling common AJAX events -jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){ - jQuery.fn[ o ] = function( f ){ - return this.on( o, f ); - }; -}); - -jQuery.each( [ "get", "post" ], function( i, method ) { - jQuery[ method ] = function( url, data, callback, type ) { - // shift arguments if data argument was omitted - if ( jQuery.isFunction( data ) ) { - type = type || callback; - callback = data; - data = undefined; - } - - return jQuery.ajax({ - type: method, - url: url, - data: data, - success: callback, - dataType: type - }); - }; -}); - -jQuery.extend({ - - getScript: function( url, callback ) { - return jQuery.get( url, undefined, callback, "script" ); - }, - - getJSON: function( url, data, callback ) { - return jQuery.get( url, data, callback, "json" ); - }, - - // Creates a full fledged settings object into target - // with both ajaxSettings and settings fields. - // If target is omitted, writes into ajaxSettings. - ajaxSetup: function( target, settings ) { - if ( settings ) { - // Building a settings object - ajaxExtend( target, jQuery.ajaxSettings ); - } else { - // Extending ajaxSettings - settings = target; - target = jQuery.ajaxSettings; - } - ajaxExtend( target, settings ); - return target; - }, - - ajaxSettings: { - url: ajaxLocation, - isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ), - global: true, - type: "GET", - contentType: "application/x-www-form-urlencoded", - processData: true, - async: true, - /* - timeout: 0, - data: null, - dataType: null, - username: null, - password: null, - cache: null, - traditional: false, - headers: {}, - */ - - accepts: { - xml: "application/xml, text/xml", - html: "text/html", - text: "text/plain", - json: "application/json, text/javascript", - "*": allTypes - }, - - contents: { - xml: /xml/, - html: /html/, - json: /json/ - }, - - responseFields: { - xml: "responseXML", - text: "responseText" - }, - - // List of data converters - // 1) key format is "source_type destination_type" (a single space in-between) - // 2) the catchall symbol "*" can be used for source_type - converters: { - - // Convert anything to text - "* text": window.String, - - // Text to html (true = no transformation) - "text html": true, - - // Evaluate text as a json expression - "text json": jQuery.parseJSON, - - // Parse text as xml - "text xml": jQuery.parseXML - }, - - // For options that shouldn't be deep extended: - // you can add your own custom options here if - // and when you create one that shouldn't be - // deep extended (see ajaxExtend) - flatOptions: { - context: true, - url: true - } - }, - - ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), - ajaxTransport: addToPrefiltersOrTransports( transports ), - - // Main method - ajax: function( url, options ) { - - // If url is an object, simulate pre-1.5 signature - if ( typeof url === "object" ) { - options = url; - url = undefined; - } - - // Force options to be an object - options = options || {}; - - var // Create the final options object - s = jQuery.ajaxSetup( {}, options ), - // Callbacks context - callbackContext = s.context || s, - // Context for global events - // It's the callbackContext if one was provided in the options - // and if it's a DOM node or a jQuery collection - globalEventContext = callbackContext !== s && - ( callbackContext.nodeType || callbackContext instanceof jQuery ) ? - jQuery( callbackContext ) : jQuery.event, - // Deferreds - deferred = jQuery.Deferred(), - completeDeferred = jQuery.Callbacks( "once memory" ), - // Status-dependent callbacks - statusCode = s.statusCode || {}, - // ifModified key - ifModifiedKey, - // Headers (they are sent all at once) - requestHeaders = {}, - requestHeadersNames = {}, - // Response headers - responseHeadersString, - responseHeaders, - // transport - transport, - // timeout handle - timeoutTimer, - // Cross-domain detection vars - parts, - // The jqXHR state - state = 0, - // To know if global events are to be dispatched - fireGlobals, - // Loop variable - i, - // Fake xhr - jqXHR = { - - readyState: 0, - - // Caches the header - setRequestHeader: function( name, value ) { - if ( !state ) { - var lname = name.toLowerCase(); - name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name; - requestHeaders[ name ] = value; - } - return this; - }, - - // Raw string - getAllResponseHeaders: function() { - return state === 2 ? responseHeadersString : null; - }, - - // Builds headers hashtable if needed - getResponseHeader: function( key ) { - var match; - if ( state === 2 ) { - if ( !responseHeaders ) { - responseHeaders = {}; - while( ( match = rheaders.exec( responseHeadersString ) ) ) { - responseHeaders[ match[1].toLowerCase() ] = match[ 2 ]; - } - } - match = responseHeaders[ key.toLowerCase() ]; - } - return match === undefined ? null : match; - }, - - // Overrides response content-type header - overrideMimeType: function( type ) { - if ( !state ) { - s.mimeType = type; - } - return this; - }, - - // Cancel the request - abort: function( statusText ) { - statusText = statusText || "abort"; - if ( transport ) { - transport.abort( statusText ); - } - done( 0, statusText ); - return this; - } - }; - - // Callback for when everything is done - // It is defined here because jslint complains if it is declared - // at the end of the function (which would be more logical and readable) - function done( status, nativeStatusText, responses, headers ) { - - // Called once - if ( state === 2 ) { - return; - } - - // State is "done" now - state = 2; - - // Clear timeout if it exists - if ( timeoutTimer ) { - clearTimeout( timeoutTimer ); - } - - // Dereference transport for early garbage collection - // (no matter how long the jqXHR object will be used) - transport = undefined; - - // Cache response headers - responseHeadersString = headers || ""; - - // Set readyState - jqXHR.readyState = status > 0 ? 4 : 0; - - var isSuccess, - success, - error, - statusText = nativeStatusText, - response = responses ? ajaxHandleResponses( s, jqXHR, responses ) : undefined, - lastModified, - etag; - - // If successful, handle type chaining - if ( status >= 200 && status < 300 || status === 304 ) { - - // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. - if ( s.ifModified ) { - - if ( ( lastModified = jqXHR.getResponseHeader( "Last-Modified" ) ) ) { - jQuery.lastModified[ ifModifiedKey ] = lastModified; - } - if ( ( etag = jqXHR.getResponseHeader( "Etag" ) ) ) { - jQuery.etag[ ifModifiedKey ] = etag; - } - } - - // If not modified - if ( status === 304 ) { - - statusText = "notmodified"; - isSuccess = true; - - // If we have data - } else { - - try { - success = ajaxConvert( s, response ); - statusText = "success"; - isSuccess = true; - } catch(e) { - // We have a parsererror - statusText = "parsererror"; - error = e; - } - } - } else { - // We extract error from statusText - // then normalize statusText and status for non-aborts - error = statusText; - if ( !statusText || status ) { - statusText = "error"; - if ( status < 0 ) { - status = 0; - } - } - } - - // Set data for the fake xhr object - jqXHR.status = status; - jqXHR.statusText = "" + ( nativeStatusText || statusText ); - - // Success/Error - if ( isSuccess ) { - deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); - } else { - deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); - } - - // Status-dependent callbacks - jqXHR.statusCode( statusCode ); - statusCode = undefined; - - if ( fireGlobals ) { - globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ), - [ jqXHR, s, isSuccess ? success : error ] ); - } - - // Complete - completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); - - if ( fireGlobals ) { - globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); - // Handle the global AJAX counter - if ( !( --jQuery.active ) ) { - jQuery.event.trigger( "ajaxStop" ); - } - } - } - - // Attach deferreds - deferred.promise( jqXHR ); - jqXHR.success = jqXHR.done; - jqXHR.error = jqXHR.fail; - jqXHR.complete = completeDeferred.add; - - // Status-dependent callbacks - jqXHR.statusCode = function( map ) { - if ( map ) { - var tmp; - if ( state < 2 ) { - for ( tmp in map ) { - statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ]; - } - } else { - tmp = map[ jqXHR.status ]; - jqXHR.then( tmp, tmp ); - } - } - return this; - }; - - // Remove hash character (#7531: and string promotion) - // Add protocol if not provided (#5866: IE7 issue with protocol-less urls) - // We also use the url parameter if available - s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" ); - - // Extract dataTypes list - s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( rspacesAjax ); - - // Determine if a cross-domain request is in order - if ( s.crossDomain == null ) { - parts = rurl.exec( s.url.toLowerCase() ); - s.crossDomain = !!( parts && - ( parts[ 1 ] != ajaxLocParts[ 1 ] || parts[ 2 ] != ajaxLocParts[ 2 ] || - ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) != - ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) ) - ); - } - - // Convert data if not already a string - if ( s.data && s.processData && typeof s.data !== "string" ) { - s.data = jQuery.param( s.data, s.traditional ); - } - - // Apply prefilters - inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); - - // If request was aborted inside a prefiler, stop there - if ( state === 2 ) { - return false; - } - - // We can fire global events as of now if asked to - fireGlobals = s.global; - - // Uppercase the type - s.type = s.type.toUpperCase(); - - // Determine if request has content - s.hasContent = !rnoContent.test( s.type ); - - // Watch for a new set of requests - if ( fireGlobals && jQuery.active++ === 0 ) { - jQuery.event.trigger( "ajaxStart" ); - } - - // More options handling for requests with no content - if ( !s.hasContent ) { - - // If data is available, append data to url - if ( s.data ) { - s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data; - // #9682: remove data so that it's not used in an eventual retry - delete s.data; - } - - // Get ifModifiedKey before adding the anti-cache parameter - ifModifiedKey = s.url; - - // Add anti-cache in url if needed - if ( s.cache === false ) { - - var ts = jQuery.now(), - // try replacing _= if it is there - ret = s.url.replace( rts, "$1_=" + ts ); - - // if nothing was replaced, add timestamp to the end - s.url = ret + ( ( ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" ); - } - } - - // Set the correct header, if data is being sent - if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { - jqXHR.setRequestHeader( "Content-Type", s.contentType ); - } - - // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. - if ( s.ifModified ) { - ifModifiedKey = ifModifiedKey || s.url; - if ( jQuery.lastModified[ ifModifiedKey ] ) { - jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ ifModifiedKey ] ); - } - if ( jQuery.etag[ ifModifiedKey ] ) { - jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ ifModifiedKey ] ); - } - } - - // Set the Accepts header for the server, depending on the dataType - jqXHR.setRequestHeader( - "Accept", - s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ? - s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : - s.accepts[ "*" ] - ); - - // Check for headers option - for ( i in s.headers ) { - jqXHR.setRequestHeader( i, s.headers[ i ] ); - } - - // Allow custom headers/mimetypes and early abort - if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) { - // Abort if not done already - jqXHR.abort(); - return false; - - } - - // Install callbacks on deferreds - for ( i in { success: 1, error: 1, complete: 1 } ) { - jqXHR[ i ]( s[ i ] ); - } - - // Get transport - transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); - - // If no transport, we auto-abort - if ( !transport ) { - done( -1, "No Transport" ); - } else { - jqXHR.readyState = 1; - // Send global event - if ( fireGlobals ) { - globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); - } - // Timeout - if ( s.async && s.timeout > 0 ) { - timeoutTimer = setTimeout( function(){ - jqXHR.abort( "timeout" ); - }, s.timeout ); - } - - try { - state = 1; - transport.send( requestHeaders, done ); - } catch (e) { - // Propagate exception as error if not done - if ( state < 2 ) { - done( -1, e ); - // Simply rethrow otherwise - } else { - throw e; - } - } - } - - return jqXHR; - }, - - // Serialize an array of form elements or a set of - // key/values into a query string - param: function( a, traditional ) { - var s = [], - add = function( key, value ) { - // If value is a function, invoke it and return its value - value = jQuery.isFunction( value ) ? value() : value; - s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value ); - }; - - // Set traditional to true for jQuery <= 1.3.2 behavior. - if ( traditional === undefined ) { - traditional = jQuery.ajaxSettings.traditional; - } - - // If an array was passed in, assume that it is an array of form elements. - if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { - // Serialize the form elements - jQuery.each( a, function() { - add( this.name, this.value ); - }); - - } else { - // If traditional, encode the "old" way (the way 1.3.2 or older - // did it), otherwise encode params recursively. - for ( var prefix in a ) { - buildParams( prefix, a[ prefix ], traditional, add ); - } - } - - // Return the resulting serialization - return s.join( "&" ).replace( r20, "+" ); - } -}); - -function buildParams( prefix, obj, traditional, add ) { - if ( jQuery.isArray( obj ) ) { - // Serialize array item. - jQuery.each( obj, function( i, v ) { - if ( traditional || rbracket.test( prefix ) ) { - // Treat each array item as a scalar. - add( prefix, v ); - - } else { - // If array item is non-scalar (array or object), encode its - // numeric index to resolve deserialization ambiguity issues. - // Note that rack (as of 1.0.0) can't currently deserialize - // nested arrays properly, and attempting to do so may cause - // a server error. Possible fixes are to modify rack's - // deserialization algorithm or to provide an option or flag - // to force array serialization to be shallow. - buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v, traditional, add ); - } - }); - - } else if ( !traditional && obj != null && typeof obj === "object" ) { - // Serialize object item. - for ( var name in obj ) { - buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); - } - - } else { - // Serialize scalar item. - add( prefix, obj ); - } -} - -// This is still on the jQuery object... for now -// Want to move this to jQuery.ajax some day -jQuery.extend({ - - // Counter for holding the number of active queries - active: 0, - - // Last-Modified header cache for next request - lastModified: {}, - etag: {} - -}); - -/* Handles responses to an ajax request: - * - sets all responseXXX fields accordingly - * - finds the right dataType (mediates between content-type and expected dataType) - * - returns the corresponding response - */ -function ajaxHandleResponses( s, jqXHR, responses ) { - - var contents = s.contents, - dataTypes = s.dataTypes, - responseFields = s.responseFields, - ct, - type, - finalDataType, - firstDataType; - - // Fill responseXXX fields - for ( type in responseFields ) { - if ( type in responses ) { - jqXHR[ responseFields[type] ] = responses[ type ]; - } - } - - // Remove auto dataType and get content-type in the process - while( dataTypes[ 0 ] === "*" ) { - dataTypes.shift(); - if ( ct === undefined ) { - ct = s.mimeType || jqXHR.getResponseHeader( "content-type" ); - } - } - - // Check if we're dealing with a known content-type - if ( ct ) { - for ( type in contents ) { - if ( contents[ type ] && contents[ type ].test( ct ) ) { - dataTypes.unshift( type ); - break; - } - } - } - - // Check to see if we have a response for the expected dataType - if ( dataTypes[ 0 ] in responses ) { - finalDataType = dataTypes[ 0 ]; - } else { - // Try convertible dataTypes - for ( type in responses ) { - if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) { - finalDataType = type; - break; - } - if ( !firstDataType ) { - firstDataType = type; - } - } - // Or just use first one - finalDataType = finalDataType || firstDataType; - } - - // If we found a dataType - // We add the dataType to the list if needed - // and return the corresponding response - if ( finalDataType ) { - if ( finalDataType !== dataTypes[ 0 ] ) { - dataTypes.unshift( finalDataType ); - } - return responses[ finalDataType ]; - } -} - -// Chain conversions given the request and the original response -function ajaxConvert( s, response ) { - - // Apply the dataFilter if provided - if ( s.dataFilter ) { - response = s.dataFilter( response, s.dataType ); - } - - var dataTypes = s.dataTypes, - converters = {}, - i, - key, - length = dataTypes.length, - tmp, - // Current and previous dataTypes - current = dataTypes[ 0 ], - prev, - // Conversion expression - conversion, - // Conversion function - conv, - // Conversion functions (transitive conversion) - conv1, - conv2; - - // For each dataType in the chain - for ( i = 1; i < length; i++ ) { - - // Create converters map - // with lowercased keys - if ( i === 1 ) { - for ( key in s.converters ) { - if ( typeof key === "string" ) { - converters[ key.toLowerCase() ] = s.converters[ key ]; - } - } - } - - // Get the dataTypes - prev = current; - current = dataTypes[ i ]; - - // If current is auto dataType, update it to prev - if ( current === "*" ) { - current = prev; - // If no auto and dataTypes are actually different - } else if ( prev !== "*" && prev !== current ) { - - // Get the converter - conversion = prev + " " + current; - conv = converters[ conversion ] || converters[ "* " + current ]; - - // If there is no direct converter, search transitively - if ( !conv ) { - conv2 = undefined; - for ( conv1 in converters ) { - tmp = conv1.split( " " ); - if ( tmp[ 0 ] === prev || tmp[ 0 ] === "*" ) { - conv2 = converters[ tmp[1] + " " + current ]; - if ( conv2 ) { - conv1 = converters[ conv1 ]; - if ( conv1 === true ) { - conv = conv2; - } else if ( conv2 === true ) { - conv = conv1; - } - break; - } - } - } - } - // If we found no converter, dispatch an error - if ( !( conv || conv2 ) ) { - jQuery.error( "No conversion from " + conversion.replace(" "," to ") ); - } - // If found converter is not an equivalence - if ( conv !== true ) { - // Convert with 1 or 2 converters accordingly - response = conv ? conv( response ) : conv2( conv1(response) ); - } - } - } - return response; -} - - - - -var jsc = jQuery.now(), - jsre = /(=)?(&|$)|??/i; - -// Default jsonp settings -jQuery.ajaxSetup({ - jsonp: "callback", - jsonpCallback: function() { - return jQuery.expando + "_" + ( jsc++ ); - } -}); - -// Detect, normalize options and install callbacks for jsonp requests -jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { - - var inspectData = s.contentType === "application/x-www-form-urlencoded" && - ( typeof s.data === "string" ); - - if ( s.dataTypes[ 0 ] === "jsonp" || - s.jsonp !== false && ( jsre.test( s.url ) || - inspectData && jsre.test( s.data ) ) ) { - - var responseContainer, - jsonpCallback = s.jsonpCallback = - jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback, - previous = window[ jsonpCallback ], - url = s.url, - data = s.data, - replace = "$1" + jsonpCallback + "$2"; - - if ( s.jsonp !== false ) { - url = url.replace( jsre, replace ); - if ( s.url === url ) { - if ( inspectData ) { - data = data.replace( jsre, replace ); - } - if ( s.data === data ) { - // Add callback manually - url += (/?/.test( url ) ? "&" : "?") + s.jsonp + "=" + jsonpCallback; - } - } - } - - s.url = url; - s.data = data; - - // Install callback - window[ jsonpCallback ] = function( response ) { - responseContainer = [ response ]; - }; - - // Clean-up function - jqXHR.always(function() { - // Set callback back to previous value - window[ jsonpCallback ] = previous; - // Call if it was a function and we have a response - if ( responseContainer && jQuery.isFunction( previous ) ) { - window[ jsonpCallback ]( responseContainer[ 0 ] ); - } - }); - - // Use data converter to retrieve json after script execution - s.converters["script json"] = function() { - if ( !responseContainer ) { - jQuery.error( jsonpCallback + " was not called" ); - } - return responseContainer[ 0 ]; - }; - - // force json dataType - s.dataTypes[ 0 ] = "json"; - - // Delegate to script - return "script"; - } -}); - - - - -// Install script dataType -jQuery.ajaxSetup({ - accepts: { - script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" - }, - contents: { - script: /javascript|ecmascript/ - }, - converters: { - "text script": function( text ) { - jQuery.globalEval( text ); - return text; - } - } -}); - -// Handle cache's special case and global -jQuery.ajaxPrefilter( "script", function( s ) { - if ( s.cache === undefined ) { - s.cache = false; - } - if ( s.crossDomain ) { - s.type = "GET"; - s.global = false; - } -}); - -// Bind script tag hack transport -jQuery.ajaxTransport( "script", function(s) { - - // This transport only deals with cross domain requests - if ( s.crossDomain ) { - - var script, - head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement; - - return { - - send: function( _, callback ) { - - script = document.createElement( "script" ); - - script.async = "async"; - - if ( s.scriptCharset ) { - script.charset = s.scriptCharset; - } - - script.src = s.url; - - // Attach handlers for all browsers - script.onload = script.onreadystatechange = function( _, isAbort ) { - - if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) { - - // Handle memory leak in IE - script.onload = script.onreadystatechange = null; - - // Remove the script - if ( head && script.parentNode ) { - head.removeChild( script ); - } - - // Dereference the script - script = undefined; - - // Callback if not abort - if ( !isAbort ) { - callback( 200, "success" ); - } - } - }; - // Use insertBefore instead of appendChild to circumvent an IE6 bug. - // This arises when a base node is used (#2709 and #4378). - head.insertBefore( script, head.firstChild ); - }, - - abort: function() { - if ( script ) { - script.onload( 0, 1 ); - } - } - }; - } -}); - - - - -var // #5280: Internet Explorer will keep connections alive if we don't abort on unload - xhrOnUnloadAbort = window.ActiveXObject ? function() { - // Abort all pending requests - for ( var key in xhrCallbacks ) { - xhrCallbacks[ key ]( 0, 1 ); - } - } : false, - xhrId = 0, - xhrCallbacks; - -// Functions to create xhrs -function createStandardXHR() { - try { - return new window.XMLHttpRequest(); - } catch( e ) {} -} - -function createActiveXHR() { - try { - return new window.ActiveXObject( "Microsoft.XMLHTTP" ); - } catch( e ) {} -} - -// Create the request object -// (This is still attached to ajaxSettings for backward compatibility) -jQuery.ajaxSettings.xhr = window.ActiveXObject ? - /* Microsoft failed to properly - * implement the XMLHttpRequest in IE7 (can't request local files), - * so we use the ActiveXObject when it is available - * Additionally XMLHttpRequest can be disabled in IE7/IE8 so - * we need a fallback. - */ - function() { - return !this.isLocal && createStandardXHR() || createActiveXHR(); - } : - // For all other browsers, use the standard XMLHttpRequest object - createStandardXHR; - -// Determine support properties -(function( xhr ) { - jQuery.extend( jQuery.support, { - ajax: !!xhr, - cors: !!xhr && ( "withCredentials" in xhr ) - }); -})( jQuery.ajaxSettings.xhr() ); - -// Create transport if the browser can provide an xhr -if ( jQuery.support.ajax ) { - - jQuery.ajaxTransport(function( s ) { - // Cross domain only allowed if supported through XMLHttpRequest - if ( !s.crossDomain || jQuery.support.cors ) { - - var callback; - - return { - send: function( headers, complete ) { - - // Get a new xhr - var xhr = s.xhr(), - handle, - i; - - // Open the socket - // Passing null username, generates a login popup on Opera (#2865) - if ( s.username ) { - xhr.open( s.type, s.url, s.async, s.username, s.password ); - } else { - xhr.open( s.type, s.url, s.async ); - } - - // Apply custom fields if provided - if ( s.xhrFields ) { - for ( i in s.xhrFields ) { - xhr[ i ] = s.xhrFields[ i ]; - } - } - - // Override mime type if needed - if ( s.mimeType && xhr.overrideMimeType ) { - xhr.overrideMimeType( s.mimeType ); - } - - // X-Requested-With header - // For cross-domain requests, seeing as conditions for a preflight are - // akin to a jigsaw puzzle, we simply never set it to be sure. - // (it can always be set on a per-request basis or even using ajaxSetup) - // For same-domain requests, won't change header if already provided. - if ( !s.crossDomain && !headers["X-Requested-With"] ) { - headers[ "X-Requested-With" ] = "XMLHttpRequest"; - } - - // Need an extra try/catch for cross domain requests in Firefox 3 - try { - for ( i in headers ) { - xhr.setRequestHeader( i, headers[ i ] ); - } - } catch( _ ) {} - - // Do send the request - // This may raise an exception which is actually - // handled in jQuery.ajax (so no try/catch here) - xhr.send( ( s.hasContent && s.data ) || null ); - - // Listener - callback = function( _, isAbort ) { - - var status, - statusText, - responseHeaders, - responses, - xml; - - // Firefox throws exceptions when accessing properties - // of an xhr when a network error occured - // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x...) - try { - - // Was never called and is aborted or complete - if ( callback && ( isAbort || xhr.readyState === 4 ) ) { - - // Only called once - callback = undefined; - - // Do not keep as active anymore - if ( handle ) { - xhr.onreadystatechange = jQuery.noop; - if ( xhrOnUnloadAbort ) { - delete xhrCallbacks[ handle ]; - } - } - - // If it's an abort - if ( isAbort ) { - // Abort it manually if needed - if ( xhr.readyState !== 4 ) { - xhr.abort(); - } - } else { - status = xhr.status; - responseHeaders = xhr.getAllResponseHeaders(); - responses = {}; - xml = xhr.responseXML; - - // Construct response list - if ( xml && xml.documentElement /* #4958 */ ) { - responses.xml = xml; - } - responses.text = xhr.responseText; - - // Firefox throws an exception when accessing - // statusText for faulty cross-domain requests - try { - statusText = xhr.statusText; - } catch( e ) { - // We normalize with Webkit giving an empty statusText - statusText = ""; - } - - // Filter status for non standard behaviors - - // If the request is local and we have data: assume a success - // (success with no data won't get notified, that's the best we - // can do given current implementations) - if ( !status && s.isLocal && !s.crossDomain ) { - status = responses.text ? 200 : 404; - // IE - #1450: sometimes returns 1223 when it should be 204 - } else if ( status === 1223 ) { - status = 204; - } - } - } - } catch( firefoxAccessException ) { - if ( !isAbort ) { - complete( -1, firefoxAccessException ); - } - } - - // Call complete if needed - if ( responses ) { - complete( status, statusText, responses, responseHeaders ); - } - }; - - // if we're in sync mode or it's in cache - // and has been retrieved directly (IE6 & IE7) - // we need to manually fire the callback - if ( !s.async || xhr.readyState === 4 ) { - callback(); - } else { - handle = ++xhrId; - if ( xhrOnUnloadAbort ) { - // Create the active xhrs callbacks list if needed - // and attach the unload handler - if ( !xhrCallbacks ) { - xhrCallbacks = {}; - jQuery( window ).unload( xhrOnUnloadAbort ); - } - // Add to list of active xhrs callbacks - xhrCallbacks[ handle ] = callback; - } - xhr.onreadystatechange = callback; - } - }, - - abort: function() { - if ( callback ) { - callback(0,1); - } - } - }; - } - }); -} - - - - -var elemdisplay = {}, - iframe, iframeDoc, - rfxtypes = /^(?:toggle|show|hide)$/, - rfxnum = /^([+-]=)?([\d+.-]+)([a-z%]*)$/i, - timerId, - fxAttrs = [ - // height animations - [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ], - // width animations - [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ], - // opacity animations - [ "opacity" ] - ], - fxNow; - -jQuery.fn.extend({ - show: function( speed, easing, callback ) { - var elem, display; - - if ( speed || speed === 0 ) { - return this.animate( genFx("show", 3), speed, easing, callback ); - - } else { - for ( var i = 0, j = this.length; i < j; i++ ) { - elem = this[ i ]; - - if ( elem.style ) { - display = elem.style.display; - - // Reset the inline display of this element to learn if it is - // being hidden by cascaded rules or not - if ( !jQuery._data(elem, "olddisplay") && display === "none" ) { - display = elem.style.display = ""; - } - - // Set elements which have been overridden with display: none - // in a stylesheet to whatever the default browser style is - // for such an element - if ( display === "" && jQuery.css(elem, "display") === "none" ) { - jQuery._data( elem, "olddisplay", defaultDisplay(elem.nodeName) ); - } - } - } - - // Set the display of most of the elements in a second loop - // to avoid the constant reflow - for ( i = 0; i < j; i++ ) { - elem = this[ i ]; - - if ( elem.style ) { - display = elem.style.display; - - if ( display === "" || display === "none" ) { - elem.style.display = jQuery._data( elem, "olddisplay" ) || ""; - } - } - } - - return this; - } - }, - - hide: function( speed, easing, callback ) { - if ( speed || speed === 0 ) { - return this.animate( genFx("hide", 3), speed, easing, callback); - - } else { - var elem, display, - i = 0, - j = this.length; - - for ( ; i < j; i++ ) { - elem = this[i]; - if ( elem.style ) { - display = jQuery.css( elem, "display" ); - - if ( display !== "none" && !jQuery._data( elem, "olddisplay" ) ) { - jQuery._data( elem, "olddisplay", display ); - } - } - } - - // Set the display of the elements in a second loop - // to avoid the constant reflow - for ( i = 0; i < j; i++ ) { - if ( this[i].style ) { - this[i].style.display = "none"; - } - } - - return this; - } - }, - - // Save the old toggle function - _toggle: jQuery.fn.toggle, - - toggle: function( fn, fn2, callback ) { - var bool = typeof fn === "boolean"; - - if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) { - this._toggle.apply( this, arguments ); - - } else if ( fn == null || bool ) { - this.each(function() { - var state = bool ? fn : jQuery(this).is(":hidden"); - jQuery(this)[ state ? "show" : "hide" ](); - }); - - } else { - this.animate(genFx("toggle", 3), fn, fn2, callback); - } - - return this; - }, - - fadeTo: function( speed, to, easing, callback ) { - return this.filter(":hidden").css("opacity", 0).show().end() - .animate({opacity: to}, speed, easing, callback); - }, - - animate: function( prop, speed, easing, callback ) { - var optall = jQuery.speed( speed, easing, callback ); - - if ( jQuery.isEmptyObject( prop ) ) { - return this.each( optall.complete, [ false ] ); - } - - // Do not change referenced properties as per-property easing will be lost - prop = jQuery.extend( {}, prop ); - - function doAnimation() { - // XXX 'this' does not always have a nodeName when running the - // test suite - - if ( optall.queue === false ) { - jQuery._mark( this ); - } - - var opt = jQuery.extend( {}, optall ), - isElement = this.nodeType === 1, - hidden = isElement && jQuery(this).is(":hidden"), - name, val, p, e, - parts, start, end, unit, - method; - - // will store per property easing and be used to determine when an animation is complete - opt.animatedProperties = {}; - - for ( p in prop ) { - - // property name normalization - name = jQuery.camelCase( p ); - if ( p !== name ) { - prop[ name ] = prop[ p ]; - delete prop[ p ]; - } - - val = prop[ name ]; - - // easing resolution: per property > opt.specialEasing > opt.easing > 'swing' (default) - if ( jQuery.isArray( val ) ) { - opt.animatedProperties[ name ] = val[ 1 ]; - val = prop[ name ] = val[ 0 ]; - } else { - opt.animatedProperties[ name ] = opt.specialEasing && opt.specialEasing[ name ] || opt.easing || 'swing'; - } - - if ( val === "hide" && hidden || val === "show" && !hidden ) { - return opt.complete.call( this ); - } - - if ( isElement && ( name === "height" || name === "width" ) ) { - // Make sure that nothing sneaks out - // Record all 3 overflow attributes because IE does not - // change the overflow attribute when overflowX and - // overflowY are set to the same value - opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ]; - - // Set display property to inline-block for height/width - // animations on inline elements that are having width/height animated - if ( jQuery.css( this, "display" ) === "inline" && - jQuery.css( this, "float" ) === "none" ) { - - // inline-level elements accept inline-block; - // block-level elements need to be inline with layout - if ( !jQuery.support.inlineBlockNeedsLayout || defaultDisplay( this.nodeName ) === "inline" ) { - this.style.display = "inline-block"; - - } else { - this.style.zoom = 1; - } - } - } - } - - if ( opt.overflow != null ) { - this.style.overflow = "hidden"; - } - - for ( p in prop ) { - e = new jQuery.fx( this, opt, p ); - val = prop[ p ]; - - if ( rfxtypes.test( val ) ) { - - // Tracks whether to show or hide based on private - // data attached to the element - method = jQuery._data( this, "toggle" + p ) || ( val === "toggle" ? hidden ? "show" : "hide" : 0 ); - if ( method ) { - jQuery._data( this, "toggle" + p, method === "show" ? "hide" : "show" ); - e[ method ](); - } else { - e[ val ](); - } - - } else { - parts = rfxnum.exec( val ); - start = e.cur(); - - if ( parts ) { - end = parseFloat( parts[2] ); - unit = parts[3] || ( jQuery.cssNumber[ p ] ? "" : "px" ); - - // We need to compute starting value - if ( unit !== "px" ) { - jQuery.style( this, p, (end || 1) + unit); - start = ( (end || 1) / e.cur() ) * start; - jQuery.style( this, p, start + unit); - } - - // If a +=/-= token was provided, we're doing a relative animation - if ( parts[1] ) { - end = ( (parts[ 1 ] === "-=" ? -1 : 1) * end ) + start; - } - - e.custom( start, end, unit ); - - } else { - e.custom( start, val, "" ); - } - } - } - - // For JS strict compliance - return true; - } - - return optall.queue === false ? - this.each( doAnimation ) : - this.queue( optall.queue, doAnimation ); - }, - - stop: function( type, clearQueue, gotoEnd ) { - if ( typeof type !== "string" ) { - gotoEnd = clearQueue; - clearQueue = type; - type = undefined; - } - if ( clearQueue && type !== false ) { - this.queue( type || "fx", [] ); - } - - return this.each(function() { - var index, - hadTimers = false, - timers = jQuery.timers, - data = jQuery._data( this ); - - // clear marker counters if we know they won't be - if ( !gotoEnd ) { - jQuery._unmark( true, this ); - } - - function stopQueue( elem, data, index ) { - var hooks = data[ index ]; - jQuery.removeData( elem, index, true ); - hooks.stop( gotoEnd ); - } - - if ( type == null ) { - for ( index in data ) { - if ( data[ index ] && data[ index ].stop && index.indexOf(".run") === index.length - 4 ) { - stopQueue( this, data, index ); - } - } - } else if ( data[ index = type + ".run" ] && data[ index ].stop ){ - stopQueue( this, data, index ); - } - - for ( index = timers.length; index--; ) { - if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) { - if ( gotoEnd ) { - - // force the next step to be the last - timers[ index ]( true ); - } else { - timers[ index ].saveState(); - } - hadTimers = true; - timers.splice( index, 1 ); - } - } - - // start the next in the queue if the last step wasn't forced - // timers currently will call their complete callbacks, which will dequeue - // but only if they were gotoEnd - if ( !( gotoEnd && hadTimers ) ) { - jQuery.dequeue( this, type ); - } - }); - } - -}); - -// Animations created synchronously will run synchronously -function createFxNow() { - setTimeout( clearFxNow, 0 ); - return ( fxNow = jQuery.now() ); -} - -function clearFxNow() { - fxNow = undefined; -} - -// Generate parameters to create a standard animation -function genFx( type, num ) { - var obj = {}; - - jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice( 0, num )), function() { - obj[ this ] = type; - }); - - return obj; -} - -// Generate shortcuts for custom animations -jQuery.each({ - slideDown: genFx( "show", 1 ), - slideUp: genFx( "hide", 1 ), - slideToggle: genFx( "toggle", 1 ), - fadeIn: { opacity: "show" }, - fadeOut: { opacity: "hide" }, - fadeToggle: { opacity: "toggle" } -}, function( name, props ) { - jQuery.fn[ name ] = function( speed, easing, callback ) { - return this.animate( props, speed, easing, callback ); - }; -}); - -jQuery.extend({ - speed: function( speed, easing, fn ) { - var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { - complete: fn || !fn && easing || - jQuery.isFunction( speed ) && speed, - duration: speed, - easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing - }; - - opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : - opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default; - - // normalize opt.queue - true/undefined/null -> "fx" - if ( opt.queue == null || opt.queue === true ) { - opt.queue = "fx"; - } - - // Queueing - opt.old = opt.complete; - - opt.complete = function( noUnmark ) { - if ( jQuery.isFunction( opt.old ) ) { - opt.old.call( this ); - } - - if ( opt.queue ) { - jQuery.dequeue( this, opt.queue ); - } else if ( noUnmark !== false ) { - jQuery._unmark( this ); - } - }; - - return opt; - }, - - easing: { - linear: function( p, n, firstNum, diff ) { - return firstNum + diff * p; - }, - swing: function( p, n, firstNum, diff ) { - return ( ( -Math.cos( p*Math.PI ) / 2 ) + 0.5 ) * diff + firstNum; - } - }, - - timers: [], - - fx: function( elem, options, prop ) { - this.options = options; - this.elem = elem; - this.prop = prop; - - options.orig = options.orig || {}; - } - -}); - -jQuery.fx.prototype = { - // Simple function for setting a style value - update: function() { - if ( this.options.step ) { - this.options.step.call( this.elem, this.now, this ); - } - - ( jQuery.fx.step[ this.prop ] || jQuery.fx.step._default )( this ); - }, - - // Get the current size - cur: function() { - if ( this.elem[ this.prop ] != null && (!this.elem.style || this.elem.style[ this.prop ] == null) ) { - return this.elem[ this.prop ]; - } - - var parsed, - r = jQuery.css( this.elem, this.prop ); - // Empty strings, null, undefined and "auto" are converted to 0, - // complex values such as "rotate(1rad)" are returned as is, - // simple values such as "10px" are parsed to Float. - return isNaN( parsed = parseFloat( r ) ) ? !r || r === "auto" ? 0 : r : parsed; - }, - - // Start an animation from one number to another - custom: function( from, to, unit ) { - var self = this, - fx = jQuery.fx; - - this.startTime = fxNow || createFxNow(); - this.end = to; - this.now = this.start = from; - this.pos = this.state = 0; - this.unit = unit || this.unit || ( jQuery.cssNumber[ this.prop ] ? "" : "px" ); - - function t( gotoEnd ) { - return self.step( gotoEnd ); - } - - t.queue = this.options.queue; - t.elem = this.elem; - t.saveState = function() { - if ( self.options.hide && jQuery._data( self.elem, "fxshow" + self.prop ) === undefined ) { - jQuery._data( self.elem, "fxshow" + self.prop, self.start ); - } - }; - - if ( t() && jQuery.timers.push(t) && !timerId ) { - timerId = setInterval( fx.tick, fx.interval ); - } - }, - - // Simple 'show' function - show: function() { - var dataShow = jQuery._data( this.elem, "fxshow" + this.prop ); - - // Remember where we started, so that we can go back to it later - this.options.orig[ this.prop ] = dataShow || jQuery.style( this.elem, this.prop ); - this.options.show = true; - - // Begin the animation - // Make sure that we start at a small width/height to avoid any flash of content - if ( dataShow !== undefined ) { - // This show is picking up where a previous hide or show left off - this.custom( this.cur(), dataShow ); - } else { - this.custom( this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur() ); - } - - // Start by showing the element - jQuery( this.elem ).show(); - }, - - // Simple 'hide' function - hide: function() { - // Remember where we started, so that we can go back to it later - this.options.orig[ this.prop ] = jQuery._data( this.elem, "fxshow" + this.prop ) || jQuery.style( this.elem, this.prop ); - this.options.hide = true; - - // Begin the animation - this.custom( this.cur(), 0 ); - }, - - // Each step of an animation - step: function( gotoEnd ) { - var p, n, complete, - t = fxNow || createFxNow(), - done = true, - elem = this.elem, - options = this.options; - - if ( gotoEnd || t >= options.duration + this.startTime ) { - this.now = this.end; - this.pos = this.state = 1; - this.update(); - - options.animatedProperties[ this.prop ] = true; - - for ( p in options.animatedProperties ) { - if ( options.animatedProperties[ p ] !== true ) { - done = false; - } - } - - if ( done ) { - // Reset the overflow - if ( options.overflow != null && !jQuery.support.shrinkWrapBlocks ) { - - jQuery.each( [ "", "X", "Y" ], function( index, value ) { - elem.style[ "overflow" + value ] = options.overflow[ index ]; - }); - } - - // Hide the element if the "hide" operation was done - if ( options.hide ) { - jQuery( elem ).hide(); - } - - // Reset the properties, if the item has been hidden or shown - if ( options.hide || options.show ) { - for ( p in options.animatedProperties ) { - jQuery.style( elem, p, options.orig[ p ] ); - jQuery.removeData( elem, "fxshow" + p, true ); - // Toggle data is no longer needed - jQuery.removeData( elem, "toggle" + p, true ); - } - } - - // Execute the complete function - // in the event that the complete function throws an exception - // we must ensure it won't be called twice. #5684 - - complete = options.complete; - if ( complete ) { - - options.complete = false; - complete.call( elem ); - } - } - - return false; - - } else { - // classical easing cannot be used with an Infinity duration - if ( options.duration == Infinity ) { - this.now = t; - } else { - n = t - this.startTime; - this.state = n / options.duration; - - // Perform the easing function, defaults to swing - this.pos = jQuery.easing[ options.animatedProperties[this.prop] ]( this.state, n, 0, 1, options.duration ); - this.now = this.start + ( (this.end - this.start) * this.pos ); - } - // Perform the next step of the animation - this.update(); - } - - return true; - } -}; - -jQuery.extend( jQuery.fx, { - tick: function() { - var timer, - timers = jQuery.timers, - i = 0; - - for ( ; i < timers.length; i++ ) { - timer = timers[ i ]; - // Checks the timer has not already been removed - if ( !timer() && timers[ i ] === timer ) { - timers.splice( i--, 1 ); - } - } - - if ( !timers.length ) { - jQuery.fx.stop(); - } - }, - - interval: 13, - - stop: function() { - clearInterval( timerId ); - timerId = null; - }, - - speeds: { - slow: 600, - fast: 200, - // Default speed - _default: 400 - }, - - step: { - opacity: function( fx ) { - jQuery.style( fx.elem, "opacity", fx.now ); - }, - - _default: function( fx ) { - if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) { - fx.elem.style[ fx.prop ] = fx.now + fx.unit; - } else { - fx.elem[ fx.prop ] = fx.now; - } - } - } -}); - -// Adds width/height step functions -// Do not set anything below 0 -jQuery.each([ "width", "height" ], function( i, prop ) { - jQuery.fx.step[ prop ] = function( fx ) { - jQuery.style( fx.elem, prop, Math.max(0, fx.now) + fx.unit ); - }; -}); - -if ( jQuery.expr && jQuery.expr.filters ) { - jQuery.expr.filters.animated = function( elem ) { - return jQuery.grep(jQuery.timers, function( fn ) { - return elem === fn.elem; - }).length; - }; -} - -// Try to restore the default display value of an element -function defaultDisplay( nodeName ) { - - if ( !elemdisplay[ nodeName ] ) { - - var body = document.body, - elem = jQuery( "<" + nodeName + ">" ).appendTo( body ), - display = elem.css( "display" ); - elem.remove(); - - // If the simple way fails, - // get element's real default display by attaching it to a temp iframe - if ( display === "none" || display === "" ) { - // No iframe to use yet, so create it - if ( !iframe ) { - iframe = document.createElement( "iframe" ); - iframe.frameBorder = iframe.width = iframe.height = 0; - } - - body.appendChild( iframe ); - - // Create a cacheable copy of the iframe document on first call. - // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML - // document to it; WebKit & Firefox won't allow reusing the iframe document. - if ( !iframeDoc || !iframe.createElement ) { - iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document; - iframeDoc.write( ( document.compatMode === "CSS1Compat" ? "<!doctype html>" : "" ) + "<html><body>" ); - iframeDoc.close(); - } - - elem = iframeDoc.createElement( nodeName ); - - iframeDoc.body.appendChild( elem ); - - display = jQuery.css( elem, "display" ); - body.removeChild( iframe ); - } - - // Store the correct default display - elemdisplay[ nodeName ] = display; - } - - return elemdisplay[ nodeName ]; -} - - - - -var rtable = /^t(?:able|d|h)$/i, - rroot = /^(?:body|html)$/i; - -if ( "getBoundingClientRect" in document.documentElement ) { - jQuery.fn.offset = function( options ) { - var elem = this[0], box; - - if ( options ) { - return this.each(function( i ) { - jQuery.offset.setOffset( this, options, i ); - }); - } - - if ( !elem || !elem.ownerDocument ) { - return null; - } - - if ( elem === elem.ownerDocument.body ) { - return jQuery.offset.bodyOffset( elem ); - } - - try { - box = elem.getBoundingClientRect(); - } catch(e) {} - - var doc = elem.ownerDocument, - docElem = doc.documentElement; - - // Make sure we're not dealing with a disconnected DOM node - if ( !box || !jQuery.contains( docElem, elem ) ) { - return box ? { top: box.top, left: box.left } : { top: 0, left: 0 }; - } - - var body = doc.body, - win = getWindow(doc), - clientTop = docElem.clientTop || body.clientTop || 0, - clientLeft = docElem.clientLeft || body.clientLeft || 0, - scrollTop = win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop, - scrollLeft = win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft, - top = box.top + scrollTop - clientTop, - left = box.left + scrollLeft - clientLeft; - - return { top: top, left: left }; - }; - -} else { - jQuery.fn.offset = function( options ) { - var elem = this[0]; - - if ( options ) { - return this.each(function( i ) { - jQuery.offset.setOffset( this, options, i ); - }); - } - - if ( !elem || !elem.ownerDocument ) { - return null; - } - - if ( elem === elem.ownerDocument.body ) { - return jQuery.offset.bodyOffset( elem ); - } - - var computedStyle, - offsetParent = elem.offsetParent, - prevOffsetParent = elem, - doc = elem.ownerDocument, - docElem = doc.documentElement, - body = doc.body, - defaultView = doc.defaultView, - prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle, - top = elem.offsetTop, - left = elem.offsetLeft; - - while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) { - if ( jQuery.support.fixedPosition && prevComputedStyle.position === "fixed" ) { - break; - } - - computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle; - top -= elem.scrollTop; - left -= elem.scrollLeft; - - if ( elem === offsetParent ) { - top += elem.offsetTop; - left += elem.offsetLeft; - - if ( jQuery.support.doesNotAddBorder && !(jQuery.support.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) { - top += parseFloat( computedStyle.borderTopWidth ) || 0; - left += parseFloat( computedStyle.borderLeftWidth ) || 0; - } - - prevOffsetParent = offsetParent; - offsetParent = elem.offsetParent; - } - - if ( jQuery.support.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) { - top += parseFloat( computedStyle.borderTopWidth ) || 0; - left += parseFloat( computedStyle.borderLeftWidth ) || 0; - } - - prevComputedStyle = computedStyle; - } - - if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) { - top += body.offsetTop; - left += body.offsetLeft; - } - - if ( jQuery.support.fixedPosition && prevComputedStyle.position === "fixed" ) { - top += Math.max( docElem.scrollTop, body.scrollTop ); - left += Math.max( docElem.scrollLeft, body.scrollLeft ); - } - - return { top: top, left: left }; - }; -} - -jQuery.offset = { - - bodyOffset: function( body ) { - var top = body.offsetTop, - left = body.offsetLeft; - - if ( jQuery.support.doesNotIncludeMarginInBodyOffset ) { - top += parseFloat( jQuery.css(body, "marginTop") ) || 0; - left += parseFloat( jQuery.css(body, "marginLeft") ) || 0; - } - - return { top: top, left: left }; - }, - - setOffset: function( elem, options, i ) { - var position = jQuery.css( elem, "position" ); - - // set position first, in-case top/left are set even on static elem - if ( position === "static" ) { - elem.style.position = "relative"; - } - - var curElem = jQuery( elem ), - curOffset = curElem.offset(), - curCSSTop = jQuery.css( elem, "top" ), - curCSSLeft = jQuery.css( elem, "left" ), - calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1, - props = {}, curPosition = {}, curTop, curLeft; - - // need to be able to calculate position if either top or left is auto and position is either absolute or fixed - if ( calculatePosition ) { - curPosition = curElem.position(); - curTop = curPosition.top; - curLeft = curPosition.left; - } else { - curTop = parseFloat( curCSSTop ) || 0; - curLeft = parseFloat( curCSSLeft ) || 0; - } - - if ( jQuery.isFunction( options ) ) { - options = options.call( elem, i, curOffset ); - } - - if ( options.top != null ) { - props.top = ( options.top - curOffset.top ) + curTop; - } - if ( options.left != null ) { - props.left = ( options.left - curOffset.left ) + curLeft; - } - - if ( "using" in options ) { - options.using.call( elem, props ); - } else { - curElem.css( props ); - } - } -}; - - -jQuery.fn.extend({ - - position: function() { - if ( !this[0] ) { - return null; - } - - var elem = this[0], - - // Get *real* offsetParent - offsetParent = this.offsetParent(), - - // Get correct offsets - offset = this.offset(), - parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset(); - - // Subtract element margins - // note: when an element has margin: auto the offsetLeft and marginLeft - // are the same in Safari causing offset.left to incorrectly be 0 - offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0; - offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0; - - // Add offsetParent borders - parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0; - parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0; - - // Subtract the two offsets - return { - top: offset.top - parentOffset.top, - left: offset.left - parentOffset.left - }; - }, - - offsetParent: function() { - return this.map(function() { - var offsetParent = this.offsetParent || document.body; - while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) { - offsetParent = offsetParent.offsetParent; - } - return offsetParent; - }); - } -}); - - -// Create scrollLeft and scrollTop methods -jQuery.each( ["Left", "Top"], function( i, name ) { - var method = "scroll" + name; - - jQuery.fn[ method ] = function( val ) { - var elem, win; - - if ( val === undefined ) { - elem = this[ 0 ]; - - if ( !elem ) { - return null; - } - - win = getWindow( elem ); - - // Return the scroll offset - return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] : - jQuery.support.boxModel && win.document.documentElement[ method ] || - win.document.body[ method ] : - elem[ method ]; - } - - // Set the scroll offset - return this.each(function() { - win = getWindow( this ); - - if ( win ) { - win.scrollTo( - !i ? val : jQuery( win ).scrollLeft(), - i ? val : jQuery( win ).scrollTop() - ); - - } else { - this[ method ] = val; - } - }); - }; -}); - -function getWindow( elem ) { - return jQuery.isWindow( elem ) ? - elem : - elem.nodeType === 9 ? - elem.defaultView || elem.parentWindow : - false; -} - - - - -// Create width, height, innerHeight, innerWidth, outerHeight and outerWidth methods -jQuery.each([ "Height", "Width" ], function( i, name ) { - - var type = name.toLowerCase(); - - // innerHeight and innerWidth - jQuery.fn[ "inner" + name ] = function() { - var elem = this[0]; - return elem ? - elem.style ? - parseFloat( jQuery.css( elem, type, "padding" ) ) : - this[ type ]() : - null; - }; - - // outerHeight and outerWidth - jQuery.fn[ "outer" + name ] = function( margin ) { - var elem = this[0]; - return elem ? - elem.style ? - parseFloat( jQuery.css( elem, type, margin ? "margin" : "border" ) ) : - this[ type ]() : - null; - }; - - jQuery.fn[ type ] = function( size ) { - // Get window width or height - var elem = this[0]; - if ( !elem ) { - return size == null ? null : this; - } - - if ( jQuery.isFunction( size ) ) { - return this.each(function( i ) { - var self = jQuery( this ); - self[ type ]( size.call( this, i, self[ type ]() ) ); - }); - } - - if ( jQuery.isWindow( elem ) ) { - // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode - // 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat - var docElemProp = elem.document.documentElement[ "client" + name ], - body = elem.document.body; - return elem.document.compatMode === "CSS1Compat" && docElemProp || - body && body[ "client" + name ] || docElemProp; - - // Get document width or height - } else if ( elem.nodeType === 9 ) { - // Either scroll[Width/Height] or offset[Width/Height], whichever is greater - return Math.max( - elem.documentElement["client" + name], - elem.body["scroll" + name], elem.documentElement["scroll" + name], - elem.body["offset" + name], elem.documentElement["offset" + name] - ); - - // Get or set width or height on the element - } else if ( size === undefined ) { - var orig = jQuery.css( elem, type ), - ret = parseFloat( orig ); - - return jQuery.isNumeric( ret ) ? ret : orig; - - // Set the width or height on the element (default to pixels if value is unitless) - } else { - return this.css( type, typeof size === "string" ? size : size + "px" ); - } - }; - -}); - - - - -// Expose jQuery to the global object -window.jQuery = window.$ = jQuery; - -// Expose jQuery as an AMD module, but only for AMD loaders that -// understand the issues with loading multiple versions of jQuery -// in a page that all might call define(). The loader will indicate -// they have special allowances for multiple jQuery versions by -// specifying define.amd.jQuery = true. Register as a named module, -// since jQuery can be concatenated with other files that may use define, -// but not use a proper concatenation script that understands anonymous -// AMD modules. A named AMD is safest and most robust way to register. -// Lowercase jquery is used because AMD module names are derived from -// file names, and jQuery is normally delivered in a lowercase file name. -// Do this after creating the global so that if an AMD module wants to call -// noConflict to hide this version of jQuery, it will work. -if ( typeof define === "function" && define.amd && define.amd.jQuery ) { - define( "jquery", [], function () { return jQuery; } ); -} - - - -})( window ); diff --git a/modules/enterprise/gui/rest-war/src/main/webapp/js/resource_tree.js b/modules/enterprise/gui/rest-war/src/main/webapp/js/resource_tree.js deleted file mode 100644 index a43eee5..0000000 --- a/modules/enterprise/gui/rest-war/src/main/webapp/js/resource_tree.js +++ /dev/null @@ -1,65 +0,0 @@ -function resourceTree(resourceId,anchor) { - -var r = 960 / 2; - - var tree = d3.layout.tree() - .size([360, r - 120]) - .separation(function(a, b) { return (a.parent == b.parent ? 1 : 2) / a.depth; }); - - var diagonal = d3.svg.diagonal.radial() - .projection(function(d) { return [d.y, d.x / 180 * Math.PI]; }); - - var vis = d3.select("#"+anchor).append("svg:svg") - .attr("width", r * 2) - .attr("height", r * 2 - 150) - .append("svg:g") - .attr("transform", "translate(" + r + "," + r + ")"); - -// d3.json("/rest/1/resource/10702/hierarchy.json", function(json) { - d3.json("/rest/1/resource/" + resourceId + "/hierarchy.json", function(json) { - var nodes = tree.nodes(json); - - var link = vis.selectAll("path.link") - .data(tree.links(nodes)) - .enter().append("svg:path") - .attr("class", "link") - .attr("d", diagonal); - - var node = vis.selectAll("g.node") - .data(nodes) - .enter().append("svg:g") - .attr("class", "node") - .attr("transform", function(d) { return "rotate(" + (d.x - 90) + ")translate(" + d.y + ")"; }); - - node.append("svg:circle") - .attr("r", function(d) { - if (d.depth==0) return 10 ; - else if (d.depth==1) return 8; - else return 5 - }) - .style("stroke", function(d){ - if (d.depth==0) return "darkblue"; - else if (d.depth==1) return "steelblue"; - else return "lightblue" - }) - .style("stroke-width", function(d){ - if (d.depth==0) return 3; - else if (d.depth==1) return 2; - else return 1.5 - }); - -// var hyperLink = node.append("a") // TODO works in adding to tree, but -// .attr("xlink:href",function(d) { return "/rest/1/resource/" + d.id; }); - - node.append("svg:text") - .attr("dx", function(d) { return d.x < 180 ? 8 : -8; }) - .attr("dy", ".31em") - .attr("text-anchor", function(d) { return d.x < 180 ? "start" : "end"; }) - .attr("transform", function(d) { return d.x < 180 ? null : "rotate(180)"; }) - .text(function(d) { return d.name; }) - .on("mousedown",function(d) { window.location= "/rest/1/resource/" + d.id; }) - .on("mouseover", function() {d3.select(this).style("fill","red").style("font-size","20px");}) - .on("mouseout", function() {d3.select(this).style("fill","black").style("font-size","10px");}); - - }); -} \ No newline at end of file diff --git a/modules/enterprise/gui/rest-war/src/main/webapp/js/rhq.js b/modules/enterprise/gui/rest-war/src/main/webapp/js/rhq.js deleted file mode 100644 index 0f1c5e6..0000000 --- a/modules/enterprise/gui/rest-war/src/main/webapp/js/rhq.js +++ /dev/null @@ -1,120 +0,0 @@ -var rhq = { - -dashboard : function() { - // get all platforms - $.get('/rest/1/resource/platforms', function(data) { - - var table = $("#table"); - for (var i = 0; i < data.length ; i++ ) { - var resource = data[i]; - - var rowId = "tr" + i ; - table.append('<tr id="'+ rowId + '">'); - - // Now get the schedules for this resource - var resId = resource.resourceId; - console.log(resId); - - $.getJSON("/rest/1/resource/"+resId+"/schedules.json?type=metric&enabledOnly=true", function (json2) { - - var tr = $("#" + rowId); - for ( var n = 0 ; n < json2.length ; n ++ ) { - var tdid = "td_" + i + "_" + n; - var schedule = json2[n]; - var td = tr.append('<td id="'+tdid+'">'); - $("#"+tdid).html(schedule.displayName + " (" + schedule.scheduleId + ')<br/><div id="d' + tdid +'"/>'); - rhq.whisker(schedule.scheduleId,tdid,180,90); - } - }) - } - }) - }, -whisker: function(scheduleId,divId,w,h) { - - d3.json( - '/rest/1/metric/data/'+scheduleId+'.json?hideEmpty=true', - function (jsondata) { -// console.log(scheduleId +", "+ divId); - var svg = d3.select("body").select("#"+divId); - svg=svg.append("svg:svg") - .attr("width", w) - .attr("height", h); - - var points = jsondata.dataPoints; - var minVal = jsondata.min; - var maxVal = jsondata.max; - var avgVal = jsondata.avg; - var minTs = jsondata.minTimeStamp; - var maxTs = jsondata.maxTimeStamp; - - var minTsD = new Date(minTs); - var maxTsD = new Date(maxTs); - - // X axis goes from lowest to highest timestamp - var x = d3.time.scale().domain([minTsD,maxTsD]).range([0,w]); - // Y axis goes from lowest to highest value - var y = d3.scale.linear().domain([minVal, maxVal]).rangeRound([0,h]); - - - // Line for the average - var avgLine = svg.append("svg:line") - .attr("x1", x(new Date(minTs))) - .attr("y1", h - y(avgVal)) - .attr("x2", x(new Date(maxTs))) - .attr("y2", h - y(avgVal)) - .attr("stroke", "lightgrey") - .attr("stroke-dasharray", "2,4"); - - // TODO if present add lines for baselines - - // data() loops over all entries in 'points' above for the remaining statements - var bars = svg.selectAll("bars").data(points); - - var currX = function(d) { - return x(new Date(d.timeStamp)) - }; - - var group = bars.enter().append("svg:g"); - - var line = group.append("svg:line") - .attr("x1", currX) - .attr("x2", currX) - .attr("y1", function(d) { - return h - y(d.low) - }) - .attr("y2", function(d) { - return h - y(d.high) - }) - .attr("stroke", "lightblue"); - - var circleLow = group.append("svg:circle") - .attr("cx", currX) - .attr("cy", function(d) { - return h - y(d.low) - }) - .attr("r", 1) - .attr("stroke", "green") - .attr("fill", "lightgreen"); - - var circleHigh = group.append("svg:circle") - .attr("cx", currX) - .attr("cy", function(d) { - return h - y(d.high) - }) - .attr("r", 1) - .attr("stroke", "green") - .attr("fill", "lightblue"); - - var circleVal = group.append("svg:circle") - .attr("cx", currX) - .attr("cy", function(d) { - return h - y(d.value) - }) - .attr("r", 1.5) - .attr("stroke", "blue") - .attr("fill", "lightpink"); - - }); -} // whisker - -};//var rhq diff --git a/modules/enterprise/gui/rest-war/src/main/webapp/raw_graph.html b/modules/enterprise/gui/rest-war/src/main/webapp/raw_graph.html deleted file mode 100644 index 44c42a5..0000000 --- a/modules/enterprise/gui/rest-war/src/main/webapp/raw_graph.html +++ /dev/null @@ -1,184 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <title>Raw mertic last 7 days</title> - <script type="text/javascript" src="js/d3.js"></script> - <script type="text/javascript" src="js/d3.layout.js"></script> - <script type="text/javascript" src="js/d3.time.js"></script> - <script type="text/javascript" src="js/jquery.js"></script> - <style type="text/css"> - -svg { - width: 960px; - height: 600px; - border: solid 1px #ccc; - font: 10px sans-serif; - shape-rendering: crispEdges; -} -.axis text -{ - fill: #333; - font-family: sans-serif; - font-size: 10px; -} -.axis .domain -{ - opacity: 0; -} -.tick -{ - stroke: #ccc; - stroke-dasharray: 1 5; -} - -path { - stroke: steelblue; - stroke-width: 2; - fill: none; -} - -line { - stroke: black; -} - - </style> - </head> - <body> - <h1 id="resId">Resource</h1> - <h2 id="header">Schedule</h2> -<button id="dotsButton" onClick="transitionDots()">Dots</button> -<button id="lineButton" onClick="transitionLine()">Lines</button> -<button id="bothButton" onClick="transitionBoth()">Both</button> - - <div id="one"></div> - <script type="text/javascript"> - -// Width and height of the chart to print -var w = 960, - h = 600; - -// Get the platforms and then the first one -$.getJSON('/rest/1/resource/platforms.json', function (json) { - var res = json[0]; - var rid = res.resourceId; - $("#resId").text("Resource " + rid + " (" + res.resourceName + ")"); - - // Now get the metrical schedules of the platform - $.getJSON("/rest/1/resource/"+rid+"/schedules.json?type=metric", function (json2) { - - // Take the first and render it - var schId = json2[0].scheduleId; - $("#header").text("Schedule " + schId + " (" + json2[0].scheduleName + "), base unit: " + json2[0].unit); - - d3.json( - '/rest/1/metric/data/' + schId + '/raw.json?duration=604800', - function (jsondata) { - - var w = 960, - h = 600; - // compute min/max values for x and y - var minVal = d3.min(jsondata,function(d) { return d.value;}); - var maxVal = d3.max(jsondata,function(d) { return d.value;}); - var minTsD = d3.min(jsondata,function(d) { return d.timeStamp;}); - var maxTsD = d3.max(jsondata,function(d) { return d.timeStamp;}); - - var avg = d3.sum(jsondata,function(d) { return d.value;}) / jsondata.length; - - - WIDTH = w; - HEIGHT = h; - MARGINS = {top: 10, right: 10, bottom: 20, left: 10}; - - var xRange = d3.time.scale().range ([MARGINS.left, WIDTH - MARGINS.right]).domain([new Date(minTsD),new Date(maxTsD)]); - var yRange = d3.scale.linear().range ([HEIGHT - MARGINS.top, MARGINS.bottom]).domain([minVal, maxVal]); - - // X axis range goes from lowest to highest timestamp - var x = d3.time.scale().domain([new Date(minTsD),new Date(maxTsD)]).range([50, w-10]); // 50-> make room for label - var y = yRange; - // Y axis range goes from lowest to highest value - // var y = d3.scale.linear().domain([minVal, maxVal]).rangeRound([0, h]); - format = d3.time.format("%H:%M"); - - - xAxis = d3.svg.axis() // generate an axis - .scale(x) // set the range of the axis - .tickSize(580) // height of the ticks - .tickSubdivide(true); // display ticks between text labels - yAxis = d3.svg.axis() // generate an axis - .scale(yRange) // set the range of the axis - .tickSize(3) // width of the ticks - .orient("right") // have the text labels on the right hand side - .tickFormat(d3.format("0e")) - .tickSubdivide(true); // display ticks between text labels - - // create the SVG - var svg = d3.select("body").append("svg:svg") - .attr("width", w) - .attr("height", h); - - // Create axes - svg.append("svg:g") - .attr("class","x axis") - .call(xAxis); - - svg.append("svg:g") - .attr("class","y axis") - .attr("transform", "translate(" + (MARGINS.left) + ",0)") - .call(yAxis); - - // create horizontal line for avg - svg.append("svg:line") - .attr("x1","50") - .attr("x2","950") - .attr("y1",y(avg)) - .attr("y2",y(avg)) - .style("stroke","red") - .attr("style","stroke-dasharray:2 2; stroke:red") - ; - - - // Now lets "loop" over the data and show the dots - var lines = svg.append("svg:g").attr("class","linechart") - .attr("opacity","0"); - - var line = d3.svg.line() - .x(function(d,i) { return x(d.timeStamp); }) - .y(function(d) { return y(d.value); }); - - lines.append("svg:path").attr("d", line(jsondata)); - - - var dot = svg.append("svg:g").attr("class","dotschart") - .selectAll("dot").data(jsondata); - - dot.enter().append("svg:circle") - .attr("cx", function (d) { - return x(d.timeStamp); - }) - .attr("cy", function (d) { - return y(d.value); - }) - .style("stroke", "blue") - .attr("r", 1) - - - }); - }) -}); - -function transitionDots() { - $(".linechart").attr("opacity",0); - $(".dotschart").attr("opacity",1); -} - -function transitionLine() { - $(".linechart").attr("opacity",1); - $(".dotschart").attr("opacity",0); -} -function transitionBoth() { - $(".linechart").attr("opacity",1); - $(".dotschart").attr("opacity",1); -} - </script> - </body> -</html> diff --git a/modules/enterprise/gui/rest-war/src/main/webapp/raw_graph7.html b/modules/enterprise/gui/rest-war/src/main/webapp/raw_graph7.html deleted file mode 100644 index 4ff8174..0000000 --- a/modules/enterprise/gui/rest-war/src/main/webapp/raw_graph7.html +++ /dev/null @@ -1,225 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <title>Raw mertic last 7 days</title> - <script type="text/javascript" src="js/d3.js"></script> - <script type="text/javascript" src="js/d3.layout.js"></script> - <script type="text/javascript" src="js/d3.time.js"></script> - <script type="text/javascript" src="js/jquery.js"></script> - <style type="text/css"> - -svg { - width: 960px; - height: 600px; - border: solid 1px #ccc; - font: 10px sans-serif; - shape-rendering: crispEdges; -} -.axis text -{ - fill: #333; - font-family: sans-serif; - font-size: 10px; -} -.axis .domain -{ - opacity: 0; -} -.tick -{ - stroke: #ccc; - stroke-dasharray: 1 5; -} - -path { - stroke: steelblue; - stroke-width: 2; - fill: none; -} - -line { - stroke: black; -} - - </style> - </head> - <body> - <h1 id="resId">Resource</h1> - <h2 id="header">Schedule</h2> -<button id="dotsButton" onClick="transitionDots() ">Dots</button> -<button id="lineButton" onClick="transitionLine()"/>Lines</button> -<button id="bothButton" onClick="transitionBoth()"/>Both</button> - - <div id="one"></div> - <script type="text/javascript"> - -// Width and height of the chart to print -var w = 960, - h = 600; - -// Get the platforms and then the first one -$.getJSON('/rest/1/resource/platforms.json', function (json) { - var res = json[0]; - var rid = res.resourceId; - $("#resId").text("Resource " + rid + " (" + res.resourceName + ")"); - - // Now get the metrical schedules of the platform - $.getJSON("/rest/1/resource/"+rid+"/schedules.json?type=metric", function (json2) { - - // Take the first and render it - var schId = json2[0].scheduleId; - $("#header").text("Schedule " + schId + " (" + json2[0].scheduleName + "), base unit: " + json2[0].unit); - - var now = new Date().getTime(); - var startTime = now - (7 * 86400*1000); - d3.json( - '/rest/1/metric/data/' + schId + '/raw.json?duration=604800', - function (jsondata) { - - - - var w = 960, - h = 600; - // compute min/max values for x and y a - var minVal = d3.min(jsondata,function(d) { return d.value;}); - var maxVal = d3.max(jsondata,function(d) { return d.value;}); - var minTsD = 0; - var maxTsD = 86400*1000; - - var minTimestamp = d3.min(jsondata,function(d) { return d.timeStamp;}); - - var avg = d3.sum(jsondata,function(d) { return d.value;}) / jsondata.length; - - - - WIDTH = w; - HEIGHT = h; - MARGINS = {top: 10, right: 10, bottom: 20, left: 10}; - - var xRange = d3.time.scale().range ([MARGINS.left, WIDTH - MARGINS.right]).domain([new Date(minTsD),new Date(maxTsD)]); - var yRange = d3.scale.linear().range ([HEIGHT - MARGINS.top, MARGINS.bottom]).domain([minVal, maxVal]); - - // X axis range goes from lowest to highest timestamp - var x = d3.time.scale().domain([new Date(0),new Date(86400*1000)]).range([50, w-10]); // 50-> make room for label -//var x = xRange; - var y = yRange; - // Y axis range goes from lowest to highest value - // var y = d3.scale.linear().domain([minVal, maxVal]).rangeRound([0, h]); - format = d3.time.format("%H:%M"); - - - xAxis = d3.svg.axis() // generate an axis - .scale(x) // set the range of the axis - .tickSize(580) // height of the ticks - .tickSubdivide(true); // display ticks between text labels - yAxis = d3.svg.axis() // generate an axis - .scale(yRange) // set the range of the axis - .tickSize(3) // width of the ticks - .orient("right") // have the text labels on the right hand side - .tickFormat(d3.format("0e")) - .tickSubdivide(true); // display ticks between text labels - - // create the SVG - var svg = d3.select("body").append("svg:svg") - .attr("width", w) - .attr("height", h); - - // Create axes - svg.append("svg:g") - .attr("class","x axis") - .call(xAxis); - - svg.append("svg:g") - .attr("class","y axis") - .attr("transform", "translate(" + (MARGINS.left) + ",0)") - .call(yAxis); - - svg.append("svg:line") - .attr("x1","50") - .attr("x2","950") - .attr("y1",y(avg)) - .attr("y2",y(avg)) - .style("stroke","red") - .attr("style","stroke-dasharray:2 2; stroke:red") - ; - - var colors = ["black","blue","green","cyan","red","orange","yellow"]; - - - // split the data into 7 data sets (1 per day) - var dat = putToBuckets(jsondata,7,now); - - // loop over the buckets and create the graph - for (day = 0 ; day < 7 ; day ++ ) { - var daydat = dat[day]; - // Now lets "loop" over the data of a bucket and show the lines and dots - var lines = svg.append("svg:g").attr("class","linechart") - .attr("opacity","1"); - - var dayMinTs = startTime + day * (86400*1000); - - var line = d3.svg.line() - .x(function(d,i) { return x(d.timeStamp-dayMinTs); }) - .y(function(d) { return y(d.value); }); - lines.append("svg:path") - .attr("d", line(daydat)) - .style("stroke",colors[day]); - - - var dot = svg.append("svg:g").attr("class","dotschart") - .selectAll("dot").data(jsondata); - - dot.enter().append("svg:circle") - .attr("cx", function (d) { - return x(d.timeStamp-dayMinTs); - }) - .attr("cy", function (d) { - return y(d.value); - }) - .style("stroke", colors[day]) - .attr("r", 1); - - } - }); - }) -}) - -function transitionDots() { - $(".linechart").attr("opacity",0); - $(".dotschart").attr("opacity",1); -} - -function transitionLine() { - $(".linechart").attr("opacity",1); - $(".dotschart").attr("opacity",0); -} -function transitionBoth() { - $(".linechart").attr("opacity",1); - $(".dotschart").attr("opacity",1); -} - -// put the data in d into n buckets -function putToBuckets(data,n,now) { - - var band = d3.extent(data,function(d){ return d.timeStamp;}); - var bs = 86400*1000; - var start = now - n * bs; - - var dat = new Array(n); - for (i = 0; i < n ; i++ ) { - dat[i]=new Array(); - } - - data.forEach(function (d) { - var diff = d.timeStamp-start; - var bucket = parseInt(diff / bs); -// console.log(d.timeStamp + ", " + diff + " buck : " + bucket); - dat[bucket].push(d); - }); - - return dat; -} - - </script> - </body> -</html> diff --git a/modules/enterprise/gui/rest-war/src/main/webapp/stacked1.html b/modules/enterprise/gui/rest-war/src/main/webapp/stacked1.html deleted file mode 100644 index 9413b70..0000000 --- a/modules/enterprise/gui/rest-war/src/main/webapp/stacked1.html +++ /dev/null @@ -1,145 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <title>Stacked metrics (free mem, schedule 10003)</title> - <script type="text/javascript" src="js/d3.js"></script> - <script type="text/javascript" src="js/d3.layout.js"></script> - <script type="text/javascript" src="js/d3.time.js"></script> - <script type="text/javascript" src="js/jquery.js"></script> - <style type="text/css"> - -svg { - width: 960px; - height: 500px; - border: solid 1px #ccc; - font: 10px sans-serif; - shape-rendering: crispEdges; -} - - </style> - </head> - <body> - - -<h1 id="resId">Resource</h1> -Upper edge of green is low, upper edge of blue is the value and upper edge of pink is high. -<br/> -<h2 id="header">Schedule</h2> - <script type="text/javascript"> - -// Get the platforms and then the first one -$.getJSON('/rest/1/resource/platforms.json', function (json) { - var res = json[0]; - var rid = res.resourceId; - $("#resId").text("Resource " + rid + " (" + res.resourceName + ")"); - - // Now get the metrical schedules of the platform - $.getJSON("/rest/1/resource/"+rid+"/schedules.json?type=metric", function (json2) { - - // Take the first - var schId = json2[0].scheduleId; - $("#header").text("Schedule " + schId + " (" + json2[0].scheduleName + ")"); - - // And call d3 graphing on it - d3.json( - '/rest/1/metric/data/'+schId+'.json', - function (jsondata) { - - var w = 960, - h = 500, - p = [20, 50, 30, 20], - x = d3.scale.ordinal().rangeRoundBands([0, w - p[1] - p[3]]), - y = d3.scale.linear().range([0, h - p[0] - p[2]]), - z = d3.scale.ordinal().range(["lightgreen", "darkblue", "lightpink"]), - format = d3.time.format("%H:%M"); - - var svg = d3.select("body").append("svg:svg") - .attr("width", w) - .attr("height", h) - .append("svg:g") - .attr("transform", "translate(" + p[3] + "," + (h - p[2]) + ")"); - - - var points = jsondata.dataPoints; - var min = jsondata.min; - var max = jsondata.max; - - var metrics = d3.layout.stack()(["low","value","high"].map(function (point) { - return points.map(function (d) { - var tmp; - if (point == "low") - tmp = d["low"] - min; - if (point == "value") { - var va = d["value"]; - var lo = d["low"]; - tmp = va-lo; - } - if (point == "high") - tmp = (d["high"]-d["value"]); - - if (tmp < 0 ) { - console.log(point); - tmp=0; - } - - return {x: new Date(d.timeStamp), y: tmp}; - }); - })); - - console.log(metrics); - - - // Compute the x-domain (by date) and y-domain (by top). - x.domain(metrics[0].map(function(d) { return d.x; })); - y.domain([0, d3.max(metrics[metrics.length - 1], function(d) { return d.y0 + d.y; })]); - - // Add a group for each cause. - var cause = svg.selectAll("g.cause") - .data(metrics) - .enter().append("svg:g") - .attr("class", "cause") - .style("fill", function(d, i) { return z(i); }) - .style("stroke", function(d, i) { return d3.rgb(z(i)).darker(); }); - - // Add a rect for each date. - var rect = cause.selectAll("rect") - .data(Object) - .enter().append("svg:rect") - .attr("x", function(d) { return x(d.x); }) - .attr("y", function(d) { return -y(d.y0) - y(d.y); }) - .attr("height", function(d) { return y(d.y); }) - .attr("width", x.rangeBand()); - - // Add a label per date. - var label = svg.selectAll("text") - .data(x.domain()) - .enter().append("svg:text") - .attr("x", function(d) { return x(d) + x.rangeBand() / 2; }) - .attr("y", 6) - .attr("text-anchor", "middle") - .attr("dy", ".71em") - .text(format); - - // Add y-axis rules. - var rule = svg.selectAll("g.rule") - .data(y.ticks(5)) - .enter().append("svg:g") - .attr("class", "rule") - .attr("transform", function(d) { return "translate(0," + -y(d) + ")"; }); - - rule.append("svg:line") - .attr("x2", w - p[1] - p[3]) - .style("stroke", function(d) { return d ? "#fff" : "#000"; }) - .style("stroke-opacity", function(d) { return d ? .7 : null; }); - - rule.append("svg:text") - .attr("x", w - p[1] - p[3] + 6) - .attr("dy", ".35em") - .text(d3.format(",d")); -}); - }); -}); - - </script> - </body> -</html> \ No newline at end of file diff --git a/modules/enterprise/gui/rest-war/src/main/webapp/stacked2.html b/modules/enterprise/gui/rest-war/src/main/webapp/stacked2.html deleted file mode 100644 index e622f2c..0000000 --- a/modules/enterprise/gui/rest-war/src/main/webapp/stacked2.html +++ /dev/null @@ -1,139 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <title>Stacked metrics (free mem, schedule 10003)</title> - <script type="text/javascript" src="js/d3.js"></script> - <script type="text/javascript" src="js/d3.layout.js"></script> - <script type="text/javascript" src="js/d3.time.js"></script> - <script type="text/javascript" src="js/jquery.js"></script> - <style type="text/css"> - -svg { - width: 960px; - height: 500px; - border: solid 1px #ccc; - font: 10px sans-serif; - shape-rendering: crispEdges; -} - - </style> - </head> - <body> - <h1 id="resId">Resource</h1> - Upper edge of green is low, upper edge of blue is the value and upper edge of pink is high. - <br/> - <h2 id="header">Schedule</h2> - <script type="text/javascript"> - -var w = 960, - h = 500, - p = [20, 50, 30, 20], - x = d3.scale.ordinal().rangeRoundBands([0, w - p[1] - p[3]]), - y = d3.scale.linear().range([0, h - p[0] - p[2]]), - z = d3.scale.ordinal().range(["lightgreen", "darkblue", "lightpink"]), - format = d3.time.format("%H:%M"); - -var svg = d3.select("body").append("svg:svg") - .attr("width", w) - .attr("height", h) - .append("svg:g") - .attr("transform", "translate(" + p[3] + "," + (h - p[2]) + ")"); - -// Get the platforms and then the first one -$.getJSON('/rest/1/resource/platforms.json', function (json) { - var res = json[0]; - var rid = res.resourceId; - $("#resId").text("Resource " + rid + " (" + res.resourceName + ")"); - - // Now get the metrical schedules of the platform - $.getJSON("/rest/1/resource/"+rid+"/schedules.json?type=metric", function (json2) { - - // Take the first - var schId = json2[0].scheduleId; - $("#header").text("Schedule " + schId + " (" + json2[0].scheduleName + ")"); - - // And call d3 graphing on it - d3.json( - '/rest/1/metric/data/'+schId+'.json', - function (jsondata) { - - var points = jsondata.dataPoints; - var min = jsondata.min; - var max = jsondata.max; - - var metrics = d3.layout.stack()(["low","value","high"].map(function (point) { - return points.map(function (d) { - var tmp; - if (point == "low") - tmp = d["low"] - min; - if (point == "value") { - var va = d["value"]; - var lo = d["low"]; - tmp = va-lo; - } - if (point == "high") - tmp = (d["high"]-d["value"]); - - if (tmp < 0 ) { - tmp=0; - } - - return {x: new Date(d.timeStamp), y: tmp}; - }); - })); - - - // Compute the x-domain (by date) and y-domain (by top). - x.domain(metrics[0].map(function(d) { return d.x; })); - y.domain([0, d3.max(metrics[metrics.length - 1], function(d) { return d.y0 + d.y; })]); - - // Add a group for each cause. - var cause = svg.selectAll("g.cause") - .data(metrics) - .enter().append("svg:g") - .attr("class", "cause") - .style("fill", function(d, i) { return z(i); }) - .style("stroke", function(d, i) { return d3.rgb(z(i)).darker(); }); - - // Add a rect for each date. - var rect = cause.selectAll("rect") - .data(Object) - .enter().append("svg:rect") - .attr("x", function(d) { return x(d.x); }) - .attr("y", function(d) { return -y(d.y0) - y(d.y); }) - .attr("height", function(d) { return 5; }) // <<<--- HERE - .attr("width", x.rangeBand()); - - // Add a label per date. - var label = svg.selectAll("text") - .data(x.domain()) - .enter().append("svg:text") - .attr("x", function(d) { return x(d) + x.rangeBand() / 2; }) - .attr("y", 6) - .attr("text-anchor", "middle") - .attr("dy", ".71em") - .text(format); - - // Add y-axis rules. - var rule = svg.selectAll("g.rule") - .data(y.ticks(5)) - .enter().append("svg:g") - .attr("class", "rule") - .attr("transform", function(d) { return "translate(0," + -y(d) + ")"; }); - - rule.append("svg:line") - .attr("x2", w - p[1] - p[3]) - .style("stroke", function(d) { return d ? "#fff" : "#000"; }) - .style("stroke-opacity", function(d) { return d ? .7 : null; }); - - rule.append("svg:text") - .attr("x", w - p[1] - p[3] + 6) - .attr("dy", ".35em") - .text(d3.format(",d")); - }); - - }) -}) - </script> - </body> -</html> \ No newline at end of file diff --git a/modules/enterprise/gui/rest-war/src/main/webapp/stacked3.html b/modules/enterprise/gui/rest-war/src/main/webapp/stacked3.html deleted file mode 100644 index 108d859..0000000 --- a/modules/enterprise/gui/rest-war/src/main/webapp/stacked3.html +++ /dev/null @@ -1,95 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <title>Stacked metrics (free mem, schedule 10003)</title> - <script type="text/javascript" src="js/d3.js"></script> - <script type="text/javascript" src="js/d3.layout.js"></script> - <script type="text/javascript" src="js/d3.time.js"></script> - <script type="text/javascript" src="js/jquery.js"></script> - <style type="text/css"> - - -div.bar { - display: inline-block; - width: 20px; - height: 2px; /* for NaN entries */ -} - - </style> - </head> - <body> - - -<h1 id="resId">Resource</h1> -Those bars show the average value during the respective time slot. Scale is from -min-value to max value. Mouseover the bar to see the actual value. -<br/> -<h2 id="header">Schedule</h2> -<table> - <tr> - <td>Minimum:</td><td id="minval"></td> - </tr> - <tr> - <td>Maximum:</td><td id="maxval"></td> - </tr> -</table> -Value: <span id="currval"></span> -<br/> -<div id="graph"></div> - <script type="text/javascript"> - - // Get the platforms and then the first one - $.getJSON('/rest/1/resource/platforms.json', function (json) { - var res = json[0]; - var rid = res.resourceId; - $("#resId").text("Resource " + rid + " (" + res.resourceName + ")"); - - // Now get the metrical schedules of the platform - $.getJSON("/rest/1/resource/" + rid + "/schedules.json?type=metric", function (json2) { - - // Take the first - var schId = json2[0].scheduleId; - $("#header").text("Schedule " + schId + " (" + json2[0].scheduleName + ")"); - - // And call d3 graphing on it - d3.json('/rest/1/metric/data/' + schId + '.json', - function (jsondata) { - - var theDiv = d3.select("div#graph"); - - var points = jsondata.dataPoints; - var min = jsondata.min; - var max = jsondata.max; - - d3.select("td#minval").text(min); - d3.select("td#maxval").text(max); - - y = d3.scale.linear().range([0, 400]).domain([min,max]); - - // Add a group for each cause. - var bar = theDiv.selectAll("div") - .data(points) - .enter().append("div") - .attr("class", "bar") - .style("background-color","lightblue") - .style("width","10px") - .style("margin-right", "2px") - .style("height", - function (d) { - return (y(d.value) + "px"); - }) - .on('mouseover',function(d){ - d3.select("#currval").append('text') - .text(d.value) - .attr('class','tip'); - }) - .on('mouseout',function(d) { - d3.selectAll(".tip").remove(); - }) - ; - }); - }); - }); - </script> - </body> -</html> \ No newline at end of file diff --git a/modules/enterprise/gui/rest-war/src/main/webapp/tree.html b/modules/enterprise/gui/rest-war/src/main/webapp/tree.html deleted file mode 100644 index 8f89993..0000000 --- a/modules/enterprise/gui/rest-war/src/main/webapp/tree.html +++ /dev/null @@ -1,44 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <title>Resource tree</title> - <script type="text/javascript" src="js/d3.js"></script> - <script type="text/javascript" src="js/d3.layout.js"></script> - <script type="text/javascript" src="js/resource_tree.js"></script> - <style type="text/css"> - -body { - font: 10px sans-serif; -} - -/* -svg { - shape-rendering: crispEdges; -} -*/ -.node circle { - fill: #fff; - stroke: steelblue; - stroke-width: 1.5px; -} - -.node { - font: 10px sans-serif; -} - -.link { - fill: none; - stroke: #ccc; - stroke-width: 1.5px; -} - - </style> -</head> -<body> - <h2>Resource tree of resource with id 10001</h2> - - <div class='gallery' id='chart'></div> - - <script>resourceTree(10001,'chart')</script> - </body> -</html> diff --git a/modules/enterprise/gui/rest-war/src/main/webapp/whisker.html b/modules/enterprise/gui/rest-war/src/main/webapp/whisker.html deleted file mode 100644 index 2b03349..0000000 --- a/modules/enterprise/gui/rest-war/src/main/webapp/whisker.html +++ /dev/null @@ -1,53 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <title>(free mem, schedule 10003)</title> - <script type="text/javascript" src="js/d3.js"></script> - <script type="text/javascript" src="js/d3.layout.js"></script> - <script type="text/javascript" src="js/d3.time.js"></script> - <script type="text/javascript" src="js/jquery.js"></script> - <script type="text/javascript" src="js/rhq.js"></script> - <style type="text/css"> - -svg { - width: 800px; - height: 600px; - border: solid 1px #ccc; - font: 10px sans-serif; - shape-rendering: crispEdges; -} - - </style> - </head> - <body> - <h1 id="resId">Resource</h1> - <h2 id="header">Schedule</h2> - - <div id="one"></div> - <script type="text/javascript"> - -// Width and height of the chart to print -var w = 800, - h = 600; - -// Get the platforms and then the first one -$.getJSON('/rest/1/resource/platforms.json', function (json) { - var res = json[0]; - var rid = res.resourceId; - $("#resId").text("Resource " + rid + " (" + res.resourceName + ")"); - - // Now get the metrical schedules of the platform - $.getJSON("/rest/1/resource/"+rid+"/schedules.json?type=metric", function (json2) { - - // Take the first and render it - var schId = json2[0].scheduleId; - $("#header").text("Schedule " + schId + " (" + json2[0].scheduleName + ")"); - rhq.whisker(schId,"one",w,h); - }) -}) - - - - </script> - </body> -</html> \ No newline at end of file diff --git a/modules/enterprise/gui/rest-war/src/main/webapp/whisker2.html b/modules/enterprise/gui/rest-war/src/main/webapp/whisker2.html deleted file mode 100644 index 67340d5..0000000 --- a/modules/enterprise/gui/rest-war/src/main/webapp/whisker2.html +++ /dev/null @@ -1,35 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <title>Dashboard</title> - <script type="text/javascript" src="js/d3.js"></script> - <script type="text/javascript" src="js/d3.layout.js"></script> - <script type="text/javascript" src="js/d3.time.js"></script> - <script type="text/javascript" src="js/jquery.js"></script> - <script type="text/javascript" src="js/rhq.js"></script> - - <style type="text/css"> - -svg { - width: 182px; - height: 92px; - border: solid 1px #ccc; - font: 10px sans-serif; - shape-rendering: crispEdges; -} - - </style> - </head> - <body> - <h2>Dashboard</h2> -<script> - $(document).ready(function() { - rhq.dashboard(); - }) -</script> - <table id="table"> - </table> - - - </body> -</html> diff --git a/modules/enterprise/server/ear/pom.xml b/modules/enterprise/server/ear/pom.xml index add3d06..596b91c 100644 --- a/modules/enterprise/server/ear/pom.xml +++ b/modules/enterprise/server/ear/pom.xml @@ -62,6 +62,13 @@
<dependency> <groupId>${project.groupId}</groupId> + <artifactId>rhq-rest-examples</artifactId> + <version>${project.version}</version> + <type>war</type> + </dependency> + + <dependency> + <groupId>${project.groupId}</groupId> <artifactId>rhq-content_http</artifactId> <version>${project.version}</version> <type>war</type> @@ -97,7 +104,7 @@ <exclusion> <groupId>javassist</groupId> <artifactId>javassist</artifactId> - </exclusion> + </exclusion> <exclusion> <groupId>org.javassist</groupId> <artifactId>javassist</artifactId> @@ -270,6 +277,13 @@ <contextRoot>/rest</contextRoot> </webModule>
+ <webModule> + <groupId>${project.groupId}</groupId> + <artifactId>rhq-rest-examples</artifactId> + <bundleFileName>rhq-rest-examples.war</bundleFileName> + <contextRoot>/rest-examples</contextRoot> + </webModule> + <!-- ** EJB-JARs --> <ejbModule> <groupId>${project.groupId}</groupId> @@ -530,16 +544,16 @@ <property> <!-- we want this always active but activeByDefault doesn't work --> <!-- see http://maven.apache.org/guides/introduction/introduction-to-profiles.html --> - <name>java.home</name> + <name>java.home</name> </property> </activation> - + <dependencies> <dependency> <groupId>org.rhq</groupId> <artifactId>rhq-scripting-python</artifactId> <version>${project.version}</version> - </dependency> + </dependency> </dependencies> </profile>
@@ -950,7 +964,7 @@
<activation> <file> - <!-- TODO(jshaughn): if and when maven allows for non-local property substitution use it. --> + <!-- TODO(jshaughn): if and when maven allows for non-local property substitution use it. --> <missing>../../../../dev-container/jbossas/standalone/deployments/rhq.ear.skipdeploy</missing> </file> </activation> @@ -967,7 +981,7 @@ <phase>package</phase> <configuration> <target> - <property name="deployment.dir" location="${rhq.deploymentDir}" /> + <property name="deployment.dir" location="${rhq.deploymentDir}" /> <property name="dodeploy.file" location="${deployment.dir}.dodeploy" /> <echo>*** Touching ${dodeploy.file} to force redeployment of ${rhq.deploymentName}</echo> <touch file="${dodeploy.file}" /> diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertHandlerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertHandlerBean.java index 074199c..9e3b41a 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertHandlerBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertHandlerBean.java @@ -1,6 +1,6 @@ /* * RHQ Management Platform - * Copyright (C) 2005-2011 Red Hat, Inc. + * Copyright (C) 2005-2012 Red Hat, Inc. * All rights reserved. * * This program is free software; you can redistribute it and/or modify @@ -26,6 +26,15 @@ import java.util.Set; import javax.ejb.EJB; import javax.ejb.Stateless; import javax.interceptor.Interceptors; +import javax.ws.rs.DELETE; +import javax.ws.rs.DefaultValue; +import javax.ws.rs.GET; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.Context; import javax.ws.rs.core.EntityTag; import javax.ws.rs.core.GenericEntity; import javax.ws.rs.core.HttpHeaders; @@ -35,6 +44,13 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.UriBuilder; import javax.ws.rs.core.UriInfo;
+import com.wordnik.swagger.annotations.Api; +import com.wordnik.swagger.annotations.ApiOperation; +import com.wordnik.swagger.annotations.ApiParam; + +import org.jboss.resteasy.annotations.GZIP; +import org.jboss.resteasy.annotations.cache.Cache; + import org.rhq.core.domain.alert.Alert; import org.rhq.core.domain.alert.AlertCondition; import org.rhq.core.domain.alert.AlertConditionLog; @@ -56,9 +72,12 @@ import org.rhq.enterprise.server.rest.domain.*; * Deal with alert related stuff * @author Heiko W. Rupp */ +@Produces({"application/json","application/xml","text/plain"}) +@Path("/alert") +@Api(value = "Deal with Alerts",description = "This api deals with alerts that have fired. It does not offer to create/update AlertDefinitions (yet)") @Stateless @Interceptors(SetCallerInterceptor.class) -public class AlertHandlerBean extends AbstractRestBean implements AlertHandlerLocal { +public class AlertHandlerBean extends AbstractRestBean {
// private final Log log = LogFactory.getLog(AlertHandlerBean.class);
@@ -69,10 +88,20 @@ public class AlertHandlerBean extends AbstractRestBean implements AlertHandlerLo AlertDefinitionManagerLocal alertDefinitionManager;
- @Override - public Response listAlerts(int page, String prio, boolean slim, Long since, Integer resourceId, Request request, - UriInfo uriInfo, - HttpHeaders headers) { + @GZIP + @GET + @Path("/") + @ApiOperation(value = "List all alerts", multiValueResponse = true, responseClass = "List<AlertRest>") + public Response listAlerts( + @ApiParam(value = "Page number", defaultValue = "0") @QueryParam("page") int page, + @ApiParam(value = "Limit to priority", allowableValues = "High, Medium, Low, All") @DefaultValue("All") @QueryParam("prio") String prio, + @ApiParam(value = "Should full resources and definitions be sent") @QueryParam("slim") @DefaultValue( + "false") boolean slim, + @ApiParam( + value = "If non-null only send alerts that have fired after this time, time is millisecond since epoch") + @QueryParam("since") Long since, + @ApiParam(value = "Id of a resource to limit search for") @QueryParam("resourceId") Integer resourceId, + @Context Request request, @Context UriInfo uriInfo, @Context HttpHeaders headers) {
AlertCriteria criteria = new AlertCriteria(); @@ -111,8 +140,11 @@ public class AlertHandlerBean extends AbstractRestBean implements AlertHandlerLo return builder.build(); }
- @Override - public int countAlerts(Long since) { + @GET + @Path("count") + @ApiOperation("Return a count of alerts in the system depending on criteria") + public int countAlerts(@ApiParam(value = "If non-null only send alerts that have fired after this time, time is millisecond since epoch") + @QueryParam("since") Long since) { AlertCriteria criteria = new AlertCriteria(); criteria.setPageControl(PageControl.getUnlimitedInstance()); criteria.fetchAlertDefinition(false); @@ -129,8 +161,14 @@ public class AlertHandlerBean extends AbstractRestBean implements AlertHandlerLo return count; }
- @Override - public Response getAlert(int id, boolean slim, UriInfo uriInfo, Request request, HttpHeaders headers) { + @GET + @Cache(maxAge = 60) + @Path("/{id}") + @ApiOperation(value = "Get one alert with the passed id", responseClass = "AlertRest") + public Response getAlert( + @ApiParam("Id of the alert to retrieve") @PathParam("id") int id, + @ApiParam(value = "Should full resources and definitions be sent") @QueryParam("slim") @DefaultValue("false") boolean slim, + @Context UriInfo uriInfo, @Context Request request, @Context HttpHeaders headers) {
Alert al = findAlertWithId(id); MediaType type = headers.getAcceptableMediaTypes().get(0); @@ -150,8 +188,12 @@ public class AlertHandlerBean extends AbstractRestBean implements AlertHandlerLo return builder.build(); }
- @Override - public Response getConditionLogs(int id, Request request, UriInfo uriInfo, HttpHeaders headers) { + @GET + @Path("/{id}/conditions") + @Cache(maxAge = 300) + @ApiOperation(value = "Return the notification logs for the given alert") + public Response getConditionLogs(@ApiParam("Id of the alert to retrieve") @PathParam("id") int id, + @Context Request request, @Context UriInfo uriInfo, @Context HttpHeaders headers) {
Alert al = findAlertWithId(id); Set<AlertConditionLog> conditions = al.getConditionLogs(); @@ -190,8 +232,12 @@ public class AlertHandlerBean extends AbstractRestBean implements AlertHandlerLo
}
- @Override - public Response getNotificationLogs(int id, Request request, UriInfo uriInfo, HttpHeaders headers) { + @GET + @Path("/{id}/notifications") + @Cache(maxAge = 60) + @ApiOperation(value = "Return the notification logs for the given alert") + public Response getNotificationLogs(@ApiParam("Id of the alert to retrieve") @PathParam("id") int id, + @Context Request request, @Context UriInfo uriInfo, @Context HttpHeaders headers) { Alert al = findAlertWithId(id); MediaType type = headers.getAcceptableMediaTypes().get(0); Response.ResponseBuilder builder; @@ -223,8 +269,10 @@ public class AlertHandlerBean extends AbstractRestBean implements AlertHandlerLo return builder.build(); }
- @Override - public AlertRest ackAlert(int id, UriInfo uriInfo) { + @PUT + @Path("/{id}") + @ApiOperation(value = "Mark the alert as acknowledged (by the caller)", notes = "Returns a slim version of the alert") + public AlertRest ackAlert(@ApiParam(value = "Id of the alert to acknowledge") @PathParam("id") int id, @Context UriInfo uriInfo) { findAlertWithId(id); // Ensure the alert exists int count = alertManager.acknowledgeAlerts(caller,new int[]{id});
@@ -235,22 +283,32 @@ public class AlertHandlerBean extends AbstractRestBean implements AlertHandlerLo return ar; }
- @Override - public void purgeAlert(int id) { + @DELETE + @Path("/{id}") + @ApiOperation(value = "Remove the alert from the lit of alerts") + public void purgeAlert(@ApiParam(value = "Id of the alert to remove") @PathParam("id") int id) { alertManager.deleteAlerts(caller, new int[]{id});
}
- @Override - public AlertDefinitionRest getDefinitionForAlert(int alertId) { + @GET + @Cache(maxAge = 300) + @Path("/{id}/definition") + @ApiOperation("Get the alert definition (basics) for the alert") + public AlertDefinitionRest getDefinitionForAlert(@ApiParam("Id of the alert to show the definition") @PathParam("id") int alertId) { Alert al = findAlertWithId(alertId); AlertDefinition def = al.getAlertDefinition(); AlertDefinitionRest ret = definitionToDomain(def); return ret; }
- @Override - public List<AlertDefinitionRest> listAlertDefinitions(int page, String status) { + @GZIP + @GET + @Path("/definition") + @ApiOperation("List all Alert Definition") + public List<AlertDefinitionRest> listAlertDefinitions( + @ApiParam(value = "Page number", defaultValue = "0") @QueryParam("page") int page, + @ApiParam(value = "Limit to status, UNUSED AT THE MOMENT ") @QueryParam("status") String status) {
AlertDefinitionCriteria criteria = new AlertDefinitionCriteria(); criteria.setPaging(page,20); // TODO add link to next page @@ -263,8 +321,11 @@ public class AlertHandlerBean extends AbstractRestBean implements AlertHandlerLo return ret; }
- @Override - public Response getAlertDefinition(int definitionId, Request request) { + @GET + @Path("/definition/{id}") + @ApiOperation(value = "Get one AlertDefinition by id", responseClass = "AlertDefinitionRest") + public Response getAlertDefinition(@ApiParam("Id of the alert definition to retrieve") @PathParam("id") int definitionId, + @Context Request request) {
AlertDefinition def = alertDefinitionManager.getAlertDefinition(caller,definitionId); if (def==null) @@ -281,8 +342,12 @@ public class AlertHandlerBean extends AbstractRestBean implements AlertHandlerLo return builder.build(); }
- @Override - public Response updateDefinition(int definitionId, AlertDefinitionRest definitionRest, Request request) { + @PUT + @Path("/definition/{id}") + @ApiOperation(value = "Update the alert definition (priority, enablement)", notes = "Priority must be HIGH,LOW,MEDIUM") + public Response updateDefinition( + @ApiParam("Id of the alert definition to update") @PathParam("id") int definitionId, + AlertDefinitionRest definitionRest) { AlertDefinition def = alertDefinitionManager.getAlertDefinition(caller,definitionId); if (def==null) throw new StuffNotFoundException("AlertDefinition with id " + definitionId); diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertHandlerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertHandlerLocal.java deleted file mode 100644 index 5ee68f4..0000000 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertHandlerLocal.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2011 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.rest; - -import java.util.List; - -import javax.ejb.Local; -import javax.ws.rs.DELETE; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.Request; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriInfo; - -import com.wordnik.swagger.annotations.Api; -import com.wordnik.swagger.annotations.ApiOperation; -import com.wordnik.swagger.annotations.ApiParam; - -import org.jboss.resteasy.annotations.GZIP; -import org.jboss.resteasy.annotations.cache.Cache; - -import org.rhq.enterprise.server.rest.domain.AlertRest; -import org.rhq.enterprise.server.rest.domain.AlertDefinitionRest; - -/** - * Deal with Alerts - * @author Heiko W. Rupp - */ -@Produces({"application/json","application/xml","text/plain"}) -@Local -@Path("/alert") -@Api(value = "Deal with Alerts",description = "This api deals with alerts that have fired. It does not offer to create/update AlertDefinitions (yet)") -public interface AlertHandlerLocal { - - @GZIP - @GET - @Path("/") - @ApiOperation(value = "List all alerts", multiValueResponse = true, responseClass = "List<AlertRest>") - Response listAlerts( - @ApiParam(value = "Page number", defaultValue = "0") @QueryParam("page") int page, - @ApiParam(value = "Limit to priority", allowableValues = "High, Medium, Low, All") @DefaultValue("All") @QueryParam("prio") String prio, - @ApiParam(value = "Should full resources and definitions be sent") @QueryParam("slim") @DefaultValue( - "false") boolean slim, - @ApiParam( - value = "If non-null only send alerts that have fired after this time, time is millisecond since epoch") - @QueryParam("since") Long since, - @ApiParam(value = "Id of a resource to limit search for") @QueryParam("resourceId") Integer resourceId, - @Context Request request, @Context UriInfo uriInfo, @Context HttpHeaders headers); - - @GET - @Path("count") - @ApiOperation("Return a count of alerts in the system depending on criteria") - int countAlerts(@ApiParam(value = "If non-null only send alerts that have fired after this time, time is millisecond since epoch") - @QueryParam("since") Long since); - - @GET - @Cache(maxAge = 60) - @Path("/{id}") - @ApiOperation(value = "Get one alert with the passed id", responseClass = "AlertRest") - Response getAlert( - @ApiParam("Id of the alert to retrieve") @PathParam("id") int id, - @ApiParam(value = "Should full resources and definitions be sent") @QueryParam("slim") @DefaultValue("false") boolean slim, - @Context UriInfo uriInfo, @Context Request request, @Context HttpHeaders headers); - - @GET - @Path("/{id}/conditions") - @Cache(maxAge = 300) - @ApiOperation(value = "Return the notification logs for the given alert") - Response getConditionLogs(@ApiParam("Id of the alert to retrieve") @PathParam("id") int id, - @Context Request request, @Context UriInfo uriInfo, @Context HttpHeaders headers); - - @GET - @Path("/{id}/notifications") - @Cache(maxAge = 60) - @ApiOperation(value = "Return the notification logs for the given alert") - Response getNotificationLogs(@ApiParam("Id of the alert to retrieve") @PathParam("id") int id, - @Context Request request, @Context UriInfo uriInfo, @Context HttpHeaders headers); - - @PUT - @Path("/{id}") - @ApiOperation(value = "Mark the alert as acknowledged (by the caller)", notes = "Returns a slim version of the alert") - AlertRest ackAlert( - @ApiParam(value = "Id of the alert to acknowledge") @PathParam("id") int id, @Context UriInfo uriInfo); - - @DELETE - @Path("/{id}") - @ApiOperation(value = "Remove the alert from the lit of alerts") - void purgeAlert( - @ApiParam(value = "Id of the alert to remove") @PathParam("id") int id); - - @GET - @Cache(maxAge = 300) - @Path("/{id}/definition") - @ApiOperation("Get the alert definition (basics) for the alert") - AlertDefinitionRest getDefinitionForAlert(@ApiParam("Id of the alert to show the definition") @PathParam("id") int alertId); - - - @GZIP - @GET - @Path("/definition") - @ApiOperation("List all Alert Definition") - List<AlertDefinitionRest> listAlertDefinitions( - @ApiParam(value = "Page number", defaultValue = "0") @QueryParam("page") int page, - @ApiParam(value = "Limit to status, UNUSED AT THE MOMENT ") @QueryParam("status") String status); - - @GET - @Path("/definition/{id}") - @ApiOperation(value = "Get one AlertDefinition by id", responseClass = "AlertDefinitionRest") - Response getAlertDefinition(@ApiParam("Id of the alert definition to retrieve") @PathParam("id") int definitionId, - @Context Request request); - - @PUT - @Path("/definition/{id}") - @ApiOperation(value = "Update the alert definition (priority, enablement)", notes = "Priority must be HIGH,LOW,MEDIUM") - Response updateDefinition(@ApiParam("Id of the alert definition to update") @PathParam("id") int definitionId, - AlertDefinitionRest definition, @Context Request request); -} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/EventHandlerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/EventHandlerBean.java index e189c34..ad1b7b0 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/EventHandlerBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/EventHandlerBean.java @@ -32,12 +32,26 @@ import javax.interceptor.Interceptors; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.Query; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.Context; import javax.ws.rs.core.GenericEntity; import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Request; import javax.ws.rs.core.Response;
+import com.wordnik.swagger.annotations.Api; +import com.wordnik.swagger.annotations.ApiOperation; +import com.wordnik.swagger.annotations.ApiParam; + +import org.jboss.resteasy.annotations.GZIP; + import org.rhq.core.domain.criteria.EventCriteria; import org.rhq.core.domain.event.Event; import org.rhq.core.domain.event.EventDefinition; @@ -55,9 +69,12 @@ import org.rhq.enterprise.server.rest.domain.EventSourceRest; * Handle event related things * @author Heiko W. Rupp */ +@Path("/event") +@Api("Api that deals with Events (e.g snmp traps, logfile lines)") +@Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML,MediaType.TEXT_HTML}) @Stateless @Interceptors(SetCallerInterceptor.class) -public class EventHandlerBean extends AbstractRestBean implements EventHandlerLocal { +public class EventHandlerBean extends AbstractRestBean {
@EJB EventManagerLocal eventManager; @@ -65,9 +82,12 @@ public class EventHandlerBean extends AbstractRestBean implements EventHandlerLo @PersistenceContext(unitName = RHQConstants.PERSISTENCE_UNIT_NAME) EntityManager em;
- @Override - public Response listEventSourcesForResource( int resourceId, Request request, - HttpHeaders headers) { + @GET + @Path("/{id}/sources") + @ApiOperation(value = "List the defined event sources for the resource", responseClass = "EventSourceRest", multiValueResponse = true) + public Response listEventSourcesForResource(@ApiParam("id of the resource") @PathParam("id") int resourceId, + @Context Request request, + @Context HttpHeaders headers) {
Resource res = fetchResource(resourceId); Set<EventSource> eventSources = res.getEventSources(); @@ -91,8 +111,10 @@ public class EventHandlerBean extends AbstractRestBean implements EventHandlerLo return builder.build(); }
- @Override - public EventSourceRest getEventSource(int sourceId) { + @GET + @Path("/source/{id}") + @ApiOperation(value = "Retrieve the event source with the passed id", responseClass = "EventSourceRest") + public EventSourceRest getEventSource(@ApiParam("Id of the source to retrieve") @PathParam("id") int sourceId) {
EventSource source = findEventSourceById(sourceId); EventSourceRest esr = convertEventSource(source); @@ -100,7 +122,14 @@ public class EventHandlerBean extends AbstractRestBean implements EventHandlerLo return esr; }
- public EventSourceRest addEventSource(int resourceId, EventSourceRest esr) { + @POST + @Path("/{id}/sources") + @ApiOperation("Add a new event source for a resource. This can e.g. be a different logfile. " + + "The source.name must match an existing definition fo this resource. " + + "If an event source for the definition name and resource with the same location already exists, no new source is created. " + + "NOTE: An Event source added this way will not sow up in the connection properties.") + public EventSourceRest addEventSource(@ApiParam("id of the resource") @PathParam("id") int resourceId, + EventSourceRest esr) {
Resource resource = fetchResource(resourceId); ResourceType rt = resource.getResourceType(); @@ -136,8 +165,10 @@ public class EventHandlerBean extends AbstractRestBean implements EventHandlerLo return result; }
- @Override - public Response deleteEventSource(int sourceId) { + @DELETE + @Path("/source/{id}") + @ApiOperation(value = "Delete the event source with the passed id") + public Response deleteEventSource(@ApiParam("Id of the source to delete") @PathParam("id") int sourceId) {
EventSource source = findEventSourceById(sourceId); em.remove(source); // We have a cascade delete on the events TODO make operation async ? @@ -145,10 +176,17 @@ public class EventHandlerBean extends AbstractRestBean implements EventHandlerLo return Response.ok().build(); }
- @Override - public Response getEventsForSource(int sourceId, long startTime, - long endTime, String severity, Request request, - HttpHeaders headers) { + @GET @GZIP + @Path("/source/{id}/events") + @ApiOperation(value = "List the events for the event source with the passed id. If no time range is given, the last 200 entries will be displayed", + responseClass = "EventRest", multiValueResponse = true) + public Response getEventsForSource(@PathParam("id") int sourceId, + @QueryParam("startTime") long startTime, + @QueryParam("endTime") long endTime, + @ApiParam(value="Select the severity to display. Default is to show all", + allowableValues = "DEBUG, INFO, WARN, ERROR, FATAL") @QueryParam("severity") String severity, + @Context Request request, + @Context HttpHeaders headers) {
EventSource source = findEventSourceById(sourceId);
@@ -172,11 +210,16 @@ public class EventHandlerBean extends AbstractRestBean implements EventHandlerLo }
- @Override - public Response getEventsForResource(int resourceId, - long startTime, - long endTime, String severity, Request request, - HttpHeaders headers) { + @GET @GZIP + @Path("/{id}/events") + @ApiOperation(value="List the events for the resource with the passed id. If no time range is given, the last 200 entries will be displayed", + responseClass = "EventRest", multiValueResponse = true) + public Response getEventsForResource(@PathParam("id") int resourceId, + @QueryParam("startTime") long startTime, + @QueryParam("endTime") long endTime, + @QueryParam("severity") String severity, + @Context Request request, + @Context HttpHeaders headers) {
EventCriteria criteria = new EventCriteria(); criteria.addFilterResourceId(resourceId); @@ -198,7 +241,11 @@ public class EventHandlerBean extends AbstractRestBean implements EventHandlerLo
}
- public Response addEventsToSource(int sourceId, List<EventRest> eventRest) { + @POST + @Path("/source/{id}/events") + @ApiOperation("Submit multiple events for one given event source; the event source in the passed Events is ignored.") + public Response addEventsToSource(@ApiParam("Id of the source to add data to") @PathParam("id") int sourceId, + List<EventRest> eventRest) {
EventSource source = findEventSourceById(sourceId); Map<EventSource,Set<Event>> eventMap = new HashMap<EventSource, Set<Event>>(); diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/EventHandlerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/EventHandlerLocal.java deleted file mode 100644 index 276312a..0000000 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/EventHandlerLocal.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.rest; - -import java.util.List; - -import javax.ejb.Local; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Request; -import javax.ws.rs.core.Response; - -import com.wordnik.swagger.annotations.Api; -import com.wordnik.swagger.annotations.ApiOperation; -import com.wordnik.swagger.annotations.ApiParam; - -import org.jboss.resteasy.annotations.GZIP; - -import org.rhq.enterprise.server.rest.domain.EventRest; -import org.rhq.enterprise.server.rest.domain.EventSourceRest; - -/** - * Class that deals with events - * @author Heiko W. Rupp - */ -@Local -@Path("/event") -@Api("Api that deals with Events (e.g snmp traps, logfile lines)") -@Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML,MediaType.TEXT_HTML}) -public interface EventHandlerLocal { - - - - @GET - @Path("/{id}/sources") - @ApiOperation(value = "List the defined event sources for the resource", responseClass = "EventSourceRest", multiValueResponse = true) - Response listEventSourcesForResource( - @ApiParam("id of the resource") @PathParam("id") int resourceId, - @Context Request request, - @Context HttpHeaders headers); - - - - @POST - @Path("/{id}/sources") - @ApiOperation("Add a new event source for a resource. This can e.g. be a different logfile. " + - "The source.name must match an existing definition fo this resource. " + - "If an event source for the definition name and resource with the same location already exists, no new source is created. " + - "NOTE: An Event source added this way will not sow up in the connection properties.") - EventSourceRest addEventSource( - @ApiParam("id of the resource") @PathParam("id") int resourceId, - EventSourceRest source); - - @DELETE - @Path("/source/{id}") - @ApiOperation(value = "Delete the event source with the passed id") - Response deleteEventSource( - @ApiParam("Id of the source to delete") @PathParam("id") int sourceId); - - @GET - @Path("/source/{id}") - @ApiOperation(value = "Retrieve the event source with the passed id", responseClass = "EventSourceRest") - EventSourceRest getEventSource( - @ApiParam("Id of the source to retrieve") @PathParam("id") int sourceId); - - @POST - @Path("/source/{id}/events") - @ApiOperation("Submit multiple events for one given event source; the event source in the passed Events is ignored.") - Response addEventsToSource( - @ApiParam("Id of the source to add data to") @PathParam("id") int sourceId, List<EventRest> event); - - @GET @GZIP - @Path("/source/{id}/events") - @ApiOperation(value = "List the events for the event source with the passed id. If no time range is given, the last 200 entries will be displayed", - responseClass = "EventRest", multiValueResponse = true) - Response getEventsForSource(@PathParam("id") int sourceId, - @QueryParam("startTime") long startTime, - @QueryParam("endTime") long endTime, - @ApiParam(value="Select the severity to display. Default is to show all", - allowableValues = "DEBUG, INFO, WARN, ERROR, FATAL") @QueryParam("severity") String severity, - @Context Request request, - @Context HttpHeaders headers); - - @GET @GZIP - @Path("/{id}/events") - @ApiOperation(value="List the events for the resource with the passed id. If no time range is given, the last 200 entries will be displayed", - responseClass = "EventRest", multiValueResponse = true) - Response getEventsForResource(@PathParam("id") int resourceId, - @QueryParam("startTime") long startTime, - @QueryParam("endTime") long endTime, - @QueryParam("severity") String severity, - @Context Request request, - @Context HttpHeaders headers); - - -} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java index d051585..9f0ed9f 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java @@ -1,3 +1,21 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.rest;
import java.net.URI; @@ -9,18 +27,36 @@ import java.util.Set; import javax.ejb.EJB; import javax.ejb.Stateless; import javax.interceptor.Interceptors; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.DefaultValue; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; import javax.ws.rs.core.Context; import javax.ws.rs.core.GenericEntity; import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Request; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriBuilder; import javax.ws.rs.core.UriInfo;
+import com.wordnik.swagger.annotations.Api; +import com.wordnik.swagger.annotations.ApiError; +import com.wordnik.swagger.annotations.ApiErrors; +import com.wordnik.swagger.annotations.ApiOperation; +import com.wordnik.swagger.annotations.ApiParam; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory;
+import org.jboss.resteasy.annotations.GZIP; +import org.jboss.resteasy.annotations.cache.Cache; + import org.rhq.core.domain.criteria.ResourceGroupCriteria; import org.rhq.core.domain.criteria.ResourceGroupDefinitionCriteria; import org.rhq.core.domain.measurement.DataType; @@ -51,7 +87,10 @@ import org.rhq.enterprise.server.rest.domain.ResourceWithType; */ @Stateless @Interceptors(SetCallerInterceptor.class) -public class GroupHandlerBean extends AbstractRestBean implements GroupHandlerLocal { +@Path("/group") +@Api(value="Deal with groups and DynaGroups", description = "Api that deals with resource groups and group definitions") +@Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML,MediaType.TEXT_HTML, "application/yaml"}) +public class GroupHandlerBean extends AbstractRestBean {
private final Log log = LogFactory.getLog(GroupHandlerBean.class);
@@ -64,7 +103,12 @@ public class GroupHandlerBean extends AbstractRestBean implements GroupHandlerLo @EJB GroupDefinitionManagerLocal definitionManager;
- public Response getGroups(String q, @Context Request request, @Context HttpHeaders headers, @Context UriInfo uriInfo) { + @GZIP + @GET + @Path("/") + @ApiOperation(value = "List all groups", multiValueResponse = true) + public Response getGroups(@ApiParam("String to search in the group name") @QueryParam("q") String q, + @Context HttpHeaders headers, @Context UriInfo uriInfo) {
ResourceGroupCriteria criteria = new ResourceGroupCriteria(); if (q!=null) { @@ -92,8 +136,12 @@ public class GroupHandlerBean extends AbstractRestBean implements GroupHandlerLo
}
- @Override - public Response getGroup(int id, @Context Request request, @Context HttpHeaders headers, + @Cache(isPrivate = true,maxAge = 60) + @GET + @Path("{id}") + @ApiOperation(value = "Get the group with the passed id") + public Response getGroup(@ApiParam(value = "Id of the group") @PathParam("id") int id, + @Context HttpHeaders headers, @Context UriInfo uriInfo) {
ResourceGroup group = fetchGroup(id, false); @@ -114,8 +162,12 @@ public class GroupHandlerBean extends AbstractRestBean implements GroupHandlerLo return builder.build(); }
- @Override - public Response createGroup(GroupRest group, @Context Request request, @Context HttpHeaders headers, @Context UriInfo uriInfo) { + @POST + @Path("/") + @ApiOperation(value = "Create a new group") + public Response createGroup( + @ApiParam(value = "A GroupRest object containing at least a name for the group") GroupRest group, + @Context HttpHeaders headers, @Context UriInfo uriInfo) {
ResourceGroup newGroup = new ResourceGroup(group.getName()); if (group.getResourceTypeId()!=null) { @@ -146,8 +198,11 @@ public class GroupHandlerBean extends AbstractRestBean implements GroupHandlerLo return builder.build(); }
- @Override - public Response updateGroup(int id, GroupRest in, @Context Request request, + @PUT + @Path("{id}") + @ApiOperation(value = "Update the passed group") + public Response updateGroup(@ApiParam(value = "Id of the group to update") @PathParam("id") int id, + @ApiParam(value = "New version of the group") GroupRest in, @Context HttpHeaders headers, @Context UriInfo uriInfo) {
@@ -166,9 +221,10 @@ public class GroupHandlerBean extends AbstractRestBean implements GroupHandlerLo return builder.build(); }
- @Override - public Response deleteGroup(int id, @Context Request request, @Context HttpHeaders headers, - @Context UriInfo uriInfo) { + @DELETE + @Path("{id}") + @ApiOperation(value="Delete the group with the passed id") + public Response deleteGroup(@ApiParam("Id of the group to delete") @PathParam("id") int id) {
try { resourceGroupManager.deleteResourceGroup(caller,id); @@ -180,8 +236,13 @@ public class GroupHandlerBean extends AbstractRestBean implements GroupHandlerLo } }
- @Override - public Response getResources(int id, @Context Request request, @Context HttpHeaders headers, + @GZIP + @GET + @Path("{id}/resources") + @Cache(isPrivate = true,maxAge = 60) + @ApiOperation(value="Get the resources of the group", multiValueResponse = true) + public Response getResources(@ApiParam("Id of the group to retrieve the resources for") @PathParam("id") int id, + @Context HttpHeaders headers, @Context UriInfo uriInfo) {
ResourceGroup resourceGroup = fetchGroup(id, false); @@ -206,9 +267,16 @@ public class GroupHandlerBean extends AbstractRestBean implements GroupHandlerLo
}
- @Override - public Response addResource(int id, int resourceId, - @Context Request request, @Context HttpHeaders headers, @Context UriInfo uriInfo) { + @PUT + @Path("{id}/resource/{resourceId}") + @ApiOperation(value="Add a resource to an existing group") + @ApiErrors({ + @ApiError(code = 404,reason = "If there is no resource or group with the passed id "), + @ApiError(code = 409,reason =" Resource type does not match the group one") + }) + public Response addResource(@ApiParam("Id of the existing group") @PathParam("id") int id, + @ApiParam("Id of the resource to add") @PathParam("resourceId") int resourceId, + @Context HttpHeaders headers, @Context UriInfo uriInfo) {
ResourceGroup resourceGroup = fetchGroup(id, false); Resource res = resourceManager.getResource(caller,resourceId); @@ -228,9 +296,12 @@ public class GroupHandlerBean extends AbstractRestBean implements GroupHandlerLo
}
- @Override - public Response removeResource(int id, int resourceId, - @Context Request request, @Context HttpHeaders headers, @Context UriInfo uriInfo) { + @DELETE + @Path("{id}/resource/{resourceId}") + @ApiOperation("Remove the resource with the passed id from the group") + public Response removeResource(@ApiParam("Id of the existing group") @PathParam("id") int id, + @ApiParam("Id of the resource to remove") @PathParam("resourceId") int resourceId, + @Context HttpHeaders headers, @Context UriInfo uriInfo) {
ResourceGroup resourceGroup = fetchGroup(id, false); Resource res = resourceManager.getResource(caller,resourceId); @@ -243,9 +314,13 @@ public class GroupHandlerBean extends AbstractRestBean implements GroupHandlerLo
}
- @Override - public Response getMetricDefinitionsForGroup(int id, Request request, HttpHeaders headers, - UriInfo uriInfo) { + @GET + @GZIP + @Path("{id}/metricDefinitions") + @ApiOperation(value = "Get the metric definitions for the compatible group with the passed id") + public Response getMetricDefinitionsForGroup(@ApiParam(value = "Id of the group") @PathParam("id") int id, + @Context HttpHeaders headers, + @Context UriInfo uriInfo) { ResourceGroup group = fetchGroup(id, true);
Set<MeasurementDefinition> definitions = group.getResourceType().getMetricDefinitions(); @@ -301,9 +376,14 @@ public class GroupHandlerBean extends AbstractRestBean implements GroupHandlerLo return gr; }
- @Override - public Response getGroupDefinitions(String q, @Context Request request, @Context HttpHeaders headers, - @Context UriInfo uriInfo) { + @GZIP + @GET + @Path("/definitions") + @ApiOperation(value="List all existing GroupDefinitions",multiValueResponse = true) + public Response getGroupDefinitions( + @ApiParam("String to search in the group definition name") @QueryParam("q") String q, + @Context HttpHeaders headers, + @Context UriInfo uriInfo) {
ResourceGroupDefinitionCriteria criteria = new ResourceGroupDefinitionCriteria(); if (q!=null) { @@ -332,9 +412,14 @@ public class GroupHandlerBean extends AbstractRestBean implements GroupHandlerLo return builder.build(); }
- @Override - public Response getGroupDefinition(int definitionId, @Context Request request, - @Context HttpHeaders headers, @Context UriInfo uriInfo) { + @GZIP + @GET + @Path("/definition/{id}") + @Cache(isPrivate = true,maxAge = 60) + @ApiOperation(value = "Retrieve a single GroupDefinition by id") + public Response getGroupDefinition( + @ApiParam("The id of the definition to retrieve") @PathParam("id") int definitionId, + @Context HttpHeaders headers, @Context UriInfo uriInfo) {
try { GroupDefinition def = definitionManager.getById(definitionId); @@ -374,9 +459,12 @@ public class GroupHandlerBean extends AbstractRestBean implements GroupHandlerLo return gdr; }
- @Override - public Response deleteGroupDefinition(int definitionId, @Context Request request, - @Context HttpHeaders headers, @Context UriInfo uriInfo) { + @DELETE + @Path("/definition/{id}") + @ApiOperation("Delete the GroupDefinition with the passed id") + public Response deleteGroupDefinition( + @ApiParam("The id of the definition to delete") @PathParam("id") int definitionId, + @Context HttpHeaders headers, @Context UriInfo uriInfo) {
try { GroupDefinition def = definitionManager.getById(definitionId); @@ -390,9 +478,12 @@ public class GroupHandlerBean extends AbstractRestBean implements GroupHandlerLo } }
- @Override + @POST + @Path("/definitions") + @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + @ApiOperation("Create a new GroupDefinition. The name of the group is required in the passed definition.") public Response createGroupDefinition(GroupDefinitionRest definition, - @Context Request request, @Context HttpHeaders headers, + @Context HttpHeaders headers, @Context UriInfo uriInfo) {
Response.ResponseBuilder builder = null; @@ -439,10 +530,14 @@ public class GroupHandlerBean extends AbstractRestBean implements GroupHandlerLo return builder.build(); }
- @Override - public Response updateGroupDefinition(int definitionId, - boolean recalculate, GroupDefinitionRest definition, - @Context Request request, @Context HttpHeaders headers, + @PUT + @Path("/definition/{id}") + @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + @ApiOperation("Update an existing GroupDefinition") + public Response updateGroupDefinition(@ApiParam("Id fo the definition to update") @PathParam("id") int definitionId, + @ApiParam("If true, trigger a re-calculation") @QueryParam( "recalculate") + @DefaultValue("false") boolean recalculate, GroupDefinitionRest definition, + @Context HttpHeaders headers, @Context UriInfo uriInfo) {
GroupDefinition gd; diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerLocal.java deleted file mode 100644 index 1cfc171..0000000 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerLocal.java +++ /dev/null @@ -1,176 +0,0 @@ -package org.rhq.enterprise.server.rest; - -import javax.ejb.Local; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Request; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriInfo; - -import com.wordnik.swagger.annotations.Api; -import com.wordnik.swagger.annotations.ApiError; -import com.wordnik.swagger.annotations.ApiErrors; -import com.wordnik.swagger.annotations.ApiOperation; -import com.wordnik.swagger.annotations.ApiParam; - -import org.jboss.resteasy.annotations.GZIP; -import org.jboss.resteasy.annotations.cache.Cache; - -import org.rhq.enterprise.server.rest.domain.GroupDefinitionRest; -import org.rhq.enterprise.server.rest.domain.GroupRest; - -/** - * Handler for Group related things - * @author Heiko W. Rupp - */ -@Local -@Path("/group") -@Api(value="Deal with groups and DynaGroups", description = "Api that deals with resource groups and group definitions") -@Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML,MediaType.TEXT_HTML, "application/yaml"}) -public interface GroupHandlerLocal { - - @GZIP - @GET - @Path("/") - @ApiOperation(value = "List all groups", multiValueResponse = true) - public Response getGroups(@ApiParam("String to search in the group name") @QueryParam("q") String q, - @Context Request request, @Context HttpHeaders headers, - @Context UriInfo uriInfo); - - @Cache(isPrivate = true,maxAge = 60) - @GET - @Path("{id}") - @ApiOperation(value = "Get the group with the passed id") - public Response getGroup( - @ApiParam(value = "Id of the group") @PathParam("id") int id, - @Context Request request, @Context HttpHeaders headers, - @Context UriInfo uriInfo); - - - @GET - @GZIP - @Path("{id}/metricDefinitions") - @ApiOperation(value = "Get the metric definitions for the compatible group with the passed id") - public Response getMetricDefinitionsForGroup(@ApiParam(value = "Id of the group") @PathParam("id") int id, - @Context Request request, @Context HttpHeaders headers, - @Context UriInfo uriInfo); - - @POST - @Path("/") - @ApiOperation(value = "Create a new group") - public Response createGroup( - @ApiParam(value = "A GroupRest object containing at least a name for the group") GroupRest group, - @Context Request request, @Context HttpHeaders headers, - @Context UriInfo uriInfo); - - @PUT - @Path("{id}") - @ApiOperation(value = "Update the passed group") - public Response updateGroup( - @ApiParam(value = "Id of the group to update") @PathParam("id") int id, - @ApiParam(value="New version of the group") GroupRest in, - @Context Request request, - @Context HttpHeaders headers, - @Context UriInfo uriInfo); - - @DELETE - @Path("{id}") - @ApiOperation(value="Delete the group with the passed id") - public Response deleteGroup( - @ApiParam("Id of the group to delete") @PathParam("id") int id, - @Context Request request, @Context HttpHeaders headers, - @Context UriInfo uriInfo); - - - @GZIP - @GET - @Path("{id}/resources") - @Cache(isPrivate = true,maxAge = 60) - @ApiOperation(value="Get the resources of the group", multiValueResponse = true) - public Response getResources( - @ApiParam("Id of the group to retrieve the resources for") @PathParam("id") int id, - @Context Request request, @Context HttpHeaders headers, - @Context UriInfo uriInfo); - - - @PUT - @Path("{id}/resource/{resourceId}") - @ApiOperation(value="Add a resource to an existing group") - @ApiErrors({ - @ApiError(code = 404,reason = "If there is no resource or group with the passed id "), - @ApiError(code = 409,reason =" Resource type does not match the group one") - }) - public Response addResource( - @ApiParam("Id of the existing group") @PathParam("id") int id, - @ApiParam("Id of the resource to add") @PathParam("resourceId") int resourceId, - @Context Request request, @Context HttpHeaders headers, - @Context UriInfo uriInfo); - - @DELETE - @Path("{id}/resource/{resourceId}") - @ApiOperation("Remove the resource with the passed id from the group") - public Response removeResource( - @ApiParam("Id of the existing group") @PathParam("id") int id, - @ApiParam("Id of the resource to remove") @PathParam("resourceId") int resourceId, - @Context Request request, @Context HttpHeaders headers, - @Context UriInfo uriInfo); - - @GZIP - @GET - @Path("/definitions") - @ApiOperation(value="List all existing GroupDefinitions",multiValueResponse = true) - public Response getGroupDefinitions(@ApiParam("String to search in the group definition name") @QueryParam("q") String q, - @Context Request request, @Context HttpHeaders headers, - @Context UriInfo uriInfo); - - @GZIP - @GET - @Path("/definition/{id}") - @Cache(isPrivate = true,maxAge = 60) - @ApiOperation(value = "Retrieve a single GroupDefinition by id") - public Response getGroupDefinition( - @ApiParam("The id of the definition to retrieve") @PathParam("id") int definitionId, - @Context Request request, @Context HttpHeaders headers, - @Context UriInfo uriInfo); - - @DELETE - @Path("/definition/{id}") - @ApiOperation("Delete the GroupDefinition with the passed id") - public Response deleteGroupDefinition( - @ApiParam("The id of the definition to delete") @PathParam("id") int definitionId, - @Context Request request, @Context HttpHeaders headers, - @Context UriInfo uriInfo); - - @POST - @Path("/definitions") - @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) - @ApiOperation("Create a new GroupDefinition. The name of the group is required in the passed definition.") - public Response createGroupDefinition( - GroupDefinitionRest definition, - @Context Request request, @Context HttpHeaders headers, - @Context UriInfo uriInfo); - - @PUT - @Path("/definition/{id}") - @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) - @ApiOperation("Update an existing GroupDefinition") - public Response updateGroupDefinition( - @ApiParam("Id fo the definition to update") @PathParam("id") int definitionId, - @ApiParam("If true, trigger a re-calculation") @QueryParam("recalculate") @DefaultValue( - "false") boolean recalculate, - GroupDefinitionRest definition, - @Context Request request, @Context HttpHeaders headers, - @Context UriInfo uriInfo); - -} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/MetricHandlerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/MetricHandlerBean.java index c757911..b927acf 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/MetricHandlerBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/MetricHandlerBean.java @@ -1,6 +1,6 @@ /* * RHQ Management Platform - * Copyright (C) 2005-2011 Red Hat, Inc. + * Copyright (C) 2005-2012 Red Hat, Inc. * All rights reserved. * * This program is free software; you can redistribute it and/or modify @@ -40,6 +40,7 @@ import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.sql.DataSource; import javax.ws.rs.Consumes; +import javax.ws.rs.DefaultValue; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.PUT; @@ -60,6 +61,14 @@ import javax.ws.rs.core.StreamingOutput; import javax.ws.rs.core.UriBuilder; import javax.ws.rs.core.UriInfo;
+import com.wordnik.swagger.annotations.Api; +import com.wordnik.swagger.annotations.ApiError; +import com.wordnik.swagger.annotations.ApiErrors; +import com.wordnik.swagger.annotations.ApiOperation; +import com.wordnik.swagger.annotations.ApiParam; + +import org.jboss.resteasy.annotations.GZIP; + import org.rhq.core.domain.common.EntityContext; import org.rhq.core.domain.measurement.DataType; import org.rhq.core.domain.measurement.MeasurementBaseline; @@ -90,10 +99,17 @@ import org.rhq.enterprise.server.rest.domain.StringValue; * Deal with metrics * @author Heiko W. Rupp */ +@Api(value = "Deal with metrics", + description = "This part of the API deals with exporting metrics") +@Produces({"application/json","application/xml", "text/html"}) +@Path("/metric") @Interceptors(SetCallerInterceptor.class) @Stateless @javax.annotation.Resource(name = "RHQ_DS", mappedName = RHQConstants.DATASOURCE_JNDI_NAME) -public class MetricHandlerBean extends AbstractRestBean implements MetricHandlerLocal { +public class MetricHandlerBean extends AbstractRestBean { + + static final String NO_RESOURCE_FOR_ID = "If no resource with the passed id exists"; + static final String NO_SCHEDULE_FOR_ID = "No schedule with the passed id exists";
@EJB MeasurementDataManagerLocal dataManager; @@ -114,11 +130,22 @@ public class MetricHandlerBean extends AbstractRestBean implements MetricHandle
private static final long EIGHT_HOURS = 8 * 3600L * 1000L;
- @Override - public Response getMetricData(int scheduleId, long startTime, long endTime, - int dataPoints,boolean hideEmpty, - @Context Request request, - @Context HttpHeaders headers) { + @GZIP + @GET + @Path("data/{scheduleId}") + @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML,MediaType.TEXT_HTML}) + @ApiOperation(value = "Get the bucketized metric values for the schedule ") + @ApiError(code = 404, reason = NO_SCHEDULE_FOR_ID) + public Response getMetricData( + @ApiParam("Schedule Id of the values to query") @PathParam("scheduleId") int scheduleId, + @ApiParam(value = "Start time since epoch.", defaultValue = "End time - 8h") @QueryParam( + "startTime") long startTime, + @ApiParam(value = "End time since epoch.", defaultValue = "Now") @QueryParam("endTime") long endTime, + @ApiParam("Number of buckets - currently fixed at 60") @QueryParam("dataPoints") @DefaultValue( + "60") int dataPoints, + @ApiParam(value = "Hide rows that are NaN only", defaultValue = "false") @QueryParam( + "hideEmpty") boolean hideEmpty, + @Context HttpHeaders headers) {
if (dataPoints<=0) throw new IllegalArgumentException("dataPoints must be >0 "); @@ -162,9 +189,22 @@ public class MetricHandlerBean extends AbstractRestBean implements MetricHandle
return builder.build(); } - - public Response getMetricDataForGroupAndDefinition(int groupId, int definitionId, long startTime, long endTime, - int dataPoints,boolean hideEmpty, Request request, HttpHeaders headers) { + @GZIP + @GET + @Path("data/group/{groupId}/{definitionId}") + @ApiOperation(value = "Get the bucketized metric values for the metric definition of the group ") + @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML,MediaType.TEXT_HTML}) + public Response getMetricDataForGroupAndDefinition( + @ApiParam("Id of the group to query") @PathParam("groupId") int groupId, + @ApiParam("Id of the metric definition to retrieve") @PathParam("definitionId") int definitionId, + @ApiParam(value = "Start time since epoch.", defaultValue = "End time - 8h") @QueryParam( + "startTime") long startTime, + @ApiParam(value = "End time since epoch.", defaultValue = "Now") @QueryParam("endTime") long endTime, + @ApiParam("Number of buckets - currently fixed at 60") @QueryParam("dataPoints") @DefaultValue( + "60") int dataPoints, + @ApiParam(value = "Hide rows that are NaN only", defaultValue = "false") @QueryParam( + "hideEmpty") boolean hideEmpty, + @Context HttpHeaders headers) {
if (startTime==0) { endTime = System.currentTimeMillis(); @@ -290,12 +330,13 @@ public class MetricHandlerBean extends AbstractRestBean implements MetricHandle return v; }
+ @GZIP @GET @Path("data") @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_HTML}) public Response getMetricDataMulti(@QueryParam("sid") String schedules, @QueryParam("startTime") long startTime, @QueryParam("endTime") long endTime, @QueryParam("dataPoints") int dataPoints, - @QueryParam("hideEmpty") boolean hideEmpty, @Context Request request, + @QueryParam("hideEmpty") boolean hideEmpty, @Context HttpHeaders headers) {
MediaType mediaType = headers.getAcceptableMediaTypes().get(0); @@ -354,7 +395,14 @@ public class MetricHandlerBean extends AbstractRestBean implements MetricHandle * @param uriInfo info about the called uri to build links * @return Schedule with respective headers */ - public Response getSchedule(int scheduleId, Request request, HttpHeaders headers, UriInfo uriInfo) { + @GET + @Path("/schedule/{id}") + @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML,MediaType.TEXT_HTML}) + @ApiOperation("Get the metric schedule for the passed id") + @ApiError(code = 404, reason = NO_SCHEDULE_FOR_ID) + public Response getSchedule(@ApiParam("Schedule Id") @PathParam("id") int scheduleId, + @Context Request request, @Context HttpHeaders headers, + @Context UriInfo uriInfo) {
MediaType mediaType = headers.getAcceptableMediaTypes().get(0);
@@ -447,8 +495,15 @@ public class MetricHandlerBean extends AbstractRestBean implements MetricHandle return builder.build(); }
- @Override - public List<MetricAggregate> getAggregatesForResource(int resourceId, long startTime, long endTime) { + @GZIP + @GET + @Path("data/resource/{resourceId}") + @ApiOperation("Retrieve a list of high/low/average/data aggregate for the resource") + @ApiError(code = 404, reason = NO_RESOURCE_FOR_ID) + public List<MetricAggregate> getAggregatesForResource( + @ApiParam("Id of the resource to query") @PathParam("resourceId") int resourceId, + @ApiParam(value = "Start time since epoch.", defaultValue="End time - 8h") @QueryParam("startTime") long startTime, + @ApiParam(value = "End time since epoch.", defaultValue = "Now") @QueryParam("endTime") long endTime) {
long now = System.currentTimeMillis(); if (endTime==0) @@ -474,8 +529,14 @@ public class MetricHandlerBean extends AbstractRestBean implements MetricHandle
}
- @Override - public List<MetricAggregate> getAggregatesForGroup(int groupId, long startTime, long endTime) { + @GZIP + @GET + @Path("data/group/{groupId}") + @ApiOperation("Retrieve a list of high/low/average/data aggregate for the group") + public List<MetricAggregate> getAggregatesForGroup( + @ApiParam("Id of the group to query") @PathParam("groupId") int groupId, + @ApiParam(value = "Start time since epoch.", defaultValue="End time - 8h") @QueryParam("startTime") long startTime, + @ApiParam(value = "End time since epoch.", defaultValue = "Now") @QueryParam("endTime") long endTime) { long now = System.currentTimeMillis(); if (endTime==0) endTime = now; @@ -498,8 +559,15 @@ public class MetricHandlerBean extends AbstractRestBean implements MetricHandle return ret; }
- @Override - public Response updateSchedule(int scheduleId, MetricSchedule in,HttpHeaders httpHeaders) { + @PUT + @Path("/schedule/{id}") + @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + @ApiOperation(value = "Update the schedule (enabled, interval) ", responseClass = "MetricSchedule") + @ApiError(code = 404, reason = NO_SCHEDULE_FOR_ID) + public Response updateSchedule(@ApiParam("Id of the schedule to query") @PathParam("id") int scheduleId, + @ApiParam(value = "New schedule data", required = true) MetricSchedule in, + @Context HttpHeaders headers) { if (in==null) throw new StuffNotFoundException("Input is null"); // TODO other type of exception if (in.getScheduleId()==null) @@ -521,17 +589,26 @@ public class MetricHandlerBean extends AbstractRestBean implements MetricHandle MetricSchedule ret = new MetricSchedule(scheduleId,def.getName(),def.getDisplayName(), schedule.isEnabled(),schedule.getInterval(),def.getUnits().toString(),def.getDataType().toString());
- return Response.ok(ret,httpHeaders.getAcceptableMediaTypes().get(0)).build(); + return Response.ok(ret,headers.getAcceptableMediaTypes().get(0)).build(); }
+ @GZIP + @ApiOperation(value = "Expose the raw metrics of a single schedule. This can only expose raw data, which means the start date may " + + "not be older than 7 days.") @GET @Path("data/{scheduleId}/raw") - public StreamingOutput getMetricDataRaw(@PathParam("scheduleId") int scheduleId, - @QueryParam("startTime") long startTime, - @QueryParam("endTime") long endTime, - long duration, - Request request, - HttpHeaders headers) { + @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML,"text/csv",MediaType.TEXT_HTML}) + @ApiErrors({ + @ApiError(code = 404, reason = NO_SCHEDULE_FOR_ID) + }) + public StreamingOutput getMetricDataRaw(@ApiParam(required = true) @PathParam("scheduleId") int scheduleId, + @ApiParam(value = "Start time since epoch", + defaultValue = "Now - 8h") @QueryParam("startTime") long startTime, + @ApiParam(value = "End time since epoch", defaultValue = "Now") @QueryParam( + "endTime") long endTime, + @ApiParam(defaultValue = "8h = 28800000ms", + value = "Timespan in ms") @QueryParam("duration") long duration, + @Context HttpHeaders headers) {
MediaType mediaType = headers.getAcceptableMediaTypes().get(0);
@@ -559,13 +636,17 @@ public class MetricHandlerBean extends AbstractRestBean implements MetricHandle return so; }
- @Override @PUT @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) + @ApiOperation("Submit a single (numerical) metric to the server") + @ApiError(code=404, reason = NO_SCHEDULE_FOR_ID) @Path("data/{scheduleId}/raw/{timeStamp}") - public Response putMetricValue(@PathParam("scheduleId") int scheduleId, @PathParam("timeStamp") long timestamp, - NumericDataPoint point, @Context HttpHeaders headers, UriInfo uriInfo) { + public Response putMetricValue(@ApiParam("Id of the schedule") @PathParam("scheduleId") int scheduleId, + @ApiParam("Timestamp of the metric") @PathParam("timeStamp") long timestamp, + @ApiParam(value = "Data point", required = true) NumericDataPoint point, + @Context HttpHeaders headers, + @Context UriInfo uriInfo) {
MediaType mediaType = headers.getAcceptableMediaTypes().get(0); MeasurementSchedule schedule = obtainSchedule(scheduleId, false, DataType.MEASUREMENT); @@ -584,7 +665,12 @@ public class MetricHandlerBean extends AbstractRestBean implements MetricHandle return Response.created(uri).type(mediaType).build(); }
- public Response putTraitValue(@PathParam("scheduleId") int scheduleId, StringValue value) { + @PUT + @Path("data/{scheduleId}/trait") + @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + @ApiOperation(value = "Submit a new trait value for the passed schedule id") + @ApiError(code = 404, reason = NO_SCHEDULE_FOR_ID) + public Response putTraitValue(@ApiParam("Id of the schedule") @PathParam("scheduleId") int scheduleId, StringValue value) { MeasurementSchedule schedule = obtainSchedule(scheduleId, false, DataType.TRAIT);
Set<MeasurementDataTrait> traits = new HashSet<MeasurementDataTrait>(1); @@ -596,8 +682,12 @@ public class MetricHandlerBean extends AbstractRestBean implements MetricHandle return Response.ok().build(); }
- @Override - public Response getTraitValue(@PathParam("scheduleId") int scheduleId) { + @GET + @Path("data/{scheduleId}/trait") + @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + @ApiOperation(value="Get the current value of the trait with the passed schedule id", responseClass = "StringValue") + @ApiError(code = 404, reason = NO_SCHEDULE_FOR_ID) + public Response getTraitValue(@ApiParam("Id of the schedule") @PathParam("scheduleId") int scheduleId) {
MeasurementSchedule schedule = obtainSchedule(scheduleId, false, DataType.TRAIT); List<MeasurementDataTrait> traits = dataManager.findTraits(caller,schedule.getResource().getId(),schedule.getDefinition().getId()); @@ -615,10 +705,10 @@ public class MetricHandlerBean extends AbstractRestBean implements MetricHandle }
- @Override @POST @Path("data/raw") @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) + @ApiOperation(value="Submit a series of (numerical) metric values to the server",responseClass = "No response") public Response postMetricValues(Collection<NumericDataPoint> points, @Context HttpHeaders headers) {
MediaType mediaType = headers.getAcceptableMediaTypes().get(0); @@ -633,10 +723,13 @@ public class MetricHandlerBean extends AbstractRestBean implements MetricHandle
}
- @Override @GET @Path("data/{scheduleId}/baseline") - public Baseline getBaseline(@PathParam("scheduleId") int scheduleId, @Context HttpHeaders headers, + @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + @ApiOperation(value = "Get the current baseline for the schedule") + @ApiError(code = 404, reason = NO_SCHEDULE_FOR_ID) + public Baseline getBaseline(@ApiParam("Id of the schedule") @PathParam("scheduleId") int scheduleId, + @Context HttpHeaders headers, @Context UriInfo uriInfo) { MeasurementSchedule schedule = obtainSchedule(scheduleId, true, DataType.MEASUREMENT); MeasurementBaseline mBase = schedule.getBaseline(); @@ -650,10 +743,12 @@ public class MetricHandlerBean extends AbstractRestBean implements MetricHandle
}
- @Override @PUT @Path("data/{scheduleId}/baseline") - public void setBaseline(@PathParam("scheduleId") int scheduleId, + @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + @ApiOperation(value = "Set a new baseline for the schedule") + @ApiError(code = 404, reason = NO_SCHEDULE_FOR_ID) + public void setBaseline(@ApiParam("Id of the schedule") @PathParam("scheduleId") int scheduleId, Baseline baseline, HttpHeaders headers, @Context UriInfo uriInfo) { MeasurementSchedule schedule = obtainSchedule(scheduleId, false, DataType.MEASUREMENT);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/MetricHandlerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/MetricHandlerLocal.java deleted file mode 100644 index 4ae33f4..0000000 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/MetricHandlerLocal.java +++ /dev/null @@ -1,254 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2011 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.rest; - -import java.util.Collection; -import java.util.List; - -import javax.ejb.Local; -import javax.ws.rs.Consumes; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.PUT; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Request; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.StreamingOutput; -import javax.ws.rs.core.UriInfo; - -import com.wordnik.swagger.annotations.Api; -import com.wordnik.swagger.annotations.ApiError; -import com.wordnik.swagger.annotations.ApiErrors; -import com.wordnik.swagger.annotations.ApiOperation; -import com.wordnik.swagger.annotations.ApiParam; - -import org.jboss.resteasy.annotations.GZIP; - -import org.rhq.enterprise.server.rest.domain.Baseline; -import org.rhq.enterprise.server.rest.domain.MetricAggregate; -import org.rhq.enterprise.server.rest.domain.MetricSchedule; -import org.rhq.enterprise.server.rest.domain.NumericDataPoint; -import org.rhq.enterprise.server.rest.domain.StringValue; - -/** - * Deal with metrics - * @author Heiko W. Rupp - */ -@Api(value = "Deal with metrics", - description = "This part of the API deals with exporting metrics") -@Produces({"application/json","application/xml", "text/html"}) -@Path("/metric") -@Local -public interface MetricHandlerLocal { - - static String NO_RESOURCE_FOR_ID = "If no resource with the passed id exists"; - static String NO_SCHEDULE_FOR_ID = "No schedule with the passed id exists"; - - @GZIP - @GET - @Path("data/{scheduleId}") - @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML,MediaType.TEXT_HTML}) - @ApiOperation(value = "Get the bucketized metric values for the schedule ") - @ApiError(code = 404, reason = NO_SCHEDULE_FOR_ID) - Response getMetricData(@ApiParam("Schedule Id of the values to query") @PathParam("scheduleId") int scheduleId, - @ApiParam(value="Start time since epoch.", defaultValue = "End time - 8h") @QueryParam("startTime") long startTime, - @ApiParam(value="End time since epoch.", defaultValue = "Now") @QueryParam("endTime") long endTime, - @ApiParam("Number of buckets - currently fixed at 60") @QueryParam("dataPoints") @DefaultValue("60") int dataPoints, - @ApiParam(value = "Hide rows that are NaN only", defaultValue = "false") @QueryParam("hideEmpty") boolean hideEmpty, - @Context Request request, - @Context HttpHeaders headers); - - @GET - @Path("data") - @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML,MediaType.TEXT_HTML}) - Response getMetricDataMulti(@QueryParam("sid") String scheduleIds, - @QueryParam("startTime") long startTime, - @QueryParam("endTime") long endTime, - @QueryParam("dataPoints") int dataPoints, - @QueryParam("hideEmpty") boolean hideEmpty, - @Context Request request, - @Context HttpHeaders headers); - - - @GET - @Path("data/resource/{resourceId}") - @ApiOperation("Retrieve a list of high/low/average/data aggregate for the resource") - @ApiError(code = 404, reason = NO_RESOURCE_FOR_ID) - List<MetricAggregate> getAggregatesForResource( - @ApiParam("Id of the resource to query") @PathParam("resourceId") int resourceId, - @ApiParam(value = "Start time since epoch.", defaultValue="End time - 8h") @QueryParam("startTime") long startTime, - @ApiParam(value = "End time since epoch.", defaultValue = "Now") @QueryParam("endTime") long endTime); - - @GET - @Path("data/group/{groupId}") - @ApiOperation("Retrieve a list of high/low/average/data aggregate for the group") - List<MetricAggregate> getAggregatesForGroup( - @ApiParam("Id of the group to query") @PathParam("groupId") int groupId, - @ApiParam(value = "Start time since epoch.", defaultValue="End time - 8h") @QueryParam("startTime") long startTime, - @ApiParam(value = "End time since epoch.", defaultValue = "Now") @QueryParam("endTime") long endTime); - - @GZIP - @GET - @Path("data/group/{groupId}/{definitionId}") - @ApiOperation(value = "Get the bucketized metric values for the metric definition of the group ") - @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML,MediaType.TEXT_HTML}) - Response getMetricDataForGroupAndDefinition( - @ApiParam("Id of the group to query") @PathParam("groupId") int groupId, - @ApiParam("Id of the metric definition to retrieve") @PathParam("definitionId") int definitionId, - @ApiParam(value = "Start time since epoch.", defaultValue="End time - 8h") @QueryParam("startTime") long startTime, - @ApiParam(value = "End time since epoch.", defaultValue = "Now") @QueryParam("endTime") long endTime, - @ApiParam("Number of buckets - currently fixed at 60") @QueryParam("dataPoints") @DefaultValue("60") int dataPoints, - @ApiParam(value = "Hide rows that are NaN only", defaultValue = "false") @QueryParam("hideEmpty") boolean hideEmpty, - @Context Request request, - @Context HttpHeaders headers); - - - /** - * Get information about the schedule - * @param scheduleId id of the schedule - * @param request Injected request - * @param headers Injected http headers - * @param uriInfo Injected Uri - * @return the schedule - */ - @GET - @Path("/schedule/{id}") - @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML,MediaType.TEXT_HTML}) - @ApiOperation("Get the metric schedule for the passed id") - @ApiError(code = 404, reason = NO_SCHEDULE_FOR_ID) - Response getSchedule(@ApiParam("Schedule Id") @PathParam("id") int scheduleId, - @Context Request request, @Context HttpHeaders headers, - @Context UriInfo uriInfo); - - /** - * Update a schedule. Currently change of collection interval and enabled/disabled state are supported. - * @param scheduleId Id of the schedule to update - * @param in Modified schedule object - * @param headers Injected http headers - * @return Result of updating - */ - @PUT - @Path("/schedule/{id}") - @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) - @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) - @ApiOperation(value = "Update the schedule (enabled, interval) ", responseClass = "MetricSchedule") - @ApiError(code = 404, reason = NO_SCHEDULE_FOR_ID) - Response updateSchedule(@ApiParam("Id of the schedule to query") @PathParam("id") int scheduleId, - @ApiParam(value = "New schedule data", required = true) MetricSchedule in, - @Context HttpHeaders headers); - - /** - * Expose the raw metrics for the given schedule - * @param scheduleId Schedule id - * @param startTime Start time, if 0 and duration=, start time = 8h before endTime - * @param endTime End time. If 0, now is used - * @param duration Duration in seconds. If duration=0, startTime is used - * @param request Injected Request headers - * @param headers Injected HttpHeaders - * @return an encoded stream of numerical values - */ - @GZIP - @ApiOperation(value = "Expose the raw metrics of a single schedule. This can only expose raw data, which means the start date may " - + "not be older than 7 days.") - @GET - @Path("data/{scheduleId}/raw") - @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML,"text/csv",MediaType.TEXT_HTML}) - @ApiErrors({ - @ApiError(code = 404, reason = NO_SCHEDULE_FOR_ID) - }) - StreamingOutput getMetricDataRaw(@ApiParam(required = true) @PathParam("scheduleId") int scheduleId, - @ApiParam(value="Start time since epoch", defaultValue = "Now - 8h") @QueryParam("startTime") long startTime, - @ApiParam(value="End time since epoch", defaultValue = "Now") @QueryParam("endTime") long endTime, - @ApiParam(defaultValue = "8h = 28800000ms", value = "Timespan in ms") @QueryParam("duration") long duration, - @Context Request request, - @Context HttpHeaders headers); - - /** - * Submit a single (numerical) metric value to the server. - * @param scheduleId Id of the schedule to submit to - * @param timestamp Timestamp of the entry - * @param point Datapoint of class NumericDataPoint - * @param headers Injected HTTP headers - * @param uriInfo Injected info about the uri - * @return Created response - */ - @PUT - @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) - @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) - @Path("data/{scheduleId}/raw/{timeStamp}") - @ApiOperation("Submit a single (numerical) metric to the server") - @ApiError(code=404, reason = NO_SCHEDULE_FOR_ID) - Response putMetricValue(@ApiParam("Id of the schedule") @PathParam("scheduleId") int scheduleId, - @ApiParam("Timestamp of the metric") @PathParam("timeStamp") long timestamp, - @ApiParam(value = "Data point", required = true) NumericDataPoint point, - @Context HttpHeaders headers, - @Context UriInfo uriInfo); - - /** - * Submit a series of (numerical) metric values to the server - * @param points Collection of NumericDataPoint entries - * @param headers Injected HTTP headers - * @return response object - */ - @POST - @Path("data/raw") - @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) - @ApiOperation(value="Submit a series of (numerical) metric values to the server",responseClass = "No response") - Response postMetricValues(Collection<NumericDataPoint> points, @Context HttpHeaders headers); - - @GET - @Path("data/{scheduleId}/baseline") - @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) - @ApiOperation(value = "Get the current baseline for the schedule") - @ApiError(code = 404, reason = NO_SCHEDULE_FOR_ID) - Baseline getBaseline(@ApiParam("Id of the schedule") @PathParam("scheduleId") int scheduleId, - @Context HttpHeaders headers, - @Context UriInfo uriInfo); - - @PUT - @Path("data/{scheduleId}/baseline") - @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) - @ApiOperation(value = "Set a new baseline for the schedule") - @ApiError(code = 404, reason = NO_SCHEDULE_FOR_ID) - void setBaseline(@ApiParam("Id of the schedule") @PathParam("scheduleId") int scheduleId, - Baseline baseline, - @Context HttpHeaders headers, - @Context UriInfo uriInfo); - - @PUT - @Path("data/{scheduleId}/trait") - @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) - @ApiOperation(value = "Submit a new trait value for the passed schedule id") - @ApiError(code = 404, reason = NO_SCHEDULE_FOR_ID) - Response putTraitValue(@ApiParam("Id of the schedule") @PathParam("scheduleId") int scheduleId, StringValue value); - - @GET - @Path("data/{scheduleId}/trait") - @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) - @ApiOperation(value="Get the current value of the trait with the passed schedule id", responseClass = "StringValue") - @ApiError(code = 404, reason = NO_SCHEDULE_FOR_ID) - Response getTraitValue(@ApiParam("Id of the schedule") @PathParam("scheduleId") int scheduleId); -} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/OperationsHandlerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/OperationsHandlerBean.java index d8b9851..92287d5 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/OperationsHandlerBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/OperationsHandlerBean.java @@ -27,10 +27,17 @@ import java.util.Set; import javax.ejb.EJB; import javax.ejb.Stateless; import javax.interceptor.Interceptors; +import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; import javax.ws.rs.core.CacheControl; +import javax.ws.rs.core.Context; import javax.ws.rs.core.EntityTag; import javax.ws.rs.core.GenericEntity; import javax.ws.rs.core.HttpHeaders; @@ -43,6 +50,9 @@ import javax.ws.rs.core.UriInfo; import com.wordnik.swagger.annotations.ApiOperation; import com.wordnik.swagger.annotations.ApiParam;
+import org.jboss.resteasy.annotations.GZIP; +import org.jboss.resteasy.annotations.cache.Cache; + import org.rhq.core.domain.configuration.Configuration; import org.rhq.core.domain.configuration.Property; import org.rhq.core.domain.configuration.PropertySimple; @@ -50,7 +60,6 @@ import org.rhq.core.domain.configuration.definition.ConfigurationDefinition; import org.rhq.core.domain.configuration.definition.PropertyDefinition; import org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple; import org.rhq.core.domain.criteria.ResourceOperationHistoryCriteria; -import org.rhq.core.domain.operation.HistoryJobId; import org.rhq.core.domain.operation.JobId; import org.rhq.core.domain.operation.OperationDefinition; import org.rhq.core.domain.operation.OperationRequestStatus; @@ -71,9 +80,11 @@ import org.rhq.enterprise.server.rest.domain.SimplePropDef; * Deal with operations * @author Heiko W. Rupp */ +@Path("/operation") +@Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) @Stateless @Interceptors(SetCallerInterceptor.class) -public class OperationsHandlerBean extends AbstractRestBean implements OperationsHandlerLocal { +public class OperationsHandlerBean extends AbstractRestBean {
@EJB OperationManagerLocal opsManager; @@ -81,11 +92,16 @@ public class OperationsHandlerBean extends AbstractRestBean implements Operation @EJB ResourceManagerLocal resourceManager;
- @Override - public Response getOperationDefinition(int definitionId, - Integer resourceId, - UriInfo uriInfo, - Request request, HttpHeaders httpHeaders) { + @GET + @Path("definition/{id}") + @Cache(maxAge = 1200) + @ApiOperation("Retrieve a single operation definition by its id") + public Response getOperationDefinition( + @ApiParam("Id of the definition to retrieve") @PathParam("id") int definitionId, + @ApiParam("Id of a resource that supports this operation") @QueryParam("resourceId") Integer resourceId, + @Context UriInfo uriInfo, + @Context Request request, + @Context HttpHeaders httpHeaders) {
@@ -148,8 +164,16 @@ public class OperationsHandlerBean extends AbstractRestBean implements Operation } }
- @Override - public Response getOperationDefinitions(Integer resourceId, UriInfo uriInfo, Request request, HttpHeaders httpHeaders) { + @GZIP + @GET + @Path("definitions") + @Cache(maxAge = 1200) + @ApiOperation("List all operation definitions for a resource") + public Response getOperationDefinitions( + @ApiParam(value = "Id of the resource",required = true) @QueryParam("resourceId") Integer resourceId, + @Context UriInfo uriInfo, + @Context Request request, + @Context HttpHeaders httpHeaders) {
if (resourceId == null) throw new ParameterMissingException("resourceId"); @@ -193,8 +217,13 @@ public class OperationsHandlerBean extends AbstractRestBean implements Operation
}
- @Override - public Response createOperation(int definitionId, Integer resourceId, UriInfo uriInfo) { + @POST + @Path("definition/{id}") + @ApiOperation("Create a new (draft) operation from the passed definition id for the passed resource") + public Response createOperation( + @ApiParam("Id of the definition") @PathParam("id") int definitionId, + @ApiParam(value = "Id of the resource", required = true) @QueryParam("resourceId") Integer resourceId, + @Context UriInfo uriInfo) {
if (resourceId == null) throw new ParameterMissingException("resourceId"); @@ -232,8 +261,10 @@ public class OperationsHandlerBean extends AbstractRestBean implements Operation
}
- @Override - public Response getOperation(int operationId) { + @GET + @Path("{id}") + @ApiOperation("Return a (draft) operation") + public Response getOperation(@ApiParam("Id of the operation to retrieve") @PathParam("id") int operationId) { OperationRest op = getFromCache(operationId,OperationRest.class); if (op==null) throw new StuffNotFoundException("Operation with id " + operationId); @@ -241,8 +272,12 @@ public class OperationsHandlerBean extends AbstractRestBean implements Operation return Response.ok(op).build(); }
- @Override - public Response updateOperation(int operationId, OperationRest operation, UriInfo uriInfo) { + @PUT + @Path("{id}") + @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + @ApiOperation("Update a (draft) operation. If the state is set to 'ready', the operation will be scheduled") + public Response updateOperation(@ApiParam("Id of the operation to update") @PathParam("id") int operationId, + OperationRest operation, @Context UriInfo uriInfo) {
if (!operation.isReadyToSubmit() && operation.getDefinitionId()>0 && !operation.getName().isEmpty()) { // TODO check all the required parameters for presence before allowing to submit @@ -280,8 +315,10 @@ public class OperationsHandlerBean extends AbstractRestBean implements Operation return builder.build(); }
- @Override - public Response cancelOperation(int operationId) { + @DELETE + @Path("{id}") + @ApiOperation("Delete a (draft) operation") + public Response cancelOperation(@ApiParam("Id of the operation to remove") @PathParam("id") int operationId) {
log.info("Cancel called");
@@ -290,8 +327,16 @@ public class OperationsHandlerBean extends AbstractRestBean implements Operation return null; // TODO: Customise this generated block }
- @Override - public Response outcome(String jobName, UriInfo uriInfo, Request request, HttpHeaders httpHeaders) { + @GZIP + @GET + @Path("history/{id}") + @ApiOperation("Return the outcome of the scheduled operation") + @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML,MediaType.TEXT_HTML}) + public Response outcome( + @ApiParam("Name of the submitted job.") @PathParam("id") String jobName, + @Context UriInfo uriInfo, + @Context Request request, + @Context HttpHeaders httpHeaders) {
MediaType mediaType = httpHeaders.getAcceptableMediaTypes().get(0);
@@ -325,7 +370,16 @@ public class OperationsHandlerBean extends AbstractRestBean implements Operation
}
- public Response listHistory(int resourceId, UriInfo uriInfo, Request request, HttpHeaders httpHeaders) { + @GZIP + @GET + @Path("history") + @ApiOperation("Return the outcome of the executed operations for a resource") + @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML,MediaType.TEXT_HTML}) + public Response listHistory( + @ApiParam("Id of a resource to limit to") @QueryParam("resourceId") int resourceId, + @Context UriInfo uriInfo, + @Context Request request, + @Context HttpHeaders httpHeaders) {
ResourceOperationHistoryCriteria criteria = new ResourceOperationHistoryCriteria(); if (resourceId>0) @@ -352,8 +406,10 @@ public class OperationsHandlerBean extends AbstractRestBean implements Operation return builder.build(); }
- @Override - public Response deleteOperationHistoryItem(String jobName) { + @DELETE + @Path("history/{id}") + @ApiOperation(value = "Delete the operation history item with the passed id") + public Response deleteOperationHistoryItem(@ApiParam("Name fo the submitted job") @PathParam("id") String jobName) {
ResourceOperationHistoryCriteria criteria = new ResourceOperationHistoryCriteria(); criteria.addFilterJobId(new JobId(jobName)); diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/OperationsHandlerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/OperationsHandlerLocal.java deleted file mode 100644 index dcf5943..0000000 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/OperationsHandlerLocal.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2011 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.rest; - -import javax.ejb.Local; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Request; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriInfo; - -import com.wordnik.swagger.annotations.ApiOperation; -import com.wordnik.swagger.annotations.ApiParam; - -import org.jboss.resteasy.annotations.GZIP; -import org.jboss.resteasy.annotations.cache.Cache; - -import org.rhq.enterprise.server.rest.domain.OperationRest; - -/** - * Service that deals with operations - * @author Heiko W. Rupp - */ -@Local -@Path("/operation") -@Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) -public interface OperationsHandlerLocal { - - - @GET - @Path("definition/{id}") - @Cache(maxAge = 1200) - @ApiOperation("Retrieve a single operation definition by its id") - public Response getOperationDefinition( - @ApiParam("Id of the definition to retrieve") @PathParam("id") int definitionId, - @ApiParam("Id of a resource that supports this operation") @QueryParam("resourceId") Integer resourceId, - @Context UriInfo uriInfo, - @Context Request request, - @Context HttpHeaders httpHeaders); - - @GZIP - @GET - @Path("definitions") - @Cache(maxAge = 1200) - @ApiOperation("List all operation definitions for a resource") - public Response getOperationDefinitions( - @ApiParam(value = "Id of the resource",required = true) @QueryParam("resourceId") Integer resourceId, - @Context UriInfo uriInfo, - @Context Request request, - @Context HttpHeaders httpHeaders - ); - - @POST - @Path("definition/{id}") - @ApiOperation("Create a new (draft) operation from the passed definition id for the passed resource") - public Response createOperation( - @ApiParam("Id of the definition") @PathParam("id") int definitionId, - @ApiParam(value = "Id of the resource", required = true) @QueryParam("resourceId") Integer resourceId, - @Context UriInfo uriInfo); - - @GET - @Path("{id}") - @ApiOperation("Return a (draft) operation") - public Response getOperation( - @ApiParam("Id of the operation to retrieve") @PathParam("id") int operationId); - - @PUT - @Path("{id}") - @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) - @ApiOperation("Update a (draft) operation. If the state is set to 'ready', the operation will be scheduled") - public Response updateOperation( - @ApiParam("Id of the operation to update") @PathParam("id") int operationId, - OperationRest operation, @Context UriInfo uriInfo); - - @DELETE - @Path("{id}") - @ApiOperation("Delete a (draft) operation") - public Response cancelOperation( - @ApiParam("Id of the operation to remove") @PathParam("id") int operationId); - - @GZIP - @GET - @Path("history/{id}") - @ApiOperation("Return the outcome of the scheduled operation") - @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML,MediaType.TEXT_HTML}) - public Response outcome( - @ApiParam("Name of the submitted job.") @PathParam("id") String jobName, - @Context UriInfo uriInfo, - @Context Request request, - @Context HttpHeaders httpHeaders); - - @GZIP - @GET - @Path("history") - @ApiOperation("Return the outcome of the executed operations for a resource") - @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML,MediaType.TEXT_HTML}) - public Response listHistory( - @ApiParam("Id of a resource to limit to") @QueryParam("resourceId") int resourceId, - @Context UriInfo uriInfo, - @Context Request request, - @Context HttpHeaders httpHeaders); - - - @DELETE - @Path("history/{id}") - @ApiOperation(value = "Delete the operation history item with the passed id") - public Response deleteOperationHistoryItem( - @ApiParam("Name fo the submitted job") @PathParam("id") String jobId); -} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/RHQApplication.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/RHQApplication.java deleted file mode 100644 index d174067..0000000 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/RHQApplication.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2011 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.rest; - -import javax.ws.rs.ApplicationPath; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import org.rhq.enterprise.server.util.LookupUtil; - -/** - * JAX-RS application class, defining the base http context. - * This is called upon servlet startup or when the first request hits - * the REST endpoint. - * - * @author Heiko W. Rupp - */ -@ApplicationPath("/1") -public class RHQApplication extends javax.ws.rs.core.Application { - - Log log = LogFactory.getLog(RHQApplication.class); - - public RHQApplication() { - log.info("Starting RHQ REST "); - - } -} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceHandlerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceHandlerBean.java index 9709fd6..98b2e6e 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceHandlerBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceHandlerBean.java @@ -33,6 +33,15 @@ import javax.ejb.Stateless; import javax.interceptor.Interceptors; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; +import javax.ws.rs.DefaultValue; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.Context; import javax.ws.rs.core.EntityTag; import javax.ws.rs.core.GenericEntity; import javax.ws.rs.core.HttpHeaders; @@ -42,6 +51,16 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.UriBuilder; import javax.ws.rs.core.UriInfo;
+import com.wordnik.swagger.annotations.Api; +import com.wordnik.swagger.annotations.ApiError; +import com.wordnik.swagger.annotations.ApiOperation; +import com.wordnik.swagger.annotations.ApiParam; + +import org.jboss.resteasy.annotations.GZIP; +import org.jboss.resteasy.annotations.cache.Cache; +import org.jboss.resteasy.links.AddLinks; +import org.jboss.resteasy.links.LinkResource; + import org.rhq.core.domain.alert.Alert; import org.rhq.core.domain.criteria.AlertCriteria; import org.rhq.core.domain.criteria.AvailabilityCriteria; @@ -72,9 +91,14 @@ import org.rhq.enterprise.server.rest.domain.*; * Class that deals with getting data about resources * @author Heiko W. Rupp */ +@Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML,MediaType.TEXT_HTML}) +@Path("/resource") +@Api(value="Resource related", description = "This endpoint deals with individual resources, not resource groups") @Interceptors(SetCallerInterceptor.class) @Stateless -public class ResourceHandlerBean extends AbstractRestBean implements ResourceHandlerLocal { +public class ResourceHandlerBean extends AbstractRestBean { + + private static final String NO_RESOURCE_FOR_ID = "If no resource with the passed id exists";
@EJB AvailabilityManagerLocal availMgr; @@ -90,8 +114,15 @@ public class ResourceHandlerBean extends AbstractRestBean implements ResourceHan @PersistenceContext(unitName = RHQConstants.PERSISTENCE_UNIT_NAME) private EntityManager entityManager;
- @Override - public Response getResource(int id, Request request, HttpHeaders headers, UriInfo uriInfo) { + @GET + @Path("/{id}") + @Cache(isPrivate = true,maxAge = 120) + @ApiOperation(value = "Retrieve a single resource", responseClass = "ResourceWithType") + @ApiError(code = 404, reason = NO_RESOURCE_FOR_ID) + + public Response getResource(@ApiParam("Id of the resource to retrieve") @PathParam("id") int id, + @Context Request request, @Context HttpHeaders headers, + @Context UriInfo uriInfo) {
Resource res; res = fetchResource(id); @@ -118,9 +149,12 @@ public class ResourceHandlerBean extends AbstractRestBean implements ResourceHan return builder.build(); }
- @Override - public Response getResourcesByQuery(String q, Request request, HttpHeaders headers, - UriInfo uriInfo) { + @GET @GZIP + @Path("/") + @ApiOperation(value = "Search for resources by the given search string", responseClass = "ResourceWithType") + public Response getResourcesByQuery(@ApiParam("String to search in the resource name") @QueryParam("q") String q, + @Context HttpHeaders headers, + @Context UriInfo uriInfo) { ResourceCriteria criteria = new ResourceCriteria(); criteria.addFilterName(q); List<Resource> ret = resMgr.findResourcesByCriteria(caller,criteria); @@ -130,8 +164,13 @@ public class ResourceHandlerBean extends AbstractRestBean implements ResourceHan return builder.build(); }
- @Override - public Response getPlatforms(Request request, HttpHeaders headers, UriInfo uriInfo) { + @GZIP + @GET + @Path("/platforms") + @Cache(isPrivate = true,maxAge = 300) + @ApiOperation(value = "List all platforms in the system", multiValueResponse = true, responseClass = "ResourceWithType") + public Response getPlatforms(@Context HttpHeaders headers, + @Context UriInfo uriInfo) {
PageControl pc = new PageControl(); List<Resource> ret = resMgr.findResourcesByCategory(caller, ResourceCategory.PLATFORM, @@ -170,27 +209,18 @@ public class ResourceHandlerBean extends AbstractRestBean implements ResourceHan return builder; }
- @Override - public ResourceWithChildren getHierarchy(int baseResourceId) { + @GET @GZIP + @Path("/{id}/hierarchy") + @Produces({"application/json","application/xml"}) + @ApiOperation(value = "Retrieve the hierarchy of resources starting with the passed one", multiValueResponse = true, responseClass = "ResourceWithType") + @ApiError(code = 404, reason = NO_RESOURCE_FOR_ID) + public ResourceWithChildren getHierarchy(@ApiParam("Id of the resource to start with") @PathParam("id")int baseResourceId) { // TODO optimize to do less recursion Resource start = obtainResource(baseResourceId); - ResourceWithChildren rwc = getHierarchy(start); - /*new ResourceWithChildren(""+start.getId(),start.getName()); - - PageControl pc = new PageControl(); - List<Resource> ret = resMgr.findResourceByParentAndInventoryStatus(caller,start,InventoryStatus.COMMITTED,pc); - if (!ret.isEmpty()) { - List<ResourceWithChildren> resList = new ArrayList<ResourceWithChildren>(ret.size()); - for (Resource res : ret) { - ResourceWithChildren child = getHierarchy(res.getId()); - resList.add(child); - } - rwc.setChildren(resList); - }*/ - return rwc; + return getHierarchy(start); }
- ResourceWithChildren getHierarchy(Resource baseResource) { + private ResourceWithChildren getHierarchy(Resource baseResource) { ResourceWithChildren rwc = new ResourceWithChildren("" + baseResource.getId(), baseResource.getName());
PageControl pc = new PageControl(); @@ -209,8 +239,11 @@ public class ResourceHandlerBean extends AbstractRestBean implements ResourceHan return rwc; }
- @Override - public Response getAvailability(int resourceId, HttpHeaders headers) { + @GET + @Path("/{id}/availability") + @ApiError(code = 404, reason = NO_RESOURCE_FOR_ID) + @ApiOperation(value = "Return the current availability for the passed resource", responseClass = "AvailabilityRest") + public Response getAvailability(@ApiParam("Id of the resource to query") @PathParam("id") int resourceId, @Context HttpHeaders headers) {
Availability avail = availMgr.getCurrentAvailabilityForResource(caller, resourceId); AvailabilityRest availabilityRest; @@ -231,8 +264,16 @@ public class ResourceHandlerBean extends AbstractRestBean implements ResourceHan return builder.build(); }
- @Override - public Response getAvailabilityHistory(int resourceId, long start, long end, HttpHeaders headers) { + @GZIP + @GET + @Path("/{id}/availability/history") + @ApiError(code = 404, reason = NO_RESOURCE_FOR_ID) + @ApiOperation(value = "Return the availability history for the passed resource", responseClass = "AvailabilityRest", multiValueResponse = true) + public Response getAvailabilityHistory( + @ApiParam("Id of the resource to query") @PathParam("id") int resourceId, + @ApiParam(value="Start time", defaultValue = "30 days ago") @QueryParam("start") long start, + @ApiParam(value="End time", defaultValue = "Now") @QueryParam("end") long end, + @Context HttpHeaders headers) { if (end==0) end = System.currentTimeMillis();
@@ -272,8 +313,11 @@ public class ResourceHandlerBean extends AbstractRestBean implements ResourceHan }
- @Override - public void reportAvailability(int resourceId, AvailabilityRest avail) { + @PUT + @Path("/{id}/availability") + @ApiOperation("Set the current availability of the passed resource") + public void reportAvailability(@ApiParam("Id of the resource to update") @PathParam("id") int resourceId, + @ApiParam(value= "New Availability setting", required = true) AvailabilityRest avail) { if (avail.getResourceId() != resourceId) throw new IllegalArgumentException("Resource Ids do not match");
@@ -289,8 +333,23 @@ public class ResourceHandlerBean extends AbstractRestBean implements ResourceHan availMgr.mergeAvailabilityReport(report); }
- public Response getSchedules(int resourceId, String scheduleType, boolean enabledOnly, String name, - Request request, HttpHeaders headers, UriInfo uriInfo) { + @GZIP + @GET + @Path("/{id}/schedules") + @LinkResource(rel="schedules",value = MetricSchedule.class) + @Cache(isPrivate = true,maxAge = 60) + @ApiOperation(value ="Get the metric schedules of the passed resource id", multiValueResponse = true, responseClass = "MetricSchedule") + @ApiError(code = 404, reason = NO_RESOURCE_FOR_ID) + public Response getSchedules( + @ApiParam("Id of the resource to obtain the schedules for") @PathParam("id") int resourceId, + @ApiParam(value = "Limit by type", + allowableValues = "<empty>, all, metric, trait, measurement") @QueryParam("type") @DefaultValue( + "all") String scheduleType, + @ApiParam(value = "Limit by enabled schedules") @QueryParam("enabledOnly") @DefaultValue( + "true") boolean enabledOnly, + @ApiParam(value = "Limit by name") @QueryParam("name") String name, + @Context HttpHeaders headers, + @Context UriInfo uriInfo) {
// allow metric as input if (scheduleType.equals("metric")) @@ -355,8 +414,17 @@ public class ResourceHandlerBean extends AbstractRestBean implements ResourceHan return builder.build(); }
- @Override - public Response getChildren(int id, Request request, HttpHeaders headers, UriInfo uriInfo) { + @GZIP + @GET + @Path("/{id}/children") + @LinkResource(rel="children", value = ResourceWithType.class) + @ApiOperation(value = "Get the direct children of the passed resource") + @ApiError(code = 404, reason = NO_RESOURCE_FOR_ID) + public Response getChildren( + @ApiParam("Id of the resource to get children") @PathParam("id") int id, + @Context HttpHeaders headers, + @Context UriInfo uriInfo) { + PageControl pc = new PageControl(); Resource parent; parent = fetchResource(id); @@ -394,8 +462,13 @@ public class ResourceHandlerBean extends AbstractRestBean implements ResourceHan return resource; }
- @Override - public List<Link> getAlertsForResource(int resourceId) { + @GZIP + @AddLinks + @GET + @Path(("/{id}/alerts")) + @ApiError(code = 404, reason = NO_RESOURCE_FOR_ID) + @ApiOperation("Get a list of links to the alerts for the passed resource") + public List<Link> getAlertsForResource(@ApiParam("Id of the resource to query") @PathParam("id") int resourceId) { AlertCriteria criteria = new AlertCriteria(); criteria.addFilterResourceIds(resourceId); List<Alert> alerts = alertManager.findAlertsByCriteria(caller, criteria); @@ -409,8 +482,16 @@ public class ResourceHandlerBean extends AbstractRestBean implements ResourceHan return links; }
- @Override - public Response createPlatform(String name, StringValue typeValue, UriInfo uriInfo) { + @ApiOperation(value = "Creata a new platform in the Server. If the platform already exists, this is a no-op." + + "The platform internally has a special name so that it will not clash with one that was generated" + + "via a normal RHQ agent") + @POST + @Path("platform/{name}") + + public Response createPlatform( + @ApiParam(value = "Name of the platform") @PathParam("name") String name, + @ApiParam(value = "Type of the platform", allowableValues = "Linux,Windows,... TODO") StringValue typeValue, + @Context UriInfo uriInfo) { String typeName = typeValue.getValue();
ResourceType type = resourceTypeManager.getResourceTypeByNameAndPlugin(typeName,"Platforms"); @@ -484,13 +565,17 @@ public class ResourceHandlerBean extends AbstractRestBean implements ResourceHan } }
- @Override - public Response createResource(String name, StringValue typeValue, - String plugin, int parentId, UriInfo uriInfo) { + @ApiOperation(value = "Create a resource with a given type below a certain parent") + @POST + @Path("{name}") + public Response createResource( + @ApiParam("Name of the new resource") @PathParam("name") String name, + @ApiParam("Name of the Resource tpye") StringValue typeValue, + @ApiParam("Name of the plugin providing the type") @QueryParam("plugin") String plugin, + @ApiParam("Id of the future parent to attach this to") @QueryParam("parentId") int parentId, + @Context UriInfo uriInfo) {
Resource parent = resMgr.getResourceById(caller,parentId); - if (parent==null) - throw new StuffNotFoundException("Parent with id [" + parentId + "]");
String typeName = typeValue.getValue(); ResourceType resType = resourceTypeManager.getResourceTypeByNameAndPlugin(typeName,plugin); diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceHandlerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceHandlerLocal.java deleted file mode 100644 index 935f875..0000000 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceHandlerLocal.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.rest; - -import java.util.List; - -import javax.ejb.Local; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Request; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriInfo; - -import com.wordnik.swagger.annotations.Api; -import com.wordnik.swagger.annotations.ApiError; -import com.wordnik.swagger.annotations.ApiOperation; -import com.wordnik.swagger.annotations.ApiParam; - -import org.jboss.resteasy.annotations.GZIP; -import org.jboss.resteasy.annotations.cache.Cache; -import org.jboss.resteasy.links.AddLinks; -import org.jboss.resteasy.links.LinkResource; -import org.jboss.resteasy.links.LinkResources; - -import org.rhq.enterprise.server.rest.domain.*; - -/** - * Interface class that describes the REST interface - * @author Heiko W. Rupp - */ -@Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML,MediaType.TEXT_HTML}) -@Path("/resource") -@Local -@Api(value="Resource related", description = "This endpoint deals with individual resources, not resource groups") -public interface ResourceHandlerLocal { - - static String NO_RESOURCE_FOR_ID = "If no resource with the passed id exists"; - - @AddLinks - @LinkResources({ - @LinkResource(rel="children", value = ResourceWithType.class) - }) - @GET - @Path("/{id}") - @Cache(isPrivate = true,maxAge = 120) - @ApiOperation(value = "Retrieve a single resource", responseClass = "ResourceWithType") - @ApiError(code = 404, reason = NO_RESOURCE_FOR_ID) - Response getResource( - @ApiParam("Id of the resource to retrieve") @PathParam("id") int id, - @Context Request request, @Context HttpHeaders headers, - @Context UriInfo uriInfo); - - @GET - @Path("/") - @ApiOperation(value = "Search for resources by the given search string", responseClass = "ResourceWithType") - Response getResourcesByQuery(@ApiParam("String to search in the resource name") @QueryParam("q")String q, - @Context Request request, @Context HttpHeaders headers, - @Context UriInfo uriInfo); - - @GZIP - @GET - @Path("/platforms") - @Cache(isPrivate = true,maxAge = 300) - @ApiOperation(value = "List all platforms in the system", multiValueResponse = true, responseClass = "ResourceWithType") - Response getPlatforms(@Context Request request, @Context HttpHeaders headers, - @Context UriInfo uriInfo); - - - @GET - @Path("/{id}/hierarchy") - @Produces({"application/json","application/xml"}) - @ApiOperation(value = "Retrieve the hierarchy of resources starting with the passed one", multiValueResponse = true, responseClass = "ResourceWithType") - @ApiError(code = 404, reason = NO_RESOURCE_FOR_ID) - ResourceWithChildren getHierarchy( - @ApiParam("Id of the resource to start with") @PathParam("id")int baseResourceId); - - @GET - @Path("/{id}/availability") - @ApiError(code = 404, reason = NO_RESOURCE_FOR_ID) - @ApiOperation(value = "Return the current availability for the passed resource", responseClass = "AvailabilityRest") - Response getAvailability( - @ApiParam("Id of the resource to query") @PathParam("id") int resourceId, @Context HttpHeaders headers); - - @GZIP - @GET - @Path("/{id}/availability/history") - @ApiError(code = 404, reason = NO_RESOURCE_FOR_ID) - @ApiOperation(value = "Return the availability history for the passed resource", responseClass = "AvailabilityRest", multiValueResponse = true) - Response getAvailabilityHistory( - @ApiParam("Id of the resource to query") @PathParam("id") int resourceId, - @ApiParam(value="Start time", defaultValue = "30 days ago") @QueryParam("start") long start, - @ApiParam(value="End time", defaultValue = "Now") @QueryParam("end") long end, - - @Context HttpHeaders headers); - - @PUT - @Path("/{id}/availability") - @ApiOperation("Set the current availability of the passed resource") - public void reportAvailability( - @ApiParam("Id of the resource to update") @PathParam("id") int resourceId, - @ApiParam(value= "New Availability setting", required = true) AvailabilityRest avail); - - @GZIP - @GET - @Path("/{id}/schedules") - @LinkResource(rel="schedules",value = MetricSchedule.class) - @Cache(isPrivate = true,maxAge = 60) - @ApiOperation(value ="Get the metric schedules of the passed resource id", multiValueResponse = true, responseClass = "MetricSchedule") - @ApiError(code = 404, reason = NO_RESOURCE_FOR_ID) - Response getSchedules(@ApiParam("Id of the resource to obtain the schedules for") @PathParam("id") int resourceId, - @ApiParam(value = "Limit by type", allowableValues = "<empty>, all, metric, trait, measurement" )@QueryParam("type") @DefaultValue("all") String scheduleType, - @ApiParam(value = "Limit by enabled schedules") @QueryParam("enabledOnly") @DefaultValue("true") boolean enabledOnly, - @ApiParam(value = "Limit by name") @QueryParam("name") String name, - @Context Request request, - @Context HttpHeaders headers, - @Context UriInfo uriInfo); - - - @GZIP - @GET - @Path("/{id}/children") - @LinkResource(rel="children", value = ResourceWithType.class) - @ApiOperation(value = "Get the direct children of the passed resource") - @ApiError(code = 404, reason = NO_RESOURCE_FOR_ID) - Response getChildren( - @ApiParam("Id of the resource to get children") @PathParam("id") int id, - @Context Request request, @Context HttpHeaders headers, - @Context UriInfo uriInfo); - - - @GZIP - @AddLinks - @GET - @Path(("/{id}/alerts")) - @ApiError(code = 404, reason = NO_RESOURCE_FOR_ID) - @ApiOperation("Get a list of links to the alerts for the passed resource") - List<Link> getAlertsForResource( - @ApiParam("Id of the resource to query") @PathParam("id") int resourceId); // TODO paging + status - - - - @ApiOperation(value = "Creata a new platform in the Server. If the platform already exists, this is a no-op." + - "The platform internally has a special name so that it will not clash with one that was generated" + - "via a normal RHQ agent") - @POST - @Path("platform/{name}") - public Response createPlatform( - @ApiParam(value = "Name of the platform") @PathParam("name") String name, - @ApiParam(value = "Type of the platform", allowableValues = "Linux,Windows,... TODO") StringValue type, - @Context UriInfo uriInfo); - - @ApiOperation(value = "Create a resource with a given type below a certain parent") - @POST - @Path("{name}") - public Response createResource( - @ApiParam("Name of the new resource") @PathParam("name") String name, - @ApiParam("Name of the Resource tpye") StringValue type, - @ApiParam("Name of the plugin providing the type") @QueryParam("plugin") String plugin, - @ApiParam("Id of the future parent to attach this to") @QueryParam("parentId") int parentId, - @Context UriInfo uriInfo); - - -} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/RootHandlerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/RootHandlerBean.java new file mode 100644 index 0000000..8d2f130 --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/RootHandlerBean.java @@ -0,0 +1,108 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.rest; + +import java.util.ArrayList; +import java.util.List; + +import javax.ejb.Stateless; +import javax.interceptor.Interceptors; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.CacheControl; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.GenericEntity; +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Request; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriInfo; + +import org.rhq.enterprise.server.rest.domain.Link; + +/** + * Handle the /rest/ context root + * + * @author Heiko W. Rupp + */ +@Path("/") +@Interceptors(SetCallerInterceptor.class) +@Stateless +public class RootHandlerBean extends AbstractRestBean { + + String[] roots = { // rel, target + "platforms","resource/platforms", + "groups","group", + "dynaGroups","group/definitions", + "alerts","alert", + "status","status", + "favoriteResource","user/favorites/resource", + "operationHistory","operation/history", + "self","" + }; + + @GET + @Path("index") + public Response index(@Context Request request, @Context HttpHeaders headers, @Context UriInfo uriInfo) { + return handleIndex(headers,uriInfo); + } + + @GET + @Path("/") + public Response index2(@Context Request request, @Context HttpHeaders headers, @Context UriInfo uriInfo) { + return handleIndex(headers,uriInfo); + } + + private Response handleIndex(HttpHeaders headers, UriInfo uriInfo) { + + MediaType mediaType = headers.getAcceptableMediaTypes().get(0); + Response.ResponseBuilder builder; + List<Link> links = new ArrayList<Link>(roots.length/2); + + for (int i = 0; i < roots.length ; i+=2) { + String rel = roots[i]; + String target = roots[i+1]; + // TODO use the uribuilder for the next? + if (mediaType.equals(MediaType.APPLICATION_JSON_TYPE)) { + target += ".json"; + } else if (mediaType.equals(MediaType.TEXT_HTML_TYPE)) { + target += ".html"; + } else if (mediaType.equals(MediaType.APPLICATION_XML_TYPE)) { + target += ".xml"; + } else { + throw new WebApplicationException(Response.Status.NOT_ACCEPTABLE); + } + Link link = new Link(rel,target); + links.add(link); + } + + if (mediaType.equals(MediaType.TEXT_HTML_TYPE)) { + builder = Response.ok(renderTemplate("index",links)); + } else { + GenericEntity<List<Link>> list = new GenericEntity<List<Link>>(links) { + }; + builder = Response.ok(list); + } + CacheControl cacheControl = new CacheControl(); + cacheControl.setMaxAge(86400); // TODO 1 day or longer? What unit is this anyway? + builder.cacheControl(cacheControl); + return builder.build(); + } +} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/StatusHandlerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/StatusHandlerBean.java index 176b72e..23bbd4b 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/StatusHandlerBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/StatusHandlerBean.java @@ -1,6 +1,6 @@ /* * RHQ Management Platform - * Copyright (C) 2005-2011 Red Hat, Inc. + * Copyright (C) 2005-2012 Red Hat, Inc. * All rights reserved. * * This program is free software; you can redistribute it and/or modify @@ -23,10 +23,19 @@ import java.util.Map; import javax.ejb.EJB; import javax.ejb.Stateless; import javax.interceptor.Interceptors; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response;
+import com.wordnik.swagger.annotations.Api; +import com.wordnik.swagger.annotations.ApiOperation; + +import org.jboss.resteasy.annotations.GZIP; + import org.rhq.core.domain.cloud.Server; import org.rhq.enterprise.server.cloud.instance.ServerManagerLocal; import org.rhq.enterprise.server.rest.domain.Status; @@ -37,9 +46,12 @@ import org.rhq.enterprise.server.system.SystemInfoManagerLocal; * Return system status * @author Heiko W. Rupp */ +@Api(value = "Provide system status information") +@Path("/status") +@Produces({"application/json","application/xml","text/html"}) @Stateless @Interceptors(SetCallerInterceptor.class) -public class StatusHandlerBean extends AbstractRestBean implements StatusHandlerLocal { +public class StatusHandlerBean extends AbstractRestBean {
@EJB @@ -47,8 +59,13 @@ public class StatusHandlerBean extends AbstractRestBean implements StatusHandler @EJB ServerManagerLocal serverManager;
- @Override - public Response getStatus(HttpHeaders httpHeaders) { + @GZIP + @ApiOperation(value="Retrieve the current configured state of the server along with some runtime information." + + "Caller must have MANAGE_SETTINGS to access this endpoint.", + responseClass = "Map 'values' with map of key-value pairs describing the status") + @GET + @Path("/") + public Response getStatus(@Context HttpHeaders httpHeaders) {
Map<String,String> statusMap = infoMgr.getSystemInformation(caller); Status status = new Status(); @@ -66,10 +83,11 @@ public class StatusHandlerBean extends AbstractRestBean implements StatusHandler return builder.build(); }
- @Override + @GET + @Path("/server") + @ApiOperation(value = "Get the operation mode of this server") public StringValue serverState() { Server server = serverManager.getServer(); - StringValue sv = new StringValue(server.getOperationMode().name()); - return sv; + return new StringValue(server.getOperationMode().name()); } } diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/StatusHandlerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/StatusHandlerLocal.java deleted file mode 100644 index f149d8c..0000000 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/StatusHandlerLocal.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2011 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.rest; - -import javax.ejb.Local; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.Response; - -import com.wordnik.swagger.annotations.Api; -import com.wordnik.swagger.annotations.ApiOperation; - -import org.jboss.resteasy.annotations.GZIP; - -import org.rhq.enterprise.server.rest.domain.StringValue; - -/** - * Return some status information about the system - * @author Heiko W. Rupp - */ -@Api(value = "Provide system status information") -@Path("/status") -@Local -@Produces({"application/json","application/xml","text/html"}) -public interface StatusHandlerLocal { - - @GZIP - @ApiOperation(value="Retrieve the current configured state of the server along with some runtime information." + - "Caller must have MANAGE_SETTINGS to access this endpoint.", - responseClass = "Map 'values' with map of key-value pairs describing the status") - @GET - @Path("/") - Response getStatus(@Context HttpHeaders httpHeaders); - - @GET - @Path("/server") - @ApiOperation(value = "Get the operation mode of this server") - StringValue serverState(); -} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/UserHandlerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/UserHandlerBean.java index 11ac93f..bdd613e 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/UserHandlerBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/UserHandlerBean.java @@ -27,6 +27,13 @@ import java.util.TreeSet; import javax.ejb.EJB; import javax.ejb.Stateless; import javax.interceptor.Interceptors; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; import javax.ws.rs.core.EntityTag; import javax.ws.rs.core.GenericEntity; import javax.ws.rs.core.HttpHeaders; @@ -35,6 +42,13 @@ import javax.ws.rs.core.Request; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo;
+import com.wordnik.swagger.annotations.Api; +import com.wordnik.swagger.annotations.ApiOperation; +import com.wordnik.swagger.annotations.ApiParam; + +import org.jboss.resteasy.annotations.GZIP; +import org.jboss.resteasy.annotations.cache.Cache; + import org.rhq.core.domain.auth.Subject; import org.rhq.core.domain.configuration.Configuration; import org.rhq.core.domain.configuration.PropertySimple; @@ -49,9 +63,12 @@ import org.rhq.enterprise.server.rest.domain.UserRest; * Class that deals with user specific stuff * @author Heiko W. Rupp */ +@Produces({"application/json","application/xml","text/plain","text/html"}) +@Path("/user") +@Api(value="Api that deals with user related stuff") @Interceptors(SetCallerInterceptor.class) @Stateless -public class UserHandlerBean extends AbstractRestBean implements UserHandlerLocal { +public class UserHandlerBean extends AbstractRestBean {
// private final Log log = LogFactory.getLog(UserHandlerBean.class);
@@ -71,13 +88,13 @@ public class UserHandlerBean extends AbstractRestBean implements UserHandlerLoca SubjectManagerLocal subjectManager;
@EJB - ResourceHandlerLocal resourceHandler; - - @EJB ResourceManagerLocal resourceManager;
- @Override - public Response getFavorites(UriInfo uriInfo, HttpHeaders httpHeaders) { + @GZIP + @GET + @Path("favorites/resource") + @ApiOperation(value = "Return a list of favorite resources of the caller", multiValueResponse = true, responseClass = "ResourceWithType") + public Response getFavorites(@Context UriInfo uriInfo, @Context HttpHeaders httpHeaders) {
Set<Integer> favIds = getResourceIdsForFavorites(); List<ResourceWithType> ret = new ArrayList<ResourceWithType>(); @@ -111,8 +128,11 @@ public class UserHandlerBean extends AbstractRestBean implements UserHandlerLoca }
- @Override - public void addFavoriteResource(int id) { + @PUT + @Path("favorites/resource/{id}") + @ApiOperation(value = "Add a resource as favorite for the caller") + public void addFavoriteResource(@ApiParam(name = "id", value = "Id of the resource") + @PathParam("id") int id) { Set<Integer> favIds = getResourceIdsForFavorites(); if (!favIds.contains(id)) { favIds.add(id); @@ -120,8 +140,11 @@ public class UserHandlerBean extends AbstractRestBean implements UserHandlerLoca } }
- @Override - public void removeResourceFromFavorites(int id) { + @DELETE + @Path("favorites/resource/{id}") + @ApiOperation(value="Remove a resource from favorites") + public void removeResourceFromFavorites(@ApiParam(name="id", value = "Id of the resource") + @PathParam("id") int id) { Set<Integer> favIds = getResourceIdsForFavorites(); if (favIds.contains(id)) { favIds.remove(id); @@ -130,7 +153,12 @@ public class UserHandlerBean extends AbstractRestBean implements UserHandlerLoca
}
- public Response getUserDetails(String loginName, Request request, HttpHeaders headers) { + @GET + @Cache(maxAge = 600) + @Path("{id}") + @ApiOperation(value = "Get info about a user", responseClass = "UserRest") + public Response getUserDetails(@ApiParam(value="Login of the user") @PathParam("id") String loginName, + @Context Request request, @Context HttpHeaders headers) {
Subject subject = subjectManager.getSubjectByName(loginName); if (subject == null) diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/UserHandlerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/UserHandlerLocal.java deleted file mode 100644 index cdc3b5f..0000000 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/UserHandlerLocal.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.rest; - -import javax.ejb.Local; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.Request; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriInfo; - -import com.wordnik.swagger.annotations.Api; -import com.wordnik.swagger.annotations.ApiOperation; -import com.wordnik.swagger.annotations.ApiParam; - -import org.jboss.resteasy.annotations.GZIP; -import org.jboss.resteasy.annotations.cache.Cache; - - -/** - * Bean that deals with user specific stuff - * @author Heiko W. Rupp - */ -@Produces({"application/json","application/xml","text/plain","text/html"}) -@Path("/user") -@Local -@Api(value="Api that deals with user related stuff") -public interface UserHandlerLocal { - - @GZIP - @GET - @Path("favorites/resource") - @ApiOperation(value = "Return a list of favorite resources of the caller", multiValueResponse = true, responseClass = "ResourceWithType") - Response getFavorites(@Context UriInfo uriInfo,@Context HttpHeaders headers); - - @PUT - @Path("favorites/resource/{id}") - @ApiOperation(value = "Add a resource as favorite for the caller") - public void addFavoriteResource( - @ApiParam(name = "id", value = "Id of the resource") - @PathParam("id") int id); - - @DELETE - @Path("favorites/resource/{id}") - @ApiOperation(value="Remove a resource from favorites") - public void removeResourceFromFavorites( - @ApiParam(name="id", value = "Id of the resource") - @PathParam("id") int id); - - - @GET - @Cache(maxAge = 600) - @Path("{id}") - @ApiOperation(value = "Get info about a user", responseClass = "UserRest") - public Response getUserDetails(@ApiParam(value="Login of the user") @PathParam("id")String loginName, - @Context Request request,@Context HttpHeaders headers); -} diff --git a/modules/enterprise/server/jar/src/main/resources/rest_templates/alert.ftl b/modules/enterprise/server/jar/src/main/resources/rest_templates/alert.ftl index fe60590..42d5385 100644 --- a/modules/enterprise/server/jar/src/main/resources/rest_templates/alert.ftl +++ b/modules/enterprise/server/jar/src/main/resources/rest_templates/alert.ftl @@ -52,7 +52,7 @@ <td>${var.definitionEnabled?string("Yes","No")}</td> </tr> </table> -<a href="/rest/1/alert/${var.id?c}/definition.html">Alert Definition</a> -<a href="/rest/1/alert/${var.id?c}/conditions.html">Condition Logs</a> -<a href="/rest/1/alert/${var.id?c}/notifications.html">Notification Logs</a> -<a href="/rest/1/resource/${var.resource.getResourceId()}.html">Resource</a> \ No newline at end of file +<a href="/rest/alert/${var.id?c}/definition.html">Alert Definition</a> +<a href="/rest/alert/${var.id?c}/conditions.html">Condition Logs</a> +<a href="/rest/alert/${var.id?c}/notifications.html">Notification Logs</a> +<a href="/rest/resource/${var.resource.getResourceId()}.html">Resource</a> \ No newline at end of file diff --git a/modules/enterprise/server/jar/src/main/resources/rest_templates/availability.ftl b/modules/enterprise/server/jar/src/main/resources/rest_templates/availability.ftl index 388d761..28b527a 100644 --- a/modules/enterprise/server/jar/src/main/resources/rest_templates/availability.ftl +++ b/modules/enterprise/server/jar/src/main/resources/rest_templates/availability.ftl @@ -27,4 +27,4 @@ Since: ${var.since?number_to_datetime} until ${var.until?number_to_datetime} </#if> <br/> -<a href="/rest/1/resource/${var.resourceId?c}.html">Back to Resource</a> +<a href="/rest/resource/${var.resourceId?c}.html">Back to Resource</a> diff --git a/modules/enterprise/server/jar/src/main/resources/rest_templates/group.ftl b/modules/enterprise/server/jar/src/main/resources/rest_templates/group.ftl index c88c072..f74f545 100644 --- a/modules/enterprise/server/jar/src/main/resources/rest_templates/group.ftl +++ b/modules/enterprise/server/jar/src/main/resources/rest_templates/group.ftl @@ -56,11 +56,11 @@ </td> </tr> </table> - <a href="/rest/1/group/${var.id?c}/resources.html">Resources</a><br/> + <a href="/rest/group/${var.id?c}/resources.html">Resources</a><br/> <#if (var.category?contains("compatible"))> - <a href="/rest/1/group/${var.id?c}/metricDefinitions.html">Metric Definitions</a><br/> + <a href="/rest/group/${var.id?c}/metricDefinitions.html">Metric Definitions</a><br/> </#if> <#if (var.dynaGroupDefinitionId >0)> - <a href="/rest/1/group/definition/${var.dynaGroupDefinitionId?c}.html">DynaGroup definition</a> + <a href="/rest/group/definition/${var.dynaGroupDefinitionId?c}.html">DynaGroup definition</a> </#if> </html> diff --git a/modules/enterprise/server/jar/src/main/resources/rest_templates/groupDefinition.ftl b/modules/enterprise/server/jar/src/main/resources/rest_templates/groupDefinition.ftl index 59aa4da..14fa596 100644 --- a/modules/enterprise/server/jar/src/main/resources/rest_templates/groupDefinition.ftl +++ b/modules/enterprise/server/jar/src/main/resources/rest_templates/groupDefinition.ftl @@ -54,7 +54,7 @@ <td>Groups</td> <td> <#list var.generatedGroupIds as groupId> - <a href="/rest/1/group/${groupId?c}.html">${groupId?c}</a> + <a href="/rest/group/${groupId?c}.html">${groupId?c}</a> </#list> </td> </tr> diff --git a/modules/enterprise/server/jar/src/main/resources/rest_templates/index.ftl b/modules/enterprise/server/jar/src/main/resources/rest_templates/index.ftl new file mode 100644 index 0000000..e135ce6 --- /dev/null +++ b/modules/enterprise/server/jar/src/main/resources/rest_templates/index.ftl @@ -0,0 +1,59 @@ +<#ftl > +<#-- +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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. + */ +--> +<#-- @ftlvariable name="var" type="java.util.List<org.rhq.enterprise.server.rest.domain.Link>" --> +<html> +<body> +<h2>RHQ Rest API</h2> +<strong>Please note: the API is not stable at this point. Do not rely on it.</strong><br/> + +Join us in making it great by providing feedback and contributions of code and examples +that use the api. +See also <a href="http://rhq-project.org/display/RHQ/Design-REST">the RHQ wiki</a> on REST. +Check out the <a href="https://github.com/rhq-project/samples/tree/master/rest-api">RHQ samples project</a> +for samples in various programming languages and +<a href="https://github.com/pilhuhn/RHQpocket">RHQpocket</a> as an example of a +mobile client (Android) of the API. +<ul> +<#list var as var> + <li> + <a href="${var.href}">${var.rel}</a> + </li> +</#list> +</ul> +<hr/> +<h2>Misc examples (using <a href="https://github.com/mbostock/d3">D3.js</a>)</h2> +Those examples use the powerful D3 library and are rendering the graphs in SVG. +They expect some resources and schedules being present from an initial import with +an empty database (meaning resource ids and schedule ids starting at 10001). +<ul> + <li><a href="/rest-examples/bars_simple.html">Display avg metrics as bars</a></li> + <li><a href="/rest-examples/stacked1.html">Metrics as stacked bars</a> in SVG</li> + <li><a href="/rest-examples/stacked3.html">Metrics as stacked bars</a> in pure HTML + (a little) CSS</li> + <li><a href="/rest-examples/stacked2.html">Metrics as rects using stacked bars from above</a></li> + <li><a href="/rest-examples/whisker.html">Whisker chart 1</a></li> + <li><a href="/rest-examples/whisker2.html">Multiple Whisker charts</a></li> + <li><a href="/rest-examples/tree.html">Resource tree</a></li> + <li><a href="/rest-examples/raw_graph.html">7 days of raw metrics as dot- or line- chart</a></li> + <li><a href="/rest-examples/raw_graph7.html">7 days of raw metrics as dot- or line- chart - comparing daily values</a></li> +</ul> +</body> +</html> diff --git a/modules/enterprise/server/jar/src/main/resources/rest_templates/metricData.ftl b/modules/enterprise/server/jar/src/main/resources/rest_templates/metricData.ftl index 61c9280..e625cc7 100644 --- a/modules/enterprise/server/jar/src/main/resources/rest_templates/metricData.ftl +++ b/modules/enterprise/server/jar/src/main/resources/rest_templates/metricData.ftl @@ -36,7 +36,7 @@ <#if var.isGroup()> <td>DefinitionId</td><td>${sched?c}</a></td> <#else> - <td>ScheduleId</td><td><a href="/rest/1/metric/schedule/${sched?c}.html">${sched?c}</a></td> + <td>ScheduleId</td><td><a href="/rest/metric/schedule/${sched?c}.html">${sched?c}</a></td> </#if> </tr>
diff --git a/modules/enterprise/server/jar/src/main/resources/rest_templates/resourceWithType.ftl b/modules/enterprise/server/jar/src/main/resources/rest_templates/resourceWithType.ftl index c95c8ba..523a34f 100644 --- a/modules/enterprise/server/jar/src/main/resources/rest_templates/resourceWithType.ftl +++ b/modules/enterprise/server/jar/src/main/resources/rest_templates/resourceWithType.ftl @@ -29,7 +29,7 @@ <td>Name</td><td>${var.resourceName}</td> </tr> <tr> - <td>Id</td><td><a href="/rest/1/resource/${var.resourceId}.html">${var.resourceId}</a></td> + <td>Id</td><td><a href="/rest/resource/${var.resourceId}.html">${var.resourceId}</a></td> </tr> <tr> <td>Type name</td><td>${var.typeName}</td> @@ -42,13 +42,13 @@ </tr> <#if var.parentId??> <tr> - <td>Parent Id</td><td><a href="/rest/1/resource/${var.parentId?c}.html">${var.parentId?c}</a></td> + <td>Parent Id</td><td><a href="/rest/resource/${var.parentId?c}.html">${var.parentId?c}</a></td> </tr> </#if> </table> - <a href="/rest/1/resource/${var.resourceId}/children.html">Children</a><br/> - <a href="/rest/1/resource/${var.resourceId}/schedules.html">Schedules</a><br/> - <a href="/rest/1/resource/${var.resourceId}/availability.html">Current availability</a><br/> - <a href="/rest/1/resource/${var.resourceId}/availability/history.html">Availability History</a><br/> - <a href="/rest/1/alert.html?resourceId=${var.resourceId}">Up to 20 Alerts for this resource</a><br/> - <a href="/rest/1/operation/history.html?resourceId=${var.resourceId}">Operations history</a> + <a href="/rest/resource/${var.resourceId}/children.html">Children</a><br/> + <a href="/rest/resource/${var.resourceId}/schedules.html">Schedules</a><br/> + <a href="/rest/resource/${var.resourceId}/availability.html">Current availability</a><br/> + <a href="/rest/resource/${var.resourceId}/availability/history.html">Availability History</a><br/> + <a href="/rest/alert.html?resourceId=${var.resourceId}">Up to 20 Alerts for this resource</a><br/> + <a href="/rest/operation/history.html?resourceId=${var.resourceId}">Operations history</a> diff --git a/modules/integration-tests/rest-api/pom.xml b/modules/integration-tests/rest-api/pom.xml index 4a2c4a6..a2e25f5 100644 --- a/modules/integration-tests/rest-api/pom.xml +++ b/modules/integration-tests/rest-api/pom.xml @@ -7,8 +7,8 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-integration-tests</artifactId> - <version>4.3.0-SNAPSHOT</version> - <relativePath>../../../pom.xml</relativePath> + <version>4.6.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/GetStatusTest.java b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/GetStatusTest.java index b59bd11..570e2bf 100644 --- a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/GetStatusTest.java +++ b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/GetStatusTest.java @@ -1,6 +1,6 @@ /* * RHQ Management Platform - * Copyright (C) 2005-2011 Red Hat, Inc. + * Copyright (C) 2005-2012 Red Hat, Inc. * All rights reserved. * * This program is free software; you can redistribute it and/or modify @@ -45,7 +45,7 @@ public class GetStatusTest {
@Rule - public Destination destination = new Destination("http://" + System.getProperty("rest.server","localhost") + ":7080/rest/1"); + public Destination destination = new Destination("http://" + System.getProperty("rest.server","localhost") + ":7080/rest");
@Context private Response response; @@ -71,7 +71,7 @@ public class GetStatusTest { @Authentication(type = AuthenticationType.BASIC, user = "user", password = "name23") ) public void testAuthRestricted() { - com.eclipsesource.restfuse.Assert.assertForbidden(response); + com.eclipsesource.restfuse.Assert.assertUnauthorized(response); }
diff --git a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/ResourcesTest.java b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/ResourcesTest.java index 88cfaaf..ca63c32 100644 --- a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/ResourcesTest.java +++ b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/ResourcesTest.java @@ -1,6 +1,6 @@ /* * RHQ Management Platform - * Copyright (C) 2005-2011 Red Hat, Inc. + * Copyright (C) 2005-2012 Red Hat, Inc. * All rights reserved. * * This program is free software; you can redistribute it and/or modify @@ -46,7 +46,7 @@ import static junit.framework.Assert.assertTrue; public class ResourcesTest {
@Rule - public Destination destination = new Destination("http://" + System.getProperty("rest.server","localhost") + ":7080/rest/1"); + public Destination destination = new Destination("http://" + System.getProperty("rest.server","localhost") + ":7080/rest");
@Context private Response response;
commit 6239ffc776249ab6ee4e08c855ffab95baefe44e Author: John Mazzitelli mazz@redhat.com Date: Thu Dec 6 17:21:46 2012 -0500
for developers, have the dev builds automatically run the installer for you so you don't have to do it in a separate step.
this works so well, we might want to do this even for production builds. But for now, leave it only for -Pdev builds.
If we want this in production builds, too, we just hardcode the line in rhq-server.sh that rhq-container.build.xml adds for dev builds.
diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-installer.sh b/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-installer.sh old mode 100644 new mode 100755 diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-server.sh b/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-server.sh old mode 100644 new mode 100755 index e917230..a4ecda8 --- a/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-server.sh +++ b/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-server.sh @@ -443,7 +443,8 @@ case "$1" in echo "$$" > "$_SERVER_PIDFILE" echo "$$" > "$_JVM_PIDFILE"
- # start the server, making sure its working directory is the JBossAS bin directory + # START SERVER + # first, making sure working directory is the JBossAS bin directory cd "${RHQ_SERVER_JBOSS_HOME}/bin" "$_JBOSS_RUN_SCRIPT" $_CMDLINE_OPTS
diff --git a/modules/enterprise/server/appserver/src/main/dev-resources/bin/rhq-autoinstall.sh b/modules/enterprise/server/appserver/src/main/dev-resources/bin/rhq-autoinstall.sh new file mode 100755 index 0000000..f61a482 --- /dev/null +++ b/modules/enterprise/server/appserver/src/main/dev-resources/bin/rhq-autoinstall.sh @@ -0,0 +1,29 @@ +if [ -z ${RHQ_SERVER_HOME} ]; then + echo RHQ_SERVER_HOME not defined + exit 1 +fi + +cd "$RHQ_SERVER_HOME" +RHQ_SERVER_HOME=`pwd` + +_INSTALLER_SCRIPT="${RHQ_SERVER_HOME}/bin/rhq-installer.sh" + +# we are normally executed just before the server starts, so give it time to initialize +sleep 5 + +_TRIES="1 2 3 4 5" +for _TRY in $_TRIES +do + echo Running Installer Now... + eval ${_INSTALLER_SCRIPT} + if [ "$?" -eq "0" ]; then + echo Installer finished + break; + elif [ "$?" -eq "1" ]; then + echo The installer has been disabled - please fix rhq-server.properties + break; + else + echo Installer exited with failure code "$?" - will try again in a few seconds + sleep 5 + fi +done diff --git a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml index a9454a5..25a2916 100644 --- a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml +++ b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml @@ -598,6 +598,13 @@ rhq.sync.endpoint-address=false </copy> <echo>Putting a developer setting in rhq-server.properties to turn on/off strict agent update version checking</echo> <echo file="${project.build.outputDirectory}/bin/rhq-server.properties" append="true">rhq.server.agent-update.nonstrict-version-check=true</echo> + <echo>Add auto-installer to rhq-server.sh script so developers don't have to run the installer in a separate step</echo> + <replace file="${project.build.outputDirectory}/bin/rhq-server.sh"> + <replacefilter> + <replacetoken># START SERVER</replacetoken> + <replacevalue><![CDATA[export RHQ_SERVER_HOME; ${RHQ_SERVER_HOME}/bin/rhq-autoinstall.sh &]]></replacevalue> + </replacefilter> + </replace> </target>
<!-- The prepare-release target must be run AFTER the resources:resources goal has executed. --> @@ -606,9 +613,9 @@ rhq.sync.endpoint-address=false <target name="prepare-release" description="If this is a release build, make sure it is properly prepared." depends="initialize, - fix-perms, developer-release-message, copy-dev-resources, + fix-perms, deploy-postgres-ds, deploy-oracle-ds">
@@ -619,7 +626,7 @@ rhq.sync.endpoint-address=false </target>
<target name="fix-perms"> - <!-- Make sure shell scripts are readable and executable. --> + <echo>Make sure shell scripts are readable and executable.</echo> <chmod dir="${project.build.outputDirectory}/bin" includes="*.sh" perm="ug+x" verbose="true" /> <chmod dir="${jboss.home}/bin" includes="*.sh" perm="ug+x" verbose="true" /> </target>
commit c17b4cf7d38974902e4d0c24641fe85781fc0aa3 Author: Stefan Negrea snegrea@redhat.com Date: Thu Dec 6 12:37:16 2012 -0600
Update generic map reader to match latest API changes for PropertyDefinitionMap.
diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ComplexConfigurationResourceComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ComplexConfigurationResourceComponent.java index f8c93a0..ac7e817 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ComplexConfigurationResourceComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ComplexConfigurationResourceComponent.java @@ -20,7 +20,8 @@
package org.rhq.plugins.cassandra;
-import java.util.List; +import java.util.Collection; +import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; import java.util.Set; @@ -67,10 +68,14 @@ public class ComplexConfigurationResourceComponent extends MBeanResourceComponen if (result instanceof Map) { PropertyDefinitionMap propertyDefinitionMap = (PropertyDefinitionMap) ((PropertyDefinitionList) propertyDefinition) .getMemberDefinition(); - List<PropertyDefinition> subPropertyDefinitions = propertyDefinitionMap.getPropertyDefinitions(); + String mapName = propertyDefinitionMap.getName(); - String keyName = ((PropertyDefinitionSimple) subPropertyDefinitions.get(0)).getName(); - String valueName = ((PropertyDefinitionSimple) subPropertyDefinitions.get(1)).getName(); + + Collection<PropertyDefinition> subPropertyDefinitions = propertyDefinitionMap + .getOrderedPropertyDefinitions(); + Iterator<PropertyDefinition> iterator = subPropertyDefinitions.iterator(); + String keyName = ((PropertyDefinitionSimple) iterator.next()).getName(); + String valueName = ((PropertyDefinitionSimple) iterator.next()).getName();
Map<Object, Object> mapValue = (Map<Object, Object>) result;
commit 205e28d1fefc84f23786b621a810e59e6c06ab34 Author: Stefan Negrea snegrea@redhat.com Date: Wed Dec 5 22:47:50 2012 -0600
Disable tests due to missing Cassandra common infrastructure.
diff --git a/modules/plugins/cassandra/src/test/java/org/rhq/plugins/cassandra/itest/DiscoveryAndConfigurationTest.java b/modules/plugins/cassandra/src/test/java/org/rhq/plugins/cassandra/itest/DiscoveryAndConfigurationTest.java index c7296fd..51adb81 100644 --- a/modules/plugins/cassandra/src/test/java/org/rhq/plugins/cassandra/itest/DiscoveryAndConfigurationTest.java +++ b/modules/plugins/cassandra/src/test/java/org/rhq/plugins/cassandra/itest/DiscoveryAndConfigurationTest.java @@ -58,7 +58,7 @@ import org.rhq.core.pluginapi.operation.OperationResult; * @author Stefan Negrea * */ -@Test(groups = { "integration" }, singleThreaded = true) +@Test(groups = { "integration" }, singleThreaded = true, enabled = false) public class DiscoveryAndConfigurationTest {
private static final int TYPE_HIERARCHY_DEPTH = 6; @@ -106,7 +106,7 @@ public class DiscoveryAndConfigurationTest { PluginContainer.getInstance().shutdown(); }
- @Test + @Test(enabled = false) public void pluginLoad() { PluginManager pluginManager = PluginContainer.getInstance().getPluginManager(); PluginEnvironment pluginEnvironment = pluginManager.getPlugin(PLUGIN_NAME); @@ -114,7 +114,7 @@ public class DiscoveryAndConfigurationTest { assert (pluginEnvironment.getPluginName().equals(PLUGIN_NAME)); }
- @Test(dependsOnMethods = "pluginLoad") + @Test(dependsOnMethods = "pluginLoad", enabled = false) public void discoverResources() throws Exception { InventoryReport report = PluginContainer.getInstance().getInventoryManager().executeServerScanImmediately(); Assert.assertNotNull(report);
commit 1b3de5e4e0dd50013aa1c5e63dcc34b982e7b52e Author: Stefan Negrea snegrea@redhat.com Date: Wed Dec 5 14:08:32 2012 -0600
Make thrift port configurable via server resource connection settings. Also remove CassandraUtil to ensure that port updates from the configuration are avaiable to child components right away.
diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeComponent.java index 1d3e08b..5f22f83 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeComponent.java @@ -26,12 +26,12 @@ import static org.rhq.core.domain.measurement.AvailabilityType.DOWN; import static org.rhq.core.domain.measurement.AvailabilityType.UNKNOWN; import static org.rhq.core.domain.measurement.AvailabilityType.UP; import static org.rhq.core.system.OperatingSystemType.WINDOWS; -import static org.rhq.plugins.cassandra.CassandraUtil.getCluster;
import java.io.File; import java.util.Set;
import me.prettyprint.hector.api.Cluster; +import me.prettyprint.hector.api.factory.HFactory;
import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -192,7 +192,12 @@ public class CassandraNodeComponent extends JMXServerComponent<ResourceComponent return; }
- Cluster cluster = getCluster(); + Cluster cluster = this.getThriftConnection(); report.addData(new MeasurementDataTrait(scheduleRequest, cluster.describeClusterName())); } + + public Cluster getThriftConnection() { + String thriftPort = this.getResourceContext().getPluginConfiguration().getSimpleValue("thriftPort"); + return HFactory.getOrCreateCluster("rhq", "localhost:" + thriftPort); + } } diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeDiscoveryComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeDiscoveryComponent.java index ac90fc1..a5f3415 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeDiscoveryComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeDiscoveryComponent.java @@ -87,6 +87,8 @@ public class CassandraNodeDiscoveryComponent extends JMXDiscoveryComponent { String path = processInfo.getExecutable().getCwd(); pluginConfig.put(new PropertySimple("baseDir", new File(path).getParentFile().getAbsolutePath()));
+ pluginConfig.put(new PropertySimple("thriftPort", "9160")); + return new DiscoveredResourceDetails(context.getResourceType(), resourceKey, resourceName, null, null, pluginConfig, processInfo); } diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraUtil.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraUtil.java deleted file mode 100644 index 5915eed..0000000 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraUtil.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * - * RHQ Management Platform - * Copyright (C) 2005-2012 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.cassandra; - -import java.util.List; - -import me.prettyprint.hector.api.Cluster; -import me.prettyprint.hector.api.ddl.KeyspaceDefinition; -import me.prettyprint.hector.api.factory.HFactory; - -/** - * @author John Sanda - */ -public class CassandraUtil { - - public static Cluster getCluster() { - // TODO Cannot hard code the port - return HFactory.getOrCreateCluster("rhq", "localhost:9160"); - } - - public static KeyspaceDefinition getKeyspaceDefinition(String keyspace) { - return getCluster().describeKeyspace(keyspace); - } - - public static List<KeyspaceDefinition> getKeyspaceDefinitions() { - return getCluster().describeKeyspaces(); - } -} diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyComponent.java index f58de06..9bfadbe 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyComponent.java @@ -27,7 +27,6 @@ package org.rhq.plugins.cassandra;
import static org.rhq.core.domain.configuration.ConfigurationUpdateStatus.FAILURE; import static org.rhq.core.domain.configuration.ConfigurationUpdateStatus.SUCCESS; -import static org.rhq.plugins.cassandra.CassandraUtil.getCluster;
import java.io.File;
@@ -96,7 +95,7 @@ public class ColumnFamilyComponent extends ComplexConfigurationResourceComponent log.debug("Updating resource configuration for column family " + context.getResourceKey()); }
- Cluster cluster = getCluster(); + Cluster cluster = this.getThriftConnection(); ColumnFamilyDefinition cfDef = getColumnFamilyDefinition(); Configuration updatedConfig = report.getConfiguration();
@@ -249,7 +248,19 @@ public class ColumnFamilyComponent extends ComplexConfigurationResourceComponent return null; }
+ /** + * @return parent resource component + */ private KeyspaceComponent getParentKeyspace() { return (KeyspaceComponent) this.getResourceContext().getParentResourceComponent(); } + + /** + * Retrieves a cluster connection from the parent resource. + * + * @return the cluster connection. + */ + private Cluster getThriftConnection() { + return getParentKeyspace().getThriftConnection(); + } } diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyDiscoveryComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyDiscoveryComponent.java index 89ab7ff..2a5f697 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyDiscoveryComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyDiscoveryComponent.java @@ -25,8 +25,6 @@
package org.rhq.plugins.cassandra;
-import static org.rhq.plugins.cassandra.CassandraUtil.getKeyspaceDefinition; - import java.util.HashSet; import java.util.Set;
@@ -51,7 +49,10 @@ public class ColumnFamilyDiscoveryComponent implements ResourceDiscoveryComponen Set<DiscoveredResourceDetails> details = new HashSet<DiscoveredResourceDetails>();
String keyspace = context.getParentResourceContext().getResourceKey(); - KeyspaceDefinition keyspaceDef = getKeyspaceDefinition(keyspace); + + KeyspaceComponent parent = (KeyspaceComponent) context.getParentResourceComponent(); + + KeyspaceDefinition keyspaceDef = parent.getKeyspaceDefinition();
for (ColumnFamilyDefinition columnFamilyDef : keyspaceDef.getCfDefs()) { String resourceKey = keyspace + "." + columnFamilyDef.getName(); diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceComponent.java index 45b9351..0cdf2e4 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceComponent.java @@ -28,6 +28,7 @@ package org.rhq.plugins.cassandra; import java.io.File; import java.util.Map;
+import me.prettyprint.hector.api.Cluster; import me.prettyprint.hector.api.ddl.KeyspaceDefinition;
import org.mc4j.ems.connection.EmsConnection; @@ -154,7 +155,7 @@ public class KeyspaceComponent implements ResourceComponent<ResourceComponent<?> }
public KeyspaceDefinition getKeyspaceDefinition() { - return CassandraUtil.getKeyspaceDefinition(context.getResourceKey()); + return this.getThriftConnection().describeKeyspace(context.getResourceKey()); }
public OperationResult takeSnapshot(Configuration parameters, String... columnFamilies) { @@ -249,4 +250,13 @@ public class KeyspaceComponent implements ResourceComponent<ResourceComponent<?> return null; }
+ /** + * Retrieves a cluster connection from the parent resource. + * + * @return the cluster connection. + */ + public Cluster getThriftConnection() { + CassandraNodeComponent parent = (CassandraNodeComponent) context.getParentResourceComponent(); + return parent.getThriftConnection(); + } } diff --git a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml index 65dde69..e7feef4 100644 --- a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml @@ -39,6 +39,7 @@ description="The RMI URL with which to connect to the Cassandra node (e.g. service:jmx:rmi:///jndi/rmi://localhost:7199/jmxrmi)."/> <c:simple-property name="type" readOnly="true" default="org.mc4j.ems.connection.support.metadata.J2SE5ConnectionTypeDescriptor" description="The type used to establish the EMS connection to the Cassandra node."/> + <c:simple-property name="thriftPort" displayName="Thrift Port" default="9160" required="true" readOnly="false" type="string" description="Thrift interface port"/> <c:simple-property name="installURI" required="false" type="string" description="The installation path for the selected server type which will be used to find client libraries (if appropriate)"/> <c:simple-property name="principal" required="false" description="The login principal/username"/> <c:simple-property name="credentials" required="false" type="password" description="The login credentials/password"/>
commit 7ca98675fbfa23dd545dd736a2e07b639da4f8a3 Author: Stefan Negrea snegrea@redhat.com Date: Tue Dec 4 16:02:41 2012 -0600
Avoid logging warning due to missing dependencies.
diff --git a/modules/plugins/cassandra/pom.xml b/modules/plugins/cassandra/pom.xml index 432c2ae..a65384c 100644 --- a/modules/plugins/cassandra/pom.xml +++ b/modules/plugins/cassandra/pom.xml @@ -70,7 +70,6 @@ <artifactId>snakeyaml</artifactId> <version>1.10</version> </dependency> - <dependency> <groupId>${rhq.groupId}</groupId> <artifactId>rhq-core-plugin-test-api</artifactId> @@ -123,6 +122,11 @@ <version>1.6.0</version> </artifactItem> <artifactItem> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <version>1.6.0</version> + </artifactItem> + <artifactItem> <groupId>org.apache.cassandra</groupId> <artifactId>cassandra-thrift</artifactId> <version>1.1.5</version>
commit d63328f17f896d9172c512f39fde963151d0041a Author: Stefan Negrea snegrea@redhat.com Date: Tue Dec 4 15:27:10 2012 -0600
Add cassandra integration tests.
diff --git a/.classpath b/.classpath index a4068fb..029ef7c 100644 --- a/.classpath +++ b/.classpath @@ -1,15 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="modules/common/ant-bundle/src/main/java"/> - <classpathentry kind="src" path="modules/enterprise/server/jar/src/test/java"/> - <classpathentry kind="src" path="modules/enterprise/server/itests-2/src/test/java"/> - <classpathentry kind="src" path="modules/enterprise/scripting/javascript/src/main/java"/> - <classpathentry kind="src" path="modules/enterprise/scripting/python/src/main/java"/> - <classpathentry kind="src" path="modules/enterprise/scripting/python/src/test/java"/> - <classpathentry kind="src" path="modules/enterprise/scripting/javascript/src/test/java"/> - <classpathentry kind="src" path="modules/enterprise/gui/installer/src/test/java"/> - <classpathentry kind="src" path="modules/common/jboss-as-dmr-client/src/test/java"/> - <classpathentry kind="src" path="modules/common/jboss-as-dmr-client/src/main/java"/> <classpathentry kind="src" path="modules/enterprise/scripting/api/src/main/java"/> <classpathentry kind="src" path="modules/cli-tests/src/main/java"/> <classpathentry kind="src" path="modules/helpers/jeeGen/src/main/java"/> @@ -49,6 +40,8 @@ <classpathentry kind="src" path="modules/enterprise/server/xml-schemas/src/test/java"/> <classpathentry kind="src" path="modules/enterprise/server/xml-schemas/target/generated-sources/xjc"/> <classpathentry kind="src" path="modules/enterprise/server/jar/src/main/java"/> + <classpathentry kind="src" path="modules/enterprise/server/jar/src/test/java"/> + <classpathentry kind="src" path="modules/enterprise/server/jar/src/main/filtered-sources/java"/> <classpathentry kind="src" path="modules/enterprise/server/jar/target/generated-sources/antlr3"/> <classpathentry kind="src" path="modules/enterprise/binding/src/main/java"/> <classpathentry kind="src" path="modules/enterprise/binding/src/test/java"/> @@ -56,8 +49,8 @@ <classpathentry kind="src" path="modules/enterprise/gui/coregui/target/generated-sources/gwt"/> <classpathentry kind="src" path="modules/enterprise/gui/portal-war/src/main/java"/> <classpathentry kind="src" path="modules/enterprise/gui/portal-war/src/test/java"/> - <classpathentry kind="src" path="modules/enterprise/gui/installer/src/main/java"/> - <classpathentry kind="src" path="modules/enterprise/gui/installer/target/generated-sources/gwt"/> + <classpathentry kind="src" path="modules/enterprise/gui/installer-war/src/main/java"/> + <classpathentry kind="src" path="modules/enterprise/gui/base-perspective-jar/src/main/java"/> <classpathentry kind="src" path="modules/enterprise/gui/content_http-war/src/main/java"/> <classpathentry kind="src" path="modules/enterprise/server/client-api/src/main/java"/> <classpathentry kind="src" path="modules/enterprise/remoting/client-api/src/main/java"/> @@ -66,8 +59,6 @@ <classpathentry kind="src" path="modules/enterprise/server/sars/agent-sar/src/main/java"/> <classpathentry kind="src" path="modules/enterprise/server/safe-invoker/src/main/java"/> <classpathentry kind="src" path="modules/enterprise/server/safe-invoker/src/test/java"/> - <classpathentry kind="src" path="modules/enterprise/server/startup-subsystem/src/main/java"/> - <classpathentry kind="src" path="modules/enterprise/server/startup-subsystem/src/test/java"/> <classpathentry kind="src" path="modules/enterprise/server/container-lib/src/main/java"/> <classpathentry kind="src" path="modules/enterprise/server/plugins/ant-bundle/src/main/java"/> <classpathentry kind="src" path="modules/enterprise/server/plugins/filetemplate-bundle/src/main/java"/> @@ -173,6 +164,7 @@ <classpathentry kind="src" path="modules/core/arquillian-integration/container/src/test/java"/> <classpathentry kind="src" path="modules/core/arquillian-integration/archive/src/main/java"/> <classpathentry kind="src" path="modules/core/arquillian-integration/container/src/main/java"/> + <classpathentry kind="src" path="modules/enterprise/server/itests/src/test/java"/> <classpathentry kind="src" path="modules/test-utils/src/main/java"/> <classpathentry kind="src" path="modules/integration-tests/mod_cluster-plugin-test/src/test/java"/> <classpathentry kind="src" path="etc/samples/skeleton-plugin/src/main/java"/> @@ -182,11 +174,14 @@ <classpathentry excluding="**" kind="src" path="modules/enterprise/comm/src/test/resources"/> <classpathentry excluding="**" kind="src" path="modules/enterprise/agent/src/main/resources"/> <classpathentry excluding="**" kind="src" path="modules/enterprise/agent/src/test/resources"/> + <classpathentry kind="src" path="modules/plugins/cassandra/src/main/java"/> + <classpathentry kind="src" path="modules/plugins/cassandra/src/test/java"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/integration/jboss-profileservice-spi/5.1.0.SP1/jboss-profileservice-spi-5.1.0.SP1.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/man/jboss-managed/2.1.1.GA/jboss-managed-2.1.1.GA.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/man/jboss-metatype/2.1.1.GA/jboss-metatype-2.1.1.GA.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/com/sun/xml/bind/jaxb-impl/2.2.4/jaxb-impl-2.2.4.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/apache/commons/commons-io/1.3.2/commons-io-1.3.2.jar" sourcepath="/M2_REPO/commons-io/commons-io/1.3.1/commons-io-1.3.1-sources.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/com/sun/xml/bind/jaxb-impl/2.1.9/jaxb-impl-2.1.9.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/i18nlog/i18nlog/1.0.10/i18nlog-1.0.10.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/gnu-getopt/getopt/1.0.13/getopt-1.0.13.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/commons-httpclient/commons-httpclient/3.0.1/commons-httpclient-3.0.1.jar"/> @@ -210,14 +205,17 @@ <classpathentry exported="true" kind="var" path="M2_REPO/tomcat/catalina/5.5.20/catalina-5.5.20.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/taglibs/standard/1.1.2/standard-1.1.2.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/jboss-common-core/2.2.17.GA/jboss-common-core-2.2.17.GA.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/jboss/jboss-common/1.2.1.GA/jboss-common-1.2.1.GA.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/javax/servlet/jstl/1.1.2/jstl-1.1.2.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/struts-menu/struts-menu/2.3/struts-menu-2.3.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/junit/junit/3.8.2/junit-3.8.2.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/apache/velocity/velocity/1.5/velocity-1.5.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/javax/xml/bind/jaxb-api/2.2.3/jaxb-api-2.2.3.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/xalan/xalan/2.5.1/xalan-2.5.1.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/javax/xml/bind/jsr173_api/1.0/jsr173_api-1.0.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/jboss/jboss-embeddable-ejb3/jboss-ejb3-all/1.0.0.Alpha9/jboss-ejb3-all-1.0.0.Alpha9.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/jboss/jbpm/3.1.1/jbpm-3.1.1.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/jboss/jboss-embeddable-ejb3/hibernate-all/1.0.0.Alpha9/hibernate-all-1.0.0.Alpha9.jar" sourcepath="/M2_REPO/hibernate/hibernate3/3.2.r14201-2/hibernate3-3.2.r14201-2.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/jetbrains/annotations/7.0.2/annotations-7.0.2.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/apache/ant/ant-launcher/1.8.0/ant-launcher-1.8.0.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/cglib/cglib-nodep/2.1_3/cglib-nodep-2.1_3.jar"/> @@ -229,25 +227,31 @@ <classpathentry exported="true" kind="var" path="M2_REPO/com/sun/facelets/jsf-facelets/1.1.15.B1/jsf-facelets-1.1.15.B1.jar" sourcepath="/M2_REPO/com/sun/facelets/jsf-facelets/1.1.15.B1/jsf-facelets-1.1.15.B1-sources.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/mc4j/org-mc4j-ems/1.3/org-mc4j-ems-1.3.jar" sourcepath="/M2_REPO/mc4j/org-mc4j-ems/1.3/org-mc4j-ems-1.3-sources.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/opensymphony/quartz/quartz/1.6.5/quartz-1.6.5.jar" sourcepath="/M2_REPO/org/opensymphony/quartz/quartz/1.6.5/quartz-1.6.5-sources.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/javax/mail/mail/1.4.4/mail-1.4.4.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/javax/mail/mail/1.4/mail-1.4.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/commons-fileupload/commons-fileupload/1.2/commons-fileupload-1.2.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/richfaces/framework/richfaces-api/3.3.3.Final/richfaces-api-3.3.3.Final.jar" sourcepath="/M2_REPO/org/richfaces/framework/richfaces-api/3.1.3.GA/richfaces-api-3.1.3.GA-sources.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/richfaces/framework/richfaces-impl/3.3.3.Final/richfaces-impl-3.3.3.Final.jar" sourcepath="/M2_REPO/org/richfaces/framework/richfaces-impl/3.3.0.GA/richfaces-impl-3.3.0.GA-sources.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/richfaces/ui/richfaces-ui/3.3.3.Final/richfaces-ui-3.3.3.Final.jar" sourcepath="/M2_REPO/org/richfaces/ui/richfaces-ui/3.3.0.GA/richfaces-ui-3.3.0.GA-sources.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/postgresql/postgresql/9.1-902.jdbc4/postgresql-9.1-902.jdbc4.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/postgresql/postgresql/9.1-901.jdbc4/postgresql-9.1-901.jdbc4.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/jboss/jboss-cache/1.4.1.SP9/jboss-cache-1.4.1.SP9.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/hyperic/sigar/1.6.5.132-3/sigar-1.6.5.132-3.jar" sourcepath="/M2_REPO/org/hyperic/sigar/1.6.3.82/sigar-1.6.3.82-sources.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/jbossts/jbossjts/4.16.2.Final/jbossjts-4.16.2.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/hyperic/sigar/1.6.5.132-3/sigar-1.6.5.132-3.jar" sourcepath="/M2_REPO/org/hyperic/sigar/1.6.5.132-3/sigar-1.6.5.132-3-sources.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/transaction/jboss-jta/4.2.3.SP5/jboss-jta-4.2.3.SP5.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/transaction/jboss-jts-common/4.2.3.SP5/jboss-jts-common-4.2.3.SP5.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/jbossws-spi/1.1.1.GA/jbossws-spi-1.1.1.GA.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/jbossws/jbossws-native-core/3.1.1.GA/jbossws-native-core-3.1.1.GA.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/apache/maven/maven-project/2.0.8/maven-project-2.0.8.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/apache/maven/maven-plugin-api/2.0.8/maven-plugin-api-2.0.8.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/codehaus/swizzle/swizzle-confluence/1.6.1/swizzle-confluence-1.6.1.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/jvnet/inflector/0.7.0/inflector-0.7.0.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/net/augeas/augeas/0.0.2/augeas-0.0.2.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/json/json/20090211/json-20090211.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/json/json/20080701/json-20080701.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/net/java/dev/jna/jna/3.2.5/jna-3.2.5.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/freemarker/freemarker/2.3.11/freemarker-2.3.11.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/seam/jboss-seam/2.1.0.SP1/jboss-seam-2.1.0.SP1.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/seam/jboss-seam-ui/2.1.0.SP1/jboss-seam-ui-2.1.0.SP1.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/hibernate/hibernate3/3.2.r14201-2/hibernate3-3.2.r14201-2.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/jline/jline/0.9.94/jline-0.9.94.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/javassist/javassist/3.12.1.GA/javassist-3.12.1.GA.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/javassist/javassist/3.9.0.GA/javassist-3.9.0.GA.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/net/sf/opencsv/opencsv/1.8/opencsv-1.8.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/commons-digester/commons-digester/1.8.1/commons-digester-1.8.1.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/commons-codec/commons-codec/1.4/commons-codec-1.4.jar"/> @@ -260,8 +264,8 @@ <classpathentry exported="true" kind="var" path="M2_REPO/jboss/web/jbossweb/2.0.1.GA/jbossweb-2.0.1.GA.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/libvirt/libvirt/0.4.1/libvirt-0.4.1.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/fedorahosted/cobbler/cobbler4j/0.1/cobbler4j-0.1.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/com/google/gwt/gwt-user/2.5.0/gwt-user-2.5.0.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/com/google/gwt/gwt-dev/2.5.0/gwt-dev-2.5.0.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/com/google/gwt/gwt-user/2.4.0/gwt-user-2.4.0.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/com/google/gwt/gwt-dev/2.4.0/gwt-dev-2.4.0.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/com/smartgwt/smartgwt/3.0/smartgwt-3.0.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/com/googlecode/gflot/gflot/2.4.2/gflot-2.4.2.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/com/jcraft/jsch/0.1.29/jsch-0.1.29.jar"/> @@ -278,62 +282,34 @@ <classpathentry exported="true" kind="var" path="M2_REPO/org/mongodb/mongo-java-driver/2.6.5/mongo-java-driver-2.6.5.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/com/googlecode/java-diff-utils/diffutils/1.2.1/diffutils-1.2.1.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/com/google/code/morphia/morphia/0.99/morphia-0.99.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/hibernate/hibernate-annotations/3.5.6-Final/hibernate-annotations-3.5.6-Final.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/hibernate/hibernate-core/4.0.1.Final/hibernate-core-4.0.1.Final.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/hibernate/hibernate-entitymanager/4.0.1.Final/hibernate-entitymanager-4.0.1.Final.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/hibernate/hibernate-validator/4.2.0.Final/hibernate-validator-4.2.0.Final.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/hibernate/javax/persistence/hibernate-jpa-2.0-api/1.0.1.Final/hibernate-jpa-2.0-api-1.0.1.Final.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/infinispan/infinispan-core/5.1.2.FINAL/infinispan-core-5.1.2.FINAL.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/spec/javax/servlet/jboss-servlet-api_3.0_spec/1.0.1.Final/jboss-servlet-api_3.0_spec-1.0.1.Final.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/msc/jboss-msc/1.0.2.GA/jboss-msc-1.0.2.GA.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/jboss-dmr/1.1.1.Final/jboss-dmr-1.1.1.Final.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/as/jboss-as-naming/7.1.1.Final/jboss-as-naming-7.1.1.Final.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/as/jboss-as-server/7.1.1.Final/jboss-as-server-7.1.1.Final.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/staxmapper/1.1.0.Final/staxmapper-1.1.0.Final.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/modules/jboss-modules/1.1.1.GA/jboss-modules-1.1.1.GA.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/as/jboss-as-subsystem-test/7.1.1.Final/jboss-as-subsystem-test-7.1.1.Final.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/as/jboss-as-controller/7.1.1.Final/jboss-as-controller-7.1.1.Final.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/as/jboss-as-controller-client/7.1.1.Final/jboss-as-controller-client-7.1.1.Final.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/resteasy/resteasy-links/2.3.4.Final/resteasy-links-2.3.4.Final.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/resteasy/resteasy-jaxrs/2.3.4.Final/resteasy-jaxrs-2.3.4.Final.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/resteasy/resteasy-jackson-provider/2.3.4.Final/resteasy-jackson-provider-2.3.4.Final.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/resteasy/jaxrs-api/2.3.4.Final/jaxrs-api-2.3.4.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/resteasy/resteasy-links/2.3.3.Final/resteasy-links-2.3.3.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/resteasy/resteasy-jaxrs/2.3.3.Final/resteasy-jaxrs-2.3.3.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/resteasy/resteasy-jackson-provider/2.3.3.Final/resteasy-jackson-provider-2.3.3.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/resteasy/jaxrs-api/2.3.3.Final/jaxrs-api-2.3.3.Final.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/sasl/jboss-sasl/1.0.0.Final/jboss-sasl-1.0.0.Final.jar"/> + <classpathentry exported="true" kind="var" path="JDK_HOME/lib/tools.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/mockito/mockito-all/1.9.0/mockito-all-1.9.0.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/powermock/powermock-api-mockito/1.4.12/powermock-api-mockito-1.4.12.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/powermock/powermock-core/1.4.12/powermock-core-1.4.12.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/powermock/powermock-api-support/1.4.12/powermock-api-support-1.4.12.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/powermock/powermock-module-testng-common/1.4.12/powermock-module-testng-common-1.4.12.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/powermock/powermock-module-testng/1.4.12/powermock-module-testng-1.4.12.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/powermock/powermock-api-mockito/1.4.11/powermock-api-mockito-1.4.11.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/powermock/powermock-core/1.4.11/powermock-core-1.4.11.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/powermock/powermock-api-support/1.4.11/powermock-api-support-1.4.11.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/powermock/powermock-module-testng-common/1.4.11/powermock-module-testng-common-1.4.11.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/powermock/powermock-module-testng/1.4.11/powermock-module-testng-1.4.11.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/liquibase/liquibase-core/2.0.3/liquibase-core-2.0.3.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/shrinkwrap/shrinkwrap-impl-base/1.0.1/shrinkwrap-impl-base-1.0.1.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/shrinkwrap/shrinkwrap-api/1.0.1/shrinkwrap-api-1.0.1.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/shrinkwrap/shrinkwrap-spi/1.0.1/shrinkwrap-spi-1.0.1.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/shrinkwrap/descriptors/shrinkwrap-descriptors-api-base/2.0.0-alpha-3/shrinkwrap-descriptors-api-base-2.0.0-alpha-3.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/shrinkwrap/resolver/shrinkwrap-resolver-api/1.0.0-beta-7/shrinkwrap-resolver-api-1.0.0-beta-7.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/shrinkwrap/resolver/shrinkwrap-resolver-api-maven/1.0.0-beta-7/shrinkwrap-resolver-api-maven-1.0.0-beta-7.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/arquillian/test/arquillian-test-spi/1.0.2.Final/arquillian-test-spi-1.0.2.Final.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/arquillian/test/arquillian-test-api/1.0.2.Final/arquillian-test-api-1.0.2.Final.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/arquillian/core/arquillian-core-spi/1.0.2.Final/arquillian-core-spi-1.0.2.Final.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/arquillian/core/arquillian-core-api/1.0.2.Final/arquillian-core-api-1.0.2.Final.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/arquillian/container/arquillian-container-spi/1.0.2.Final/arquillian-container-spi-1.0.2.Final.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/arquillian/container/arquillian-container-test-api/1.0.2.Final/arquillian-container-test-api-1.0.2.Final.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/arquillian/config/arquillian-config-api/1.0.2.Final/arquillian-config-api-1.0.2.Final.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/arquillian/container/arquillian-container-test-impl-base/1.0.2.Final/arquillian-container-test-impl-base-1.0.2.Final.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/arquillian/testng/arquillian-testng-core/1.0.2.Final/arquillian-testng-core-1.0.2.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/shrinkwrap/shrinkwrap-impl-base/1.0.0/shrinkwrap-impl-base-1.0.0.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/shrinkwrap/shrinkwrap-api/1.0.0/shrinkwrap-api-1.0.0.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/shrinkwrap/shrinkwrap-spi/1.0.0/shrinkwrap-spi-1.0.0.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/shrinkwrap/descriptors/shrinkwrap-descriptors-api-base/2.0.0-alpha-2/shrinkwrap-descriptors-api-base-2.0.0-alpha-2.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/shrinkwrap/resolver/shrinkwrap-resolver-api/1.0.0-beta-6/shrinkwrap-resolver-api-1.0.0-beta-6.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/shrinkwrap/resolver/shrinkwrap-resolver-api-maven/1.0.0-beta-6/shrinkwrap-resolver-api-maven-1.0.0-beta-6.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/arquillian/test/arquillian-test-spi/1.0.0.Final/arquillian-test-spi-1.0.0.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/arquillian/test/arquillian-test-api/1.0.0.Final/arquillian-test-api-1.0.0.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/arquillian/core/arquillian-core-spi/1.0.0.Final/arquillian-core-spi-1.0.0.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/arquillian/core/arquillian-core-api/1.0.0.Final/arquillian-core-api-1.0.0.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/arquillian/container/arquillian-container-spi/1.0.0.Final/arquillian-container-spi-1.0.0.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/arquillian/container/arquillian-container-test-api/1.0.0.Final/arquillian-container-test-api-1.0.0.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/arquillian/testng/arquillian-testng-core/1.0.0.Final/arquillian-testng-core-1.0.0.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/com/wordnik/swagger-annotations_2.9.1/1.1-SNAPSHOT/swagger-annotations_2.9.1-1.1-20120531.064118-1.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/byteman/byteman/1.2.1/byteman-1.2.1.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/ejb3/jboss-ejb3-ext-api/2.0.0/jboss-ejb3-ext-api-2.0.0.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/spec/javax/ejb/jboss-ejb-api_3.1_spec/1.0.2.Final/jboss-ejb-api_3.1_spec-1.0.2.Final.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/spec/javax/jms/jboss-jms-api_1.1_spec/1.0.0.Final/jboss-jms-api_1.1_spec-1.0.0.Final.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/spec/javax/interceptor/jboss-interceptors-api_1.1_spec/1.0.0.Final/jboss-interceptors-api_1.1_spec-1.0.0.Final.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/spec/javax/transaction/jboss-transaction-api_1.1_spec/1.0.0.Final/jboss-transaction-api_1.1_spec-1.0.0.Final.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/remotingjmx/remoting-jmx/1.0.2.Final/remoting-jmx-1.0.2.Final.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/mozilla/rhino/1.7R4/rhino-1.7R4.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/picketbox/picketbox/4.0.7.Final/picketbox-4.0.7.Final.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/python/jython-standalone/2.5.2/jython-standalone-2.5.2.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/com/wordnik/swagger-annotations_2.9.1/1.1.1-SNAPSHOT/swagger-annotations_2.9.1-1.1.1-20121031.024335-6.jar"/> - <classpathentry exported="true" kind="var" path="JDK_HOME/lib/tools.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/joda-time/joda-time/2.1/joda-time-2.1.jar"/> <classpathentry kind="var" path="M2_REPO/org/apache/cassandra/cassandra-thrift/1.1.5/cassandra-thrift-1.1.5.jar"/> <classpathentry kind="var" path="M2_REPO/org/hectorclient/hector-core/1.1-1/hector-core-1.1-1.jar"/> <classpathentry kind="output" path="eclipse-classes"/> diff --git a/modules/plugins/cassandra/pom.xml b/modules/plugins/cassandra/pom.xml index 7b4f506..432c2ae 100644 --- a/modules/plugins/cassandra/pom.xml +++ b/modules/plugins/cassandra/pom.xml @@ -70,6 +70,21 @@ <artifactId>snakeyaml</artifactId> <version>1.10</version> </dependency> + + <dependency> + <groupId>${rhq.groupId}</groupId> + <artifactId>rhq-core-plugin-test-api</artifactId> + <version>${project.version}</version> + <type>pom</type> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>${rhq.groupId}</groupId> + <artifactId>rhq-core-plugin-test-util</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> </dependencies>
<build> @@ -191,6 +206,82 @@ <goal>run</goal> </goals> </execution> + + <execution> + <phase>pre-integration-test</phase> + <configuration> + <target> + <echo>Setting up plugin dependencies...</echo> + <property name="settings.localRepository" location="${user.home}/.m2/repository" /> + <mkdir dir="target/testsetup" /> + + <mkdir dir="target/testsetup/plugins" /> + <copy toDir="target/testsetup/plugins" flatten="true"> + <fileset dir="${settings.localRepository}/"> + <include name="org/rhq/rhq-jmx-plugin/${project.version}/rhq-jmx-plugin-${project.version}.jar" /> + </fileset> + <fileset dir="${rhq.deploymentDir}"> + <include name="${project.artifactId}-${project.version}.jar" /> + </fileset> + <fileset dir="${project.build.directory}" includes="${project.artifactId}-${project.version}.jar" /> + </copy> + + <mkdir dir="target/testsetup/lib" /> + <unzip dest="target/testsetup/lib"> + <fileset dir="${settings.localRepository}/org/hyperic/sigar-dist/${sigar.version}" includes="*.zip" /> + <patternset> + <include name="**/lib/sigar.jar" /> + <include name="**/lib/bcel*.jar" /> + <include name="**/lib/*.so" /> + <include name="**/lib/*.sl" /> + <include name="**/lib/*.dll" /> + <include name="**/lib/*.dylib" /> + </patternset> + </unzip> + <move todir="target/testsetup/lib" flatten="true"> + <fileset dir="target/testsetup/lib"> + <include name="**/lib/*" /> + </fileset> + </move> + <delete dir="target/testsetup/lib/hyperic-sigar-${sigar.version}" /> + </target> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + </executions> + </plugin> + + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <skip>true</skip> + </configuration> + <executions> + <execution> + <id>surefire-it</id> + <phase>integration-test</phase> + <goals> + <goal>test</goal> + </goals> + <configuration> + <skip>${maven.test.skip}</skip> + <excludedGroups>${rhq.testng.excludedGroups}</excludedGroups> + <useSystemClassLoader>false</useSystemClassLoader> + <argLine>-Dorg.hyperic.sigar.path=${basedir}/target/testsetup/lib</argLine> + <systemProperties> + <property> + <name>project.artifactId</name> + <value>${project.artifactId}</value> + </property> + <property> + <name>project.version</name> + <value>${project.version}</value> + </property> + </systemProperties> + </configuration> + </execution> </executions> </plugin> </plugins> diff --git a/modules/plugins/cassandra/src/test/java/org/rhq/plugins/cassandra/itest/DiscoveryAndConfigurationTest.java b/modules/plugins/cassandra/src/test/java/org/rhq/plugins/cassandra/itest/DiscoveryAndConfigurationTest.java new file mode 100644 index 0000000..c7296fd --- /dev/null +++ b/modules/plugins/cassandra/src/test/java/org/rhq/plugins/cassandra/itest/DiscoveryAndConfigurationTest.java @@ -0,0 +1,268 @@ +/* + * RHQ Management Platform + * Copyright 2011, Red Hat Middleware LLC, and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +package org.rhq.plugins.cassandra.itest; + +import java.io.File; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.Queue; +import java.util.Set; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.testng.Assert; +import org.testng.annotations.AfterSuite; +import org.testng.annotations.BeforeSuite; +import org.testng.annotations.Test; + +import org.rhq.core.clientapi.agent.configuration.ConfigurationUpdateRequest; +import org.rhq.core.clientapi.server.configuration.ConfigurationUpdateResponse; +import org.rhq.core.clientapi.server.discovery.InventoryReport; +import org.rhq.core.domain.configuration.Configuration; +import org.rhq.core.domain.measurement.DataType; +import org.rhq.core.domain.measurement.MeasurementData; +import org.rhq.core.domain.measurement.MeasurementDefinition; +import org.rhq.core.domain.measurement.MeasurementReport; +import org.rhq.core.domain.measurement.MeasurementScheduleRequest; +import org.rhq.core.domain.resource.Resource; +import org.rhq.core.pc.PluginContainer; +import org.rhq.core.pc.PluginContainerConfiguration; +import org.rhq.core.pc.configuration.ConfigurationManager; +import org.rhq.core.pc.plugin.FileSystemPluginFinder; +import org.rhq.core.pc.plugin.PluginEnvironment; +import org.rhq.core.pc.plugin.PluginManager; +import org.rhq.core.pluginapi.inventory.ResourceComponent; +import org.rhq.core.pluginapi.measurement.MeasurementFacet; +import org.rhq.core.pluginapi.operation.OperationFacet; +import org.rhq.core.pluginapi.operation.OperationResult; + +/** + * @author Stefan Negrea + * + */ +@Test(groups = { "integration" }, singleThreaded = true) +public class DiscoveryAndConfigurationTest { + + private static final int TYPE_HIERARCHY_DEPTH = 6; + protected static final String PLUGIN_NAME = "Cassandra"; + + private Log log = LogFactory.getLog(this.getClass()); + private ConfigurationManager configManager; + + + protected int getTypeHierarchyDepth() { + return TYPE_HIERARCHY_DEPTH; + } + + protected String getPluginName() { + return PLUGIN_NAME; + } + + @BeforeSuite + public void setupTestResources() { + try { + File pluginDir = new File("target/testsetup/plugins"); + PluginContainerConfiguration pcConfig = new PluginContainerConfiguration(); + pcConfig.setPluginFinder(new FileSystemPluginFinder(pluginDir)); + pcConfig.setPluginDirectory(pluginDir); + + pcConfig.setInsideAgent(false); + PluginContainer.getInstance().setConfiguration(pcConfig); + PluginContainer.getInstance().initialize(); + log.info("PC started."); + for (String plugin : PluginContainer.getInstance().getPluginManager().getMetadataManager().getPluginNames()) { + log.info("...Loaded plugin: " + plugin); + } + + configManager = PluginContainer.getInstance().getConfigurationManager(); + configManager.initialize(); + Thread.sleep(10 * 1000L); + + } catch (Exception e) { + log.info("Error initializing the context", e); + } + } + + @AfterSuite + public void stopTestResources() { + PluginContainer.getInstance().shutdown(); + } + + @Test + public void pluginLoad() { + PluginManager pluginManager = PluginContainer.getInstance().getPluginManager(); + PluginEnvironment pluginEnvironment = pluginManager.getPlugin(PLUGIN_NAME); + assert (pluginEnvironment != null) : "Null environment, plugin not loaded"; + assert (pluginEnvironment.getPluginName().equals(PLUGIN_NAME)); + } + + @Test(dependsOnMethods = "pluginLoad") + public void discoverResources() throws Exception { + InventoryReport report = PluginContainer.getInstance().getInventoryManager().executeServerScanImmediately(); + Assert.assertNotNull(report); + log.info("Discovery took: " + (report.getEndTime() - report.getStartTime()) + "ms"); + + Thread.sleep(1000); + + report = PluginContainer.getInstance().getInventoryManager().executeServiceScanImmediately(); + Assert.assertNotNull(report); + log.info("Discovery took: " + (report.getEndTime() - report.getStartTime()) + "ms"); + + Set<String> ignoredResourceTypes = new HashSet<String>(); + ignoredResourceTypes.add("Cassandra Server JVM"); + + Set<String> ignoredResourceNames = new HashSet<String>(); + ignoredResourceNames.add("system"); + + Set<Resource> resources = findResourcesForTest(PluginContainer.getInstance().getInventoryManager().getPlatform(), + ignoredResourceTypes, ignoredResourceNames); + log.info("Found " + resources.size() + " Cassandra resources."); + + Assert.assertNotEquals(resources.size(), 0, "No cassandra or related instances found."); + + for (Object resource : resources.toArray()) { + loadResourceMetrics((Resource) resource); + loadUpdateResourceConfiguration((Resource) resource); + executeResourceOperations((Resource) resource); + } + } + + private void loadUpdateResourceConfiguration(Resource resource) throws Exception { + if (resource.getResourceType().getResourceConfigurationDefinition() != null + && resource.getResourceType().getResourceConfigurationDefinition().getPropertyDefinitions().size() != 0) { + try { + Configuration configUnderTest = configManager.loadResourceConfiguration(resource.getId()); + + ConfigurationUpdateRequest updateRequest = new ConfigurationUpdateRequest(1, configUnderTest, + resource.getId()); + ConfigurationUpdateResponse updateResponse = configManager + .executeUpdateResourceConfigurationImmediately(updateRequest); + + if (updateResponse == null) { + log.error("------------------------------"); + log.error(resource); + log.error("Update Response is NULL!!!!"); + log.error("------------------------------\n"); + } + if (updateResponse.getErrorMessage() != null) { + log.error("------------------------------"); + log.error(resource); + log.error(updateResponse.getErrorMessage()); + log.error("------------------------------\n"); + } + } catch (Exception e) { + log.error(resource, e); + } + } + } + + @SuppressWarnings("rawtypes") + private void loadResourceMetrics(Resource resource) throws Exception { + ResourceComponent resourceComponent = PluginContainer.getInstance().getInventoryManager() + .getResourceComponent(resource); + + if (resourceComponent instanceof MeasurementFacet) { + for (MeasurementDefinition def : resource.getResourceType().getMetricDefinitions()) { + Set<MeasurementScheduleRequest> metricList = new HashSet<MeasurementScheduleRequest>(); + metricList.add(new MeasurementScheduleRequest(1, def.getName(), 1000, true, def.getDataType(), null)); + MeasurementReport report = new MeasurementReport(); + ((MeasurementFacet) resourceComponent).getValues(report, metricList); + + if (def.getDataType().equals(DataType.TRAIT)) { + MeasurementData data = report.getTraitData().iterator().next(); + Assert.assertNotNull(data, "Unable to collect trait [" + def.getName() + "] on " + resource); + log.info("Measurement: " + def.getName() + "=" + data.getValue()); + } else if (def.getDataType().equals(DataType.MEASUREMENT)) { + MeasurementData data = report.getNumericData().iterator().next(); + Assert.assertNotNull(data, "Unable to collect measurement [" + def.getName() + "] on " + resource); + log.info("Measurement: " + def.getName() + "=" + data.getValue()); + } + } + } + } + + private void executeResourceOperations(Resource resource) throws Exception { + String resourceTypeName = resource.getResourceType().getName(); + + if (resourceTypeName.equals("CacheService")) { + Configuration config = new Configuration(); + executeOperation(resource, "saveCaches", config); + executeOperation(resource, "invalidateKeyCache", config); + executeOperation(resource, "invalidateRowCache", config); + } else if (resourceTypeName.equals("Keyspace")) { + Configuration config = new Configuration(); + executeOperation(resource, "repair", config); + executeOperation(resource, "compact", config); + executeOperation(resource, "takeSnapshot", config); + } else if (resourceTypeName.equals("ColumnFamily")) { + Configuration config = new Configuration(); + executeOperation(resource, "repair", config); + executeOperation(resource, "compact", config); + executeOperation(resource, "takeSnapshot", config); + executeOperation(resource, "disableAutoCompaction", config); + } + } + + @SuppressWarnings("rawtypes") + private void executeOperation(Resource resource, String operationName, Configuration config) throws Exception { + ResourceComponent resourceComponent = PluginContainer.getInstance().getInventoryManager() + .getResourceComponent(resource); + + OperationResult result = ((OperationFacet) resourceComponent).invokeOperation(operationName, config); + + if (result != null) { + log.info("Result of operation " + operationName + " was: " + result.getSimpleResult()); + if (result.getErrorMessage() != null) { + Assert.fail("Operation execution failed"); + } + } + } + + private Set<Resource> findResourcesForTest(Resource parent, Set<String> ignoredResourceTypes, + Set<String> ignoredResourceNames) { + Set<Resource> foundResources = new HashSet<Resource>(); + + Queue<Resource> discoveryQueue = new LinkedList<Resource>(); + discoveryQueue.add(parent); + + while (!discoveryQueue.isEmpty()) { + Resource currentResource = discoveryQueue.poll(); + + if (ignoredResourceTypes.contains(currentResource.getResourceType().getName()) + || ignoredResourceNames.contains(currentResource.getName())) { + continue; + } + + log.info("Discovered resource of type: " + currentResource.getResourceType().getName()); + if (currentResource.getResourceType().getPlugin().equals(PLUGIN_NAME)) { + foundResources.add(currentResource); + } + + if (currentResource.getChildResources() != null) { + for (Resource child : currentResource.getChildResources()) { + discoveryQueue.add(child); + } + } + } + + return foundResources; + } +} \ No newline at end of file
commit 626c434e4ce55199e140e2e8a2d7c29fef073031 Author: Stefan Negrea snegrea@redhat.com Date: Tue Dec 4 15:26:47 2012 -0600
A few plugin descriptor and code updates based on integration test results.
diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyComponent.java index 845b2fb..f58de06 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyComponent.java @@ -47,13 +47,11 @@ import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport; import org.rhq.core.pluginapi.inventory.ResourceContext; import org.rhq.core.pluginapi.operation.OperationResult; import org.rhq.core.util.file.FileUtil; -import org.rhq.plugins.jmx.JMXComponent; -import org.rhq.plugins.jmx.MBeanResourceComponent;
/** * @author John Sanda */ -public class ColumnFamilyComponent extends MBeanResourceComponent<JMXComponent<?>> { +public class ColumnFamilyComponent extends ComplexConfigurationResourceComponent {
private Log log = LogFactory.getLog(ColumnFamilyComponent.class);
diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ComplexConfigurationResourceComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ComplexConfigurationResourceComponent.java index 583e2c4..f8c93a0 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ComplexConfigurationResourceComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ComplexConfigurationResourceComponent.java @@ -36,6 +36,7 @@ import org.rhq.core.domain.configuration.definition.PropertyDefinition; import org.rhq.core.domain.configuration.definition.PropertyDefinitionList; import org.rhq.core.domain.configuration.definition.PropertyDefinitionMap; import org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple; +import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport; import org.rhq.plugins.jmx.JMXComponent; import org.rhq.plugins.jmx.MBeanResourceComponent;
@@ -110,4 +111,10 @@ public class ComplexConfigurationResourceComponent extends MBeanResourceComponen
return configuration; } + + @Override + public void updateResourceConfiguration(ConfigurationUpdateReport report) { + // don't try to update the read only properties, it will fail + super.updateResourceConfiguration(report, true); + } } diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceComponent.java index 5b15ee4..45b9351 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceComponent.java @@ -36,6 +36,7 @@ import org.mc4j.ems.connection.bean.attribute.EmsAttribute; import org.mc4j.ems.connection.bean.operation.EmsOperation;
import org.rhq.core.domain.configuration.Configuration; +import org.rhq.core.domain.configuration.ConfigurationUpdateStatus; import org.rhq.core.domain.configuration.PropertyList; import org.rhq.core.domain.configuration.PropertyMap; import org.rhq.core.domain.configuration.PropertySimple; @@ -107,6 +108,7 @@ public class KeyspaceComponent implements ResourceComponent<ResourceComponent<?>
@Override public void updateResourceConfiguration(ConfigurationUpdateReport report) { + report.setStatus(ConfigurationUpdateStatus.NOCHANGE); }
@Override diff --git a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml index 246d002..65dde69 100644 --- a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml @@ -80,7 +80,6 @@ </plugin-configuration> </server>
- <service name="StorageProxy" discovery="org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent" class="org.rhq.plugins.jmx.MBeanResourceComponent" @@ -104,10 +103,11 @@ <metric property="TotalWriteLatencyMicros" measurementType="trendsup" displayType="detail" displayName="Total Write Latency (microseconds)" description="The latency of all write operations since execution start"/> <metric property="WriteOperations" measurementType="trendsup" displayType="summary" description="Total number of write operations since execution start"/>
+ <resource-configuration> <c:simple-property name="HintedHandoffEnabled" type="boolean" required="true" description="Hinted Handoff Enabled"/> - <c:simple-property name="MaxHintsInProgress" type="long" required="true" description="Max Hints in Progress"/> - <c:simple-property name="MaxHintWindow" type="long" required="true" description="Max Hint Window"/> + <c:simple-property name="MaxHintsInProgress" type="integer" required="true" description="Max Hints in Progress"/> + <c:simple-property name="MaxHintWindow" type="integer" required="true" description="Max Hint Window"/> <c:simple-property name="RPCTimeout" type="long" required="true" displayName="RPC Timeout" description="RPC Timeout"/> </resource-configuration> </service> @@ -162,7 +162,7 @@ <metric property="Load" dataType="measurement" units="bytes" displayType="summary" description="Amount of load in disk usage on the node being queried"/> <metric property="OperationMode" dataType="trait" displayType="summary" description="Current operation mode"/> <metric property="ReleaseVersion" dataType="trait" displayType="summary" description="Cassandra version"/> - <metric property="RPCServiceRunning" dataType="trait" displayType="summary" displayName="RPC Service Running" description="RPC Service Running"/> + <metric property="RPCServerRunning" dataType="trait" displayType="summary" displayName="RPC Service Running" description="RPC Service Running"/> <metric property="SchemaVersion" dataType="trait" displayType="summary" description="The current schema version for this node. The value is calculated as a checksum of all rows in the system.schema_* column families. This value is used in an algorithm to compare schema versions @@ -240,7 +240,7 @@ <c:simple-property name="nameTemplate" readOnly="true" type="string" default="Commit Log" /> </plugin-configuration>
- <metric property="TotalCommitLogSize" measurementType="trendsup" displayType="summary" description="Size of all commit log segments"/> + <metric property="TotalCommitlogSize" measurementType="trendsup" dataType="measurement" displayType="summary" description="Size of all commit log segments"/> <metric property="PendingTasks" measurementType="dynamic" displayType="summary" description="Number of tasks waiting to be executed"/> <metric property="CompletedTasks" measurementType="trendsup" displayType="summary" description="Number of completed tasks"/> </service> @@ -343,7 +343,7 @@ <operation name="invalidateRowCache" description="Invalidate the row cache."/>
<metric property="KeyCacheHits" measurementType="dynamic" displayType="summary" description="Number of key cache hits"/> - <metric property="RowCacheHists" measurementType="dynamic" displayType="summary" description="Number of row cache hits"/> + <metric property="RowCacheHits" measurementType="dynamic" displayType="summary" description="Number of row cache hits"/>
<metric property="KeyCacheRequests" measurementType="dynamic" displayType="summary" description="Number of key cache requests"/> <metric property="RowCacheRequests" measurementType="dynamic" displayType="summary" description="Number of row cache requests"/> @@ -552,7 +552,7 @@ </plugin-configuration>
<metric property="TotalTimeouts" measurementType="trendsup" displayType="detail" description="Total timeouts."/> - <metric property="RecentTotalTimeouts" measurementType="trendsup" displayType="detail" description="Recent total timeouts."/> + <metric property="RecentTotalTimouts" measurementType="trendsup" displayType="detail" description="Recent total timeouts."/>
<resource-configuration> <c:list-property name="CommandPendingTasks" readOnly="true"> @@ -737,7 +737,7 @@ defaults to 10 days and allows for a large amount of time for consistency to be achived prior to deletion. In a single node cluster this can be reduced to zero."/> <c:simple-property name="CompactionStrategyClass" type="string" required="true" description="Compaction strategy class name."/> - <c:simple-property name="CompressionParameters" type="string" required="true" description="Compression parameters"/> + <c:simple-property name="CompressionParameters" type="string" readOnly="true" description="Compression parameters"/> <c:simple-property name="MinimumCompactionThreshold" type="integer" required="true" description="Minimum number of sstables in queue before compaction kicks off."/> <c:simple-property name="MaximumCompactionThreshold" type="integer" required="true" description="Maximum number of sstables in queue before compaction kicks off."/> <c:list-property name="snapshots" readOnly="true" required="false">
commit db9a36777950444d7b3c559c79ed9d67d2c4b11d Author: Stefan Negrea snegrea@redhat.com Date: Thu Nov 1 16:36:43 2012 -0500
Get the list of keyspaces directly from the StorageService bean instead of using hector.
diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceDiscoveryComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceDiscoveryComponent.java index 58c6ecc..5c761df 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceDiscoveryComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceDiscoveryComponent.java @@ -25,33 +25,90 @@
package org.rhq.plugins.cassandra;
-import static org.rhq.plugins.cassandra.CassandraUtil.getKeyspaceDefinitions; - +import java.util.ArrayList; import java.util.HashSet; +import java.util.List; import java.util.Set;
-import me.prettyprint.hector.api.ddl.KeyspaceDefinition; +import org.mc4j.ems.connection.EmsConnection; +import org.mc4j.ems.connection.bean.EmsBean; +import org.mc4j.ems.connection.bean.attribute.EmsAttribute;
import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails; -import org.rhq.core.pluginapi.inventory.ResourceComponent; import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent; import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext; +import org.rhq.plugins.jmx.JMXComponent;
/** * @author John Sanda */ -public class KeyspaceDiscoveryComponent implements ResourceDiscoveryComponent<ResourceComponent<?>> { +public class KeyspaceDiscoveryComponent implements ResourceDiscoveryComponent<JMXComponent<?>> { + + private static final String STORAGE_SERVICE_BEAN = "org.apache.cassandra.db:type=StorageService";
@Override - public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<ResourceComponent<?>> context) + public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<JMXComponent<?>> context) throws Exception { + Set<DiscoveredResourceDetails> details = new HashSet<DiscoveredResourceDetails>();
- for (KeyspaceDefinition keyspaceDef : getKeyspaceDefinitions()) { - details.add(new DiscoveredResourceDetails(context.getResourceType(), keyspaceDef.getName(), - keyspaceDef.getName(), null, null, null, null)); + for (Object keyspaceName : getKeyspaces(context.getParentResourceComponent().getEmsConnection())) { + details.add(new DiscoveredResourceDetails(context.getResourceType(), keyspaceName.toString(), keyspaceName + .toString(), null, null, null, null)); }
return details; } + + /** + * Retrieve the keyspace names from the StorageService bean. + * + * @param emsConnection Ems Connection + * @return list of keyspaces + */ + @SuppressWarnings("unchecked") + private List<Object> getKeyspaces(EmsConnection emsConnection) { + List<Object> value = null; + + EmsBean emsBean = loadBean(STORAGE_SERVICE_BEAN, emsConnection); + if (emsBean != null) { + EmsAttribute attribute = emsBean.getAttribute("Keyspaces"); + if (attribute != null) { + value = (List<Object>) attribute.refresh(); + } + } + + if (value == null) { + value = new ArrayList<Object>(); + } + + return value; + } + + /** + * Loads the bean with the given object name. + * + * Subclasses are free to override this method in order to load the bean. + * + * @param objectName the name of the bean to load + * @return the bean that is loaded + */ + private EmsBean loadBean(String objectName, EmsConnection emsConnection) { + if (emsConnection != null) { + EmsBean bean = emsConnection.getBean(objectName); + if (bean == null) { + // In some cases, this resource component may have been discovered by some means other than querying its + // parent's EMSConnection (e.g. ApplicationDiscoveryComponent uses a filesystem to discover EARs and + // WARs that are not yet deployed). In such cases, getBean() will return null, since EMS won't have the + // bean in its cache. To cover such cases, make an attempt to query the underlying MBeanServer for the + // bean before giving up. + emsConnection.queryBeans(objectName); + bean = emsConnection.getBean(objectName); + } + + return bean; + } + + return null; + } }
commit e15a6c0985481a8a850398c1e6b9e51e9e3e83ad Author: Stefan Negrea snegrea@redhat.com Date: Thu Nov 1 15:57:24 2012 -0500
Enable full support for StorageService properties and metrics.
diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ComplexConfigurationResourceComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ComplexConfigurationResourceComponent.java index b046d08..583e2c4 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ComplexConfigurationResourceComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ComplexConfigurationResourceComponent.java @@ -45,7 +45,7 @@ import org.rhq.plugins.jmx.MBeanResourceComponent; */ public class ComplexConfigurationResourceComponent extends MBeanResourceComponent<JMXComponent<?>> {
- @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "deprecation" }) @Override public Configuration loadResourceConfiguration() { Configuration configuration = super.loadResourceConfiguration(); @@ -90,6 +90,15 @@ public class ComplexConfigurationResourceComponent extends MBeanResourceComponen for (Object entry : setValue) { propertyList.add(new PropertySimple(entryName, entry.toString())); } + } else if (result instanceof Object[]) { + String entryName = ((PropertyDefinitionSimple) ((PropertyDefinitionList) propertyDefinition) + .getMemberDefinition()).getName(); + + Object[] arrayValue = (Object[]) result; + + for (Object entry : arrayValue) { + propertyList.add(new PropertySimple(entryName, entry.toString())); + } }
if (propertyList.getList().size() != 0) { diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java index d3e61cf..65baca8 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java @@ -36,18 +36,14 @@ import org.mc4j.ems.connection.bean.attribute.EmsAttribute; import org.mc4j.ems.connection.bean.operation.EmsOperation;
import org.rhq.core.domain.configuration.Configuration; -import org.rhq.core.domain.configuration.PropertyList; -import org.rhq.core.domain.configuration.PropertySimple; import org.rhq.core.domain.measurement.AvailabilityType; import org.rhq.core.pluginapi.inventory.ResourceContext; import org.rhq.core.pluginapi.operation.OperationResult; -import org.rhq.plugins.jmx.JMXComponent; -import org.rhq.plugins.jmx.MBeanResourceComponent;
/** * @author John Sanda */ -public class StorageServiceComponent extends MBeanResourceComponent<JMXComponent<?>> { +public class StorageServiceComponent extends ComplexConfigurationResourceComponent {
private Log log = LogFactory.getLog(StorageServiceComponent.class);
@@ -125,21 +121,4 @@ public class StorageServiceComponent extends MBeanResourceComponent<JMXComponent
return new OperationResult(); } - - @Override - public Configuration loadResourceConfiguration() { - Configuration config = super.loadResourceConfiguration(); - EmsBean emsBean = getEmsBean(); - EmsAttribute attribute = emsBean.getAttribute("AllDataFileLocations"); - - PropertyList list = new PropertyList("dataFileLocations"); - String[] dirs = (String[]) attribute.getValue(); - for (String dir : dirs) { - list.add(new PropertySimple("directory", dir)); - } - config.put(list); - - return config; - } - } diff --git a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml index 4cfe3e3..246d002 100644 --- a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml @@ -155,23 +155,76 @@ </parameters> </operation>
- <metric property="Token" dataType="trait" description="A string representation of this node's token" defaultOn="true"/> - <metric property="ReleaseVersion" dataType="trait" description="The Cassandra version"/> + <metric property="CurrentGenerationNumber" dataType="trait" displayType="summary" description="Current generation number"/> + <metric property="ExceptionCount" measurementType="trendsup" dataType="measurement" displayType="summary" description="Exception Count"/> + <metric property="Initialized" dataType="trait" displayType="summary" description="Initialized"/> + <metric property="Joined" dataType="trait" displayType="summary" description="Joined"/> + <metric property="Load" dataType="measurement" units="bytes" displayType="summary" description="Amount of load in disk usage on the node being queried"/> + <metric property="OperationMode" dataType="trait" displayType="summary" description="Current operation mode"/> + <metric property="ReleaseVersion" dataType="trait" displayType="summary" description="Cassandra version"/> + <metric property="RPCServiceRunning" dataType="trait" displayType="summary" displayName="RPC Service Running" description="RPC Service Running"/> <metric property="SchemaVersion" dataType="trait" displayType="summary" description="The current schema version for this node. The value is calculated as a checksum of all rows in the system.schema_* column families. This value is used in an algorithm to compare schema versions between nodes and apply updates as necessary. This value should be the same for all fully initialized nodes in the cluster."/> - <metric property="ReleaseVersion" dataType="trait" description="Cassandra version"/> - <metric property="Load" dataType="measurement" units="bytes" displayType="summary" description="Amount of load in disk usage on the node being queried"/> - <metric property="OperationMode" dataType="trait" description="The current operation mode"/> + <metric property="Token" dataType="trait" displayType="summary" description="A string representation of this node's token" defaultOn="true"/>
<resource-configuration> - <c:simple-property name="SavedCachesLocation" type="string" readOnly="true" description="Location of the saved caches directory"/> - <c:simple-property name="CommitLogLocation" type="string" readOnly="true" default="Location of the commit log directory"/> - <c:list-property name="dataFileLocations" readOnly="true" description="List of data file locations"> - <c:simple-property name="directory" type="string" readOnly="true"/> - </c:list-property> + <c:group name="DataStorage"> + <c:list-property name="AllDataFileLocations" displayName="Data File Locations" readOnly="true" description="List of data file locations"> + <c:simple-property name="directory" type="string" readOnly="true"/> + </c:list-property> + <c:simple-property name="CommitLogLocation" type="string" readOnly="true" default="Location of the commit log directory"/> + <c:simple-property name="SavedCachesLocation" type="string" readOnly="true" description="Location of the saved caches directory"/> + </c:group> + + <c:group name="NodeConfiguration"> + <c:simple-property name="CompactionThroughputMbPerSec" type="integer" required="true" displayName="Compaction Throughput Mb Per Sec" description="Compaction throughput in Mb/Sec"/> + <c:simple-property name="DrainProgress" type="string" required="false" readOnly="true" description="Drain progress"/> + <c:simple-property name="IncrementalBackupsEnabled" type="boolean" required="true" description="Incremental Backups Enabled"/> + <c:list-property name="PrimaryRange" readOnly="true" description="Primary Range"> + <c:simple-property name="element" type="string" readOnly="true"/> + </c:list-property> + <c:simple-property name="RemovalStatus" type="string" readOnly="true" description="Removal status"/> + <c:simple-property name="StreamThroughputMbPerSec" type="integer" required="true" displayName="Stream Throughput Mb Per Sec" description="Stream throughput in Mb/Sec"/> + </c:group> + + <c:group name="Cluster Information"> + <c:list-property name="LeavingNodes" readOnly="true" description="List of nodes currently leaving the ring."> + <c:simple-property name="node" readOnly="true"/> + </c:list-property> + <c:list-property name="LiveNodes" readOnly="true" description="list of live nodes in the cluster, where liveness is determined by the failure detector of the node being queried."> + <c:simple-property name="node" readOnly="true"/> + </c:list-property> + <c:list-property name="JoiningNodes" readOnly="true" description="List of nodes currently joining the ring."> + <c:simple-property name="node" readOnly="true"/> + </c:list-property> + <c:list-property name="LoadMap" readOnly="true" description="Human-readable load values for the cluster."> + <c:map-property name="entry" readOnly="true"> + <c:simple-property name="endpoint" readOnly="true"/> + <c:simple-property name="load" readOnly="true"/> + </c:map-property> + </c:list-property> + <c:list-property name="MovingNodes" readOnly="true" description="List of nodes currently moving the ring."> + <c:simple-property name="node" readOnly="true"/> + </c:list-property> + <c:list-property name="Ownership" readOnly="true" description="Mapping of token -> percentage of cluster owned by that token"> + <c:map-property name="entry" readOnly="true"> + <c:simple-property name="token" readOnly="true"/> + <c:simple-property name="percentage" readOnly="true"/> + </c:map-property> + </c:list-property> + <c:list-property name="TokenToEndpointMap" readOnly="true" description="Token To Endpoint Map"> + <c:map-property name="entry" readOnly="true"> + <c:simple-property name="token" readOnly="true"/> + <c:simple-property name="endpoint" readOnly="true"/> + </c:map-property> + </c:list-property> + <c:list-property name="UnreachableNodes" readOnly="true" description="List of unreachable nodes in the cluster, as determined by this node's failure detector."> + <c:simple-property name="node" readOnly="true"/> + </c:list-property> + </c:group> </resource-configuration> </service>
commit ff62f0dc65eb104827c614cd1d2abd85ffa5c75a Author: Stefan Negrea snegrea@redhat.com Date: Thu Nov 1 13:11:49 2012 -0500
Add a generic map/set property parser covers cases specific to Cassandra MBeans.
diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ComplexConfigurationResourceComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ComplexConfigurationResourceComponent.java new file mode 100644 index 0000000..b046d08 --- /dev/null +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ComplexConfigurationResourceComponent.java @@ -0,0 +1,104 @@ +/* + * RHQ Management Platform + * Copyright 2011, Red Hat Middleware LLC, and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +package org.rhq.plugins.cassandra; + +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import org.mc4j.ems.connection.bean.attribute.EmsAttribute; + +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.core.domain.configuration.definition.PropertyDefinition; +import org.rhq.core.domain.configuration.definition.PropertyDefinitionList; +import org.rhq.core.domain.configuration.definition.PropertyDefinitionMap; +import org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple; +import org.rhq.plugins.jmx.JMXComponent; +import org.rhq.plugins.jmx.MBeanResourceComponent; + +/** + * @author Stefan Negrea + * + */ +public class ComplexConfigurationResourceComponent extends MBeanResourceComponent<JMXComponent<?>> { + + @SuppressWarnings("unchecked") + @Override + public Configuration loadResourceConfiguration() { + Configuration configuration = super.loadResourceConfiguration(); + + ConfigurationDefinition resourceConfigurationDefinition = this.resourceContext.getResourceType() + .getResourceConfigurationDefinition(); + + for (PropertyDefinition propertyDefinition : resourceConfigurationDefinition.getPropertyDefinitions().values()) { + if (propertyDefinition instanceof PropertyDefinitionList) { + + EmsAttribute attribute = getEmsBean().getAttribute(propertyDefinition.getName()); + + if (attribute != null) { + Object result = attribute.refresh(); + + PropertyList propertyList = new PropertyList(propertyDefinition.getName()); + + if (result instanceof Map) { + PropertyDefinitionMap propertyDefinitionMap = (PropertyDefinitionMap) ((PropertyDefinitionList) propertyDefinition) + .getMemberDefinition(); + List<PropertyDefinition> subPropertyDefinitions = propertyDefinitionMap.getPropertyDefinitions(); + String mapName = propertyDefinitionMap.getName(); + String keyName = ((PropertyDefinitionSimple) subPropertyDefinitions.get(0)).getName(); + String valueName = ((PropertyDefinitionSimple) subPropertyDefinitions.get(1)).getName(); + + Map<Object, Object> mapValue = (Map<Object, Object>) result; + + PropertyMap propertyMap; + for (Entry<Object, Object> entry : mapValue.entrySet()) { + propertyMap = new PropertyMap(mapName); + propertyMap.put(new PropertySimple(keyName, entry.getKey().toString())); + propertyMap.put(new PropertySimple(valueName, entry.getValue().toString())); + + propertyList.add(propertyMap); + } + } else if (result instanceof Set) { + String entryName = ((PropertyDefinitionSimple) ((PropertyDefinitionList) propertyDefinition) + .getMemberDefinition()).getName(); + + Set<Object> setValue = (Set<Object>) result; + + for (Object entry : setValue) { + propertyList.add(new PropertySimple(entryName, entry.toString())); + } + } + + if (propertyList.getList().size() != 0) { + configuration.put(propertyList); + } + } + } + } + + return configuration; + } +} diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/FailureDetectorComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/FailureDetectorComponent.java deleted file mode 100644 index 38d0149..0000000 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/FailureDetectorComponent.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * RHQ Management Platform - * Copyright 2011, Red Hat Middleware LLC, and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -package org.rhq.plugins.cassandra; - -import org.rhq.core.domain.configuration.Configuration; -import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport; -import org.rhq.plugins.jmx.JMXComponent; -import org.rhq.plugins.jmx.MBeanResourceComponent; - -/** - * @author Stefan Negrea - * - */ -public class FailureDetectorComponent extends MBeanResourceComponent<JMXComponent<?>> { - - @Override - public Configuration loadResourceConfiguration() { - return super.loadResourceConfiguration(); - } - - @Override - public void updateResourceConfiguration(ConfigurationUpdateReport report) { - super.updateResourceConfiguration(report); - } -} diff --git a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml index 73ed5a6..4cfe3e3 100644 --- a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml @@ -401,7 +401,7 @@
<service name="FailureDetector" discovery="org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent" - class="org.rhq.plugins.cassandra.FailureDetectorComponent" + class="org.rhq.plugins.cassandra.ComplexConfigurationResourceComponent" singleton="true" subCategory="Network Services">
@@ -467,7 +467,7 @@
<service name="StreamingService" discovery="org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent" - class="org.rhq.plugins.jmx.MBeanResourceComponent" + class="org.rhq.plugins.cassandra.ComplexConfigurationResourceComponent" singleton="true" subCategory="Network Services">
@@ -479,23 +479,17 @@ <resource-configuration> <c:simple-property name="Status" type="string" required="false" readOnly="true" description="Status"/> <c:list-property name="StreamDestinations" readOnly="true"> - <c:map-property name="StreamDestination" readOnly="true"> - <c:simple-property name="name" type="string" readOnly="true"/> - <c:simple-property name="value" type="string" readOnly="true"/> - </c:map-property> + <c:simple-property name="StreamDestination" readOnly="true" type="string"/> </c:list-property> <c:list-property name="StreamSources" readOnly="true"> - <c:map-property name="StreamSource" readOnly="true"> - <c:simple-property name="name" type="string" readOnly="true"/> - <c:simple-property name="value" type="string" readOnly="true"/> - </c:map-property> + <c:simple-property name="StreamSource" readOnly="true" type="string"/> </c:list-property> </resource-configuration> </service>
<service name="MessagingService" discovery="org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent" - class="org.rhq.plugins.jmx.MBeanResourceComponent" + class="org.rhq.plugins.cassandra.ComplexConfigurationResourceComponent" singleton="true" subCategory="Network Services">
commit 96a1cd872387fa6c4a2d6173ee27ba296fb5a99c Author: Stefan Negrea snegrea@redhat.com Date: Wed Oct 31 13:35:00 2012 -0500
One more updated for the code that attempts to reconnect to the JMX server. Before attempting to reconnect, attempt to close the existing connection to avoid thread leaks from underlying resources.
diff --git a/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXServerComponent.java b/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXServerComponent.java index 412096d..14f43b9 100644 --- a/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXServerComponent.java +++ b/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXServerComponent.java @@ -132,10 +132,19 @@ public class JMXServerComponent<T extends ResourceComponent<?>> implements JMXCo */ private synchronized void reconnectIfDisconnected() { if ((connectionProvider) == null || !connectionProvider.isConnected()) { + if (connection != null) { + try { + connection.close(); + } catch (Exception e) { + log.debug("Unable to close existing EmsConnection for " + context.getResourceType() + "[" + + context.getResourceKey() + "] due to error: " + e); + } + } + try { internalStart(); } catch (Exception e) { - log.debug("Still unable to reconnect to " + context.getResourceType() + "[" + context.getResourceKey() + log.debug("Unable to reconnect to " + context.getResourceType() + "[" + context.getResourceKey() + "] due to error: " + e); } }
commit 716ab833096f76121c7b34203ef9d1cc20f52671 Author: Stefan Negrea snegrea@redhat.com Date: Tue Oct 30 17:18:14 2012 -0500
Add the last set of exposed management interfaces to the resource descriptor.
Also, moved all the resources to groups based on management function.
diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/FailureDetectorComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/FailureDetectorComponent.java new file mode 100644 index 0000000..38d0149 --- /dev/null +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/FailureDetectorComponent.java @@ -0,0 +1,43 @@ +/* + * RHQ Management Platform + * Copyright 2011, Red Hat Middleware LLC, and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +package org.rhq.plugins.cassandra; + +import org.rhq.core.domain.configuration.Configuration; +import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport; +import org.rhq.plugins.jmx.JMXComponent; +import org.rhq.plugins.jmx.MBeanResourceComponent; + +/** + * @author Stefan Negrea + * + */ +public class FailureDetectorComponent extends MBeanResourceComponent<JMXComponent<?>> { + + @Override + public Configuration loadResourceConfiguration() { + return super.loadResourceConfiguration(); + } + + @Override + public void updateResourceConfiguration(ConfigurationUpdateReport report) { + super.updateResourceConfiguration(report); + } +} diff --git a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml index bc115d3..73ed5a6 100644 --- a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml @@ -29,7 +29,9 @@ <subcategories> <subcategory name="Client Request Metrics" description="Client Request Metrics"/> <subcategory name="Server Request Metrics" description="Server Request Metrics"/> - <subcategory name="Internal Server Metrics" description="Server Request Metrics"/> + <subcategory name="Internal Server Metrics" description="Internal Server Metrics"/> + <subcategory name="Database Management Services" description="Database Management Services"/> + <subcategory name="Network Services" description="Network Services"/> </subcategories>
<plugin-configuration> @@ -82,7 +84,8 @@ <service name="StorageProxy" discovery="org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent" class="org.rhq.plugins.jmx.MBeanResourceComponent" - singleton="true"> + singleton="true" + subCategory="Database Management Services">
<plugin-configuration> <c:simple-property name="objectName" readOnly="true" default="org.apache.cassandra.db:type=StorageProxy"/> @@ -112,7 +115,8 @@ <service name="StorageService" discovery="org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent" class="org.rhq.plugins.cassandra.StorageServiceComponent" - singleton="true"> + singleton="true" + subCategory="Database Management Services">
<plugin-configuration> <c:simple-property name="objectName" readOnly="true" default="org.apache.cassandra.db:type=StorageService"/> @@ -175,7 +179,8 @@ <service name="CommitLog" discovery="org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent" class="org.rhq.plugins.jmx.MBeanResourceComponent" - singleton="true"> + singleton="true" + subCategory="Database Management Services">
<plugin-configuration> <c:simple-property name="objectName" readOnly="true" type="string" default="org.apache.cassandra.db:type=Commitlog"/> @@ -240,7 +245,8 @@ <service name="CompactionManager" discovery="org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent" class="org.rhq.plugins.jmx.MBeanResourceComponent" - singleton="true"> + singleton="true" + subCategory="Database Management Services">
<plugin-configuration> <c:simple-property name="objectName" readOnly="true" type="string" default="org.apache.cassandra.db:type=CompactionManager"/> @@ -271,7 +277,8 @@ <service name="CacheService" discovery="org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent" class="org.rhq.plugins.jmx.MBeanResourceComponent" - singleton="true"> + singleton="true" + subCategory="Database Management Services">
<plugin-configuration> <c:simple-property name="objectName" readOnly="true" type="string" default="org.apache.cassandra.db:type=Caches"/> @@ -307,6 +314,255 @@ </service>
+ <service name="ConfigurableStages" + discovery="org.rhq.plugins.cassandra.MetricsDiscoveryComponent" + class="org.rhq.plugins.jmx.MBeanResourceComponent" + singleton="true" + subCategory="Server Request Metrics"> + + <plugin-configuration> + <c:simple-property name="objectName" readOnly="true" type="string" + default="org.apache.cassandra.request:type=MutationStage|org.apache.cassandra.request:type=ReadStage|org.apache.cassandra.request:type=ReplicateOnWriteStage"/> + <c:simple-property name="nameMarker" readOnly="true" type="string" default="type=" /> + </plugin-configuration> + + <metric property="ActiveCount" measurementType="dynamic" displayType="summary" description="Active Count"/> + <metric property="CurrentlyBlockedTasks" measurementType="dynamic" displayType="summary" description="Currently Blocked Tasks"/> + <metric property="CompletedTasks" measurementType="dynamic" displayType="summary" description="Completed Tasks"/> + <metric property="PendingTasks" measurementType="dynamic" displayType="summary" description="Pending Tasks"/> + <metric property="TotalBlockedTasks" measurementType="dynamic" displayType="summary" description="Total Blocked Tasks"/> + + <resource-configuration> + <c:simple-property name="CorePoolSize" type="integer" required="true" description="Core Pool Size."/> + </resource-configuration> + </service> + + <service name="EnabledStages" + discovery="org.rhq.plugins.cassandra.MetricsDiscoveryComponent" + class="org.rhq.plugins.jmx.MBeanResourceComponent" + singleton="true" + subCategory="Server Request Metrics"> + + <plugin-configuration> + <c:simple-property name="objectName" readOnly="true" type="string" + default="org.apache.cassandra.request:type=ReadRepairStage|org.apache.cassandra.request:type=RequestResponseStage"/> + <c:simple-property name="nameMarker" readOnly="true" type="string" default="type=" /> + </plugin-configuration> + + <metric property="ActiveCount" measurementType="dynamic" displayType="summary" description="Active Count"/> + <metric property="CurrentlyBlockedTasks" measurementType="dynamic" displayType="summary" description="Currently Blocked Tasks"/> + <metric property="CompletedTasks" measurementType="dynamic" displayType="summary" description="Completed Tasks"/> + <metric property="PendingTasks" measurementType="dynamic" displayType="summary" description="Pending Tasks"/> + <metric property="TotalBlockedTasks" measurementType="dynamic" displayType="summary" description="Total Blocked Tasks"/> + </service> + + <service name="ConfigurableInternalServerMetrics" + discovery="org.rhq.plugins.cassandra.MetricsDiscoveryComponent" + class="org.rhq.plugins.jmx.MBeanResourceComponent" + singleton="true" + subCategory="Internal Server Metrics"> + + <plugin-configuration> + <c:simple-property name="objectName" readOnly="true" type="string" + default="org.apache.cassandra.internal:type=AntiEntropySessions"/> + <c:simple-property name="nameMarker" readOnly="true" type="string" default="type=" /> + </plugin-configuration> + + <metric property="ActiveCount" measurementType="dynamic" displayType="summary" description="Active Count"/> + <metric property="CurrentlyBlockedTasks" measurementType="dynamic" displayType="summary" description="Currently Blocked Tasks"/> + <metric property="CompletedTasks" measurementType="dynamic" displayType="summary" description="Completed Tasks"/> + <metric property="PendingTasks" measurementType="dynamic" displayType="summary" description="Pending Tasks"/> + <metric property="TotalBlockedTasks" measurementType="dynamic" displayType="summary" description="Total Blocked Tasks"/> + + <resource-configuration> + <c:simple-property name="CorePoolSize" type="integer" required="true" description="Core Pool Size."/> + </resource-configuration> + </service> + + <service name="EnabledInternalServerMetrics" + discovery="org.rhq.plugins.cassandra.MetricsDiscoveryComponent" + class="org.rhq.plugins.jmx.MBeanResourceComponent" + singleton="true" + subCategory="Internal Server Metrics"> + + <plugin-configuration> + <c:simple-property name="objectName" readOnly="true" type="string" + default="org.apache.cassandra.internal:type=AntiEntropyStage|org.apache.cassandra.internal:type=FlushWriter|org.apache.cassandra.internal:type=GossipStage|org.apache.cassandra.internal:type=HintedHandoff|org.apache.cassandra.internal:type=InternalResponseStage|org.apache.cassandra.internal:type=MemtablePostFlusher|org.apache.cassandra.internal:type=MigrationStage|org.apache.cassandra.internal:type=MiscStage|org.apache.cassandra.internal:type=StreamStage|org.apache.cassandra.internal:type=commitlog_archiver"/> + <c:simple-property name="nameMarker" readOnly="true" type="string" default="type=" /> + </plugin-configuration> + + <metric property="ActiveCount" measurementType="dynamic" displayType="summary" description="Active Count"/> + <metric property="CurrentlyBlockedTasks" measurementType="dynamic" displayType="summary" description="Currently Blocked Tasks"/> + <metric property="CompletedTasks" measurementType="dynamic" displayType="summary" description="Completed Tasks"/> + <metric property="PendingTasks" measurementType="dynamic" displayType="summary" description="Pending Tasks"/> + <metric property="TotalBlockedTasks" measurementType="dynamic" displayType="summary" description="Total Blocked Tasks"/> + </service> + + + <service name="FailureDetector" + discovery="org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent" + class="org.rhq.plugins.cassandra.FailureDetectorComponent" + singleton="true" + subCategory="Network Services"> + + <plugin-configuration> + <c:simple-property name="objectName" readOnly="true" type="string" default="org.apache.cassandra.net:type=FailureDetector"/> + <c:simple-property name="nameTemplate" readOnly="true" type="string" default="Failure Detector" /> + </plugin-configuration> + + <resource-configuration> + <c:simple-property name="PhiConvictThreshold" type="integer" required="true" description="Phi-convict threshold sets the sensitivity of the failure detector. Lower values increase the likelihood that an unresponsive node will be marked as down, while higher values decrease the likelihood."/> + <c:simple-property name="AllEndpointStates" type="integer" required="false" readOnly="true" description="States of all the end-points."/> + <c:list-property name="SimpleStates" readOnly="true"> + <c:map-property name="SimpleState" readOnly="true"> + <c:simple-property name="name" type="string" readOnly="true"/> + <c:simple-property name="value" type="string" readOnly="true"/> + </c:map-property> + </c:list-property> + </resource-configuration> + </service> + + + <service name="Gossiper" + discovery="org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent" + class="org.rhq.plugins.jmx.MBeanResourceComponent" + singleton="true" + subCategory="Network Services"> + + <plugin-configuration> + <c:simple-property name="objectName" readOnly="true" type="string" default="org.apache.cassandra.net:type=Gossiper"/> + <c:simple-property name="nameTemplate" readOnly="true" type="string" default="Gossiper" /> + </plugin-configuration> + + <operation name="getVersion" description="Get version"> + <parameters> + <c:simple-property name="p1" displayName="Address" required="true" type="string" description="Address"/> + </parameters> + <results> + <c:simple-property name="operationResult" description="Version"/> + </results> + </operation> + <operation name="getCurrentGenerationNumber" description="Get current generation number"> + <parameters> + <c:simple-property name="p1" displayName="Address" required="true" type="string" description="Address"/> + </parameters> + <results> + <c:simple-property name="operationResult" description="Current Generation Number"/> + </results> + </operation> + <operation name="getEndpointDowntime" description="Get endpoint downtime"> + <parameters> + <c:simple-property name="p1" displayName="Address" required="true" type="string" description="Address"/> + </parameters> + <results> + <c:simple-property name="operationResult" description="Endpoint Downtime"/> + </results> + </operation> + <operation name="unsafeAssassinateEndpoint" description="Unsafe assassinate endpoint"> + <parameters> + <c:simple-property name="p1" displayName="Address" required="true" type="string" description="Address"/> + </parameters> + </operation> + </service> + + <service name="StreamingService" + discovery="org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent" + class="org.rhq.plugins.jmx.MBeanResourceComponent" + singleton="true" + subCategory="Network Services"> + + <plugin-configuration> + <c:simple-property name="objectName" readOnly="true" type="string" default="org.apache.cassandra.net:type=StreamingService"/> + <c:simple-property name="nameTemplate" readOnly="true" type="string" default="Streaming Service" /> + </plugin-configuration> + + <resource-configuration> + <c:simple-property name="Status" type="string" required="false" readOnly="true" description="Status"/> + <c:list-property name="StreamDestinations" readOnly="true"> + <c:map-property name="StreamDestination" readOnly="true"> + <c:simple-property name="name" type="string" readOnly="true"/> + <c:simple-property name="value" type="string" readOnly="true"/> + </c:map-property> + </c:list-property> + <c:list-property name="StreamSources" readOnly="true"> + <c:map-property name="StreamSource" readOnly="true"> + <c:simple-property name="name" type="string" readOnly="true"/> + <c:simple-property name="value" type="string" readOnly="true"/> + </c:map-property> + </c:list-property> + </resource-configuration> + </service> + + <service name="MessagingService" + discovery="org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent" + class="org.rhq.plugins.jmx.MBeanResourceComponent" + singleton="true" + subCategory="Network Services"> + + <plugin-configuration> + <c:simple-property name="objectName" readOnly="true" default="org.apache.cassandra.net:type=MessagingService"/> + <c:simple-property name="nameTemplate" readOnly="true" type="string" default="Messaging Service"/> + </plugin-configuration> + + <metric property="TotalTimeouts" measurementType="trendsup" displayType="detail" description="Total timeouts."/> + <metric property="RecentTotalTimeouts" measurementType="trendsup" displayType="detail" description="Recent total timeouts."/> + + <resource-configuration> + <c:list-property name="CommandPendingTasks" readOnly="true"> + <c:map-property name="CommandPendingTask" readOnly="true"> + <c:simple-property name="name" type="string" readOnly="true"/> + <c:simple-property name="value" type="string" readOnly="true"/> + </c:map-property> + </c:list-property> + <c:list-property name="CommandCompletedTasks" readOnly="true"> + <c:map-property name="CommandCompletedTask" readOnly="true"> + <c:simple-property name="name" type="string" readOnly="true"/> + <c:simple-property name="value" type="string" readOnly="true"/> + </c:map-property> + </c:list-property> + + <c:list-property name="ResponsePendingTasks" readOnly="true"> + <c:map-property name="ResponsePendingTask" readOnly="true"> + <c:simple-property name="name" type="string" readOnly="true"/> + <c:simple-property name="value" type="string" readOnly="true"/> + </c:map-property> + </c:list-property> + <c:list-property name="ResponseCompletedTasks" readOnly="true"> + <c:map-property name="ResponseCompletedTask" readOnly="true"> + <c:simple-property name="name" type="string" readOnly="true"/> + <c:simple-property name="value" type="string" readOnly="true"/> + </c:map-property> + </c:list-property> + + <c:list-property name="DroppedMessages" readOnly="true"> + <c:map-property name="DroppedMessage" readOnly="true"> + <c:simple-property name="name" type="string" readOnly="true"/> + <c:simple-property name="value" type="string" readOnly="true"/> + </c:map-property> + </c:list-property> + <c:list-property name="RecentlyDroppedMessages" readOnly="true"> + <c:map-property name="RecentlyDroppedMessage" readOnly="true"> + <c:simple-property name="name" type="string" readOnly="true"/> + <c:simple-property name="value" type="string" readOnly="true"/> + </c:map-property> + </c:list-property> + + <c:list-property name="TimeoutsPerHost" readOnly="true"> + <c:map-property name="TimeoutPerHost" readOnly="true"> + <c:simple-property name="name" type="string" readOnly="true"/> + <c:simple-property name="value" type="string" readOnly="true"/> + </c:map-property> + </c:list-property> + <c:list-property name="RecentTimeoutsPerHost" readOnly="true"> + <c:map-property name="RecentTimeoutPerHost" readOnly="true"> + <c:simple-property name="name" type="string" readOnly="true"/> + <c:simple-property name="value" type="string" readOnly="true"/> + </c:map-property> + </c:list-property> + </resource-configuration> + </service> + + <service name="Keyspace" discovery="org.rhq.plugins.cassandra.KeyspaceDiscoveryComponent" class="org.rhq.plugins.cassandra.KeyspaceComponent"> @@ -447,90 +703,5 @@ </service> </service>
- - <service name="ConfigurableStages" - discovery="org.rhq.plugins.cassandra.MetricsDiscoveryComponent" - class="org.rhq.plugins.jmx.MBeanResourceComponent" - singleton="true" - subCategory="Server Request Metrics"> - - <plugin-configuration> - <c:simple-property name="objectName" readOnly="true" type="string" - default="org.apache.cassandra.request:type=MutationStage|org.apache.cassandra.request:type=ReadStage|org.apache.cassandra.request:type=ReplicateOnWriteStage"/> - <c:simple-property name="nameMarker" readOnly="true" type="string" default="type=" /> - </plugin-configuration> - - <metric property="ActiveCount" measurementType="dynamic" displayType="summary" description="Active Count"/> - <metric property="CurrentlyBlockedTasks" measurementType="dynamic" displayType="summary" description="Currently Blocked Tasks"/> - <metric property="CompletedTasks" measurementType="dynamic" displayType="summary" description="Completed Tasks"/> - <metric property="PendingTasks" measurementType="dynamic" displayType="summary" description="Pending Tasks"/> - <metric property="TotalBlockedTasks" measurementType="dynamic" displayType="summary" description="Total Blocked Tasks"/> - - <resource-configuration> - <c:simple-property name="CorePoolSize" type="integer" required="true" description="Core Pool Size."/> - </resource-configuration> - </service> - - <service name="EnabledStages" - discovery="org.rhq.plugins.cassandra.MetricsDiscoveryComponent" - class="org.rhq.plugins.jmx.MBeanResourceComponent" - singleton="true" - subCategory="Server Request Metrics"> - - <plugin-configuration> - <c:simple-property name="objectName" readOnly="true" type="string" - default="org.apache.cassandra.request:type=ReadRepairStage|org.apache.cassandra.request:type=RequestResponseStage"/> - <c:simple-property name="nameMarker" readOnly="true" type="string" default="type=" /> - </plugin-configuration> - - <metric property="ActiveCount" measurementType="dynamic" displayType="summary" description="Active Count"/> - <metric property="CurrentlyBlockedTasks" measurementType="dynamic" displayType="summary" description="Currently Blocked Tasks"/> - <metric property="CompletedTasks" measurementType="dynamic" displayType="summary" description="Completed Tasks"/> - <metric property="PendingTasks" measurementType="dynamic" displayType="summary" description="Pending Tasks"/> - <metric property="TotalBlockedTasks" measurementType="dynamic" displayType="summary" description="Total Blocked Tasks"/> - </service> - - <service name="ConfigurableInternalServerMetrics" - discovery="org.rhq.plugins.cassandra.MetricsDiscoveryComponent" - class="org.rhq.plugins.jmx.MBeanResourceComponent" - singleton="true" - subCategory="Internal Server Metrics"> - - <plugin-configuration> - <c:simple-property name="objectName" readOnly="true" type="string" - default="org.apache.cassandra.internal:type=AntiEntropySessions"/> - <c:simple-property name="nameMarker" readOnly="true" type="string" default="type=" /> - </plugin-configuration> - - <metric property="ActiveCount" measurementType="dynamic" displayType="summary" description="Active Count"/> - <metric property="CurrentlyBlockedTasks" measurementType="dynamic" displayType="summary" description="Currently Blocked Tasks"/> - <metric property="CompletedTasks" measurementType="dynamic" displayType="summary" description="Completed Tasks"/> - <metric property="PendingTasks" measurementType="dynamic" displayType="summary" description="Pending Tasks"/> - <metric property="TotalBlockedTasks" measurementType="dynamic" displayType="summary" description="Total Blocked Tasks"/> - - <resource-configuration> - <c:simple-property name="CorePoolSize" type="integer" required="true" description="Core Pool Size."/> - </resource-configuration> - </service> - - <service name="EnabledInternalServerMetrics" - discovery="org.rhq.plugins.cassandra.MetricsDiscoveryComponent" - class="org.rhq.plugins.jmx.MBeanResourceComponent" - singleton="true" - subCategory="Internal Server Metrics"> - - <plugin-configuration> - <c:simple-property name="objectName" readOnly="true" type="string" - default="org.apache.cassandra.internal:type=AntiEntropyStage|org.apache.cassandra.internal:type=FlushWriter|org.apache.cassandra.internal:type=GossipStage|org.apache.cassandra.internal:type=HintedHandoff|org.apache.cassandra.internal:type=InternalResponseStage|org.apache.cassandra.internal:type=MemtablePostFlusher|org.apache.cassandra.internal:type=MigrationStage|org.apache.cassandra.internal:type=MiscStage|org.apache.cassandra.internal:type=StreamStage|org.apache.cassandra.internal:type=commitlog_archiver"/> - <c:simple-property name="nameMarker" readOnly="true" type="string" default="type=" /> - </plugin-configuration> - - <metric property="ActiveCount" measurementType="dynamic" displayType="summary" description="Active Count"/> - <metric property="CurrentlyBlockedTasks" measurementType="dynamic" displayType="summary" description="Currently Blocked Tasks"/> - <metric property="CompletedTasks" measurementType="dynamic" displayType="summary" description="Completed Tasks"/> - <metric property="PendingTasks" measurementType="dynamic" displayType="summary" description="Pending Tasks"/> - <metric property="TotalBlockedTasks" measurementType="dynamic" displayType="summary" description="Total Blocked Tasks"/> - </service> - </server> </plugin> \ No newline at end of file
commit 04ccef2a3a011aef07144bcbdd71f01ac1594f92 Author: Stefan Negrea snegrea@redhat.com Date: Tue Oct 30 12:18:26 2012 -0500
Update self-referencing option sources to use explicit keyword 'self'. This reduces the confusion that an implicit self reference would pose for plugin writers.
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 feace12..50e5fd4 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 @@ -2583,11 +2583,18 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf String expr = expression; if (expr.contains(":")) { expr = expr.substring(expr.indexOf(':') + 1); - criteria.setSearchExpression(expr); - resources = resourceManager.findResourcesByCriteria(subject, criteria); - } else if (resourceId >= 0) { - resources = new ArrayList<Resource>(); - resources.add(resourceManager.getResourceById(subject, resourceId)); + + if (!"self".equals(expr)) { + criteria.setSearchExpression(expr); + resources = resourceManager.findResourcesByCriteria(subject, criteria); + } else if (resourceId >= 0) { + resources = new ArrayList<Resource>(); + resources.add(resourceManager.getResourceById(subject, resourceId)); + } else { + log.warn("Self reference requested but resource id is not valid." + + "Option source expression:" + expression); + return; + } } else { log.warn("Option source expression for property " + pds.getName() + " and target configuration contains no ':'"); diff --git a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml index 1966ea3..bc115d3 100644 --- a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml @@ -401,7 +401,7 @@ <operation name="restoreSnapshot" description="Restore the column family from a previously taken snapshot."> <parameters> <c:simple-property name="snapshotName" required="true" type="string" description="Snapshot Name"> - <c:option-source target="configuration" expression="snapshots/snapshot=name"/> + <c:option-source target="configuration" expression="snapshots/snapshot=name:self"/> </c:simple-property> </parameters> <results>
commit 413ac227436b90d9a05b5e21783ff14f2eeea4ee Author: Stefan Negrea snegrea@redhat.com Date: Tue Oct 30 10:24:00 2012 -0500
Mark connection and connectionProvider as volatile since they can be accesses from multiple threads at the same time. This will avoid issues where a thread will have a stale cached value of either attribute.
This important in the context of re-establishing JMX connections since it will avoid cases where a thread relies on cached values of these attributes.
diff --git a/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXServerComponent.java b/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXServerComponent.java index e510c44..412096d 100644 --- a/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXServerComponent.java +++ b/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXServerComponent.java @@ -51,8 +51,8 @@ public class JMXServerComponent<T extends ResourceComponent<?>> implements JMXCo
private static final Log log = LogFactory.getLog(JMXServerComponent.class);
- private EmsConnection connection; - private ConnectionProvider connectionProvider; + private volatile EmsConnection connection; + private volatile ConnectionProvider connectionProvider;
/** * The context of a component that is started. Note, other classes should use #getResourceContext(), rather than
commit 882450f177b2ba9575777f5e0959d3447bafbfdf Author: Stefan Negrea snegrea@redhat.com Date: Fri Oct 26 11:55:25 2012 -0500
Correct parameter name to match execution code.
diff --git a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml index 50a24fa..1966ea3 100644 --- a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml @@ -400,7 +400,7 @@ </operation> <operation name="restoreSnapshot" description="Restore the column family from a previously taken snapshot."> <parameters> - <c:simple-property name="name" required="true" type="string" description="Snapshot Name"> + <c:simple-property name="snapshotName" required="true" type="string" description="Snapshot Name"> <c:option-source target="configuration" expression="snapshots/snapshot=name"/> </c:simple-property> </parameters>
commit d0059a4c958104b97c20dc6a4693c1172aead666 Author: Stefan Negrea snegrea@redhat.com Date: Fri Oct 26 11:53:17 2012 -0500
Updating the JMX plugin to check if the connection is still open or valid before returning the connection object. In case the connection is no longer valid, the code will attempt to reconnect to the server.
The reconnection code was already used in the availability method. This change only expands its usage.
diff --git a/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXServerComponent.java b/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXServerComponent.java index 1b6dd2c..e510c44 100644 --- a/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXServerComponent.java +++ b/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXServerComponent.java @@ -24,7 +24,6 @@ package org.rhq.plugins.jmx;
import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; - import org.mc4j.ems.connection.EmsConnection; import org.mc4j.ems.connection.support.ConnectionProvider;
@@ -44,7 +43,7 @@ import org.rhq.plugins.jmx.util.ConnectionProviderFactory; * versions. The same holds true for Hibernate applications - multiple connections can be created * to different versions of the Hibernate MBean and due to the isolation of each connection, there * are no version incompatibility errors that will occur. - * + * * @author Greg Hinkle * @author John Mazzitelli */ @@ -106,18 +105,13 @@ public class JMXServerComponent<T extends ResourceComponent<?>> implements JMXCo }
public EmsConnection getEmsConnection() { + this.reconnectIfDisconnected(); + return this.connection; }
public AvailabilityType getAvailability() { - if ((connectionProvider) == null || !connectionProvider.isConnected()) { - try { - internalStart(); - } catch (Exception e) { - log.debug("Still unable to reconnect to " + context.getResourceType() + "[" + context.getResourceKey() - + "] due to error: " + e); - } - } + this.reconnectIfDisconnected();
return ((connectionProvider != null) && connectionProvider.isConnected()) ? AvailabilityType.UP : AvailabilityType.DOWN; @@ -127,4 +121,23 @@ public class JMXServerComponent<T extends ResourceComponent<?>> implements JMXCo return this.context; }
+ /** + * This method will attempt to reestablish the connection to the JMX server + * if it detects that the current connection is no longer open or valid. + * + * The code that detects if a connection is still open or valid is in the external + * EMS library and depends on the type of connection provider. Please read the EMS + * documentation and code for more details on how ConnectionProvider.isConnected() + * works for different supported providers. + */ + private synchronized void reconnectIfDisconnected() { + if ((connectionProvider) == null || !connectionProvider.isConnected()) { + try { + internalStart(); + } catch (Exception e) { + log.debug("Still unable to reconnect to " + context.getResourceType() + "[" + context.getResourceKey() + + "] due to error: " + e); + } + } + } } \ No newline at end of file
commit 9d382a47b78071ff33fee6fa2b6d399f7cb53ceb Author: Stefan Negrea snegrea@redhat.com Date: Wed Oct 24 18:08:05 2012 -0500
Fix compilation error in unused plugin.
diff --git a/modules/plugins/hardware/src/main/java/org/rhq/plugins/hardware/SmartDiskComponent.java b/modules/plugins/hardware/src/main/java/org/rhq/plugins/hardware/SmartDiskComponent.java index bde1627..2421e67 100644 --- a/modules/plugins/hardware/src/main/java/org/rhq/plugins/hardware/SmartDiskComponent.java +++ b/modules/plugins/hardware/src/main/java/org/rhq/plugins/hardware/SmartDiskComponent.java @@ -115,8 +115,8 @@ public class SmartDiskComponent implements ResourceComponent, MeasurementFacet {
public static void main(String[] args) throws Exception { SmartDiskComponent sdc = new SmartDiskComponent(); - sdc.start(new ResourceContext(new Resource("/dev/sda", "foo", new ResourceType()), null, null, null, null, null, - null, null, null, null, null, null, null, PluginContainerDeployment.AGENT)); + sdc.start(new ResourceContext(new Resource("/dev/sda", "foo", new ResourceType()), null, null, null, null, + null, null, null, null, null, null, null, null, PluginContainerDeployment.AGENT)); sdc.getValues(null, null);
}
commit 3863c5d85d78e3a4b0be7a6636fbf17b13e4b828 Author: Stefan Negrea snegrea@redhat.com Date: Wed Oct 24 18:07:27 2012 -0500
Add support for resource self-referencing option sources.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java index 638e645..06207cd 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java @@ -88,5 +88,6 @@ public interface ConfigurationGWTService extends RemoteService { void deleteGroupResourceConfigurationUpdate(Integer groupId, Integer[] groupResourceConfigUpdateIds) throws RuntimeException;
- ConfigurationDefinition getOptionValuesForConfigDefinition(ConfigurationDefinition definition) throws RuntimeException; + ConfigurationDefinition getOptionValuesForConfigDefinition(int resourceId, ConfigurationDefinition definition) + throws RuntimeException; } diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java index f4066f0..0f54af0 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java @@ -117,6 +117,7 @@ public abstract class AbstractOperationScheduleDetailsView extends }
protected abstract boolean hasControlPermission(); + protected abstract int getResourceId();
@Override public String getListViewPath() { @@ -457,7 +458,7 @@ public abstract class AbstractOperationScheduleDetailsView extends }
ConfigurationGWTServiceAsync configurationService = GWTServiceLookup.getConfigurationService(); - configurationService.getOptionValuesForConfigDefinition(parametersDefinition, + configurationService.getOptionValuesForConfigDefinition(getResourceId(), parametersDefinition, new AsyncCallback<ConfigurationDefinition>() {
@Override diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/operation/schedule/GroupOperationScheduleDetailsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/operation/schedule/GroupOperationScheduleDetailsView.java index 013bc85..0ce98d3 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/operation/schedule/GroupOperationScheduleDetailsView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/operation/schedule/GroupOperationScheduleDetailsView.java @@ -61,6 +61,11 @@ public class GroupOperationScheduleDetailsView extends AbstractOperationSchedule }
@Override + protected int getResourceId() { + return -1; + } + + @Override protected void init(final boolean isReadOnly) { if (isNewRecord()) { ResourceDatasource resourceDatasource = new ResourceDatasource(); diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java index 4e87eb0..f0947ac 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java @@ -121,7 +121,7 @@ public class ResourceConfigurationEditView extends LocatableVLayout implements P buttonbar.destroy(); removeMember(buttonbar); } - + GWTServiceLookup.getConfigurationService().getLatestResourceConfigurationUpdate(resource.getId(), new AsyncCallback<ResourceConfigurationUpdate>() { @Override @@ -134,14 +134,15 @@ public class ResourceConfigurationEditView extends LocatableVLayout implements P refreshing = false; return; } - + ResourceTypeRepository.Cache.getInstance().getResourceTypes(resource.getResourceType().getId(), EnumSet.of(MetadataType.resourceConfigurationDefinition), new TypeLoadedCallback() { @Override public void onTypesLoaded(ResourceType type) { ConfigurationGWTServiceAsync configurationService = GWTServiceLookup.getConfigurationService(); - configurationService.getOptionValuesForConfigDefinition( - type.getResourceConfigurationDefinition(), new AsyncCallback<ConfigurationDefinition>(){ + configurationService.getOptionValuesForConfigDefinition(resource.getId(), + type.getResourceConfigurationDefinition(), + new AsyncCallback<ConfigurationDefinition>() { @Override public void onFailure(Throwable throwable) { refreshing = false; diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/schedule/ResourceOperationScheduleDetailsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/schedule/ResourceOperationScheduleDetailsView.java index bebe550..00f72ae 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/schedule/ResourceOperationScheduleDetailsView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/schedule/ResourceOperationScheduleDetailsView.java @@ -24,4 +24,9 @@ public class ResourceOperationScheduleDetailsView extends AbstractOperationSched return this.resourceComposite.getResourcePermission().isControl(); }
+ @Override + protected int getResourceId() { + return this.resourceComposite.getResource().getId(); + } + } diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryConfigurationStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryConfigurationStep.java index 40e155ee..fdb67aa 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryConfigurationStep.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryConfigurationStep.java @@ -101,7 +101,7 @@ public class ResourceFactoryConfigurationStep extends AbstractWizardStep impleme this.startingConfig = wizard.getNewResourceStartingConfiguration();
ConfigurationGWTServiceAsync configurationService = GWTServiceLookup.getConfigurationService(); - configurationService.getOptionValuesForConfigDefinition(def, + configurationService.getOptionValuesForConfigDefinition(-1, def, new AsyncCallback<ConfigurationDefinition>() { public void onSuccess(ConfigurationDefinition result) { createAndAddConfigurationEditor(result); diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java index 04bfdcb..d351f7a 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java @@ -352,11 +352,11 @@ public class ConfigurationGWTServiceImpl extends AbstractGWTServiceImpl implemen }
@Override - public ConfigurationDefinition getOptionValuesForConfigDefinition(ConfigurationDefinition definition) + public ConfigurationDefinition getOptionValuesForConfigDefinition(int resourceId, ConfigurationDefinition definition) throws RuntimeException { try { ConfigurationDefinition def = configurationManager.getOptionsForConfigurationDefinition( - getSessionSubject(), definition); + getSessionSubject(), resourceId, definition); return SerialUtility.prepare(def, "ConfigurationService.getOptionValuesForPropertySimple"); } catch (Throwable t) { throw getExceptionToThrowToClient(t); 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 bd728d6..feace12 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 @@ -2511,26 +2511,27 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf }
@Override - public ConfigurationDefinition getOptionsForConfigurationDefinition(Subject subject, ConfigurationDefinition def) { + public ConfigurationDefinition getOptionsForConfigurationDefinition(Subject subject, int resourceId, + ConfigurationDefinition def) {
for (Map.Entry<String, PropertyDefinition> entry : def.getPropertyDefinitions().entrySet()) { PropertyDefinition pd = entry.getValue();
if (pd instanceof PropertyDefinitionSimple) { PropertyDefinitionSimple pds = (PropertyDefinitionSimple) pd; - handlePDS(subject, pds); + handlePDS(subject, resourceId, pds);
} else if (pd instanceof PropertyDefinitionList) { PropertyDefinitionList pdl = (PropertyDefinitionList) pd; PropertyDefinition memberDef = pdl.getMemberDefinition(); if (memberDef instanceof PropertyDefinitionSimple) { PropertyDefinitionSimple pds = (PropertyDefinitionSimple) memberDef; - handlePDS(subject, pds); + handlePDS(subject, resourceId, pds); } else if (memberDef instanceof PropertyDefinitionMap) { PropertyDefinitionMap pdm = (PropertyDefinitionMap) memberDef; for (PropertyDefinition inner : pdm.getOrderedPropertyDefinitions()) { if (inner instanceof PropertyDefinitionSimple) { - handlePDS(subject, (PropertyDefinitionSimple) inner); + handlePDS(subject, resourceId, (PropertyDefinitionSimple) inner); } log.debug("3 ____[ " + inner.toString() + " in " + pdl.toString() + " ]____ not yet supported"); } @@ -2542,7 +2543,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf PropertyDefinitionMap pdm = (PropertyDefinitionMap) pd; for (PropertyDefinition inner : pdm.getOrderedPropertyDefinitions()) { if (inner instanceof PropertyDefinitionSimple) { - handlePDS(subject, (PropertyDefinitionSimple) inner); + handlePDS(subject, resourceId, (PropertyDefinitionSimple) inner); } else { log.debug("4 ____[ " + inner.toString() + " in " + pdm.toString() + " ]____ not yet supported"); } @@ -2560,7 +2561,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf * @param subject Subject of the caller - may limit search results * @param pds the PropertyDefinitionSimple to work on */ - private void handlePDS(Subject subject, PropertyDefinitionSimple pds) { + private void handlePDS(Subject subject, int resourceId, PropertyDefinitionSimple pds) {
if (pds.getOptionsSource() != null) { // evaluate the source parameters @@ -2573,33 +2574,35 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf filterPattern = Pattern.compile(filter);
if (tt == PropertyOptionsSource.TargetType.RESOURCE || tt == PropertyOptionsSource.TargetType.CONFIGURATION) { + List<Resource> resources = null; ResourceCriteria criteria = new ResourceCriteria();
if (tt == PropertyOptionsSource.TargetType.CONFIGURATION) { // split out expression part for target=configuration // return if no property specifier is given String expr = expression; - if (!expr.contains(":")) { + if (expr.contains(":")) { + expr = expr.substring(expr.indexOf(':') + 1); + criteria.setSearchExpression(expr); + resources = resourceManager.findResourcesByCriteria(subject, criteria); + } else if (resourceId >= 0) { + resources = new ArrayList<Resource>(); + resources.add(resourceManager.getResourceById(subject, resourceId)); + } else { log.warn("Option source expression for property " + pds.getName() + " and target configuration contains no ':'"); return; } - - expr = expr.substring(expr.indexOf(':') + 1); - criteria.setSearchExpression(expr); } else { criteria.setSearchExpression(expression); + resources = resourceManager.findResourcesByCriteria(subject, criteria); }
- List<ResourceComposite> composites = resourceManager - .findResourceCompositesByCriteria(subject, criteria); - for (ResourceComposite composite : composites) { - + for (Resource resource : resources) { if (tt == PropertyOptionsSource.TargetType.RESOURCE) { + String name = resource.getName();
- String name = composite.getResource().getName(); // filter if the user provided a filter - if (filterPattern != null) { Matcher m = filterPattern.matcher(name); if (m.matches()) { @@ -2609,12 +2612,10 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf } else { // Filter is null -> none provided -> do not filter PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(name, "" + name); pds.getEnumeratedValues().add(pde); - } - } else if (tt == PropertyOptionsSource.TargetType.CONFIGURATION) { // for configuration we need to drill down into the resource configuration - if (!handleConfigurationTarget(pds, expression, composite.getResource())) + if (!handleConfigurationTarget(pds, expression, resource)) return;
} @@ -2643,22 +2644,22 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf */ private boolean handleConfigurationTarget(PropertyDefinitionSimple pds, String expression, Resource resource) { Configuration configuration = resource.getResourceConfiguration(); - Property p; - String propName = expression.substring(0, expression.indexOf(":")); - boolean isMapOrList = expression.contains("=");
+ if (expression.indexOf(":") != -1) { + expression = expression.substring(0, expression.indexOf(":")); + } + + boolean isMapOrList = expression.contains("="); + Property p; if (isMapOrList) { - String mapPropLocation = propName.substring(0, propName.indexOf("=")); - String mapPropName; + String mapPropLocation = expression.substring(0, expression.indexOf("=")); if (mapPropLocation.contains("/")) { - // List of maps - mapPropName = mapPropLocation.substring(0, mapPropLocation.indexOf('/')); - } else { - mapPropName = mapPropLocation; + mapPropLocation = mapPropLocation.substring(0, mapPropLocation.indexOf('/')); } - p = configuration.get(mapPropName); - } else - p = configuration.get(propName); + p = configuration.get(mapPropLocation); + } else { + p = configuration.get(expression); + }
if (p == null) { log.warn("Option source expression for property " + pds.getName() + " and target configuration not found"); @@ -2696,7 +2697,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf return false; } String subPropName; - subPropName = propName.substring(propName.indexOf("=") + 1); + subPropName = expression.substring(expression.indexOf("=") + 1);
for (Property tmp : propertyList) { PropertyMap pm = (PropertyMap) tmp; 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 1ab9e5e..f5b28ee 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 @@ -471,5 +471,6 @@ public interface ConfigurationManagerLocal extends ConfigurationManagerRemote { PageList<GroupPluginConfigurationUpdate> findGroupPluginConfigurationUpdatesByCriteria(Subject subject, GroupPluginConfigurationUpdateCriteria criteria);
- ConfigurationDefinition getOptionsForConfigurationDefinition(Subject subject, ConfigurationDefinition def); + ConfigurationDefinition getOptionsForConfigurationDefinition(Subject subject, int resourceId, + ConfigurationDefinition def); } \ No newline at end of file diff --git a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml index e3c33d0..50a24fa 100644 --- a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml @@ -209,7 +209,7 @@ <c:simple-property name="objectName" readOnly="true" type="string" default="org.apache.cassandra.metrics:type=ClientRequestMetrics,name=ReadUnavailables"/> <c:simple-property name="nameTemplate" readOnly="true" type="string" default="Read Unavailables" /> </plugin-configuration> - <metric property="Count" displayName="Read Unavailable" measurementType="trendsup" displayType="summary" description="Number of read unavailable occurred for this node"/> + <metric property="Count" displayName="Read Unavailables" measurementType="trendsup" displayType="summary" description="Number of read unavailable occurred for this node"/> </service>
<service name="WriteTimeouts" @@ -400,8 +400,8 @@ </operation> <operation name="restoreSnapshot" description="Restore the column family from a previously taken snapshot."> <parameters> - <c:simple-property name="snapshotName" required="true" type="string" description="Snapshot Name"> - <c:option-source target="configuration" expression="snapshots:type=ColumnFamily"/> + <c:simple-property name="name" required="true" type="string" description="Snapshot Name"> + <c:option-source target="configuration" expression="snapshots/snapshot=name"/> </c:simple-property> </parameters> <results>
commit 6e1deaa847fd9d631e1198debfceba8b8ce14e9b Author: Stefan Negrea snegrea@redhat.com Date: Wed Oct 24 10:45:56 2012 -0500
Add server and internal metrics to the list of metrics.
Add the possibility to restore column families from snapshot.
diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeComponent.java index dd06f39..1d3e08b 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeComponent.java @@ -84,18 +84,18 @@ public class CassandraNodeComponent extends JMXServerComponent<ResourceComponent public OperationResult invokeOperation(String name, Configuration parameters) throws Exception {
if (name.equals("shutdown")) { - return shutdown(parameters); + return shutdownNode(); } else if (name.equals("start")) { - return start(parameters); + return startNode(); } else if (name.equals("restart")) { - return restart(parameters); + return restartNode(); }
return null; }
@SuppressWarnings("rawtypes") - private OperationResult shutdown(Configuration params) { + protected OperationResult shutdownNode() { ResourceContext<?> context = getResourceContext();
if (log.isInfoEnabled()) { @@ -137,7 +137,7 @@ public class CassandraNodeComponent extends JMXServerComponent<ResourceComponent } }
- private OperationResult start(Configuration params) { + protected OperationResult startNode() { ResourceContext<?> context = getResourceContext(); Configuration pluginConfig = context.getPluginConfiguration(); String baseDir = pluginConfig.getSimpleValue("baseDir"); @@ -157,11 +157,11 @@ public class CassandraNodeComponent extends JMXServerComponent<ResourceComponent } }
- private OperationResult restart(Configuration params) { - OperationResult result = shutdown(params); + protected OperationResult restartNode() { + OperationResult result = shutdownNode();
if (result.getErrorMessage() == null) { - result = start(params); + result = startNode(); }
return result; diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraUtil.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraUtil.java index a0990d8..5915eed 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraUtil.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraUtil.java @@ -1,28 +1,27 @@ /* * - * * RHQ Management Platform - * * Copyright (C) 2005-2012 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-2012 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.cassandra;
import java.util.List; diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyComponent.java index 6371549..845b2fb 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyComponent.java @@ -28,6 +28,9 @@ package org.rhq.plugins.cassandra; import static org.rhq.core.domain.configuration.ConfigurationUpdateStatus.FAILURE; import static org.rhq.core.domain.configuration.ConfigurationUpdateStatus.SUCCESS; import static org.rhq.plugins.cassandra.CassandraUtil.getCluster; + +import java.io.File; + import me.prettyprint.hector.api.Cluster; import me.prettyprint.hector.api.ddl.ColumnFamilyDefinition; import me.prettyprint.hector.api.exceptions.HectorException; @@ -36,10 +39,14 @@ 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.PropertyList; +import org.rhq.core.domain.configuration.PropertyMap; import org.rhq.core.domain.configuration.PropertySimple; import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport; import org.rhq.core.pluginapi.inventory.ResourceContext; import org.rhq.core.pluginapi.operation.OperationResult; +import org.rhq.core.util.file.FileUtil; import org.rhq.plugins.jmx.JMXComponent; import org.rhq.plugins.jmx.MBeanResourceComponent;
@@ -59,8 +66,8 @@ public class ColumnFamilyComponent extends MBeanResourceComponent<JMXComponent<? log.debug("Loading resource context for column family " + context.getResourceKey()); }
- ColumnFamilyDefinition cfDef = getColumnFamilyDefinition(); - config.put(new PropertySimple("gc_grace_seconds", cfDef.getGcGraceSeconds())); + config.put(new PropertySimple("gc_grace_seconds", this.getColumnFamilyDefinition().getGcGraceSeconds())); + config.put(this.getSnapshotsWithDetails());
return config; } @@ -76,6 +83,8 @@ public class ColumnFamilyComponent extends MBeanResourceComponent<JMXComponent<? } else if (name.equals("takeSnapshot")) { String columnFamilyName = this.getResourceContext().getPluginConfiguration().getSimpleValue("name"); return this.getParentKeyspace().takeSnapshot(parameters, columnFamilyName); + } else if (name.equals("restoreSnapshot")){ + return this.restoreSnapshot(parameters); }
return super.invokeOperation(name, parameters); @@ -111,13 +120,127 @@ public class ColumnFamilyComponent extends MBeanResourceComponent<JMXComponent<? }
report.getConfiguration().remove("gc_grace_seconds"); + report.getConfiguration().remove("snapshots"); + super.updateResourceConfiguration(report); }
+ private PropertyList getSnapshotsWithDetails() { + PropertyList listOfSnapshots = new PropertyList("snapshots"); + + KeyspaceComponent parentKeyspace = this.getParentKeyspace(); + PropertyList parentDataFileLocations = parentKeyspace.getKeySpaceDataFileLocations(); + + for (Property directory : parentDataFileLocations.getList()) { + String directoryName = ((PropertySimple) directory).getStringValue(); + directoryName += "/" + this.getResourceContext().getPluginConfiguration().getSimpleValue("name"); + directoryName += "/snapshots"; + + File snapshotDirectory = new File(directoryName); + + if (snapshotDirectory.exists()) { + File[] files = snapshotDirectory.listFiles(); + + for (File individualSnapshot : files) { + if (individualSnapshot.isDirectory()) { + PropertyMap snapshotDetails = new PropertyMap("snapshot"); + snapshotDetails.put(new PropertySimple("name", individualSnapshot.getName())); + snapshotDetails.put(new PropertySimple("folder", individualSnapshot.getAbsolutePath())); + listOfSnapshots.add(snapshotDetails); + } + } + } + } + + return listOfSnapshots; + } + + private OperationResult restoreSnapshot(Configuration parameters) { + OperationResult result = new OperationResult(); + + //1. Find the list of snapshots discovered + String requestedSnapshotName = parameters.getSimpleValue("snapshotName"); + PropertyList listOfSnapShots = this.getSnapshotsWithDetails(); + + String snapshotDirectoryName = null; + for (Property property : listOfSnapShots.getList()) { + String snapshotName = ((PropertyMap) property).getSimpleValue("name", null); + if (requestedSnapshotName.equals(snapshotName)) { + snapshotDirectoryName = ((PropertyMap) property).getSimpleValue("folder", null); + break; + } + } + + //2. Find out if the discovered snapshot still exists on disk + if (snapshotDirectoryName == null) { + result.setErrorMessage("Restore failed! The snapshot does not exist!"); + return result; + } + + File snapshotDirectory = new File(snapshotDirectoryName); + if (!snapshotDirectory.exists() || !snapshotDirectory.isDirectory()) { + result.setErrorMessage("Restore failed! The snapshot does not exist on disk!"); + return result; + } + + //3. Shutdown Cassandra + CassandraNodeComponent node = this.getParentKeyspace().getCassandraNodeComponent(); + node.shutdownNode(); + + //4. Remove the entire commit log + KeyspaceComponent parentKeyspace = this.getParentKeyspace(); + + parentKeyspace.clearCommitLog(); + + //5. Copy the snapshot files to the column family folders + PropertyList parentDataFileLocations = parentKeyspace.getKeySpaceDataFileLocations(); + + for (Property dataFileDirectoryProperty : parentDataFileLocations.getList()) { + String columnFamilyDirectoryName = ((PropertySimple) dataFileDirectoryProperty).getStringValue(); + columnFamilyDirectoryName += "/" + this.getResourceContext().getPluginConfiguration().getSimpleValue("name"); + + File columnFamilyDirectory = new File(columnFamilyDirectoryName); + if(columnFamilyDirectory.exists()){ + //5.1 Remove existing data files + File[] originalColumnFamilyDataFiles = columnFamilyDirectory.listFiles(); + if (originalColumnFamilyDataFiles != null) { + for (File file : originalColumnFamilyDataFiles) { + if (file.isFile()) { + file.delete(); + } + } + } + + //5.2 Copy snapshots files to column family folder + File[] filesToBeRestored = snapshotDirectory.listFiles(); + if (filesToBeRestored != null) { + for (File fileToBeRestored : filesToBeRestored) { + if (fileToBeRestored.isFile()) { + File destinationFile = new File(columnFamilyDirectory, fileToBeRestored.getName()); + try { + FileUtil.copyFile(fileToBeRestored, destinationFile); + } catch (Exception e) { + result.setErrorMessage("Restore failed! The file copying process failed!"); + return result; + } + } + } + } + } + } + + //6. Restart Cassandra + node.startNode(); + + result.setSimpleResult("Snapshot restored succesfully..."); + + return result; + } + private ColumnFamilyDefinition getColumnFamilyDefinition() { Configuration pluginConfig = this.getResourceContext().getPluginConfiguration(); String cfName = pluginConfig.getSimpleValue("name"); - KeyspaceComponent<?> keyspaceComponent = this.getParentKeyspace(); + KeyspaceComponent keyspaceComponent = this.getParentKeyspace();
for (ColumnFamilyDefinition cfDef : keyspaceComponent.getKeyspaceDefinition().getCfDefs()) { if (cfName.equals(cfDef.getName())) { @@ -128,7 +251,7 @@ public class ColumnFamilyComponent extends MBeanResourceComponent<JMXComponent<? return null; }
- private KeyspaceComponent<?> getParentKeyspace() { - return (KeyspaceComponent<?>) this.getResourceContext().getParentResourceComponent(); + private KeyspaceComponent getParentKeyspace() { + return (KeyspaceComponent) this.getResourceContext().getParentResourceComponent(); } } diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceComponent.java index d2d6126..5b15ee4 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceComponent.java @@ -25,12 +25,14 @@
package org.rhq.plugins.cassandra;
+import java.io.File; import java.util.Map;
import me.prettyprint.hector.api.ddl.KeyspaceDefinition;
import org.mc4j.ems.connection.EmsConnection; import org.mc4j.ems.connection.bean.EmsBean; +import org.mc4j.ems.connection.bean.attribute.EmsAttribute; import org.mc4j.ems.connection.bean.operation.EmsOperation;
import org.rhq.core.domain.configuration.Configuration; @@ -49,18 +51,18 @@ import org.rhq.plugins.jmx.JMXComponent; /** * @author John Sanda */ -public class KeyspaceComponent<T extends ResourceComponent<?>> implements ResourceComponent<T>, ConfigurationFacet, - JMXComponent<T>, OperationFacet { +public class KeyspaceComponent implements ResourceComponent<ResourceComponent<?>>, ConfigurationFacet, + JMXComponent<ResourceComponent<?>>, OperationFacet {
private static final String STORAGE_SERVICE_BEAN = "org.apache.cassandra.db:type=StorageService";
private static final String COMPACT_OPERATION = "forceTableCompaction"; private static final String REPAIR_OPERATION = "forceTableRepair";
- private ResourceContext<T> context; + private ResourceContext<ResourceComponent<?>> context;
@Override - public void start(ResourceContext<T> context) throws Exception { + public void start(ResourceContext<ResourceComponent<?>> context) throws Exception { this.context = context; }
@@ -98,6 +100,7 @@ public class KeyspaceComponent<T extends ResourceComponent<?>> implements Resour list.add(map); } config.put(list); + config.put(this.getKeySpaceDataFileLocations());
return config; } @@ -175,6 +178,46 @@ public class KeyspaceComponent<T extends ResourceComponent<?>> implements Resour return new OperationResult(); }
+ public PropertyList getKeySpaceDataFileLocations() { + EmsBean emsBean = loadBean(STORAGE_SERVICE_BEAN); + EmsAttribute attribute = emsBean.getAttribute("AllDataFileLocations"); + + PropertyList list = new PropertyList("keyspaceFileLocations"); + String[] dirs = (String[]) attribute.getValue(); + for (String dir : dirs) { + if (!dir.endsWith("/")) { + dir = dir + "/"; + } + + list.add(new PropertySimple("directory", dir + context.getResourceKey())); + } + + return list; + } + + public PropertySimple getCommitLogProperty() { + EmsBean emsBean = loadBean(STORAGE_SERVICE_BEAN); + EmsAttribute attribute = emsBean.getAttribute("CommitLogLocation"); + return new PropertySimple("CommitLogLocation", attribute.refresh()); + } + + public boolean clearCommitLog() { + PropertySimple commitLogProperty = this.getCommitLogProperty(); + + File commitLogFolder = new File(commitLogProperty.getStringValue()); + + File[] commitLogFiles = commitLogFolder.listFiles(); + for (File file : commitLogFiles) { + file.delete(); + } + + return true; + } + + public CassandraNodeComponent getCassandraNodeComponent() { + return (CassandraNodeComponent) this.context.getParentResourceComponent(); + } + /** * Loads the bean with the given object name. * diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/MetricsDiscoveryComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/MetricsDiscoveryComponent.java new file mode 100644 index 0000000..fbd2ef5 --- /dev/null +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/MetricsDiscoveryComponent.java @@ -0,0 +1,61 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.cassandra; + +import java.util.Set; + +import org.rhq.core.domain.util.StringUtils; +import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails; +import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext; +import org.rhq.plugins.jmx.JMXComponent; +import org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent; + +/** + * @author Stefan Negrea + */ +public class MetricsDiscoveryComponent extends MBeanResourceDiscoveryComponent<JMXComponent<?>> { + + public static final String PROPERTY_NAME_MARKER = "nameMarker"; + + public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<JMXComponent<?>> context) { + String nameMarker = context.getDefaultPluginConfiguration().getSimpleValue(PROPERTY_NAME_MARKER); + + Set<DiscoveredResourceDetails> discoveredResources = super.discoverResources(context, true); + + String updatedResourceName; + int index; + for (DiscoveredResourceDetails discoveredResource : discoveredResources) { + updatedResourceName = discoveredResource.getResourceName(); + if ( (index = updatedResourceName.indexOf(nameMarker)) != -1) { + updatedResourceName = updatedResourceName.substring(index + nameMarker.length()); + if (updatedResourceName.length() != 0) { + updatedResourceName = StringUtils.deCamelCase(updatedResourceName); + discoveredResource.setResourceName(updatedResourceName); + } + } + } + + return discoveredResources; + } + +} diff --git a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml index 6ed9ef4..e3c33d0 100644 --- a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml @@ -28,6 +28,8 @@
<subcategories> <subcategory name="Client Request Metrics" description="Client Request Metrics"/> + <subcategory name="Server Request Metrics" description="Server Request Metrics"/> + <subcategory name="Internal Server Metrics" description="Server Request Metrics"/> </subcategories>
<plugin-configuration> @@ -181,8 +183,8 @@ </plugin-configuration>
<metric property="TotalCommitLogSize" measurementType="trendsup" displayType="summary" description="Size of all commit log segments"/> - <metric property="PendingTasks" measurementType="dynamic" displayType="detail" description="Number of tasks waiting to be executed"/> - <metric property="CompletedTasks" measurementType="trendsup" displayType="detail" description="Number of completed tasks"/> + <metric property="PendingTasks" measurementType="dynamic" displayType="summary" description="Number of tasks waiting to be executed"/> + <metric property="CompletedTasks" measurementType="trendsup" displayType="summary" description="Number of completed tasks"/> </service>
@@ -260,7 +262,7 @@ </operation>
<metric property="CompletedTasks" measurementType="trendsup" displayType="summary" description="Number of completed compactions since server [re]start"/> - <metric property="PendingTasks" measurementType="dynamic" displayType="detail" description="Number of tasks waiting to be executed"/> + <metric property="PendingTasks" measurementType="dynamic" displayType="summary" description="Number of tasks waiting to be executed"/> <metric property="TotalBytesCompacted" measurementType="trendsup" displayType="detail" description="Total number of bytes compacted since server [re]start"/> <metric property="TotalCompactionsCompleted" measurementType="trendsup" displayType="detail" description="Total number of compactions since server [re]start"/> </service> @@ -280,17 +282,17 @@ <operation name="invalidateKeyCache" description="Invalidate the key cache."/> <operation name="invalidateRowCache" description="Invalidate the row cache."/>
- <metric property="KeyCacheHits" measurementType="dynamic" displayType="detail" description="Number of key cache hits"/> - <metric property="RowCacheHists" measurementType="dynamic" displayType="detail" description="Number of row cache hits"/> + <metric property="KeyCacheHits" measurementType="dynamic" displayType="summary" description="Number of key cache hits"/> + <metric property="RowCacheHists" measurementType="dynamic" displayType="summary" description="Number of row cache hits"/>
- <metric property="KeyCacheRequests" measurementType="dynamic" displayType="detail" description="Number of key cache requests"/> - <metric property="RowCacheRequests" measurementType="dynamic" displayType="detail" description="Number of row cache requests"/> + <metric property="KeyCacheRequests" measurementType="dynamic" displayType="summary" description="Number of key cache requests"/> + <metric property="RowCacheRequests" measurementType="dynamic" displayType="summary" description="Number of row cache requests"/>
- <metric property="KeyCacheRecentHitRate" measurementType="dynamic" displayType="detail" description="Recent key cache hit rate"/> - <metric property="RowCacheRecentHitRate" measurementType="dynamic" displayType="detail" description="Recent row cache hit rate"/> + <metric property="KeyCacheRecentHitRate" measurementType="dynamic" displayType="summary" description="Recent key cache hit rate"/> + <metric property="RowCacheRecentHitRate" measurementType="dynamic" displayType="summary" description="Recent row cache hit rate"/>
- <metric property="KeyCacheCapacityInBytes" measurementType="dynamic" displayType="detail" description="Key cache capacity in bytes"/> - <metric property="RowCacheCapacityInBytes" measurementType="dynamic" displayType="detail" description="Row cache capacity in bytes"/> + <metric property="KeyCacheCapacityInBytes" measurementType="dynamic" displayType="summary" description="Key cache capacity in bytes"/> + <metric property="RowCacheCapacityInBytes" measurementType="dynamic" displayType="summary" description="Row cache capacity in bytes"/>
<metric property="KeyCacheSize" measurementType="dynamic" displayType="detail" description="Key cache size"/> <metric property="RowCacheSize" measurementType="dynamic" displayType="detail" description="Row cache size"/> @@ -344,6 +346,9 @@ <c:simple-property name="strategyOptionValue" type="string" readOnly="true"/> </c:map-property> </c:list-property> + <c:list-property name="keyspaceFileLocations" readOnly="true" description="List of data file locations"> + <c:simple-property name="directory" type="string" readOnly="true"/> + </c:list-property> </resource-configuration>
<service name="ColumnFamily" @@ -393,24 +398,34 @@ <c:simple-property name="operationResult" description="Filenames that contain the given key on this node."/> </results> </operation> + <operation name="restoreSnapshot" description="Restore the column family from a previously taken snapshot."> + <parameters> + <c:simple-property name="snapshotName" required="true" type="string" description="Snapshot Name"> + <c:option-source target="configuration" expression="snapshots:type=ColumnFamily"/> + </c:simple-property> + </parameters> + <results> + <c:simple-property name="operationResult" description="Filenames that contain the given key on this node."/> + </results> + </operation>
- <metric property="CompressionRatio" measurementType="dynamic" displayType="detail" description="Compression Ratio"/> - <metric property="LiveDiskSpaceUsed" displayName="Live Disk Space Used" measurementType="dynamic" displayType="detail" description="Disk space used by SSTables belonging to this CF"/> - <metric property="LiveSSTableCount" displayName="Live SS Table Count" measurementType="dynamic" displayType="detail" description="Number of SSTables on disk for this CF"/> - <metric property="MaxRowSize" measurementType="dynamic" displayType="detail" description="Size of the largest compacted row"/> - <metric property="MeanRowSize" measurementType="dynamic" displayType="detail" description="Means size of the compacted rows"/> - <metric property="MemtableColumnsCount" displayName="Memtable Columns Count" measurementType="dynamic" displayType="detail" description="Total number of columns present in the memtable."/> + <metric property="CompressionRatio" measurementType="dynamic" displayType="summary" description="Compression Ratio"/> + <metric property="LiveDiskSpaceUsed" displayName="Live Disk Space Used" measurementType="dynamic" displayType="summary" description="Disk space used by SSTables belonging to this CF"/> + <metric property="LiveSSTableCount" displayName="Live SS Table Count" measurementType="dynamic" displayType="summary" description="Number of SSTables on disk for this CF"/> + <metric property="MaxRowSize" measurementType="dynamic" displayType="summary" description="Size of the largest compacted row"/> + <metric property="MeanRowSize" measurementType="dynamic" displayType="summary" description="Means size of the compacted rows"/> + <metric property="MemtableColumnsCount" displayName="Memtable Columns Count" measurementType="dynamic" displayType="summary" description="Total number of columns present in the memtable."/> <metric property="MemtableDataSize" displayName="Memtable Data Size" measurementType="dynamic" displayType="detail" description="Total amount of data stored in the memtable, including column related overhead."/> - <metric property="MemtableSwitchCount" displayName="Memtable Switch Count" measurementType="dynamic" displayType="detail" description="Number of times that a flush has resulted in the memtable being switched out."/> - <metric property="MinRowSize" measurementType="dynamic" displayType="detail" description="Size of the smallest compacted row"/> - <metric property="PendingTasks" measurementType="dynamic" displayType="detail" description="Estimated number of tasks pending for this column family"/> + <metric property="MemtableSwitchCount" displayName="Memtable Switch Count" measurementType="dynamic" displayType="summary" description="Number of times that a flush has resulted in the memtable being switched out."/> + <metric property="MinRowSize" measurementType="dynamic" displayType="summary" description="Size of the smallest compacted row"/> + <metric property="PendingTasks" measurementType="dynamic" displayType="summary" description="Estimated number of tasks pending for this column family"/> <metric property="ReadCount" displayName="Read Count" measurementType="trendsup" displayType="summary" description="Number of read operations since execution start"/> <metric property="RecentReadLatencyMicros" displayName="Recent Read Latency (in micro seconds)" measurementType="trendsup" displayType="detail" description="Latency of read operations since this metric was last sampled"/> <metric property="RecentWriteLatencyMicros" displayName="Recent Write Latency (in micro seconds)" measurementType="trendsup" displayType="detail" description="Latency of write operations since this metric was last sampled"/> - <metric property="TotalDiskSpaceUsed" measurementType="dynamic" displayType="summary" description="Total disk space used by SSTables belonging to this CF, including obsolete ones waiting to be GC'd"/> + <metric property="TotalDiskSpaceUsed" measurementType="dynamic" displayType="detail" description="Total disk space used by SSTables belonging to this CF, including obsolete ones waiting to be GC'd"/> <metric property="TotalReadLatencyMicros" displayName="Total Read Latency (in micro seconds)" measurementType="trendsup" displayType="detail" description="Latency of read operations since execution start"/> <metric property="TotalWriteLatencyMicros" displayName="Total Write Latency (in micro seconds)" measurementType="trendsup" displayType="detail" description="Latency of write operations since execution start"/> - <metric property="UnleveledSSTables" measurementType="dynamic" displayType="detail" description="Number of SSTables in L0. Always return 0 if Leveled compaction is not enabled."/> + <metric property="UnleveledSSTables" measurementType="dynamic" displayType="summary" description="Number of SSTables in L0. Always return 0 if Leveled compaction is not enabled."/> <metric property="WriteCount" displayName="Write Count" measurementType="trendsup" displayType="summary" description="Number of write operations since execution start"/>
<resource-configuration> @@ -422,9 +437,100 @@ <c:simple-property name="CompressionParameters" type="string" required="true" description="Compression parameters"/> <c:simple-property name="MinimumCompactionThreshold" type="integer" required="true" description="Minimum number of sstables in queue before compaction kicks off."/> <c:simple-property name="MaximumCompactionThreshold" type="integer" required="true" description="Maximum number of sstables in queue before compaction kicks off."/> + <c:list-property name="snapshots" readOnly="true" required="false"> + <c:map-property name="snapshot" readOnly="true"> + <c:simple-property name="name" readOnly="true"/> + <c:simple-property name="folder" readOnly="true" description="Snapshot Folder"/> + </c:map-property> + </c:list-property> </resource-configuration> </service> </service>
+ + <service name="ConfigurableStages" + discovery="org.rhq.plugins.cassandra.MetricsDiscoveryComponent" + class="org.rhq.plugins.jmx.MBeanResourceComponent" + singleton="true" + subCategory="Server Request Metrics"> + + <plugin-configuration> + <c:simple-property name="objectName" readOnly="true" type="string" + default="org.apache.cassandra.request:type=MutationStage|org.apache.cassandra.request:type=ReadStage|org.apache.cassandra.request:type=ReplicateOnWriteStage"/> + <c:simple-property name="nameMarker" readOnly="true" type="string" default="type=" /> + </plugin-configuration> + + <metric property="ActiveCount" measurementType="dynamic" displayType="summary" description="Active Count"/> + <metric property="CurrentlyBlockedTasks" measurementType="dynamic" displayType="summary" description="Currently Blocked Tasks"/> + <metric property="CompletedTasks" measurementType="dynamic" displayType="summary" description="Completed Tasks"/> + <metric property="PendingTasks" measurementType="dynamic" displayType="summary" description="Pending Tasks"/> + <metric property="TotalBlockedTasks" measurementType="dynamic" displayType="summary" description="Total Blocked Tasks"/> + + <resource-configuration> + <c:simple-property name="CorePoolSize" type="integer" required="true" description="Core Pool Size."/> + </resource-configuration> + </service> + + <service name="EnabledStages" + discovery="org.rhq.plugins.cassandra.MetricsDiscoveryComponent" + class="org.rhq.plugins.jmx.MBeanResourceComponent" + singleton="true" + subCategory="Server Request Metrics"> + + <plugin-configuration> + <c:simple-property name="objectName" readOnly="true" type="string" + default="org.apache.cassandra.request:type=ReadRepairStage|org.apache.cassandra.request:type=RequestResponseStage"/> + <c:simple-property name="nameMarker" readOnly="true" type="string" default="type=" /> + </plugin-configuration> + + <metric property="ActiveCount" measurementType="dynamic" displayType="summary" description="Active Count"/> + <metric property="CurrentlyBlockedTasks" measurementType="dynamic" displayType="summary" description="Currently Blocked Tasks"/> + <metric property="CompletedTasks" measurementType="dynamic" displayType="summary" description="Completed Tasks"/> + <metric property="PendingTasks" measurementType="dynamic" displayType="summary" description="Pending Tasks"/> + <metric property="TotalBlockedTasks" measurementType="dynamic" displayType="summary" description="Total Blocked Tasks"/> + </service> + + <service name="ConfigurableInternalServerMetrics" + discovery="org.rhq.plugins.cassandra.MetricsDiscoveryComponent" + class="org.rhq.plugins.jmx.MBeanResourceComponent" + singleton="true" + subCategory="Internal Server Metrics"> + + <plugin-configuration> + <c:simple-property name="objectName" readOnly="true" type="string" + default="org.apache.cassandra.internal:type=AntiEntropySessions"/> + <c:simple-property name="nameMarker" readOnly="true" type="string" default="type=" /> + </plugin-configuration> + + <metric property="ActiveCount" measurementType="dynamic" displayType="summary" description="Active Count"/> + <metric property="CurrentlyBlockedTasks" measurementType="dynamic" displayType="summary" description="Currently Blocked Tasks"/> + <metric property="CompletedTasks" measurementType="dynamic" displayType="summary" description="Completed Tasks"/> + <metric property="PendingTasks" measurementType="dynamic" displayType="summary" description="Pending Tasks"/> + <metric property="TotalBlockedTasks" measurementType="dynamic" displayType="summary" description="Total Blocked Tasks"/> + + <resource-configuration> + <c:simple-property name="CorePoolSize" type="integer" required="true" description="Core Pool Size."/> + </resource-configuration> + </service> + + <service name="EnabledInternalServerMetrics" + discovery="org.rhq.plugins.cassandra.MetricsDiscoveryComponent" + class="org.rhq.plugins.jmx.MBeanResourceComponent" + singleton="true" + subCategory="Internal Server Metrics"> + + <plugin-configuration> + <c:simple-property name="objectName" readOnly="true" type="string" + default="org.apache.cassandra.internal:type=AntiEntropyStage|org.apache.cassandra.internal:type=FlushWriter|org.apache.cassandra.internal:type=GossipStage|org.apache.cassandra.internal:type=HintedHandoff|org.apache.cassandra.internal:type=InternalResponseStage|org.apache.cassandra.internal:type=MemtablePostFlusher|org.apache.cassandra.internal:type=MigrationStage|org.apache.cassandra.internal:type=MiscStage|org.apache.cassandra.internal:type=StreamStage|org.apache.cassandra.internal:type=commitlog_archiver"/> + <c:simple-property name="nameMarker" readOnly="true" type="string" default="type=" /> + </plugin-configuration> + + <metric property="ActiveCount" measurementType="dynamic" displayType="summary" description="Active Count"/> + <metric property="CurrentlyBlockedTasks" measurementType="dynamic" displayType="summary" description="Currently Blocked Tasks"/> + <metric property="CompletedTasks" measurementType="dynamic" displayType="summary" description="Completed Tasks"/> + <metric property="PendingTasks" measurementType="dynamic" displayType="summary" description="Pending Tasks"/> + <metric property="TotalBlockedTasks" measurementType="dynamic" displayType="summary" description="Total Blocked Tasks"/> + </service> + </server> </plugin> \ No newline at end of file
commit 59943b821669aad8c262b8c5db7c1d66b0c85e00 Author: Stefan Negrea snegrea@redhat.com Date: Tue Oct 16 15:31:03 2012 -0500
Added support for cache service. Also updated storage proxy, storage manager, and compaction manager.
diff --git a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml index b322f27..6ed9ef4 100644 --- a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml @@ -87,16 +87,23 @@ <c:simple-property name="nameTemplate" readOnly="true" type="string" default="Storage Proxy"/> </plugin-configuration>
- <metric property="RangeOperations" measurementType="trendsup" description="The total number of range operations since execution start"/> - <metric property="ReadOperations" measurementType="trendsup" displayType="summary" description="The total number of read operations since execution start"/> - <metric property="TotalDiskSpaceUsed" measurementType="dynamic" displayType="summary"/> - <metric property="TotalRangeLatencyMicros" displayName="Total Range Latency (in micro seconds)" measurementType="trendsup" description="The total latency of all range operations since execution start"/> - <metric property="TotalReadLatencyMicros" displayName="Total Read Latency (in micro seconds)" measurementType="trendsup" displayType="detail" description="The latency all of read operations since execution start"/> - <metric property="TotalWriteLatencyMicros" displayName="Total Write Latency (in micro seconds)" measurementType="trendsup" displayType="detail" description="The latency of all write operations since execution start"/> - <metric property="WriteOperations" measurementType="trendsup" displayType="summary" description="The total number of write operations since execution start"/> + <metric property="HintsInProgress" measurementType="dynamic" displayType="summary" description="Hints in progress."/> + <metric property="RecentRangeLatencyMicros" measurementType="dynamic" displayType="summary" displayName="Recent Range Latency (microseconds)" description="Recent range latency in microseconds."/> + <metric property="RecentReadLatencyMicros" measurementType="dynamic" displayType="summary" displayName="Recent Read Latency (microseconds)" description="Recent read latency in microseconds."/> + <metric property="RecentWriteLatencyMicros" measurementType="dynamic" displayType="summary" displayName="Recent Write Latency (microseconds)" description="Recent write latency in microseconds."/> + <metric property="RangeOperations" measurementType="trendsup" displayType="summary" description="Total number of range operations since execution start"/> + <metric property="ReadOperations" measurementType="trendsup" displayType="summary" description="Total number of read operations since execution start"/> + <metric property="TotalHints" measurementType="trendsup" displayType="detail" description="Total hints."/> + <metric property="TotalRangeLatencyMicros" measurementType="trendsup" displayType="detail" displayName="Total Range Latency (microseconds)" description="The total latency of all range operations since execution start"/> + <metric property="TotalReadLatencyMicros" measurementType="trendsup" displayType="detail" displayName="Total Read Latency (microseconds)" description="The latency all of read operations since execution start"/> + <metric property="TotalWriteLatencyMicros" measurementType="trendsup" displayType="detail" displayName="Total Write Latency (microseconds)" description="The latency of all write operations since execution start"/> + <metric property="WriteOperations" measurementType="trendsup" displayType="summary" description="Total number of write operations since execution start"/>
<resource-configuration> - <c:simple-property name="readOperations" type="long" readOnly="true"/> + <c:simple-property name="HintedHandoffEnabled" type="boolean" required="true" description="Hinted Handoff Enabled"/> + <c:simple-property name="MaxHintsInProgress" type="long" required="true" description="Max Hints in Progress"/> + <c:simple-property name="MaxHintWindow" type="long" required="true" description="Max Hint Window"/> + <c:simple-property name="RPCTimeout" type="long" required="true" displayName="RPC Timeout" description="RPC Timeout"/> </resource-configuration> </service>
@@ -149,14 +156,14 @@ in the system.schema_* column families. This value is used in an algorithm to compare schema versions between nodes and apply updates as necessary. This value should be the same for all fully initialized nodes in the cluster."/> - <metric property="ReleaseVersion" dataType="trait" description="The Cassandra version"/> - <metric property="Load" dataType="measurement" units="bytes" displayType="summary" description="The amount of load in disk usage on the node being queried"/> + <metric property="ReleaseVersion" dataType="trait" description="Cassandra version"/> + <metric property="Load" dataType="measurement" units="bytes" displayType="summary" description="Amount of load in disk usage on the node being queried"/> <metric property="OperationMode" dataType="trait" description="The current operation mode"/>
<resource-configuration> - <c:simple-property name="SavedCachesLocation" type="string" readOnly="true" description="The location of the saved caches directory"/> - <c:simple-property name="CommitLogLocation" type="string" readOnly="true" default="The location of the commit log directory"/> - <c:list-property name="dataFileLocations" readOnly="true" description="A list of data file locations"> + <c:simple-property name="SavedCachesLocation" type="string" readOnly="true" description="Location of the saved caches directory"/> + <c:simple-property name="CommitLogLocation" type="string" readOnly="true" default="Location of the commit log directory"/> + <c:list-property name="dataFileLocations" readOnly="true" description="List of data file locations"> <c:simple-property name="directory" type="string" readOnly="true"/> </c:list-property> </resource-configuration> @@ -238,6 +245,20 @@ <c:simple-property name="nameTemplate" readOnly="true" type="string" default="Compaction Manager" /> </plugin-configuration>
+ <operation name="stopCompaction" description="Stop all running compaction-like tasks having the provided type."> + <parameters> + <c:simple-property name="p1" displayName="Type" required="true" description="Type of compaction to stop"> + <c:property-options> + <c:option value="COMPACTION"/> + <c:option value="VALIDATION"/> + <c:option value="CLEANUP"/> + <c:option value="SCRUB"/> + <c:option value="INDEX_BUILD"/> + </c:property-options> + </c:simple-property> + </parameters> + </operation> + <metric property="CompletedTasks" measurementType="trendsup" displayType="summary" description="Number of completed compactions since server [re]start"/> <metric property="PendingTasks" measurementType="dynamic" displayType="detail" description="Number of tasks waiting to be executed"/> <metric property="TotalBytesCompacted" measurementType="trendsup" displayType="detail" description="Total number of bytes compacted since server [re]start"/> @@ -245,6 +266,45 @@ </service>
+ <service name="CacheService" + discovery="org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent" + class="org.rhq.plugins.jmx.MBeanResourceComponent" + singleton="true"> + + <plugin-configuration> + <c:simple-property name="objectName" readOnly="true" type="string" default="org.apache.cassandra.db:type=Caches"/> + <c:simple-property name="nameTemplate" readOnly="true" type="string" default="Cache Service" /> + </plugin-configuration> + + <operation name="saveCaches" description="Save row and key caches."/> + <operation name="invalidateKeyCache" description="Invalidate the key cache."/> + <operation name="invalidateRowCache" description="Invalidate the row cache."/> + + <metric property="KeyCacheHits" measurementType="dynamic" displayType="detail" description="Number of key cache hits"/> + <metric property="RowCacheHists" measurementType="dynamic" displayType="detail" description="Number of row cache hits"/> + + <metric property="KeyCacheRequests" measurementType="dynamic" displayType="detail" description="Number of key cache requests"/> + <metric property="RowCacheRequests" measurementType="dynamic" displayType="detail" description="Number of row cache requests"/> + + <metric property="KeyCacheRecentHitRate" measurementType="dynamic" displayType="detail" description="Recent key cache hit rate"/> + <metric property="RowCacheRecentHitRate" measurementType="dynamic" displayType="detail" description="Recent row cache hit rate"/> + + <metric property="KeyCacheCapacityInBytes" measurementType="dynamic" displayType="detail" description="Key cache capacity in bytes"/> + <metric property="RowCacheCapacityInBytes" measurementType="dynamic" displayType="detail" description="Row cache capacity in bytes"/> + + <metric property="KeyCacheSize" measurementType="dynamic" displayType="detail" description="Key cache size"/> + <metric property="RowCacheSize" measurementType="dynamic" displayType="detail" description="Row cache size"/> + + <resource-configuration> + <c:simple-property name="KeyCacheCapacityInMB" type="long" required="true" displayName="Key Cache Capacity In MB" description="Key cache capacity in MB"/> + <c:simple-property name="RowCacheCapacityInMB" type="long" required="true" displayName="Row Cache Capacity In MB" description="Row cache capacity in MB"/> + + <c:simple-property name="KeyCacheSavePeriodInSeconds" type="integer" required="true" description="Key cache save period in seconds"/> + <c:simple-property name="RowCacheSavePeriodInSeconds" type="integer" required="true" description="Row cache save period in seconds"/> + </resource-configuration> + </service> + + <service name="Keyspace" discovery="org.rhq.plugins.cassandra.KeyspaceDiscoveryComponent" class="org.rhq.plugins.cassandra.KeyspaceComponent">
commit 07bd2ceac5d3ead6684115091bbb289247b51c8d Author: Stefan Negrea snegrea@redhat.com Date: Tue Oct 16 09:57:29 2012 -0500
Enable client request metrics. Also included is a compaction of the XML plugin descriptor.
diff --git a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml index 950d7c8..b322f27 100644 --- a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml @@ -25,104 +25,75 @@ <server name="Cassandra Node" discovery="CassandraNodeDiscoveryComponent" class="CassandraNodeComponent"> + + <subcategories> + <subcategory name="Client Request Metrics" description="Client Request Metrics"/> + </subcategories> + <plugin-configuration> - <c:simple-property - name="connectorAddress" - displayName="Manager URL" - description="The RMI URL with which to connect to the Cassandra node (e.g. service:jmx:rmi:///jndi/rmi://localhost:7199/jmxrmi)." - default="service:jmx:rmi:///jndi/rmi://localhost:7199/jmxrmi"/> - <c:simple-property - name="type" - description="The type used to establish the EMS connection to the Cassandra node." - default="org.mc4j.ems.connection.support.metadata.J2SE5ConnectionTypeDescriptor" - readOnly="true"/> + <c:simple-property name="connectorAddress" displayName="Manager URL" default="service:jmx:rmi:///jndi/rmi://localhost:7199/jmxrmi" + description="The RMI URL with which to connect to the Cassandra node (e.g. service:jmx:rmi:///jndi/rmi://localhost:7199/jmxrmi)."/> + <c:simple-property name="type" readOnly="true" default="org.mc4j.ems.connection.support.metadata.J2SE5ConnectionTypeDescriptor" + description="The type used to establish the EMS connection to the Cassandra node."/> <c:simple-property name="installURI" required="false" type="string" description="The installation path for the selected server type which will be used to find client libraries (if appropriate)"/> <c:simple-property name="principal" required="false" description="The login principal/username"/> <c:simple-property name="credentials" required="false" type="password" description="The login credentials/password"/> <c:simple-property name="additionalClassPathEntries" required="false" type="string" description="Comma-separated list of directories and filenames that contain resources and classes needed to communicate with the JMX Server and its MBeans. If you specify 'some/directory/*.jar', all jars found in the given directory will be added."/> <c:simple-property name="commandLine" required="false" type="string" description="the command line of the JVM at the time it was discovered - only used by JVMs with type Local; if the command line of the JVM changes, this property's value will need to be updated accordingly in order for RHQ to connect to the JVM"/> - <c:simple-property name="baseDir" - displayName="Base Directory" - description="The base directory from which the Cassandra Daemon was launched." - required="false"/> + <c:simple-property name="baseDir" displayName="Base Directory" description="The base directory from which the Cassandra Daemon was launched." required="false"/> </plugin-configuration>
- <process-scan name="CassandraDaemon" - query="process|basename|match=^java.*,arg|org.apache.cassandra.thrift.CassandraDaemon|match=.*"/> + <process-scan name="CassandraDaemon" query="process|basename|match=^java.*,arg|org.apache.cassandra.thrift.CassandraDaemon|match=.*"/>
<operation name="shutdown" description="Shuts down the Cassandra daemon"> <results> <c:simple-property name="shutdownResult" description="Shutdown the Cassandra daemon"/> </results> </operation> - <operation name="start" description="Starts the Cassandra daemon"> <results> <c:simple-property name="startResult" description="Start the Cassandra daemon"/> </results> </operation> - <operation name="restart" description="Restarts the Cassandra daemon"> <results> <c:simple-property name="startResult" description="Restart the Cassandra daemon"/> </results> </operation>
- <metric property="cluster" - dataType="trait" - description="The name of the cluster. This is used to prevent machines in one logical cluster from joining another." - displayType="summary"/> + <metric property="cluster" dataType="trait" description="The name of the cluster. This is used to prevent machines in one logical cluster from joining another." displayType="summary"/> +
<server name="Cassandra Server JVM" - description="The JVM of the Cassandra node" - sourcePlugin="JMX" - sourceType="JMX Server" + sourcePlugin="JMX" sourceType="JMX Server" discovery="org.rhq.plugins.jmx.EmbeddedJMXServerDiscoveryComponent" class="org.rhq.plugins.jmx.EmbeddedJMXServerComponent" + description="The JVM of the Cassandra node" singleton="true"> + <plugin-configuration> - <c:simple-property name="type" type="string" default="PARENT" readOnly="true" - description="The EMS connection type for this JVM (cannot be modified)"/> + <c:simple-property name="type" type="string" default="PARENT" readOnly="true" description="The EMS connection type for this JVM (cannot be modified)"/> </plugin-configuration> </server>
+ <service name="StorageProxy" discovery="org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent" class="org.rhq.plugins.jmx.MBeanResourceComponent" singleton="true"> + <plugin-configuration> <c:simple-property name="objectName" readOnly="true" default="org.apache.cassandra.db:type=StorageProxy"/> <c:simple-property name="nameTemplate" readOnly="true" type="string" default="Storage Proxy"/> </plugin-configuration>
- <metric property="TotalReadLatencyMicros" - displayName="Total Read Latency (in micro seconds)" - measurementType="trendsup" - displayType="detail" - description="The latency all of read operations since execution start"/> - <metric property="TotalWriteLatencyMicros" - displayName="Total Write Latency (in micro seconds)" - measurementType="trendsup" - displayType="detail" - description="The latency of all write operations since execution start"/> - <metric property="ReadOperations" - measurementType="trendsup" - displayType="summary" - description="The total number of read operations since execution start"/> - <metric property="WriteOperations" - measurementType="trendsup" - displayType="summary" - description="The total number of write operations since execution start"/> - <metric property="RangeOperations" - measurementType="trendsup" - description="The total number of range operations since execution start"/> - <metric property="TotalRangeLatencyMicros" - displayName="Total Range Latency (in micro seconds)" - measurementType="trendsup" - description="The total latency of all range operations since execution start"/> - <metric property="TotalDiskSpaceUsed" - measurementType="dynamic" - displayType="summary"/> + <metric property="RangeOperations" measurementType="trendsup" description="The total number of range operations since execution start"/> + <metric property="ReadOperations" measurementType="trendsup" displayType="summary" description="The total number of read operations since execution start"/> + <metric property="TotalDiskSpaceUsed" measurementType="dynamic" displayType="summary"/> + <metric property="TotalRangeLatencyMicros" displayName="Total Range Latency (in micro seconds)" measurementType="trendsup" description="The total latency of all range operations since execution start"/> + <metric property="TotalReadLatencyMicros" displayName="Total Read Latency (in micro seconds)" measurementType="trendsup" displayType="detail" description="The latency all of read operations since execution start"/> + <metric property="TotalWriteLatencyMicros" displayName="Total Write Latency (in micro seconds)" measurementType="trendsup" displayType="detail" description="The latency of all write operations since execution start"/> + <metric property="WriteOperations" measurementType="trendsup" displayType="summary" description="The total number of write operations since execution start"/>
<resource-configuration> <c:simple-property name="readOperations" type="long" readOnly="true"/> @@ -133,20 +104,19 @@ discovery="org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent" class="org.rhq.plugins.cassandra.StorageServiceComponent" singleton="true"> + <plugin-configuration> <c:simple-property name="objectName" readOnly="true" default="org.apache.cassandra.db:type=StorageService"/> <c:simple-property name="nameTemplate" type="string" readOnly="true" default="Storage Service"/> </plugin-configuration>
<operation name="startRPCServer" description="Start the Thrift server"/> - <operation name="stopRPCServer" description="Stop the Thrift server"/> - <operation name="takeSnapshot" description="Takes a snapshot of all keyspaces. A snapshot first flushes all in-memory writes to disk and then creates a hard - link of each SSTable file for each keyspace. Note that a column family can have multiple - SSTables on disk. By default snapshots are stored in the <cassandra_data_dir>/<keyspace_name>/<column_family_name>/snapshots - directory. On Linux/UNIX systems cassandra_data_dir defaults to /var/lib/cassandra/data"> + link of each SSTable file for each keyspace. Note that a column family can have multiple + SSTables on disk. By default snapshots are stored in the <cassandra_data_dir>/<keyspace_name>/<column_family_name>/snapshots + directory. On Linux/UNIX systems cassandra_data_dir defaults to /var/lib/cassandra/data"> <parameters> <c:simple-property name="snapshotName" required="false" type="string" displayName="Snapshot Name" description="Snapshot name. If left empty current system time in milliseconds will be used as the snapshot name."/> @@ -172,108 +142,109 @@ </parameters> </operation>
- <metric property="Token" - dataType="trait" - description="A string representation of this node's token" - defaultOn="true"/> - - <metric property="ReleaseVersion" - dataType="trait" - description="The Cassandra version"/> - <metric property="SchemaVersion" - dataType="trait" + <metric property="Token" dataType="trait" description="A string representation of this node's token" defaultOn="true"/> + <metric property="ReleaseVersion" dataType="trait" description="The Cassandra version"/> + <metric property="SchemaVersion" dataType="trait" displayType="summary" description="The current schema version for this node. The value is calculated as a checksum of all rows - in the system.schema_* column families. This value is used in an algorithm to compare schema versions - between nodes and apply updates as necessary. This value should be the same for all fully initialized - nodes in the cluster." - displayType="summary"/> - <metric property="ReleaseVersion" - dataType="trait" - description="The Cassandra version"/> - <metric property="Load" - dataType="measurement" - units="bytes" - displayType="summary" - description="The amount of load in disk usage on the node being queried"/> - <metric property="OperationMode" - dataType="trait" - description="The current operation mode"/> + in the system.schema_* column families. This value is used in an algorithm to compare schema versions + between nodes and apply updates as necessary. This value should be the same for all fully initialized + nodes in the cluster."/> + <metric property="ReleaseVersion" dataType="trait" description="The Cassandra version"/> + <metric property="Load" dataType="measurement" units="bytes" displayType="summary" description="The amount of load in disk usage on the node being queried"/> + <metric property="OperationMode" dataType="trait" description="The current operation mode"/>
<resource-configuration> - <c:simple-property name="SavedCachesLocation" type="string" readOnly="true" - description="The location of the saved caches directory"/> - <c:simple-property name="CommitLogLocation" type="string" readOnly="true" - default="The location of the commit log directory"/> + <c:simple-property name="SavedCachesLocation" type="string" readOnly="true" description="The location of the saved caches directory"/> + <c:simple-property name="CommitLogLocation" type="string" readOnly="true" default="The location of the commit log directory"/> <c:list-property name="dataFileLocations" readOnly="true" description="A list of data file locations"> <c:simple-property name="directory" type="string" readOnly="true"/> </c:list-property> </resource-configuration> </service>
+ <service name="CommitLog" discovery="org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent" class="org.rhq.plugins.jmx.MBeanResourceComponent" singleton="true"> + <plugin-configuration> <c:simple-property name="objectName" readOnly="true" type="string" default="org.apache.cassandra.db:type=Commitlog"/> <c:simple-property name="nameTemplate" readOnly="true" type="string" default="Commit Log" /> </plugin-configuration>
- <metric property="TotalCommitLogSize" - measurementType="trendsup" - displayType="summary" - description="Size of all commit log segments"/> - <metric property="PendingTasks" - measurementType="dynamic" - displayType="detail" - description="Number of tasks waiting to be executed"/> - <metric property="CompletedTasks" - measurementType="trendsup" - displayType="detail" - description="Number of completed tasks"/> + <metric property="TotalCommitLogSize" measurementType="trendsup" displayType="summary" description="Size of all commit log segments"/> + <metric property="PendingTasks" measurementType="dynamic" displayType="detail" description="Number of tasks waiting to be executed"/> + <metric property="CompletedTasks" measurementType="trendsup" displayType="detail" description="Number of completed tasks"/> </service>
- <service name="ClientRequestMetrics" + + <service name="ReadTimeouts" discovery="org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent" class="org.rhq.plugins.jmx.MBeanResourceComponent" - singleton="true"> + singleton="true" + subCategory="Client Request Metrics"> + <plugin-configuration> + <c:simple-property name="objectName" readOnly="true" type="string" default="org.apache.cassandra.metrics:type=ClientRequestMetrics,name=ReadTimeouts"/> + <c:simple-property name="nameTemplate" readOnly="true" type="string" default="Read Timeouts" /> + </plugin-configuration> + <metric property="Count" displayName="Read Timeouts" measurementType="trendsup" displayType="summary" description="Number of read timeouts occurred for this node"/> + </service> + + <service name="ReadUnavailables" + discovery="org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent" + class="org.rhq.plugins.jmx.MBeanResourceComponent" + singleton="true" + subCategory="Client Request Metrics"> <plugin-configuration> - <c:simple-property name="objectName" readOnly="true" type="string" default="org.apache.cassandra.db:type=tobeadded"/> + <c:simple-property name="objectName" readOnly="true" type="string" default="org.apache.cassandra.metrics:type=ClientRequestMetrics,name=ReadUnavailables"/> + <c:simple-property name="nameTemplate" readOnly="true" type="string" default="Read Unavailables" /> </plugin-configuration> + <metric property="Count" displayName="Read Unavailable" measurementType="trendsup" displayType="summary" description="Number of read unavailable occurred for this node"/> + </service>
- <metric property="ReadTimeouts" measurementType="trendsup" displayType="summary" description="Size of all commit log segments"/> - <metric property="ReadUnavailables" measurementType="trendsup" displayType="summary" description="Number of tasks waiting to be executed"/> - <metric property="WriteTimeouts" measurementType="trendsup" displayType="summary" description="Number of completed tasks"/> - <metric property="WriteUnavailables" measurementType="trendsup" displayType="summary" description="Number of completed tasks"/> + <service name="WriteTimeouts" + discovery="org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent" + class="org.rhq.plugins.jmx.MBeanResourceComponent" + singleton="true" + subCategory="Client Request Metrics"> + <plugin-configuration> + <c:simple-property name="objectName" readOnly="true" type="string" default="org.apache.cassandra.metrics:type=ClientRequestMetrics,name=WriteTimeouts"/> + <c:simple-property name="nameTemplate" readOnly="true" type="string" default="Write Timeouts" /> + </plugin-configuration> + <metric property="Count" displayName="Write Timeouts" measurementType="trendsup" displayType="summary" description="Number of write timeouts occurred for this node"/> </service>
+ <service name="WriteUnavailables" + discovery="org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent" + class="org.rhq.plugins.jmx.MBeanResourceComponent" + singleton="true" + subCategory="Client Request Metrics"> + <plugin-configuration> + <c:simple-property name="objectName" readOnly="true" type="string" default="org.apache.cassandra.metrics:type=ClientRequestMetrics,name=WriteUnavailables"/> + <c:simple-property name="nameTemplate" readOnly="true" type="string" default="Write Unavailables" /> + </plugin-configuration> + <metric property="Count" displayName="Write Unavailables" measurementType="trendsup" displayType="summary" description="Number of write unavailables occurred for this node"/> + </service> + + <service name="CompactionManager" discovery="org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent" class="org.rhq.plugins.jmx.MBeanResourceComponent" singleton="true"> + <plugin-configuration> <c:simple-property name="objectName" readOnly="true" type="string" default="org.apache.cassandra.db:type=CompactionManager"/> <c:simple-property name="nameTemplate" readOnly="true" type="string" default="Compaction Manager" /> </plugin-configuration>
- <metric property="CompletedTasks" - measurementType="trendsup" - displayType="summary" - description="Number of completed compactions since server [re]start"/> - <metric property="PendingTasks" - measurementType="dynamic" - displayType="detail" - description="Number of tasks waiting to be executed"/> - <metric property="TotalBytesCompacted" - measurementType="trendsup" - displayType="detail" - description="Total number of bytes compacted since server [re]start"/> - <metric property="TotalCompactionsCompleted" - measurementType="trendsup" - displayType="detail" - description="Total number of compactions since server [re]start"/> + <metric property="CompletedTasks" measurementType="trendsup" displayType="summary" description="Number of completed compactions since server [re]start"/> + <metric property="PendingTasks" measurementType="dynamic" displayType="detail" description="Number of tasks waiting to be executed"/> + <metric property="TotalBytesCompacted" measurementType="trendsup" displayType="detail" description="Total number of bytes compacted since server [re]start"/> + <metric property="TotalCompactionsCompleted" measurementType="trendsup" displayType="detail" description="Total number of compactions since server [re]start"/> </service>
+ <service name="Keyspace" discovery="org.rhq.plugins.cassandra.KeyspaceDiscoveryComponent" class="org.rhq.plugins.cassandra.KeyspaceComponent"> @@ -291,7 +262,6 @@ run a major compaction, automatic minor compactions are no longer triggered frequently forcing you to manually run major compactions on a routine basis. So while read performance will be good immediately following a major compaction, it will continually degrade until the next major compaction is manually invoked."/> - <operation name="takeSnapshot" description="Takes a snapshot of this keyspaces. A snapshot first flushes all in-memory writes to disk and then creates a hard link of each SSTable file for the keyspace. Note that a column family can have multiple @@ -319,6 +289,7 @@ <service name="ColumnFamily" discovery="org.rhq.plugins.cassandra.ColumnFamilyDiscoveryComponent" class="org.rhq.plugins.cassandra.ColumnFamilyComponent"> + <plugin-configuration> <c:simple-property name="objectName" readOnly="true" type="string"/> <c:simple-property name="name" type="string" description="The column family name"/> @@ -348,7 +319,7 @@ </operation> <operation name="disableAutoCompaction" description="Disable automatic compaction. Once you disable compaction, automatic minor compactions are no longer triggered frequently forcing you to - manually run major compactions on a routine basis."/> + manually run major compactions on a routine basis."/> <operation name="estimateKeys" description="Estimate keys"> <results> <c:simple-property name="operationResult" description="Estimated Keys"/> @@ -363,7 +334,6 @@ </results> </operation>
- <metric property="CompressionRatio" measurementType="dynamic" displayType="detail" description="Compression Ratio"/> <metric property="LiveDiskSpaceUsed" displayName="Live Disk Space Used" measurementType="dynamic" displayType="detail" description="Disk space used by SSTables belonging to this CF"/> <metric property="LiveSSTableCount" displayName="Live SS Table Count" measurementType="dynamic" displayType="detail" description="Number of SSTables on disk for this CF"/> @@ -383,15 +353,11 @@ <metric property="UnleveledSSTables" measurementType="dynamic" displayType="detail" description="Number of SSTables in L0. Always return 0 if Leveled compaction is not enabled."/> <metric property="WriteCount" displayName="Write Count" measurementType="trendsup" displayType="summary" description="Number of write operations since execution start"/>
- <metric property="" displayName="" measurementType="dynamic" displayType="detail" description=""/> - <resource-configuration> <c:simple-property name="gc_grace_seconds" displayName="gc_grace_seconds" required="false" default="864000" type="integer" - description="Specifies the time to wait before garbage collecting tombstones (deletion - markers). The value, specified in seconds, defaults to 10 days and allows for a large - amount of time for consistency to be achived prior to deletion. In a single node cluster - this can be reduced to zero."/> - + description="Specifies the time to wait before garbage collecting tombstones (deletion markers). The value, specified in seconds, + defaults to 10 days and allows for a large amount of time for consistency to be achived prior to deletion. In a single node cluster + this can be reduced to zero."/> <c:simple-property name="CompactionStrategyClass" type="string" required="true" description="Compaction strategy class name."/> <c:simple-property name="CompressionParameters" type="string" required="true" description="Compression parameters"/> <c:simple-property name="MinimumCompactionThreshold" type="integer" required="true" description="Minimum number of sstables in queue before compaction kicks off."/> @@ -399,5 +365,6 @@ </resource-configuration> </service> </service> + </server> </plugin> \ No newline at end of file
commit 1d4350ce085840d948fd49ff397308b799386723 Author: Stefan Negrea snegrea@redhat.com Date: Mon Oct 15 16:00:51 2012 -0500
Enable snapshot taking for the entire node, keyspace, and column family. Add all meaningful metrics, operations and properties to column family resources.
Add a stub for client request metrics, more code needed here since the metrics are split over 4 beans.
diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyComponent.java index e0be788..6371549 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyComponent.java @@ -52,14 +52,14 @@ public class ColumnFamilyComponent extends MBeanResourceComponent<JMXComponent<?
@Override public Configuration loadResourceConfiguration() { + Configuration config = super.loadResourceConfiguration(); + if (log.isDebugEnabled()) { ResourceContext<?> context = getResourceContext(); log.debug("Loading resource context for column family " + context.getResourceKey()); }
ColumnFamilyDefinition cfDef = getColumnFamilyDefinition(); - Configuration config = new Configuration(); - config.put(new PropertySimple("gc_grace_seconds", cfDef.getGcGraceSeconds()));
return config; @@ -73,12 +73,12 @@ public class ColumnFamilyComponent extends MBeanResourceComponent<JMXComponent<? } else if (name.equals("compact")) { String columnFamilyName = this.getResourceContext().getPluginConfiguration().getSimpleValue("name"); return this.getParentKeyspace().compactKeyspace(columnFamilyName); + } else if (name.equals("takeSnapshot")) { + String columnFamilyName = this.getResourceContext().getPluginConfiguration().getSimpleValue("name"); + return this.getParentKeyspace().takeSnapshot(parameters, columnFamilyName); }
- OperationResult failedOperation = new OperationResult(); - failedOperation.setErrorMessage("Operation not implemented."); - - return failedOperation; + return super.invokeOperation(name, parameters); };
@Override @@ -109,6 +109,9 @@ public class ColumnFamilyComponent extends MBeanResourceComponent<JMXComponent<? report.setErrorMessageFromThrowable(e); report.setStatus(FAILURE); } + + report.getConfiguration().remove("gc_grace_seconds"); + super.updateResourceConfiguration(report); }
private ColumnFamilyDefinition getColumnFamilyDefinition() { diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceComponent.java index aee8727..d2d6126 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceComponent.java @@ -112,6 +112,8 @@ public class KeyspaceComponent<T extends ResourceComponent<?>> implements Resour return repairKeyspace(); } else if (name.equals("compact")) { return compactKeyspace(); + } else if (name.equals("takeSnapshot")) { + return takeSnapshot(parameters); }
OperationResult failedOperation = new OperationResult(); @@ -150,6 +152,29 @@ public class KeyspaceComponent<T extends ResourceComponent<?>> implements Resour return CassandraUtil.getKeyspaceDefinition(context.getResourceKey()); }
+ public OperationResult takeSnapshot(Configuration parameters, String... columnFamilies) { + String keyspace = context.getResourceKey(); + String snapshotName = parameters.getSimpleValue("snapshotName"); + if (snapshotName == null || snapshotName.trim().isEmpty()) { + snapshotName = System.currentTimeMillis() + ""; + } + + EmsBean emsBean = loadBean(STORAGE_SERVICE_BEAN); + if (columnFamilies == null || columnFamilies.length == 0) { + EmsOperation operation = emsBean.getOperation("takeSnapshot", String.class, String[].class); + operation.invoke(snapshotName, new String[] { keyspace }); + } else { + EmsOperation operation = emsBean.getOperation("takeColumnFamilySnapshot", String.class, String.class, + String.class); + + for (String columnFamily : columnFamilies) { + operation.invoke(keyspace, columnFamily, snapshotName); + } + } + + return new OperationResult(); + } + /** * Loads the bean with the given object name. * diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java index 664c5b0..d3e61cf 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java @@ -92,7 +92,7 @@ public class StorageServiceComponent extends MBeanResourceComponent<JMXComponent
@Override public OperationResult invokeOperation(String name, Configuration parameters) throws Exception { - if (name.equals("takeKeyspaceSnapshot")) { + if (name.equals("takeSnapshot")) { return takeSnapshot(parameters); } else if (name.equals("setLog4jLevel")) { return setLog4jLevel(parameters); @@ -101,24 +101,25 @@ public class StorageServiceComponent extends MBeanResourceComponent<JMXComponent return super.invokeOperation(name, parameters); }
- private OperationResult takeSnapshot(Configuration params) { + private OperationResult takeSnapshot(Configuration parameters) { EmsBean emsBean = getEmsBean(); EmsOperation operation = emsBean.getOperation("takeSnapshot", String.class, String[].class); + String snapshotName = parameters.getSimpleValue("snapshotName"); + if (snapshotName == null || snapshotName.trim().isEmpty()) { + snapshotName = System.currentTimeMillis() + ""; + }
- String snapshotName = params.getSimpleValue("snapshotName"); - String keyspaceName = params.getSimpleValue("keyspaceName"); - - operation.invoke(snapshotName, new String[] {keyspaceName}); + operation.invoke(snapshotName, new String[] {});
return new OperationResult(); }
- private OperationResult setLog4jLevel(Configuration params) { + private OperationResult setLog4jLevel(Configuration parameters) { EmsBean emsBean = getEmsBean(); EmsOperation operation = emsBean.getOperation("setLog4jLevel", String.class, String.class);
- String classQualifier = params.getSimpleValue("classQualifier"); - String level = params.getSimpleValue("level"); + String classQualifier = parameters.getSimpleValue("classQualifier"); + String level = parameters.getSimpleValue("level");
operation.invoke(classQualifier, level);
diff --git a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml index 0f863e3..950d7c8 100644 --- a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml @@ -142,17 +142,14 @@
<operation name="stopRPCServer" description="Stop the Thrift server"/>
- <operation name="takeKeyspaceSnapshot" - description="Takes a snapshot of all column families in a keyspace."> - <parameters> - <c:simple-property name="snapshotName" - required="true" - type="string" - description="A snapshot first flushes all in-memory writes to disk and then creates a hard - link of each SSTable file for the keyspace. Note that a column family can have multiple + <operation name="takeSnapshot" + description="Takes a snapshot of all keyspaces. A snapshot first flushes all in-memory writes to disk and then creates a hard + link of each SSTable file for each keyspace. Note that a column family can have multiple SSTables on disk. By default snapshots are stored in the <cassandra_data_dir>/<keyspace_name>/<column_family_name>/snapshots - directory. On Linux/UNIX systems cassandra_data_dir defaults to /var/lib/cassandra/data"/> - <c:simple-property name="keyspaceName" required="true" type="string"/> + directory. On Linux/UNIX systems cassandra_data_dir defaults to /var/lib/cassandra/data"> + <parameters> + <c:simple-property name="snapshotName" required="false" type="string" displayName="Snapshot Name" + description="Snapshot name. If left empty current system time in milliseconds will be used as the snapshot name."/> </parameters> </operation>
@@ -236,6 +233,20 @@ description="Number of completed tasks"/> </service>
+ <service name="ClientRequestMetrics" + discovery="org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent" + class="org.rhq.plugins.jmx.MBeanResourceComponent" + singleton="true"> + <plugin-configuration> + <c:simple-property name="objectName" readOnly="true" type="string" default="org.apache.cassandra.db:type=tobeadded"/> + </plugin-configuration> + + <metric property="ReadTimeouts" measurementType="trendsup" displayType="summary" description="Size of all commit log segments"/> + <metric property="ReadUnavailables" measurementType="trendsup" displayType="summary" description="Number of tasks waiting to be executed"/> + <metric property="WriteTimeouts" measurementType="trendsup" displayType="summary" description="Number of completed tasks"/> + <metric property="WriteUnavailables" measurementType="trendsup" displayType="summary" description="Number of completed tasks"/> + </service> + <service name="CompactionManager" discovery="org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent" class="org.rhq.plugins.jmx.MBeanResourceComponent" @@ -269,17 +280,28 @@
<operation name="repair" displayName="Repair Keyspace" description="Cassandra compares data on this node with the versions on other replicas to update any - out of sync copies of the data. This should be run infrequently as it is a disk IO and CPU intensive - operation. All data for each column that is being repaired is read. Unless you are not performing any - deletes, it is important to run regularly scheduled repairs to ensure that deleted data gets purged. - The frequency that this should be run should be less than the gc_grace_period for each column family. - This runs a repair on all column families in this keyspace." /> + out of sync copies of the data. This should be run infrequently as it is a disk IO and CPU intensive + operation. All data for each column that is being repaired is read. Unless you are not performing any + deletes, it is important to run regularly scheduled repairs to ensure that deleted data gets purged. + The frequency that this should be run should be less than the gc_grace_period for each column family. + This runs a repair on all column families in this keyspace." /> <operation name="compact" displayName="Compact Keyspace" description="Forces major compaction of the keyspace. Though major compaction can free disk space - used during runtime it temporarily doubles disk space usage and is I/O and CPU intensive. Once you - run a major compaction, automatic minor compactions are no longer triggered frequently forcing you to - manually run major compactions on a routine basis. So while read performance will be good immediately - following a major compaction, it will continually degrade until the next major compaction is manually invoked."/> + used during runtime it temporarily doubles disk space usage and is I/O and CPU intensive. Once you + run a major compaction, automatic minor compactions are no longer triggered frequently forcing you to + manually run major compactions on a routine basis. So while read performance will be good immediately + following a major compaction, it will continually degrade until the next major compaction is manually invoked."/> + + <operation name="takeSnapshot" + description="Takes a snapshot of this keyspaces. A snapshot first flushes all in-memory writes to disk and then creates a hard + link of each SSTable file for the keyspace. Note that a column family can have multiple + SSTables on disk. By default snapshots are stored in the <cassandra_data_dir>/<keyspace_name>/<column_family_name>/snapshots + directory. On Linux/UNIX systems cassandra_data_dir defaults to /var/lib/cassandra/data"> + <parameters> + <c:simple-property name="snapshotName" required="false" type="string" displayName="Snapshot Name" + description="Snapshot name. If left empty current system time in milliseconds will be used as the snapshot name."/> + </parameters> + </operation>
<resource-configuration> <c:simple-property name="name" type="string" description="The keyspace name" readOnly="true"/> @@ -304,66 +326,76 @@
<operation name="repair" displayName="Repair Column Family" description="Cassandra compares data on this node with the versions on other replicas to update any - out of sync copies of the data. This should be run infrequently as it is a disk IO and CPU intensive - operation. All data for each column that is being repaired is read. Unless you are not performing any - deletes, it is important to run regularly scheduled repairs to ensure that deleted data gets purged. - The frequency that this should be run should be less than the gc_grace_period for the column family." /> - <operation name="compact" displayName="Compact Column Family" + out of sync copies of the data. This should be run infrequently as it is a disk IO and CPU intensive + operation. All data for each column that is being repaired is read. Unless you are not performing any + deletes, it is important to run regularly scheduled repairs to ensure that deleted data gets purged. + The frequency that this should be run should be less than the gc_grace_period for the column family." /> + <operation name="compact" displayName="Force Major Column Family Compaction" description="Forces major compaction of this column family. Though major compaction can free disk space - used during runtime it temporarily doubles disk space usage and is I/O and CPU intensive. Once you - run a major compaction, automatic minor compactions are no longer triggered frequently forcing you to - manually run major compactions on a routine basis. So while read performance will be good immediately - following a major compaction, it will continually degrade until the next major compaction is manually invoked."/> - - <metric property="CompressionRatio" - displayName="Compression Ratio" - measurementType="dynamic" - displayType="detail" - description="Compression Ratio"/> - <metric property="TotalReadLatencyMicros" - displayName="Total Read Latency (in micro seconds)" - measurementType="trendsup" - displayType="detail" - description="The latency of read operations since execution start"/> - <metric property="RecentReadLatencyMicros" - displayName="Recent Read Latency (in micro seconds)" - measurementType="trendsup" - displayType="detail" - description="The latency of read operations since this metric was last sampled"/> - <metric property="TotalWriteLatencyMicros" - displayName="Total Write Latency (in micro seconds)" - measurementType="trendsup" - displayType="detail" - description="The latency of write operations since execution start"/> - <metric property="RecentWriteLatencyMicros" - displayName="Recent Write Latency (in micro seconds)" - measurementType="trendsup" - displayType="detail" - description="The latency of write operations since this metric was last sampled"/> - <metric displayName="Read Count" - property="ReadCount" - measurementType="trendsup" - displayType="summary" - description="The number of read operations since execution start"/> - <metric displayName="Write Count" - property="WriteCount" - measurementType="trendsup" - displayType="summary" - description="The number of write operations since execution start"/> - <metric property="TotalDiskSpaceUsed" - measurementType="dynamic" - displayType="summary"/> + used during runtime it temporarily doubles disk space usage and is I/O and CPU intensive. Once you + run a major compaction, automatic minor compactions are no longer triggered frequently forcing you to + manually run major compactions on a routine basis. So while read performance will be good immediately + following a major compaction, it will continually degrade until the next major compaction is manually invoked."/> + <operation name="takeSnapshot" + description="Takes a snapshot of this keyspaces. A snapshot first flushes all in-memory writes to disk and then creates a hard + link of each SSTable file for the keyspace. Note that a column family can have multiple + SSTables on disk. By default snapshots are stored in the <cassandra_data_dir>/<keyspace_name>/<column_family_name>/snapshots + directory. On Linux/UNIX systems cassandra_data_dir defaults to /var/lib/cassandra/data"> + <parameters> + <c:simple-property name="snapshotName" required="false" type="string" displayName="Snapshot Name" + description="Snapshot name. If left empty current system time in milliseconds will be used as the snapshot name."/> + </parameters> + </operation> + <operation name="disableAutoCompaction" + description="Disable automatic compaction. Once you disable compaction, automatic minor compactions are no longer triggered frequently forcing you to + manually run major compactions on a routine basis."/> + <operation name="estimateKeys" description="Estimate keys"> + <results> + <c:simple-property name="operationResult" description="Estimated Keys"/> + </results> + </operation> + <operation name="getSSTablesForKey" displayName="Get SSTables For Key" description="Returns a list of filenames that contain the given key on this node."> + <parameters> + <c:simple-property name="p1" displayName="Key" required="true" type="string" description="Key"/> + </parameters> + <results> + <c:simple-property name="operationResult" description="Filenames that contain the given key on this node."/> + </results> + </operation> + + + <metric property="CompressionRatio" measurementType="dynamic" displayType="detail" description="Compression Ratio"/> + <metric property="LiveDiskSpaceUsed" displayName="Live Disk Space Used" measurementType="dynamic" displayType="detail" description="Disk space used by SSTables belonging to this CF"/> + <metric property="LiveSSTableCount" displayName="Live SS Table Count" measurementType="dynamic" displayType="detail" description="Number of SSTables on disk for this CF"/> + <metric property="MaxRowSize" measurementType="dynamic" displayType="detail" description="Size of the largest compacted row"/> + <metric property="MeanRowSize" measurementType="dynamic" displayType="detail" description="Means size of the compacted rows"/> + <metric property="MemtableColumnsCount" displayName="Memtable Columns Count" measurementType="dynamic" displayType="detail" description="Total number of columns present in the memtable."/> + <metric property="MemtableDataSize" displayName="Memtable Data Size" measurementType="dynamic" displayType="detail" description="Total amount of data stored in the memtable, including column related overhead."/> + <metric property="MemtableSwitchCount" displayName="Memtable Switch Count" measurementType="dynamic" displayType="detail" description="Number of times that a flush has resulted in the memtable being switched out."/> + <metric property="MinRowSize" measurementType="dynamic" displayType="detail" description="Size of the smallest compacted row"/> + <metric property="PendingTasks" measurementType="dynamic" displayType="detail" description="Estimated number of tasks pending for this column family"/> + <metric property="ReadCount" displayName="Read Count" measurementType="trendsup" displayType="summary" description="Number of read operations since execution start"/> + <metric property="RecentReadLatencyMicros" displayName="Recent Read Latency (in micro seconds)" measurementType="trendsup" displayType="detail" description="Latency of read operations since this metric was last sampled"/> + <metric property="RecentWriteLatencyMicros" displayName="Recent Write Latency (in micro seconds)" measurementType="trendsup" displayType="detail" description="Latency of write operations since this metric was last sampled"/> + <metric property="TotalDiskSpaceUsed" measurementType="dynamic" displayType="summary" description="Total disk space used by SSTables belonging to this CF, including obsolete ones waiting to be GC'd"/> + <metric property="TotalReadLatencyMicros" displayName="Total Read Latency (in micro seconds)" measurementType="trendsup" displayType="detail" description="Latency of read operations since execution start"/> + <metric property="TotalWriteLatencyMicros" displayName="Total Write Latency (in micro seconds)" measurementType="trendsup" displayType="detail" description="Latency of write operations since execution start"/> + <metric property="UnleveledSSTables" measurementType="dynamic" displayType="detail" description="Number of SSTables in L0. Always return 0 if Leveled compaction is not enabled."/> + <metric property="WriteCount" displayName="Write Count" measurementType="trendsup" displayType="summary" description="Number of write operations since execution start"/> + + <metric property="" displayName="" measurementType="dynamic" displayType="detail" description=""/>
<resource-configuration> - <c:simple-property name="gc_grace_seconds" - displayName="gc_grace_seconds" - required="false" - default="864000" - type="integer" + <c:simple-property name="gc_grace_seconds" displayName="gc_grace_seconds" required="false" default="864000" type="integer" description="Specifies the time to wait before garbage collecting tombstones (deletion markers). The value, specified in seconds, defaults to 10 days and allows for a large amount of time for consistency to be achived prior to deletion. In a single node cluster this can be reduced to zero."/> + + <c:simple-property name="CompactionStrategyClass" type="string" required="true" description="Compaction strategy class name."/> + <c:simple-property name="CompressionParameters" type="string" required="true" description="Compression parameters"/> + <c:simple-property name="MinimumCompactionThreshold" type="integer" required="true" description="Minimum number of sstables in queue before compaction kicks off."/> + <c:simple-property name="MaximumCompactionThreshold" type="integer" required="true" description="Maximum number of sstables in queue before compaction kicks off."/> </resource-configuration> </service> </service>
commit ad3f715ca083892750f225b0a9c847cb08524eab Author: Stefan Negrea snegrea@redhat.com Date: Fri Oct 12 17:30:26 2012 -0500
Moved keyspace and column family specific operations away from storage service to respective resources. Added compaction manager resource. Added metrices to commit log. Plus various other minor updates.
diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyComponent.java index e3cc66d..e0be788 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyComponent.java @@ -39,6 +39,7 @@ import org.rhq.core.domain.configuration.Configuration; import org.rhq.core.domain.configuration.PropertySimple; import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport; import org.rhq.core.pluginapi.inventory.ResourceContext; +import org.rhq.core.pluginapi.operation.OperationResult; import org.rhq.plugins.jmx.JMXComponent; import org.rhq.plugins.jmx.MBeanResourceComponent;
@@ -65,6 +66,22 @@ public class ColumnFamilyComponent extends MBeanResourceComponent<JMXComponent<? }
@Override + public OperationResult invokeOperation(String name, Configuration parameters) throws Exception { + if (name.equals("repair")) { + String columnFamilyName = this.getResourceContext().getPluginConfiguration().getSimpleValue("name"); + return this.getParentKeyspace().repairKeyspace(columnFamilyName); + } else if (name.equals("compact")) { + String columnFamilyName = this.getResourceContext().getPluginConfiguration().getSimpleValue("name"); + return this.getParentKeyspace().compactKeyspace(columnFamilyName); + } + + OperationResult failedOperation = new OperationResult(); + failedOperation.setErrorMessage("Operation not implemented."); + + return failedOperation; + }; + + @Override public void updateResourceConfiguration(ConfigurationUpdateReport report) { ResourceContext<?> context = getResourceContext();
@@ -95,10 +112,9 @@ public class ColumnFamilyComponent extends MBeanResourceComponent<JMXComponent<? }
private ColumnFamilyDefinition getColumnFamilyDefinition() { - ResourceContext<?> context = getResourceContext(); - Configuration pluginConfig = context.getPluginConfiguration(); + Configuration pluginConfig = this.getResourceContext().getPluginConfiguration(); String cfName = pluginConfig.getSimpleValue("name"); - KeyspaceComponent<?> keyspaceComponent = (KeyspaceComponent<?>) context.getParentResourceComponent(); + KeyspaceComponent<?> keyspaceComponent = this.getParentKeyspace();
for (ColumnFamilyDefinition cfDef : keyspaceComponent.getKeyspaceDefinition().getCfDefs()) { if (cfName.equals(cfDef.getName())) { @@ -108,4 +124,8 @@ public class ColumnFamilyComponent extends MBeanResourceComponent<JMXComponent<?
return null; } + + private KeyspaceComponent<?> getParentKeyspace() { + return (KeyspaceComponent<?>) this.getResourceContext().getParentResourceComponent(); + } } diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceComponent.java index 372fe11..aee8727 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceComponent.java @@ -30,6 +30,8 @@ import java.util.Map; import me.prettyprint.hector.api.ddl.KeyspaceDefinition;
import org.mc4j.ems.connection.EmsConnection; +import org.mc4j.ems.connection.bean.EmsBean; +import org.mc4j.ems.connection.bean.operation.EmsOperation;
import org.rhq.core.domain.configuration.Configuration; import org.rhq.core.domain.configuration.PropertyList; @@ -40,13 +42,20 @@ import org.rhq.core.pluginapi.configuration.ConfigurationFacet; import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport; 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; import org.rhq.plugins.jmx.JMXComponent;
/** * @author John Sanda */ public class KeyspaceComponent<T extends ResourceComponent<?>> implements ResourceComponent<T>, ConfigurationFacet, - JMXComponent<T> { + JMXComponent<T>, OperationFacet { + + private static final String STORAGE_SERVICE_BEAN = "org.apache.cassandra.db:type=StorageService"; + + private static final String COMPACT_OPERATION = "forceTableCompaction"; + private static final String REPAIR_OPERATION = "forceTableRepair";
private ResourceContext<T> context;
@@ -61,7 +70,7 @@ public class KeyspaceComponent<T extends ResourceComponent<?>> implements Resour
@Override public AvailabilityType getAvailability() { - return AvailabilityType.UP; + return context.getParentResourceComponent().getAvailability(); }
@Override @@ -93,12 +102,81 @@ public class KeyspaceComponent<T extends ResourceComponent<?>> implements Resour return config; }
+ @Override + public void updateResourceConfiguration(ConfigurationUpdateReport report) { + } + + @Override + public OperationResult invokeOperation(String name, Configuration parameters) throws Exception { + if (name.equals("repair")) { + return repairKeyspace(); + } else if (name.equals("compact")) { + return compactKeyspace(); + } + + OperationResult failedOperation = new OperationResult(); + failedOperation.setErrorMessage("Operation not implemented."); + + return failedOperation; + } + + public OperationResult repairKeyspace(String... columnFamilies) { + EmsBean emsBean = loadBean(STORAGE_SERVICE_BEAN); + EmsOperation operation = emsBean.getOperation(REPAIR_OPERATION, String.class, boolean.class, String[].class); + + String keyspace = context.getResourceKey(); + if (columnFamilies == null) { + columnFamilies = new String[] {}; + } + operation.invoke(keyspace, true, columnFamilies); + + return new OperationResult(); + } + + public OperationResult compactKeyspace(String... columnFamilies) { + EmsBean emsBean = loadBean(STORAGE_SERVICE_BEAN); + EmsOperation operation = emsBean.getOperation(COMPACT_OPERATION, String.class, String[].class); + + String keyspace = context.getResourceKey(); + if (columnFamilies == null) { + columnFamilies = new String[] {}; + } + operation.invoke(keyspace, new String[] {}); + + return new OperationResult(); + } + public KeyspaceDefinition getKeyspaceDefinition() { return CassandraUtil.getKeyspaceDefinition(context.getResourceKey()); }
- @Override - public void updateResourceConfiguration(ConfigurationUpdateReport report) { + /** + * Loads the bean with the given object name. + * + * Subclasses are free to override this method in order to load the bean. + * + * @param objectName the name of the bean to load + * @return the bean that is loaded + */ + protected EmsBean loadBean(String objectName) { + EmsConnection emsConnection = getEmsConnection(); + + if (emsConnection != null) { + EmsBean bean = emsConnection.getBean(objectName); + if (bean == null) { + // In some cases, this resource component may have been discovered by some means other than querying its + // parent's EMSConnection (e.g. ApplicationDiscoveryComponent uses a filesystem to discover EARs and + // WARs that are not yet deployed). In such cases, getBean() will return null, since EMS won't have the + // bean in its cache. To cover such cases, make an attempt to query the underlying MBeanServer for the + // bean before giving up. + emsConnection.queryBeans(objectName); + bean = emsConnection.getBean(objectName); + } + + return bean; + } + + return null; }
} diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java index 655a2d6..664c5b0 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java @@ -96,10 +96,6 @@ public class StorageServiceComponent extends MBeanResourceComponent<JMXComponent return takeSnapshot(parameters); } else if (name.equals("setLog4jLevel")) { return setLog4jLevel(parameters); - } else if (name.equals("repair")) { - return repairKeyspace(parameters); - } else if (name.equals("compact")) { - return compactKeyspace(parameters); }
return super.invokeOperation(name, parameters); @@ -129,27 +125,6 @@ public class StorageServiceComponent extends MBeanResourceComponent<JMXComponent return new OperationResult(); }
- private OperationResult repairKeyspace(Configuration params) { - String keyspace = params.getSimpleValue("keyspace"); - EmsBean emsBean = getEmsBean(); - EmsOperation operation = emsBean.getOperation("forceTableRepair", String.class, boolean.class, String[].class); - - operation.invoke(keyspace, true, new String[] {}); - - return new OperationResult(); - } - - private OperationResult compactKeyspace(Configuration params) { - String keyspace = params.getSimpleValue("keyspace"); - EmsBean emsBean = getEmsBean(); - EmsOperation operation = emsBean.getOperation("forceTableCompaction", String.class, String[].class); - - operation.invoke(keyspace, new String[] {}); - - return new OperationResult(); - } - - @Override public Configuration loadResourceConfiguration() { Configuration config = super.loadResourceConfiguration(); @@ -165,4 +140,5 @@ public class StorageServiceComponent extends MBeanResourceComponent<JMXComponent
return config; } + } diff --git a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml index 24cc80b..0f863e3 100644 --- a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml @@ -88,9 +88,11 @@
<service name="StorageProxy" discovery="org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent" - class="org.rhq.plugins.jmx.MBeanResourceComponent"> + class="org.rhq.plugins.jmx.MBeanResourceComponent" + singleton="true"> <plugin-configuration> <c:simple-property name="objectName" readOnly="true" default="org.apache.cassandra.db:type=StorageProxy"/> + <c:simple-property name="nameTemplate" readOnly="true" type="string" default="Storage Proxy"/> </plugin-configuration>
<metric property="TotalReadLatencyMicros" @@ -133,7 +135,7 @@ singleton="true"> <plugin-configuration> <c:simple-property name="objectName" readOnly="true" default="org.apache.cassandra.db:type=StorageService"/> - <c:simple-property name="nameTemplate" type="string" description="The keyspace name" readOnly="true" default="Storage Service"/> + <c:simple-property name="nameTemplate" type="string" readOnly="true" default="Storage Service"/> </plugin-configuration>
<operation name="startRPCServer" description="Start the Thrift server"/> @@ -173,28 +175,6 @@ </parameters> </operation>
- <operation name="repair" displayName="Repair Keyspace" - description="Cassandra compares data on this node with the versions on other replicas to update any - out of sync copies of the data. This should be run infrequently as it is a disk IO and CPU intensive - operation. All data for each column that is being repaired is read. Unless you are not performing any - deletes, it is important to run regularly scheduled repairs to ensure that deleted data gets purged. - The frequency that this should be run should be less than the gc_grace_period for each column family. - The current implementation runs repair on all column families in the specified keyspace."> - <parameters> - <c:simple-property name="keyspace" required="true" type="string"> - <c:option-source target="resource" expression="type=^Keyspace$"/> - </c:simple-property> - </parameters> - </operation> - <operation name="compact" displayName="Compact Keyspace" - description="Forces major compaction of a single keyspace."> - <parameters> - <c:simple-property name="keyspace" required="true" type="string"> - <c:option-source target="resource" expression="type=^Keyspace$"/> - </c:simple-property> - </parameters> - </operation> - <metric property="Token" dataType="trait" description="A string representation of this node's token" @@ -235,31 +215,72 @@
<service name="CommitLog" discovery="org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent" - class="org.rhq.plugins.jmx.MBeanResourceComponent"> + class="org.rhq.plugins.jmx.MBeanResourceComponent" + singleton="true"> <plugin-configuration> - <c:simple-property name="objectName" - readOnly="true" - type="string" - default="org.apache.cassandra.db:type=Commitlog"/> + <c:simple-property name="objectName" readOnly="true" type="string" default="org.apache.cassandra.db:type=Commitlog"/> + <c:simple-property name="nameTemplate" readOnly="true" type="string" default="Commit Log" /> </plugin-configuration>
<metric property="TotalCommitLogSize" measurementType="trendsup" displayType="summary" - description="The size of all commit log segments"/> + description="Size of all commit log segments"/> <metric property="PendingTasks" measurementType="dynamic" displayType="detail" - description="The number of tasks waiting to be executed"/> + description="Number of tasks waiting to be executed"/> <metric property="CompletedTasks" measurementType="trendsup" displayType="detail" - description="The number of completed tasks"/> + description="Number of completed tasks"/> + </service> + + <service name="CompactionManager" + discovery="org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent" + class="org.rhq.plugins.jmx.MBeanResourceComponent" + singleton="true"> + <plugin-configuration> + <c:simple-property name="objectName" readOnly="true" type="string" default="org.apache.cassandra.db:type=CompactionManager"/> + <c:simple-property name="nameTemplate" readOnly="true" type="string" default="Compaction Manager" /> + </plugin-configuration> + + <metric property="CompletedTasks" + measurementType="trendsup" + displayType="summary" + description="Number of completed compactions since server [re]start"/> + <metric property="PendingTasks" + measurementType="dynamic" + displayType="detail" + description="Number of tasks waiting to be executed"/> + <metric property="TotalBytesCompacted" + measurementType="trendsup" + displayType="detail" + description="Total number of bytes compacted since server [re]start"/> + <metric property="TotalCompactionsCompleted" + measurementType="trendsup" + displayType="detail" + description="Total number of compactions since server [re]start"/> </service>
<service name="Keyspace" discovery="org.rhq.plugins.cassandra.KeyspaceDiscoveryComponent" class="org.rhq.plugins.cassandra.KeyspaceComponent"> + + <operation name="repair" displayName="Repair Keyspace" + description="Cassandra compares data on this node with the versions on other replicas to update any + out of sync copies of the data. This should be run infrequently as it is a disk IO and CPU intensive + operation. All data for each column that is being repaired is read. Unless you are not performing any + deletes, it is important to run regularly scheduled repairs to ensure that deleted data gets purged. + The frequency that this should be run should be less than the gc_grace_period for each column family. + This runs a repair on all column families in this keyspace." /> + <operation name="compact" displayName="Compact Keyspace" + description="Forces major compaction of the keyspace. Though major compaction can free disk space + used during runtime it temporarily doubles disk space usage and is I/O and CPU intensive. Once you + run a major compaction, automatic minor compactions are no longer triggered frequently forcing you to + manually run major compactions on a routine basis. So while read performance will be good immediately + following a major compaction, it will continually degrade until the next major compaction is manually invoked."/> + <resource-configuration> <c:simple-property name="name" type="string" description="The keyspace name" readOnly="true"/> <c:simple-property name="replicationFactor" type="integer" readOnly="true"/> @@ -281,6 +302,24 @@ <c:simple-property name="name" type="string" description="The column family name"/> </plugin-configuration>
+ <operation name="repair" displayName="Repair Column Family" + description="Cassandra compares data on this node with the versions on other replicas to update any + out of sync copies of the data. This should be run infrequently as it is a disk IO and CPU intensive + operation. All data for each column that is being repaired is read. Unless you are not performing any + deletes, it is important to run regularly scheduled repairs to ensure that deleted data gets purged. + The frequency that this should be run should be less than the gc_grace_period for the column family." /> + <operation name="compact" displayName="Compact Column Family" + description="Forces major compaction of this column family. Though major compaction can free disk space + used during runtime it temporarily doubles disk space usage and is I/O and CPU intensive. Once you + run a major compaction, automatic minor compactions are no longer triggered frequently forcing you to + manually run major compactions on a routine basis. So while read performance will be good immediately + following a major compaction, it will continually degrade until the next major compaction is manually invoked."/> + + <metric property="CompressionRatio" + displayName="Compression Ratio" + measurementType="dynamic" + displayType="detail" + description="Compression Ratio"/> <metric property="TotalReadLatencyMicros" displayName="Total Read Latency (in micro seconds)" measurementType="trendsup"
commit c307710a17e7145c2f200269ef07fc7ee21a4c93 Author: Stefan Negrea snegrea@redhat.com Date: Thu Oct 11 14:04:58 2012 -0500
Add support for restart and compact operations. Also update repair operations to use dependent values for keyspace.
diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeComponent.java index 561f8ef..dd06f39 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeComponent.java @@ -82,11 +82,15 @@ public class CassandraNodeComponent extends JMXServerComponent<ResourceComponent
@Override public OperationResult invokeOperation(String name, Configuration parameters) throws Exception { + if (name.equals("shutdown")) { return shutdown(parameters); } else if (name.equals("start")) { return start(parameters); + } else if (name.equals("restart")) { + return restart(parameters); } + return null; }
@@ -127,7 +131,9 @@ public class CassandraNodeComponent extends JMXServerComponent<ResourceComponent return new OperationResult("Successfully shut down Cassandra daemon with pid " + pid); } catch (SigarException e) { log.warn("Failed to shut down Cassandra node with pid " + pid, e); - return new OperationResult("Failed to shut down Cassandra node with pid " + pid + ": " + e.getMessage()); + OperationResult failure = new OperationResult("Failed to shut down Cassandra node with pid " + pid); + failure.setErrorMessage(ThrowableUtil.getAllMessages(e)); + return failure; } }
@@ -151,6 +157,16 @@ public class CassandraNodeComponent extends JMXServerComponent<ResourceComponent } }
+ private OperationResult restart(Configuration params) { + OperationResult result = shutdown(params); + + if (result.getErrorMessage() == null) { + result = start(params); + } + + return result; + } + private String getStartScript() { ResourceContext<?> context = getResourceContext(); SystemInfo systemInfo = context.getSystemInformation(); diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java index d5a26b9..655a2d6 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java @@ -94,14 +94,12 @@ public class StorageServiceComponent extends MBeanResourceComponent<JMXComponent public OperationResult invokeOperation(String name, Configuration parameters) throws Exception { if (name.equals("takeKeyspaceSnapshot")) { return takeSnapshot(parameters); - } - - if (name.equals("setLog4jLevel")) { + } else if (name.equals("setLog4jLevel")) { return setLog4jLevel(parameters); - } - - if (name.equals("repair")) { - return repair(parameters); + } else if (name.equals("repair")) { + return repairKeyspace(parameters); + } else if (name.equals("compact")) { + return compactKeyspace(parameters); }
return super.invokeOperation(name, parameters); @@ -131,7 +129,7 @@ public class StorageServiceComponent extends MBeanResourceComponent<JMXComponent return new OperationResult(); }
- private OperationResult repair(Configuration params) { + private OperationResult repairKeyspace(Configuration params) { String keyspace = params.getSimpleValue("keyspace"); EmsBean emsBean = getEmsBean(); EmsOperation operation = emsBean.getOperation("forceTableRepair", String.class, boolean.class, String[].class); @@ -141,6 +139,17 @@ public class StorageServiceComponent extends MBeanResourceComponent<JMXComponent return new OperationResult(); }
+ private OperationResult compactKeyspace(Configuration params) { + String keyspace = params.getSimpleValue("keyspace"); + EmsBean emsBean = getEmsBean(); + EmsOperation operation = emsBean.getOperation("forceTableCompaction", String.class, String[].class); + + operation.invoke(keyspace, new String[] {}); + + return new OperationResult(); + } + + @Override public Configuration loadResourceConfiguration() { Configuration config = super.loadResourceConfiguration(); diff --git a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml index 9b520b7..24cc80b 100644 --- a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml @@ -52,13 +52,19 @@
<operation name="shutdown" description="Shuts down the Cassandra daemon"> <results> - <c:simple-property name="shutdownResult" description="Results of Cassandra daemon shutdown"/> + <c:simple-property name="shutdownResult" description="Shutdown the Cassandra daemon"/> </results> </operation>
<operation name="start" description="Starts the Cassandra daemon"> <results> - <c:simple-property name="startResult" description="Results of Cassandra daemon start up"/> + <c:simple-property name="startResult" description="Start the Cassandra daemon"/> + </results> + </operation> + + <operation name="restart" description="Restarts the Cassandra daemon"> + <results> + <c:simple-property name="startResult" description="Restart the Cassandra daemon"/> </results> </operation>
@@ -123,9 +129,11 @@
<service name="StorageService" discovery="org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent" - class="org.rhq.plugins.cassandra.StorageServiceComponent"> + class="org.rhq.plugins.cassandra.StorageServiceComponent" + singleton="true"> <plugin-configuration> <c:simple-property name="objectName" readOnly="true" default="org.apache.cassandra.db:type=StorageService"/> + <c:simple-property name="nameTemplate" type="string" description="The keyspace name" readOnly="true" default="Storage Service"/> </plugin-configuration>
<operation name="startRPCServer" description="Start the Thrift server"/> @@ -145,7 +153,7 @@ <c:simple-property name="keyspaceName" required="true" type="string"/> </parameters> </operation> - + <operation name="setLog4jLevel" description="Sets the logging level for classes under the clas qualifier."> <parameters> @@ -165,7 +173,7 @@ </parameters> </operation>
- <operation name="repair" + <operation name="repair" displayName="Repair Keyspace" description="Cassandra compares data on this node with the versions on other replicas to update any out of sync copies of the data. This should be run infrequently as it is a disk IO and CPU intensive operation. All data for each column that is being repaired is read. Unless you are not performing any @@ -173,7 +181,17 @@ The frequency that this should be run should be less than the gc_grace_period for each column family. The current implementation runs repair on all column families in the specified keyspace."> <parameters> - <c:simple-property name="keyspace" required="true" type="string"/> + <c:simple-property name="keyspace" required="true" type="string"> + <c:option-source target="resource" expression="type=^Keyspace$"/> + </c:simple-property> + </parameters> + </operation> + <operation name="compact" displayName="Compact Keyspace" + description="Forces major compaction of a single keyspace."> + <parameters> + <c:simple-property name="keyspace" required="true" type="string"> + <c:option-source target="resource" expression="type=^Keyspace$"/> + </c:simple-property> </parameters> </operation>
@@ -224,7 +242,7 @@ type="string" default="org.apache.cassandra.db:type=Commitlog"/> </plugin-configuration> - + <metric property="TotalCommitLogSize" measurementType="trendsup" displayType="summary"
commit ef0fc8209d04e002362f16b504502b6c1633272a Author: Stefan Negrea snegrea@redhat.com Date: Thu Oct 11 14:03:34 2012 -0500
Update plugin version to be in sync with RHQ master version.
diff --git a/modules/plugins/cassandra/pom.xml b/modules/plugins/cassandra/pom.xml index eaeb17e..7b4f506 100644 --- a/modules/plugins/cassandra/pom.xml +++ b/modules/plugins/cassandra/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-plugins-parent</artifactId> - <version>4.5.0-SNAPSHOT</version> + <version>4.6.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId>
commit a7467cb41df119a102e0b8b4f6e1a01495e8352d Author: Stefan Negrea snegrea@redhat.com Date: Wed Oct 10 17:01:18 2012 -0500
Fix all code warnings. Also update the call to the repair method of StorageServiceComponent.
diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeComponent.java index a89e3f6..561f8ef 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeComponent.java @@ -31,6 +31,8 @@ import static org.rhq.plugins.cassandra.CassandraUtil.getCluster; import java.io.File; import java.util.Set;
+import me.prettyprint.hector.api.Cluster; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.hyperic.sigar.SigarException; @@ -43,6 +45,7 @@ import org.rhq.core.domain.measurement.AvailabilityType; import org.rhq.core.domain.measurement.MeasurementDataTrait; import org.rhq.core.domain.measurement.MeasurementReport; import org.rhq.core.domain.measurement.MeasurementScheduleRequest; +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; @@ -55,18 +58,17 @@ import org.rhq.core.system.SystemInfo; import org.rhq.core.util.exception.ThrowableUtil; import org.rhq.plugins.jmx.JMXServerComponent;
-import me.prettyprint.hector.api.Cluster; - /** * @author John Sanda */ -public class CassandraNodeComponent extends JMXServerComponent implements MeasurementFacet, OperationFacet { +public class CassandraNodeComponent extends JMXServerComponent<ResourceComponent<?>> implements MeasurementFacet, + OperationFacet {
private Log log = LogFactory.getLog(CassandraNodeComponent.class);
@Override public AvailabilityType getAvailability() { - ResourceContext context = getResourceContext(); + ResourceContext<?> context = getResourceContext(); ProcessInfo processInfo = context.getNativeProcess();
if (processInfo == null) { @@ -88,8 +90,9 @@ public class CassandraNodeComponent extends JMXServerComponent implements Measur return null; }
+ @SuppressWarnings("rawtypes") private OperationResult shutdown(Configuration params) { - ResourceContext context = getResourceContext(); + ResourceContext<?> context = getResourceContext();
if (log.isInfoEnabled()) { log.info("Starting shutdown operation on " + CassandraNodeComponent.class.getName() + @@ -103,19 +106,19 @@ public class CassandraNodeComponent extends JMXServerComponent implements Measur log.debug("Disabling thrift..."); } EmsOperation operation = storageService.getOperation("stopRPCServer", emptyParams); - operation.invoke(emptyParams); + operation.invoke((Object[]) emptyParams);
if (log.isDebugEnabled()) { log.debug("Disabling gossip..."); } operation = storageService.getOperation("stopGossiping", emptyParams); - operation.invoke(emptyParams); + operation.invoke((Object[]) emptyParams);
if (log.isDebugEnabled()) { log.debug("Initiating drain..."); } operation = storageService.getOperation("drain", emptyParams); - operation.invoke(emptyParams); + operation.invoke((Object[]) emptyParams);
ProcessInfo process = context.getNativeProcess(); long pid = process.getPid(); @@ -129,7 +132,7 @@ public class CassandraNodeComponent extends JMXServerComponent implements Measur }
private OperationResult start(Configuration params) { - ResourceContext context = getResourceContext(); + ResourceContext<?> context = getResourceContext(); Configuration pluginConfig = context.getPluginConfiguration(); String baseDir = pluginConfig.getSimpleValue("baseDir"); File binDir = new File(baseDir, "bin"); @@ -149,7 +152,7 @@ public class CassandraNodeComponent extends JMXServerComponent implements Measur }
private String getStartScript() { - ResourceContext context = getResourceContext(); + ResourceContext<?> context = getResourceContext(); SystemInfo systemInfo = context.getSystemInformation();
if (systemInfo.getOperatingSystemType() == WINDOWS) { diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeDiscoveryComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeDiscoveryComponent.java index 68566fb..ac90fc1 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeDiscoveryComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeDiscoveryComponent.java @@ -42,8 +42,9 @@ import org.rhq.plugins.jmx.JMXDiscoveryComponent; */ public class CassandraNodeDiscoveryComponent extends JMXDiscoveryComponent {
+ @SuppressWarnings({ "rawtypes", "unchecked" }) @Override - public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext context) { + public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext context) { Set<DiscoveredResourceDetails> details = new HashSet<DiscoveredResourceDetails>(); List<ProcessScanResult> processScanResults = context.getAutoDiscoveredProcesses();
@@ -57,7 +58,7 @@ public class CassandraNodeDiscoveryComponent extends JMXDiscoveryComponent { return details; }
- private DiscoveredResourceDetails getDetails(ResourceDiscoveryContext context, + private DiscoveredResourceDetails getDetails(ResourceDiscoveryContext<?> context, ProcessScanResult processScanResult) { ProcessInfo processInfo = processScanResult.getProcessInfo(); String jmxPort = null; diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyComponent.java index f3f085d..e3cc66d 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyComponent.java @@ -28,6 +28,9 @@ package org.rhq.plugins.cassandra; import static org.rhq.core.domain.configuration.ConfigurationUpdateStatus.FAILURE; import static org.rhq.core.domain.configuration.ConfigurationUpdateStatus.SUCCESS; import static org.rhq.plugins.cassandra.CassandraUtil.getCluster; +import me.prettyprint.hector.api.Cluster; +import me.prettyprint.hector.api.ddl.ColumnFamilyDefinition; +import me.prettyprint.hector.api.exceptions.HectorException;
import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -36,23 +39,20 @@ import org.rhq.core.domain.configuration.Configuration; import org.rhq.core.domain.configuration.PropertySimple; import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport; import org.rhq.core.pluginapi.inventory.ResourceContext; +import org.rhq.plugins.jmx.JMXComponent; import org.rhq.plugins.jmx.MBeanResourceComponent;
-import me.prettyprint.hector.api.Cluster; -import me.prettyprint.hector.api.ddl.ColumnFamilyDefinition; -import me.prettyprint.hector.api.exceptions.HectorException; - /** * @author John Sanda */ -public class ColumnFamilyComponent extends MBeanResourceComponent { +public class ColumnFamilyComponent extends MBeanResourceComponent<JMXComponent<?>> {
private Log log = LogFactory.getLog(ColumnFamilyComponent.class);
@Override public Configuration loadResourceConfiguration() { if (log.isDebugEnabled()) { - ResourceContext context = getResourceContext(); + ResourceContext<?> context = getResourceContext(); log.debug("Loading resource context for column family " + context.getResourceKey()); }
@@ -66,7 +66,7 @@ public class ColumnFamilyComponent extends MBeanResourceComponent {
@Override public void updateResourceConfiguration(ConfigurationUpdateReport report) { - ResourceContext context = getResourceContext(); + ResourceContext<?> context = getResourceContext();
if (log.isDebugEnabled()) { log.debug("Updating resource configuration for column family " + context.getResourceKey()); @@ -95,10 +95,10 @@ public class ColumnFamilyComponent extends MBeanResourceComponent { }
private ColumnFamilyDefinition getColumnFamilyDefinition() { - ResourceContext context = getResourceContext(); + ResourceContext<?> context = getResourceContext(); Configuration pluginConfig = context.getPluginConfiguration(); String cfName = pluginConfig.getSimpleValue("name"); - KeyspaceComponent keyspaceComponent = (KeyspaceComponent) context.getParentResourceComponent(); + KeyspaceComponent<?> keyspaceComponent = (KeyspaceComponent<?>) context.getParentResourceComponent();
for (ColumnFamilyDefinition cfDef : keyspaceComponent.getKeyspaceDefinition().getCfDefs()) { if (cfName.equals(cfDef.getName())) { diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyDiscoveryComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyDiscoveryComponent.java index b63d2dc..89ab7ff 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyDiscoveryComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyDiscoveryComponent.java @@ -30,22 +30,24 @@ import static org.rhq.plugins.cassandra.CassandraUtil.getKeyspaceDefinition; import java.util.HashSet; import java.util.Set;
+import me.prettyprint.hector.api.ddl.ColumnFamilyDefinition; +import me.prettyprint.hector.api.ddl.KeyspaceDefinition; + import org.rhq.core.domain.configuration.Configuration; import org.rhq.core.domain.configuration.PropertySimple; import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails; +import org.rhq.core.pluginapi.inventory.ResourceComponent; import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent; import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
-import me.prettyprint.hector.api.ddl.ColumnFamilyDefinition; -import me.prettyprint.hector.api.ddl.KeyspaceDefinition; - /** * @author John Sanda */ -public class ColumnFamilyDiscoveryComponent implements ResourceDiscoveryComponent { +public class ColumnFamilyDiscoveryComponent implements ResourceDiscoveryComponent<ResourceComponent<?>> {
@Override - public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext context) throws Exception { + public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<ResourceComponent<?>> context) + throws Exception { Set<DiscoveredResourceDetails> details = new HashSet<DiscoveredResourceDetails>();
String keyspace = context.getParentResourceContext().getResourceKey(); diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceComponent.java index 17b7fd9..372fe11 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceComponent.java @@ -27,6 +27,8 @@ package org.rhq.plugins.cassandra;
import java.util.Map;
+import me.prettyprint.hector.api.ddl.KeyspaceDefinition; + import org.mc4j.ems.connection.EmsConnection;
import org.rhq.core.domain.configuration.Configuration; @@ -40,17 +42,16 @@ import org.rhq.core.pluginapi.inventory.ResourceComponent; import org.rhq.core.pluginapi.inventory.ResourceContext; import org.rhq.plugins.jmx.JMXComponent;
-import me.prettyprint.hector.api.ddl.KeyspaceDefinition; - /** * @author John Sanda */ -public class KeyspaceComponent implements ResourceComponent, ConfigurationFacet, JMXComponent { +public class KeyspaceComponent<T extends ResourceComponent<?>> implements ResourceComponent<T>, ConfigurationFacet, + JMXComponent<T> {
- private ResourceContext context; + private ResourceContext<T> context;
@Override - public void start(ResourceContext context) throws Exception { + public void start(ResourceContext<T> context) throws Exception { this.context = context; }
@@ -65,7 +66,7 @@ public class KeyspaceComponent implements ResourceComponent, ConfigurationFacet,
@Override public EmsConnection getEmsConnection() { - JMXComponent parent = (JMXComponent) context.getParentResourceComponent(); + JMXComponent<?> parent = (JMXComponent<?>) context.getParentResourceComponent(); return parent.getEmsConnection(); }
diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceDiscoveryComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceDiscoveryComponent.java index 6dbab65..58c6ecc 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceDiscoveryComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceDiscoveryComponent.java @@ -30,19 +30,21 @@ import static org.rhq.plugins.cassandra.CassandraUtil.getKeyspaceDefinitions; import java.util.HashSet; import java.util.Set;
+import me.prettyprint.hector.api.ddl.KeyspaceDefinition; + import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails; +import org.rhq.core.pluginapi.inventory.ResourceComponent; import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent; import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
-import me.prettyprint.hector.api.ddl.KeyspaceDefinition; - /** * @author John Sanda */ -public class KeyspaceDiscoveryComponent implements ResourceDiscoveryComponent { +public class KeyspaceDiscoveryComponent implements ResourceDiscoveryComponent<ResourceComponent<?>> {
@Override - public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext context) throws Exception { + public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<ResourceComponent<?>> context) + throws Exception { Set<DiscoveredResourceDetails> details = new HashSet<DiscoveredResourceDetails>();
for (KeyspaceDefinition keyspaceDef : getKeyspaceDefinitions()) { diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java index b1e388f..d5a26b9 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java @@ -41,18 +41,19 @@ import org.rhq.core.domain.configuration.PropertySimple; import org.rhq.core.domain.measurement.AvailabilityType; import org.rhq.core.pluginapi.inventory.ResourceContext; import org.rhq.core.pluginapi.operation.OperationResult; +import org.rhq.plugins.jmx.JMXComponent; import org.rhq.plugins.jmx.MBeanResourceComponent;
/** * @author John Sanda */ -public class StorageServiceComponent extends MBeanResourceComponent { +public class StorageServiceComponent extends MBeanResourceComponent<JMXComponent<?>> {
private Log log = LogFactory.getLog(StorageServiceComponent.class);
@Override public AvailabilityType getAvailability() { - ResourceContext context = getResourceContext(); + ResourceContext<?> context = getResourceContext(); try { EmsBean emsBean = loadBean(); if (emsBean == null) { @@ -100,7 +101,7 @@ public class StorageServiceComponent extends MBeanResourceComponent { }
if (name.equals("repair")) { - return runRepair(parameters); + return repair(parameters); }
return super.invokeOperation(name, parameters);
commit e6f67a25db3edf0a0a4dc976801d3c0dee40d73e Author: Stefan Negrea snegrea@redhat.com Date: Wed Oct 10 16:37:36 2012 -0500
Update Eclipse classpath entries for the Cassandra plugin.
diff --git a/.classpath b/.classpath index 996b0fc..a4068fb 100644 --- a/.classpath +++ b/.classpath @@ -334,5 +334,7 @@ <classpathentry exported="true" kind="var" path="M2_REPO/com/wordnik/swagger-annotations_2.9.1/1.1.1-SNAPSHOT/swagger-annotations_2.9.1-1.1.1-20121031.024335-6.jar"/> <classpathentry exported="true" kind="var" path="JDK_HOME/lib/tools.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/joda-time/joda-time/2.1/joda-time-2.1.jar"/> + <classpathentry kind="var" path="M2_REPO/org/apache/cassandra/cassandra-thrift/1.1.5/cassandra-thrift-1.1.5.jar"/> + <classpathentry kind="var" path="M2_REPO/org/hectorclient/hector-core/1.1-1/hector-core-1.1-1.jar"/> <classpathentry kind="output" path="eclipse-classes"/> </classpath>
commit 1f5daa6eb28b450a15e652488055749bdb775b1d Author: John Sanda jsanda@redhat.com Date: Wed Sep 19 17:02:33 2012 -0400
Adding repair operation for StorageService type
The Cassandra docs recommend running repair as a routine maintenance operation. See http://wiki.apache.org/cassandra/Operations#Frequency_of_nodetool_repair for details. Interestingly the JMX operations for repair are exposed on the storage service mbean. The frequencey of how often it is run should be determined in part by the value of gc_grace_seconds which is specified at the column family level.
From a user standpoint, it will be somewhat difficult to determine that minimum frequency as it will require querying the gc_grace_seconds config property for each column family; however, that property will likely remain the same across column families. We could expose the repair operation at the column family level, using a safe default interval <= gc_grace_seconds. This could result in multiple repairs running simultaneously. I am not sure whether or not this would/could be problematic.
diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java index bcc0cb1..b1e388f 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java @@ -99,6 +99,10 @@ public class StorageServiceComponent extends MBeanResourceComponent { return setLog4jLevel(parameters); }
+ if (name.equals("repair")) { + return runRepair(parameters); + } + return super.invokeOperation(name, parameters); }
@@ -126,6 +130,16 @@ public class StorageServiceComponent extends MBeanResourceComponent { return new OperationResult(); }
+ private OperationResult repair(Configuration params) { + String keyspace = params.getSimpleValue("keyspace"); + EmsBean emsBean = getEmsBean(); + EmsOperation operation = emsBean.getOperation("forceTableRepair", String.class, boolean.class, String[].class); + + operation.invoke(keyspace, true, new String[] {}); + + return new OperationResult(); + } + @Override public Configuration loadResourceConfiguration() { Configuration config = super.loadResourceConfiguration(); diff --git a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml index 8463a82..9b520b7 100644 --- a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml @@ -5,6 +5,7 @@ code base of Cassandra which comes from the cassandra-1.1 branch of the Cassandra git repo. The plugin will not yet work with 1.2.x Cassandra builds which come out of its trunk (i.e., master) branch." package="org.rhq.plugins.cassandra" + version="5.0.3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" xmlns:c="urn:xmlns:rhq-configuration"> @@ -164,6 +165,18 @@ </parameters> </operation>
+ <operation name="repair" + description="Cassandra compares data on this node with the versions on other replicas to update any + out of sync copies of the data. This should be run infrequently as it is a disk IO and CPU intensive + operation. All data for each column that is being repaired is read. Unless you are not performing any + deletes, it is important to run regularly scheduled repairs to ensure that deleted data gets purged. + The frequency that this should be run should be less than the gc_grace_period for each column family. + The current implementation runs repair on all column families in the specified keyspace."> + <parameters> + <c:simple-property name="keyspace" required="true" type="string"/> + </parameters> + </operation> + <metric property="Token" dataType="trait" description="A string representation of this node's token"
commit 3e49f5f0c47530773ea1e374cc33a37fc3074be1 Author: John Sanda jsanda@redhat.com Date: Wed Sep 19 15:26:44 2012 -0400
Adding initial implementation of ConfigurationFacet for ColumnFamilyComponent
There are a number of column family configuration options that are not exposed through JMX. All of the properties/options can be seen from the Cassandra CLI. This commit adds initial support for loading/viewing and updating those configuration settings.
diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyComponent.java index 3ec51bf..f3f085d 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyComponent.java @@ -25,10 +25,87 @@
package org.rhq.plugins.cassandra;
+import static org.rhq.core.domain.configuration.ConfigurationUpdateStatus.FAILURE; +import static org.rhq.core.domain.configuration.ConfigurationUpdateStatus.SUCCESS; +import static org.rhq.plugins.cassandra.CassandraUtil.getCluster; + +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.PropertySimple; +import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport; +import org.rhq.core.pluginapi.inventory.ResourceContext; import org.rhq.plugins.jmx.MBeanResourceComponent;
+import me.prettyprint.hector.api.Cluster; +import me.prettyprint.hector.api.ddl.ColumnFamilyDefinition; +import me.prettyprint.hector.api.exceptions.HectorException; + /** * @author John Sanda */ public class ColumnFamilyComponent extends MBeanResourceComponent { + + private Log log = LogFactory.getLog(ColumnFamilyComponent.class); + + @Override + public Configuration loadResourceConfiguration() { + if (log.isDebugEnabled()) { + ResourceContext context = getResourceContext(); + log.debug("Loading resource context for column family " + context.getResourceKey()); + } + + ColumnFamilyDefinition cfDef = getColumnFamilyDefinition(); + Configuration config = new Configuration(); + + config.put(new PropertySimple("gc_grace_seconds", cfDef.getGcGraceSeconds())); + + return config; + } + + @Override + public void updateResourceConfiguration(ConfigurationUpdateReport report) { + ResourceContext context = getResourceContext(); + + if (log.isDebugEnabled()) { + log.debug("Updating resource configuration for column family " + context.getResourceKey()); + } + + Cluster cluster = getCluster(); + ColumnFamilyDefinition cfDef = getColumnFamilyDefinition(); + Configuration updatedConfig = report.getConfiguration(); + + String gcGraceSeconds = updatedConfig.getSimpleValue("gc_grace_seconds", "864000"); + cfDef.setGcGraceSeconds(Integer.parseInt(gcGraceSeconds)); + + try { + cluster.updateColumnFamily(cfDef, true); + report.setStatus(SUCCESS); + } catch (HectorException e) { + String msg = "Failed to update resource configuration for column family " + context.getResourceKey(); + if (log.isDebugEnabled()) { + log.debug(msg, e); + } else if (log.isWarnEnabled()) { + log.warn(msg); + } + report.setErrorMessageFromThrowable(e); + report.setStatus(FAILURE); + } + } + + private ColumnFamilyDefinition getColumnFamilyDefinition() { + ResourceContext context = getResourceContext(); + Configuration pluginConfig = context.getPluginConfiguration(); + String cfName = pluginConfig.getSimpleValue("name"); + KeyspaceComponent keyspaceComponent = (KeyspaceComponent) context.getParentResourceComponent(); + + for (ColumnFamilyDefinition cfDef : keyspaceComponent.getKeyspaceDefinition().getCfDefs()) { + if (cfName.equals(cfDef.getName())) { + return cfDef; + } + } + + return null; + } } diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyDiscoveryComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyDiscoveryComponent.java index d320f75..b63d2dc 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyDiscoveryComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyDiscoveryComponent.java @@ -57,6 +57,7 @@ public class ColumnFamilyDiscoveryComponent implements ResourceDiscoveryComponen pluginConfig.put(new PropertySimple("objectName", "org.apache.cassandra.db:type=ColumnFamilies,keyspace=" + keyspaceDef.getName() + ",columnfamily=" + columnFamilyDef.getName())); + pluginConfig.put(new PropertySimple("name", columnFamilyDef.getName())); details.add(new DiscoveredResourceDetails(context.getResourceType(), resourceKey, columnFamilyDef.getName(), null, null, pluginConfig, null)); } diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceComponent.java index d736669..17b7fd9 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceComponent.java @@ -25,8 +25,6 @@
package org.rhq.plugins.cassandra;
-import static org.rhq.plugins.cassandra.CassandraUtil.getKeyspaceDefinition; - import java.util.Map;
import org.mc4j.ems.connection.EmsConnection; @@ -73,7 +71,7 @@ public class KeyspaceComponent implements ResourceComponent, ConfigurationFacet,
@Override public Configuration loadResourceConfiguration() throws Exception { - KeyspaceDefinition keyspaceDef = getKeyspaceDefinition(context.getResourceKey()); + KeyspaceDefinition keyspaceDef = getKeyspaceDefinition();
Configuration config = new Configuration(); config.put(new PropertySimple("name", keyspaceDef.getName())); @@ -94,6 +92,10 @@ public class KeyspaceComponent implements ResourceComponent, ConfigurationFacet, return config; }
+ public KeyspaceDefinition getKeyspaceDefinition() { + return CassandraUtil.getKeyspaceDefinition(context.getResourceKey()); + } + @Override public void updateResourceConfiguration(ConfigurationUpdateReport report) { } diff --git a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml index 1ba9bfb..8463a82 100644 --- a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml @@ -5,7 +5,6 @@ code base of Cassandra which comes from the cassandra-1.1 branch of the Cassandra git repo. The plugin will not yet work with 1.2.x Cassandra builds which come out of its trunk (i.e., master) branch." package="org.rhq.plugins.cassandra" - version="5.0.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" xmlns:c="urn:xmlns:rhq-configuration"> @@ -248,6 +247,7 @@ class="org.rhq.plugins.cassandra.ColumnFamilyComponent"> <plugin-configuration> <c:simple-property name="objectName" readOnly="true" type="string"/> + <c:simple-property name="name" type="string" description="The column family name"/> </plugin-configuration>
<metric property="TotalReadLatencyMicros" @@ -283,6 +283,18 @@ <metric property="TotalDiskSpaceUsed" measurementType="dynamic" displayType="summary"/> + + <resource-configuration> + <c:simple-property name="gc_grace_seconds" + displayName="gc_grace_seconds" + required="false" + default="864000" + type="integer" + description="Specifies the time to wait before garbage collecting tombstones (deletion + markers). The value, specified in seconds, defaults to 10 days and allows for a large + amount of time for consistency to be achived prior to deletion. In a single node cluster + this can be reduced to zero."/> + </resource-configuration> </service> </service> </server>
commit 5be85c9feb53a01843d24574586e3cab450f8b48 Author: John Sanda jsanda@redhat.com Date: Wed Sep 19 14:05:02 2012 -0400
Adding CommitLog resource type
Adding CommitLog type along with a few metrics for it. Also providing a more detailed description for the SchemaVersion trait which is managed by the StorageService type.
diff --git a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml index 902bc49..1ba9bfb 100644 --- a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml @@ -5,6 +5,7 @@ code base of Cassandra which comes from the cassandra-1.1 branch of the Cassandra git repo. The plugin will not yet work with 1.2.x Cassandra builds which come out of its trunk (i.e., master) branch." package="org.rhq.plugins.cassandra" + version="5.0.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" xmlns:c="urn:xmlns:rhq-configuration"> @@ -63,7 +64,8 @@
<metric property="cluster" dataType="trait" - description="The name of the cluster. This is used to prevent machines in one logical cluster from joining another."/> + description="The name of the cluster. This is used to prevent machines in one logical cluster from joining another." + displayType="summary"/>
<server name="Cassandra Server JVM" description="The JVM of the Cassandra node" @@ -163,12 +165,21 @@ </parameters> </operation>
+ <metric property="Token" + dataType="trait" + description="A string representation of this node's token" + defaultOn="true"/> + <metric property="ReleaseVersion" dataType="trait" description="The Cassandra version"/> <metric property="SchemaVersion" dataType="trait" - description="The current schema version"/> + description="The current schema version for this node. The value is calculated as a checksum of all rows + in the system.schema_* column families. This value is used in an algorithm to compare schema versions + between nodes and apply updates as necessary. This value should be the same for all fully initialized + nodes in the cluster." + displayType="summary"/> <metric property="ReleaseVersion" dataType="trait" description="The Cassandra version"/> @@ -192,6 +203,30 @@ </resource-configuration> </service>
+ <service name="CommitLog" + discovery="org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent" + class="org.rhq.plugins.jmx.MBeanResourceComponent"> + <plugin-configuration> + <c:simple-property name="objectName" + readOnly="true" + type="string" + default="org.apache.cassandra.db:type=Commitlog"/> + </plugin-configuration> + + <metric property="TotalCommitLogSize" + measurementType="trendsup" + displayType="summary" + description="The size of all commit log segments"/> + <metric property="PendingTasks" + measurementType="dynamic" + displayType="detail" + description="The number of tasks waiting to be executed"/> + <metric property="CompletedTasks" + measurementType="trendsup" + displayType="detail" + description="The number of completed tasks"/> + </service> + <service name="Keyspace" discovery="org.rhq.plugins.cassandra.KeyspaceDiscoveryComponent" class="org.rhq.plugins.cassandra.KeyspaceComponent">
commit 85f2b9091ea53ab8efb3b0b0f80ecae0a030409e Author: John Sanda jsanda@redhat.com Date: Wed Sep 19 00:15:44 2012 -0400
Adding some traits and resource operation to StorageService type
This commit adds a setLog4jLevel operation. It also introduces a few new traits,
* operation mode * release version * schema version
diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java index a72b92c..bcc0cb1 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java @@ -95,6 +95,10 @@ public class StorageServiceComponent extends MBeanResourceComponent { return takeSnapshot(parameters); }
+ if (name.equals("setLog4jLevel")) { + return setLog4jLevel(parameters); + } + return super.invokeOperation(name, parameters); }
@@ -110,6 +114,18 @@ public class StorageServiceComponent extends MBeanResourceComponent { return new OperationResult(); }
+ private OperationResult setLog4jLevel(Configuration params) { + EmsBean emsBean = getEmsBean(); + EmsOperation operation = emsBean.getOperation("setLog4jLevel", String.class, String.class); + + String classQualifier = params.getSimpleValue("classQualifier"); + String level = params.getSimpleValue("level"); + + operation.invoke(classQualifier, level); + + return new OperationResult(); + } + @Override public Configuration loadResourceConfiguration() { Configuration config = super.loadResourceConfiguration(); diff --git a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml index 3afff6c..902bc49 100644 --- a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml @@ -143,6 +143,25 @@ <c:simple-property name="keyspaceName" required="true" type="string"/> </parameters> </operation> + + <operation name="setLog4jLevel" + description="Sets the logging level for classes under the clas qualifier."> + <parameters> + <c:simple-property name="classQualifier" type="string" required="false" default="org.apache.cassandra"/> + <c:simple-property name="level" required="false" default="DEBUG"> + <c:property-options> + <c:option name="ALL" value="ALL"/> + <c:option name="DEBUG" value="DEBUG"/> + <c:option name="INFO" value="INFO"/> + <c:option name="FATAL" value="FATAL"/> + <c:option name="WARN" value="WARN"/> + <c:option name="ERROR" value="ERROR"/> + <c:option name="TRACE" value="TRACE"/> + <c:option name="OFF" value="OFF"/> + </c:property-options> + </c:simple-property> + </parameters> + </operation>
<metric property="ReleaseVersion" dataType="trait" @@ -150,11 +169,17 @@ <metric property="SchemaVersion" dataType="trait" description="The current schema version"/> + <metric property="ReleaseVersion" + dataType="trait" + description="The Cassandra version"/> <metric property="Load" dataType="measurement" units="bytes" displayType="summary" description="The amount of load in disk usage on the node being queried"/> + <metric property="OperationMode" + dataType="trait" + description="The current operation mode"/>
<resource-configuration> <c:simple-property name="SavedCachesLocation" type="string" readOnly="true"
commit 3e2b6e61312bc641ed2417b3c71660f5ec548b19 Author: John Sanda jsanda@redhat.com Date: Tue Sep 18 10:19:26 2012 -0400
Updating logic for getAvailability
The following checks are now performed as part of an availability check:
* establish connection and load JMX bean * verify that thrift rpc server is running * verify that storage service is initialized
If any of those checks fail, an availability of DOWN is reported. If an exception is thrown while performing one of those checks, UNKNOWN is returned.
diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java index 5acb438..a72b92c 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java @@ -25,6 +25,12 @@
package org.rhq.plugins.cassandra;
+import static org.rhq.core.domain.measurement.AvailabilityType.DOWN; +import static org.rhq.core.domain.measurement.AvailabilityType.UNKNOWN; +import static org.rhq.core.domain.measurement.AvailabilityType.UP; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.mc4j.ems.connection.bean.EmsBean; import org.mc4j.ems.connection.bean.attribute.EmsAttribute; import org.mc4j.ems.connection.bean.operation.EmsOperation; @@ -32,6 +38,8 @@ import org.mc4j.ems.connection.bean.operation.EmsOperation; import org.rhq.core.domain.configuration.Configuration; import org.rhq.core.domain.configuration.PropertyList; import org.rhq.core.domain.configuration.PropertySimple; +import org.rhq.core.domain.measurement.AvailabilityType; +import org.rhq.core.pluginapi.inventory.ResourceContext; import org.rhq.core.pluginapi.operation.OperationResult; import org.rhq.plugins.jmx.MBeanResourceComponent;
@@ -40,6 +48,47 @@ import org.rhq.plugins.jmx.MBeanResourceComponent; */ public class StorageServiceComponent extends MBeanResourceComponent {
+ private Log log = LogFactory.getLog(StorageServiceComponent.class); + + @Override + public AvailabilityType getAvailability() { + ResourceContext context = getResourceContext(); + try { + EmsBean emsBean = loadBean(); + if (emsBean == null) { + log.warn("Unable to establish JMX connection to " + context.getResourceKey()); + return DOWN; + } + + AvailabilityType availability = UP; + + EmsAttribute thriftEnabledAttr = emsBean.getAttribute("RPCServerRunning"); + Boolean thriftEnabled = (Boolean) thriftEnabledAttr.getValue(); + + if (!thriftEnabled) { + if (log.isWarnEnabled()) { + log.warn("Thrift RPC server is disabled for " + context.getResourceKey()); + } + availability = DOWN; + } + + EmsAttribute initializedAttr = emsBean.getAttribute("Initialized"); + Boolean initialized = (Boolean) initializedAttr.getValue(); + + if (!initialized) { + if (log.isWarnEnabled()) { + log.warn(context.getResourceKey() + " is not initialized"); + } + availability = DOWN; + } + + return availability; + } catch (Exception e) { + log.error("Unable to determine availability for " + context.getResourceKey(), e); + return UNKNOWN; + } + } + @Override public OperationResult invokeOperation(String name, Configuration parameters) throws Exception { if (name.equals("takeKeyspaceSnapshot")) {
commit 4aad36ced036a50984a150efd6e47c50306584f3 Author: John Sanda jsanda@redhat.com Date: Tue Sep 18 09:35:01 2012 -0400
Adding logic for Windows platforms in Cassandra Node start operation
diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeComponent.java index f82ca05..a89e3f6 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeComponent.java @@ -25,6 +25,7 @@ package org.rhq.plugins.cassandra; import static org.rhq.core.domain.measurement.AvailabilityType.DOWN; import static org.rhq.core.domain.measurement.AvailabilityType.UNKNOWN; import static org.rhq.core.domain.measurement.AvailabilityType.UP; +import static org.rhq.core.system.OperatingSystemType.WINDOWS; import static org.rhq.plugins.cassandra.CassandraUtil.getCluster;
import java.io.File; @@ -132,7 +133,7 @@ public class CassandraNodeComponent extends JMXServerComponent implements Measur Configuration pluginConfig = context.getPluginConfiguration(); String baseDir = pluginConfig.getSimpleValue("baseDir"); File binDir = new File(baseDir, "bin"); - File startScript = new File(binDir, "cassandra"); + File startScript = new File(binDir, getStartScript());
ProcessExecution scriptExe = ProcessExecutionUtility.createProcessExecution(startScript); SystemInfo systemInfo = context.getSystemInformation(); @@ -147,6 +148,17 @@ public class CassandraNodeComponent extends JMXServerComponent implements Measur } }
+ private String getStartScript() { + ResourceContext context = getResourceContext(); + SystemInfo systemInfo = context.getSystemInformation(); + + if (systemInfo.getOperatingSystemType() == WINDOWS) { + return "cassandra.bat"; + } else { + return "cassandra"; + } + } + @Override public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> metrics) throws Exception { MeasurementScheduleRequest scheduleRequest = null;
commit ec7e3fc96ceed5cb746c3274b8f7c5fe33e4526d Author: John Sanda jsanda@redhat.com Date: Tue Sep 18 09:18:12 2012 -0400
Make the shutdown operation for the Cassandra Node type more robust
The shutdown operation now does the following:
* disable thrift (i.e., stop accepting client requests) * disable gossip (i.e., stop inter-node communication) * drain (finish all streaming and flush all memtables and commit log) * send kill signal
diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeComponent.java index a6654fe..f82ca05 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeComponent.java @@ -33,6 +33,9 @@ import java.util.Set; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.hyperic.sigar.SigarException; +import org.mc4j.ems.connection.EmsConnection; +import org.mc4j.ems.connection.bean.EmsBean; +import org.mc4j.ems.connection.bean.operation.EmsOperation;
import org.rhq.core.domain.configuration.Configuration; import org.rhq.core.domain.measurement.AvailabilityType; @@ -86,6 +89,33 @@ public class CassandraNodeComponent extends JMXServerComponent implements Measur
private OperationResult shutdown(Configuration params) { ResourceContext context = getResourceContext(); + + if (log.isInfoEnabled()) { + log.info("Starting shutdown operation on " + CassandraNodeComponent.class.getName() + + " with resource key " + context.getResourceKey()); + } + EmsConnection emsConnection = getEmsConnection(); + EmsBean storageService = emsConnection.getBean("org.apache.cassandra.db:type=StorageService"); + Class[] emptyParams = new Class[0]; + + if (log.isDebugEnabled()) { + log.debug("Disabling thrift..."); + } + EmsOperation operation = storageService.getOperation("stopRPCServer", emptyParams); + operation.invoke(emptyParams); + + if (log.isDebugEnabled()) { + log.debug("Disabling gossip..."); + } + operation = storageService.getOperation("stopGossiping", emptyParams); + operation.invoke(emptyParams); + + if (log.isDebugEnabled()) { + log.debug("Initiating drain..."); + } + operation = storageService.getOperation("drain", emptyParams); + operation.invoke(emptyParams); + ProcessInfo process = context.getNativeProcess(); long pid = process.getPid(); try { diff --git a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml index bfac4b9..3afff6c 100644 --- a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml @@ -5,7 +5,6 @@ code base of Cassandra which comes from the cassandra-1.1 branch of the Cassandra git repo. The plugin will not yet work with 1.2.x Cassandra builds which come out of its trunk (i.e., master) branch." package="org.rhq.plugins.cassandra" - version="5.0.3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" xmlns:c="urn:xmlns:rhq-configuration">
commit 1b536fcc7d72ddf2d419525a83e9e8aa7de8f2c0 Author: John Sanda jsanda@redhat.com Date: Tue Sep 18 07:28:50 2012 -0400
Adding start operation for cassandra daemon
This commit adds support for starting a cassandra daemon using the cassandra start script. A new property named baseDir has been added to the connection properties. baseDir is used to resolve the path of the cassandra start script. Logic needs to be added to handle Windows.
diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeComponent.java index efa2e47..a6654fe 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeComponent.java @@ -22,8 +22,12 @@ */ package org.rhq.plugins.cassandra;
+import static org.rhq.core.domain.measurement.AvailabilityType.DOWN; +import static org.rhq.core.domain.measurement.AvailabilityType.UNKNOWN; +import static org.rhq.core.domain.measurement.AvailabilityType.UP; import static org.rhq.plugins.cassandra.CassandraUtil.getCluster;
+import java.io.File; import java.util.Set;
import org.apache.commons.logging.Log; @@ -31,6 +35,7 @@ import org.apache.commons.logging.LogFactory; import org.hyperic.sigar.SigarException;
import org.rhq.core.domain.configuration.Configuration; +import org.rhq.core.domain.measurement.AvailabilityType; import org.rhq.core.domain.measurement.MeasurementDataTrait; import org.rhq.core.domain.measurement.MeasurementReport; import org.rhq.core.domain.measurement.MeasurementScheduleRequest; @@ -38,7 +43,12 @@ 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; +import org.rhq.core.pluginapi.util.ProcessExecutionUtility; +import org.rhq.core.system.ProcessExecution; +import org.rhq.core.system.ProcessExecutionResults; import org.rhq.core.system.ProcessInfo; +import org.rhq.core.system.SystemInfo; +import org.rhq.core.util.exception.ThrowableUtil; import org.rhq.plugins.jmx.JMXServerComponent;
import me.prettyprint.hector.api.Cluster; @@ -50,71 +60,26 @@ public class CassandraNodeComponent extends JMXServerComponent implements Measur
private Log log = LogFactory.getLog(CassandraNodeComponent.class);
-// private ResourceContext context; -// -// private EmsConnection emsConnection; -// -// @Override -// public void start(ResourceContext context) throws Exception { -// this.context = context; -// } -// -// @Override -// public void stop() { -// emsConnection = null; -// } -// -// @Override -// public AvailabilityType getAvailability() { -// if (emsConnection == null) { -// getEmsConnection(); -// } -// return AvailabilityType.UP; -// } -// -// @Override -// public EmsConnection getEmsConnection() { -// if (emsConnection != null) { -// return emsConnection; -// } -// -// try { -// Configuration pluginConfig = context.getPluginConfiguration(); -// -// ConnectionSettings connectionSettings = new ConnectionSettings(); -// -// String connectionTypeDescriptorClass = pluginConfig.getSimple(JMXDiscoveryComponent.CONNECTION_TYPE) -// .getStringValue(); -// PropertySimple serverUrl = pluginConfig -// .getSimple(JMXDiscoveryComponent.CONNECTOR_ADDRESS_CONFIG_PROPERTY); -// -// connectionSettings.initializeConnectionType((ConnectionTypeDescriptor) Class.forName( -// connectionTypeDescriptorClass).newInstance()); -// // if not provided use the default serverUrl -// if (null != serverUrl) { -// connectionSettings.setServerUrl(serverUrl.getStringValue()); -// } -// -// ConnectionFactory connectionFactory = new ConnectionFactory(); -// ConnectionProvider connectionProvider = connectionFactory.getConnectionProvider(connectionSettings); -// emsConnection = connectionProvider.connect(); -// emsConnection.loadSynchronous(false); -// -// return emsConnection; -// } catch (InstantiationException e) { -// throw new RuntimeException("Failed to get EMS connection", e); -// } catch (IllegalAccessException e) { -// throw new RuntimeException("Failed to get EMS connection", e); -// } catch (ClassNotFoundException e) { -// throw new RuntimeException("Failed to get EMS connection", e); -// } -// } + @Override + public AvailabilityType getAvailability() { + ResourceContext context = getResourceContext(); + ProcessInfo processInfo = context.getNativeProcess();
+ if (processInfo == null) { + return UNKNOWN; + } else if (processInfo.isRunning()) { + return UP; + } else { + return DOWN; + } + }
@Override public OperationResult invokeOperation(String name, Configuration parameters) throws Exception { if (name.equals("shutdown")) { return shutdown(parameters); + } else if (name.equals("start")) { + return start(parameters); } return null; } @@ -125,14 +90,33 @@ public class CassandraNodeComponent extends JMXServerComponent implements Measur long pid = process.getPid(); try { process.kill("KILL"); - context.getAvailabilityContext().requestAvailabilityCheck(); - return new OperationResult("Successfully shut down Cassandra node with pid " + pid); + return new OperationResult("Successfully shut down Cassandra daemon with pid " + pid); } catch (SigarException e) { log.warn("Failed to shut down Cassandra node with pid " + pid, e); return new OperationResult("Failed to shut down Cassandra node with pid " + pid + ": " + e.getMessage()); } }
+ private OperationResult start(Configuration params) { + ResourceContext context = getResourceContext(); + Configuration pluginConfig = context.getPluginConfiguration(); + String baseDir = pluginConfig.getSimpleValue("baseDir"); + File binDir = new File(baseDir, "bin"); + File startScript = new File(binDir, "cassandra"); + + ProcessExecution scriptExe = ProcessExecutionUtility.createProcessExecution(startScript); + SystemInfo systemInfo = context.getSystemInformation(); + ProcessExecutionResults results = systemInfo.executeProcess(scriptExe); + + if (results.getError() == null) { + return new OperationResult("Successfully started Cassandra daemon"); + } else { + OperationResult failure = new OperationResult("Failed to start Cassandra daemon"); + failure.setErrorMessage(ThrowableUtil.getAllMessages(results.getError())); + return failure; + } + } + @Override public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> metrics) throws Exception { MeasurementScheduleRequest scheduleRequest = null; diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeDiscoveryComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeDiscoveryComponent.java index 88ff74d..68566fb 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeDiscoveryComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeDiscoveryComponent.java @@ -22,64 +22,71 @@ */ package org.rhq.plugins.cassandra;
+import java.io.File; +import java.util.HashSet; +import java.util.List; import java.util.Set;
+import org.mc4j.ems.connection.support.metadata.J2SE5ConnectionTypeDescriptor; + +import org.rhq.core.domain.configuration.Configuration; +import org.rhq.core.domain.configuration.PropertySimple; import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails; +import org.rhq.core.pluginapi.inventory.ProcessScanResult; import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext; +import org.rhq.core.system.ProcessInfo; import org.rhq.plugins.jmx.JMXDiscoveryComponent;
/** * @author John Sanda */ public class CassandraNodeDiscoveryComponent extends JMXDiscoveryComponent { + @Override - public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext context) { - return super.discoverResources(context); + public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext context) { + Set<DiscoveredResourceDetails> details = new HashSet<DiscoveredResourceDetails>(); + List<ProcessScanResult> processScanResults = context.getAutoDiscoveredProcesses(); + + for (ProcessScanResult processScanResult : processScanResults) { + DiscoveredResourceDetails discoveredDetails = getDetails(context, processScanResult); + if (discoveredDetails != null) { + details.add(discoveredDetails); + } + } + + return details; }
- // @Override -// public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext context) throws Exception { -// Set<DiscoveredResourceDetails> details = new HashSet<DiscoveredResourceDetails>(); -// List<ProcessScanResult> processScanResults = context.getAutoDiscoveredProcesses(); -// -// for (ProcessScanResult processScanResult : processScanResults) { -// DiscoveredResourceDetails discoveredDetails = getDetails(context, processScanResult); -// if (discoveredDetails != null) { -// details.add(discoveredDetails); -// } -// } -// -// return details; -// } -// -// private DiscoveredResourceDetails getDetails(ResourceDiscoveryContext context, -// ProcessScanResult processScanResult) { -// ProcessInfo processInfo = processScanResult.getProcessInfo(); -// String jmxPort = null; -// -// for (String arg : processInfo.getCommandLine()) { -// if (arg.startsWith("-Dcom.sun.management.jmxremote.port")) { -// String[] jmxPortArg = arg.split("="); -// jmxPort = jmxPortArg[1]; -// break; -// } -// } -// -// if (jmxPort == null) { -// return null; -// } -// -// String resourceKey = "CassandraDaemon:" + jmxPort; -// String resourceName = "CassandraDaemon"; -// -// Configuration pluginConfig = new Configuration(); -// pluginConfig.put(new PropertySimple(JMXDiscoveryComponent.CONNECTION_TYPE, -// J2SE5ConnectionTypeDescriptor.class.getName())); -// pluginConfig.put(new PropertySimple(JMXDiscoveryComponent.CONNECTOR_ADDRESS_CONFIG_PROPERTY, -// //service:jmx:rmi:///jndi/rmi://127.0.0.1:7199/jmxrmi -// "service:jmx:rmi:///jndi/rmi://127.0.0.1:" + jmxPort + "/jmxrmi")); -// -// return new DiscoveredResourceDetails(context.getResourceType(), resourceKey, resourceName, null, null, -// pluginConfig, processInfo); -// } + private DiscoveredResourceDetails getDetails(ResourceDiscoveryContext context, + ProcessScanResult processScanResult) { + ProcessInfo processInfo = processScanResult.getProcessInfo(); + String jmxPort = null; + + for (String arg : processInfo.getCommandLine()) { + if (arg.startsWith("-Dcom.sun.management.jmxremote.port")) { + String[] jmxPortArg = arg.split("="); + jmxPort = jmxPortArg[1]; + break; + } + } + + if (jmxPort == null) { + return null; + } + + String resourceKey = "CassandraDaemon:" + jmxPort; + String resourceName = "CassandraDaemon"; + + Configuration pluginConfig = new Configuration(); + pluginConfig.put(new PropertySimple(JMXDiscoveryComponent.CONNECTION_TYPE, + J2SE5ConnectionTypeDescriptor.class.getName())); + pluginConfig.put(new PropertySimple(JMXDiscoveryComponent.CONNECTOR_ADDRESS_CONFIG_PROPERTY, + "service:jmx:rmi:///jndi/rmi://127.0.0.1:" + jmxPort + "/jmxrmi")); + + String path = processInfo.getExecutable().getCwd(); + pluginConfig.put(new PropertySimple("baseDir", new File(path).getParentFile().getAbsolutePath())); + + return new DiscoveredResourceDetails(context.getResourceType(), resourceKey, resourceName, null, null, + pluginConfig, processInfo); + } } diff --git a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml index 195bbae..bfac4b9 100644 --- a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml @@ -5,6 +5,7 @@ code base of Cassandra which comes from the cassandra-1.1 branch of the Cassandra git repo. The plugin will not yet work with 1.2.x Cassandra builds which come out of its trunk (i.e., master) branch." package="org.rhq.plugins.cassandra" + version="5.0.3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" xmlns:c="urn:xmlns:rhq-configuration"> @@ -40,15 +41,24 @@ <c:simple-property name="credentials" required="false" type="password" description="The login credentials/password"/> <c:simple-property name="additionalClassPathEntries" required="false" type="string" description="Comma-separated list of directories and filenames that contain resources and classes needed to communicate with the JMX Server and its MBeans. If you specify 'some/directory/*.jar', all jars found in the given directory will be added."/> <c:simple-property name="commandLine" required="false" type="string" description="the command line of the JVM at the time it was discovered - only used by JVMs with type Local; if the command line of the JVM changes, this property's value will need to be updated accordingly in order for RHQ to connect to the JVM"/> + <c:simple-property name="baseDir" + displayName="Base Directory" + description="The base directory from which the Cassandra Daemon was launched." + required="false"/> </plugin-configuration>
<process-scan name="CassandraDaemon" query="process|basename|match=^java.*,arg|org.apache.cassandra.thrift.CassandraDaemon|match=.*"/>
- <operation name="shutdown" - description="Shuts down the Cassandra node"> + <operation name="shutdown" description="Shuts down the Cassandra daemon"> <results> - <c:simple-property name="shutdownResult" description="Results of Cassandra node shutdown"/> + <c:simple-property name="shutdownResult" description="Results of Cassandra daemon shutdown"/> + </results> + </operation> + + <operation name="start" description="Starts the Cassandra daemon"> + <results> + <c:simple-property name="startResult" description="Results of Cassandra daemon start up"/> </results> </operation>
commit 50539c6677ebeb14dc7287722c5df63081c7c9f0 Author: John Sanda jsanda@redhat.com Date: Mon Sep 17 19:42:13 2012 -0400
Adding Cassandra Server JVM type to monitor Cassandra JVM
This commit also adds a shutdown operation for the Cassandra Node type.
diff --git a/modules/plugins/cassandra/pom.xml b/modules/plugins/cassandra/pom.xml index 945c367..eaeb17e 100644 --- a/modules/plugins/cassandra/pom.xml +++ b/modules/plugins/cassandra/pom.xml @@ -65,6 +65,11 @@ <artifactId>hector-core</artifactId> <version>1.1-1</version> </dependency> + <dependency> + <groupId>org.yaml</groupId> + <artifactId>snakeyaml</artifactId> + <version>1.10</version> + </dependency> </dependencies>
<build> @@ -94,6 +99,10 @@ <artifactId>libthrift</artifactId> </artifactItem> <artifactItem> + <groupId>org.yaml</groupId> + <artifactId>snakeyaml</artifactId> + </artifactItem> + <artifactItem> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.6.0</version> diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeComponent.java index 619350e..efa2e47 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeComponent.java @@ -22,81 +22,132 @@ */ package org.rhq.plugins.cassandra;
-import org.mc4j.ems.connection.ConnectionFactory; -import org.mc4j.ems.connection.EmsConnection; -import org.mc4j.ems.connection.settings.ConnectionSettings; -import org.mc4j.ems.connection.support.ConnectionProvider; -import org.mc4j.ems.connection.support.metadata.ConnectionTypeDescriptor; +import static org.rhq.plugins.cassandra.CassandraUtil.getCluster; + +import java.util.Set; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.hyperic.sigar.SigarException;
import org.rhq.core.domain.configuration.Configuration; -import org.rhq.core.domain.configuration.PropertySimple; -import org.rhq.core.domain.measurement.AvailabilityType; +import org.rhq.core.domain.measurement.MeasurementDataTrait; +import org.rhq.core.domain.measurement.MeasurementReport; +import org.rhq.core.domain.measurement.MeasurementScheduleRequest; import org.rhq.core.pluginapi.inventory.ResourceContext; -import org.rhq.plugins.jmx.JMXDiscoveryComponent; +import org.rhq.core.pluginapi.measurement.MeasurementFacet; +import org.rhq.core.pluginapi.operation.OperationFacet; +import org.rhq.core.pluginapi.operation.OperationResult; +import org.rhq.core.system.ProcessInfo; import org.rhq.plugins.jmx.JMXServerComponent;
+import me.prettyprint.hector.api.Cluster; + /** * @author John Sanda */ -public class CassandraNodeComponent extends JMXServerComponent { +public class CassandraNodeComponent extends JMXServerComponent implements MeasurementFacet, OperationFacet {
- private ResourceContext context; + private Log log = LogFactory.getLog(CassandraNodeComponent.class);
- private EmsConnection emsConnection; +// private ResourceContext context; +// +// private EmsConnection emsConnection; +// +// @Override +// public void start(ResourceContext context) throws Exception { +// this.context = context; +// } +// +// @Override +// public void stop() { +// emsConnection = null; +// } +// +// @Override +// public AvailabilityType getAvailability() { +// if (emsConnection == null) { +// getEmsConnection(); +// } +// return AvailabilityType.UP; +// } +// +// @Override +// public EmsConnection getEmsConnection() { +// if (emsConnection != null) { +// return emsConnection; +// } +// +// try { +// Configuration pluginConfig = context.getPluginConfiguration(); +// +// ConnectionSettings connectionSettings = new ConnectionSettings(); +// +// String connectionTypeDescriptorClass = pluginConfig.getSimple(JMXDiscoveryComponent.CONNECTION_TYPE) +// .getStringValue(); +// PropertySimple serverUrl = pluginConfig +// .getSimple(JMXDiscoveryComponent.CONNECTOR_ADDRESS_CONFIG_PROPERTY); +// +// connectionSettings.initializeConnectionType((ConnectionTypeDescriptor) Class.forName( +// connectionTypeDescriptorClass).newInstance()); +// // if not provided use the default serverUrl +// if (null != serverUrl) { +// connectionSettings.setServerUrl(serverUrl.getStringValue()); +// } +// +// ConnectionFactory connectionFactory = new ConnectionFactory(); +// ConnectionProvider connectionProvider = connectionFactory.getConnectionProvider(connectionSettings); +// emsConnection = connectionProvider.connect(); +// emsConnection.loadSynchronous(false); +// +// return emsConnection; +// } catch (InstantiationException e) { +// throw new RuntimeException("Failed to get EMS connection", e); +// } catch (IllegalAccessException e) { +// throw new RuntimeException("Failed to get EMS connection", e); +// } catch (ClassNotFoundException e) { +// throw new RuntimeException("Failed to get EMS connection", e); +// } +// }
- @Override - public void start(ResourceContext context) throws Exception { - this.context = context; - }
@Override - public void stop() { - emsConnection = null; + public OperationResult invokeOperation(String name, Configuration parameters) throws Exception { + if (name.equals("shutdown")) { + return shutdown(parameters); + } + return null; }
- @Override - public AvailabilityType getAvailability() { - if (emsConnection == null) { - getEmsConnection(); + private OperationResult shutdown(Configuration params) { + ResourceContext context = getResourceContext(); + ProcessInfo process = context.getNativeProcess(); + long pid = process.getPid(); + try { + process.kill("KILL"); + context.getAvailabilityContext().requestAvailabilityCheck(); + return new OperationResult("Successfully shut down Cassandra node with pid " + pid); + } catch (SigarException e) { + log.warn("Failed to shut down Cassandra node with pid " + pid, e); + return new OperationResult("Failed to shut down Cassandra node with pid " + pid + ": " + e.getMessage()); } - return AvailabilityType.UP; }
@Override - public EmsConnection getEmsConnection() { - if (emsConnection != null) { - return emsConnection; - } - - try { - Configuration pluginConfig = context.getPluginConfiguration(); - - ConnectionSettings connectionSettings = new ConnectionSettings(); - - String connectionTypeDescriptorClass = pluginConfig.getSimple(JMXDiscoveryComponent.CONNECTION_TYPE) - .getStringValue(); - PropertySimple serverUrl = pluginConfig - .getSimple(JMXDiscoveryComponent.CONNECTOR_ADDRESS_CONFIG_PROPERTY); - - connectionSettings.initializeConnectionType((ConnectionTypeDescriptor) Class.forName( - connectionTypeDescriptorClass).newInstance()); - // if not provided use the default serverUrl - if (null != serverUrl) { - connectionSettings.setServerUrl(serverUrl.getStringValue()); + public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> metrics) throws Exception { + MeasurementScheduleRequest scheduleRequest = null; + for (MeasurementScheduleRequest r : metrics) { + if (r.getName().equals("cluster")) { + scheduleRequest = r; + break; } + }
- ConnectionFactory connectionFactory = new ConnectionFactory(); - ConnectionProvider connectionProvider = connectionFactory.getConnectionProvider(connectionSettings); - emsConnection = connectionProvider.connect(); - emsConnection.loadSynchronous(false); - - return emsConnection; - } catch (InstantiationException e) { - throw new RuntimeException("Failed to get EMS connection", e); - } catch (IllegalAccessException e) { - throw new RuntimeException("Failed to get EMS connection", e); - } catch (ClassNotFoundException e) { - throw new RuntimeException("Failed to get EMS connection", e); + if (scheduleRequest == null) { + return; } + + Cluster cluster = getCluster(); + report.addData(new MeasurementDataTrait(scheduleRequest, cluster.describeClusterName())); } } diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeDiscoveryComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeDiscoveryComponent.java index b3bf024..88ff74d 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeDiscoveryComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeDiscoveryComponent.java @@ -22,14 +22,22 @@ */ package org.rhq.plugins.cassandra;
+import java.util.Set; + +import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails; +import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext; import org.rhq.plugins.jmx.JMXDiscoveryComponent;
/** * @author John Sanda */ public class CassandraNodeDiscoveryComponent extends JMXDiscoveryComponent { + @Override + public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext context) { + return super.discoverResources(context); + }
-// @Override + // @Override // public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext context) throws Exception { // Set<DiscoveredResourceDetails> details = new HashSet<DiscoveredResourceDetails>(); // List<ProcessScanResult> processScanResults = context.getAutoDiscoveredProcesses(); diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraUtil.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraUtil.java index ddd83c9..a0990d8 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraUtil.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraUtil.java @@ -36,7 +36,7 @@ import me.prettyprint.hector.api.factory.HFactory; */ public class CassandraUtil {
- private static Cluster getCluster() { + public static Cluster getCluster() { // TODO Cannot hard code the port return HFactory.getOrCreateCluster("rhq", "localhost:9160"); } diff --git a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml index f100d60..195bbae 100644 --- a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml @@ -21,7 +21,9 @@
<depends plugin="JMX" useClasses="true"/>
- <server name="Cassandra Node" discovery="CassandraNodeDiscoveryComponent" class="CassandraNodeComponent"> + <server name="Cassandra Node" + discovery="CassandraNodeDiscoveryComponent" + class="CassandraNodeComponent"> <plugin-configuration> <c:simple-property name="connectorAddress" @@ -43,6 +45,30 @@ <process-scan name="CassandraDaemon" query="process|basename|match=^java.*,arg|org.apache.cassandra.thrift.CassandraDaemon|match=.*"/>
+ <operation name="shutdown" + description="Shuts down the Cassandra node"> + <results> + <c:simple-property name="shutdownResult" description="Results of Cassandra node shutdown"/> + </results> + </operation> + + <metric property="cluster" + dataType="trait" + description="The name of the cluster. This is used to prevent machines in one logical cluster from joining another."/> + + <server name="Cassandra Server JVM" + description="The JVM of the Cassandra node" + sourcePlugin="JMX" + sourceType="JMX Server" + discovery="org.rhq.plugins.jmx.EmbeddedJMXServerDiscoveryComponent" + class="org.rhq.plugins.jmx.EmbeddedJMXServerComponent" + singleton="true"> + <plugin-configuration> + <c:simple-property name="type" type="string" default="PARENT" readOnly="true" + description="The EMS connection type for this JVM (cannot be modified)"/> + </plugin-configuration> + </server> + <service name="StorageProxy" discovery="org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent" class="org.rhq.plugins.jmx.MBeanResourceComponent">
commit 3b9b75f82dfdc1e1531c9cca4b0c0bd86f205937 Author: John Sanda jsanda@redhat.com Date: Fri Sep 14 14:02:12 2012 -0400
Adding metrics for StorageProxy type
diff --git a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml index aa526d6..f100d60 100644 --- a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml @@ -50,6 +50,35 @@ <c:simple-property name="objectName" readOnly="true" default="org.apache.cassandra.db:type=StorageProxy"/> </plugin-configuration>
+ <metric property="TotalReadLatencyMicros" + displayName="Total Read Latency (in micro seconds)" + measurementType="trendsup" + displayType="detail" + description="The latency all of read operations since execution start"/> + <metric property="TotalWriteLatencyMicros" + displayName="Total Write Latency (in micro seconds)" + measurementType="trendsup" + displayType="detail" + description="The latency of all write operations since execution start"/> + <metric property="ReadOperations" + measurementType="trendsup" + displayType="summary" + description="The total number of read operations since execution start"/> + <metric property="WriteOperations" + measurementType="trendsup" + displayType="summary" + description="The total number of write operations since execution start"/> + <metric property="RangeOperations" + measurementType="trendsup" + description="The total number of range operations since execution start"/> + <metric property="TotalRangeLatencyMicros" + displayName="Total Range Latency (in micro seconds)" + measurementType="trendsup" + description="The total latency of all range operations since execution start"/> + <metric property="TotalDiskSpaceUsed" + measurementType="dynamic" + displayType="summary"/> + <resource-configuration> <c:simple-property name="readOperations" type="long" readOnly="true"/> </resource-configuration> @@ -130,7 +159,7 @@ displayName="Total Read Latency (in micro seconds)" measurementType="trendsup" displayType="detail" - description="The latency all of read operations since execution start"/> + description="The latency of read operations since execution start"/> <metric property="RecentReadLatencyMicros" displayName="Recent Read Latency (in micro seconds)" measurementType="trendsup" @@ -140,7 +169,7 @@ displayName="Total Write Latency (in micro seconds)" measurementType="trendsup" displayType="detail" - description="The latency of all write operations since execution start"/> + description="The latency of write operations since execution start"/> <metric property="RecentWriteLatencyMicros" displayName="Recent Write Latency (in micro seconds)" measurementType="trendsup"
commit 53eb70e13af03724afc9e68a43fad17530aef561 Author: John Sanda jsanda@redhat.com Date: Fri Sep 14 13:36:17 2012 -0400
Adding metrics for ColumnFamily type
diff --git a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml index 333402c..aa526d6 100644 --- a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml @@ -5,7 +5,6 @@ code base of Cassandra which comes from the cassandra-1.1 branch of the Cassandra git repo. The plugin will not yet work with 1.2.x Cassandra builds which come out of its trunk (i.e., master) branch." package="org.rhq.plugins.cassandra" - version="5.0.3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" xmlns:c="urn:xmlns:rhq-configuration"> @@ -126,20 +125,37 @@ <plugin-configuration> <c:simple-property name="objectName" readOnly="true" type="string"/> </plugin-configuration> - <!--<resource-configuration>--> - <!--<c:simple-property name="columnFamilyName" type="string" readOnly="true"/>--> - <!--</resource-configuration>-->
+ <metric property="TotalReadLatencyMicros" + displayName="Total Read Latency (in micro seconds)" + measurementType="trendsup" + displayType="detail" + description="The latency all of read operations since execution start"/> + <metric property="RecentReadLatencyMicros" + displayName="Recent Read Latency (in micro seconds)" + measurementType="trendsup" + displayType="detail" + description="The latency of read operations since this metric was last sampled"/> + <metric property="TotalWriteLatencyMicros" + displayName="Total Write Latency (in micro seconds)" + measurementType="trendsup" + displayType="detail" + description="The latency of all write operations since execution start"/> + <metric property="RecentWriteLatencyMicros" + displayName="Recent Write Latency (in micro seconds)" + measurementType="trendsup" + displayType="detail" + description="The latency of write operations since this metric was last sampled"/> <metric displayName="Read Count" - property="readCount" + property="ReadCount" measurementType="trendsup" - displayType="summary"/> - + displayType="summary" + description="The number of read operations since execution start"/> <metric displayName="Write Count" - property="writeCount" + property="WriteCount" measurementType="trendsup" - displayType="summary"/> - + displayType="summary" + description="The number of write operations since execution start"/> <metric property="TotalDiskSpaceUsed" measurementType="dynamic" displayType="summary"/>
commit 4aa54483980a4fb9a78bef744b34019b46748662 Author: John Sanda jsanda@redhat.com Date: Fri Sep 14 11:42:45 2012 -0400
Adding some metrics and resource configuration for StorageService
diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java index 07b93e5..5acb438 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java @@ -26,9 +26,12 @@ package org.rhq.plugins.cassandra;
import org.mc4j.ems.connection.bean.EmsBean; +import org.mc4j.ems.connection.bean.attribute.EmsAttribute; import org.mc4j.ems.connection.bean.operation.EmsOperation;
import org.rhq.core.domain.configuration.Configuration; +import org.rhq.core.domain.configuration.PropertyList; +import org.rhq.core.domain.configuration.PropertySimple; import org.rhq.core.pluginapi.operation.OperationResult; import org.rhq.plugins.jmx.MBeanResourceComponent;
@@ -57,4 +60,20 @@ public class StorageServiceComponent extends MBeanResourceComponent {
return new OperationResult(); } + + @Override + public Configuration loadResourceConfiguration() { + Configuration config = super.loadResourceConfiguration(); + EmsBean emsBean = getEmsBean(); + EmsAttribute attribute = emsBean.getAttribute("AllDataFileLocations"); + + PropertyList list = new PropertyList("dataFileLocations"); + String[] dirs = (String[]) attribute.getValue(); + for (String dir : dirs) { + list.add(new PropertySimple("directory", dir)); + } + config.put(list); + + return config; + } } diff --git a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml index 0d4e885..333402c 100644 --- a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml @@ -5,6 +5,7 @@ code base of Cassandra which comes from the cassandra-1.1 branch of the Cassandra git repo. The plugin will not yet work with 1.2.x Cassandra builds which come out of its trunk (i.e., master) branch." package="org.rhq.plugins.cassandra" + version="5.0.3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" xmlns:c="urn:xmlns:rhq-configuration"> @@ -61,7 +62,7 @@ <plugin-configuration> <c:simple-property name="objectName" readOnly="true" default="org.apache.cassandra.db:type=StorageService"/> </plugin-configuration> - + <operation name="startRPCServer" description="Start the Thrift server"/>
<operation name="stopRPCServer" description="Stop the Thrift server"/> @@ -79,6 +80,28 @@ <c:simple-property name="keyspaceName" required="true" type="string"/> </parameters> </operation> + + <metric property="ReleaseVersion" + dataType="trait" + description="The Cassandra version"/> + <metric property="SchemaVersion" + dataType="trait" + description="The current schema version"/> + <metric property="Load" + dataType="measurement" + units="bytes" + displayType="summary" + description="The amount of load in disk usage on the node being queried"/> + + <resource-configuration> + <c:simple-property name="SavedCachesLocation" type="string" readOnly="true" + description="The location of the saved caches directory"/> + <c:simple-property name="CommitLogLocation" type="string" readOnly="true" + default="The location of the commit log directory"/> + <c:list-property name="dataFileLocations" readOnly="true" description="A list of data file locations"> + <c:simple-property name="directory" type="string" readOnly="true"/> + </c:list-property> + </resource-configuration> </service>
<service name="Keyspace" @@ -106,6 +129,20 @@ <!--<resource-configuration>--> <!--<c:simple-property name="columnFamilyName" type="string" readOnly="true"/>--> <!--</resource-configuration>--> + + <metric displayName="Read Count" + property="readCount" + measurementType="trendsup" + displayType="summary"/> + + <metric displayName="Write Count" + property="writeCount" + measurementType="trendsup" + displayType="summary"/> + + <metric property="TotalDiskSpaceUsed" + measurementType="dynamic" + displayType="summary"/> </service> </service> </server>
commit 5917ad11141c012c04ae20239d558bb0f698fdd8 Author: John Sanda jsanda@redhat.com Date: Thu Sep 13 21:59:29 2012 -0400
Initial commit for CassandraUtil
This commit is a minor refactoring to centralize access to Hector APIs for accessing Cassandra meta data. Calls to access KeyspaceDefinition objects now go through CassandraUtil.
diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraUtil.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraUtil.java new file mode 100644 index 0000000..ddd83c9 --- /dev/null +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraUtil.java @@ -0,0 +1,51 @@ +/* + * + * * RHQ Management Platform + * * Copyright (C) 2005-2012 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.cassandra; + +import java.util.List; + +import me.prettyprint.hector.api.Cluster; +import me.prettyprint.hector.api.ddl.KeyspaceDefinition; +import me.prettyprint.hector.api.factory.HFactory; + +/** + * @author John Sanda + */ +public class CassandraUtil { + + private static Cluster getCluster() { + // TODO Cannot hard code the port + return HFactory.getOrCreateCluster("rhq", "localhost:9160"); + } + + public static KeyspaceDefinition getKeyspaceDefinition(String keyspace) { + return getCluster().describeKeyspace(keyspace); + } + + public static List<KeyspaceDefinition> getKeyspaceDefinitions() { + return getCluster().describeKeyspaces(); + } +} diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyDiscoveryComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyDiscoveryComponent.java index 53b6d62..d320f75 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyDiscoveryComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyDiscoveryComponent.java @@ -25,6 +25,8 @@
package org.rhq.plugins.cassandra;
+import static org.rhq.plugins.cassandra.CassandraUtil.getKeyspaceDefinition; + import java.util.HashSet; import java.util.Set;
@@ -34,10 +36,8 @@ import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails; import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent; import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
-import me.prettyprint.hector.api.Cluster; import me.prettyprint.hector.api.ddl.ColumnFamilyDefinition; import me.prettyprint.hector.api.ddl.KeyspaceDefinition; -import me.prettyprint.hector.api.factory.HFactory;
/** * @author John Sanda @@ -46,11 +46,10 @@ public class ColumnFamilyDiscoveryComponent implements ResourceDiscoveryComponen
@Override public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext context) throws Exception { - Cluster cluster = HFactory.getOrCreateCluster("rhq", "localhost:9160"); Set<DiscoveredResourceDetails> details = new HashSet<DiscoveredResourceDetails>();
String keyspace = context.getParentResourceContext().getResourceKey(); - KeyspaceDefinition keyspaceDef = cluster.describeKeyspace(keyspace); + KeyspaceDefinition keyspaceDef = getKeyspaceDefinition(keyspace);
for (ColumnFamilyDefinition columnFamilyDef : keyspaceDef.getCfDefs()) { String resourceKey = keyspace + "." + columnFamilyDef.getName(); diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceComponent.java index 4e9097f..d736669 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceComponent.java @@ -25,6 +25,8 @@
package org.rhq.plugins.cassandra;
+import static org.rhq.plugins.cassandra.CassandraUtil.getKeyspaceDefinition; + import java.util.Map;
import org.mc4j.ems.connection.EmsConnection; @@ -40,9 +42,7 @@ import org.rhq.core.pluginapi.inventory.ResourceComponent; import org.rhq.core.pluginapi.inventory.ResourceContext; import org.rhq.plugins.jmx.JMXComponent;
-import me.prettyprint.hector.api.Cluster; import me.prettyprint.hector.api.ddl.KeyspaceDefinition; -import me.prettyprint.hector.api.factory.HFactory;
/** * @author John Sanda @@ -73,8 +73,7 @@ public class KeyspaceComponent implements ResourceComponent, ConfigurationFacet,
@Override public Configuration loadResourceConfiguration() throws Exception { - Cluster cluster = HFactory.getOrCreateCluster("rhq", "localhost:9160"); - KeyspaceDefinition keyspaceDef = cluster.describeKeyspace(context.getResourceKey()); + KeyspaceDefinition keyspaceDef = getKeyspaceDefinition(context.getResourceKey());
Configuration config = new Configuration(); config.put(new PropertySimple("name", keyspaceDef.getName())); diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceDiscoveryComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceDiscoveryComponent.java index 5e3cece..6dbab65 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceDiscoveryComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceDiscoveryComponent.java @@ -25,6 +25,8 @@
package org.rhq.plugins.cassandra;
+import static org.rhq.plugins.cassandra.CassandraUtil.getKeyspaceDefinitions; + import java.util.HashSet; import java.util.Set;
@@ -32,9 +34,7 @@ import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails; import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent; import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
-import me.prettyprint.hector.api.Cluster; import me.prettyprint.hector.api.ddl.KeyspaceDefinition; -import me.prettyprint.hector.api.factory.HFactory;
/** * @author John Sanda @@ -42,12 +42,10 @@ import me.prettyprint.hector.api.factory.HFactory; public class KeyspaceDiscoveryComponent implements ResourceDiscoveryComponent {
@Override - public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext context) - throws Exception { - Cluster cluster = HFactory.getOrCreateCluster("rhq", "localhost:9160"); + public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext context) throws Exception { Set<DiscoveredResourceDetails> details = new HashSet<DiscoveredResourceDetails>();
- for (KeyspaceDefinition keyspaceDef : cluster.describeKeyspaces()) { + for (KeyspaceDefinition keyspaceDef : getKeyspaceDefinitions()) { details.add(new DiscoveredResourceDetails(context.getResourceType(), keyspaceDef.getName(), keyspaceDef.getName(), null, null, null, null)); }
commit 0a609702d25a02110ef96279be52d68cb370f854 Author: John Sanda jsanda@redhat.com Date: Thu Sep 13 21:44:05 2012 -0400
Adding Keyspace resource type
This commit introduces a Keyspace resource type. The ColumnFamily type has been moved and made a child type of the Keyspace type. This provides a nice, logical view of column families in a keyspace.
diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyDiscoveryComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyDiscoveryComponent.java index 67196c8..53b6d62 100644 --- a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyDiscoveryComponent.java +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyDiscoveryComponent.java @@ -28,10 +28,6 @@ package org.rhq.plugins.cassandra; import java.util.HashSet; import java.util.Set;
-import org.mc4j.ems.connection.EmsConnection; -import org.mc4j.ems.connection.bean.EmsBean; -import org.mc4j.ems.connection.bean.attribute.EmsAttribute; - import org.rhq.core.domain.configuration.Configuration; import org.rhq.core.domain.configuration.PropertySimple; import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails; @@ -50,26 +46,20 @@ public class ColumnFamilyDiscoveryComponent implements ResourceDiscoveryComponen
@Override public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext context) throws Exception { - CassandraNodeComponent parent = (CassandraNodeComponent) context.getParentResourceComponent(); - EmsConnection emsConnection = parent.getEmsConnection(); - EmsBean emsBean = emsConnection.getBean("org.apache.cassandra.db:type=StorageService"); - - EmsAttribute attribute = emsBean.getAttribute("keyspaces"); - Cluster cluster = HFactory.getOrCreateCluster("rhq", "localhost:9160"); Set<DiscoveredResourceDetails> details = new HashSet<DiscoveredResourceDetails>();
- for (KeyspaceDefinition keyspaceDef : cluster.describeKeyspaces()) { - for (ColumnFamilyDefinition columnFamilyDef : keyspaceDef.getCfDefs()) { - String resourceKey = keyspaceDef.getName() + "." + columnFamilyDef.getName(); - Configuration pluginConfig = new Configuration(); - // org.apache.cassandra.db:type=ColumnFamilies,keyspace=test,columnfamily=users - pluginConfig.put(new PropertySimple("objectName", - "org.apache.cassandra.db:type=ColumnFamilies,keyspace=" + keyspaceDef.getName() + - ",columnfamily=" + columnFamilyDef.getName())); - details.add(new DiscoveredResourceDetails(context.getResourceType(), resourceKey, - columnFamilyDef.getName(), null, null, pluginConfig, null)); - } + String keyspace = context.getParentResourceContext().getResourceKey(); + KeyspaceDefinition keyspaceDef = cluster.describeKeyspace(keyspace); + + for (ColumnFamilyDefinition columnFamilyDef : keyspaceDef.getCfDefs()) { + String resourceKey = keyspace + "." + columnFamilyDef.getName(); + Configuration pluginConfig = new Configuration(); + pluginConfig.put(new PropertySimple("objectName", + "org.apache.cassandra.db:type=ColumnFamilies,keyspace=" + keyspaceDef.getName() + + ",columnfamily=" + columnFamilyDef.getName())); + details.add(new DiscoveredResourceDetails(context.getResourceType(), resourceKey, + columnFamilyDef.getName(), null, null, pluginConfig, null)); }
return details; diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceComponent.java new file mode 100644 index 0000000..4e9097f --- /dev/null +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceComponent.java @@ -0,0 +1,102 @@ +/* + * + * * RHQ Management Platform + * * Copyright (C) 2005-2012 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.cassandra; + +import java.util.Map; + +import org.mc4j.ems.connection.EmsConnection; + +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.measurement.AvailabilityType; +import org.rhq.core.pluginapi.configuration.ConfigurationFacet; +import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport; +import org.rhq.core.pluginapi.inventory.ResourceComponent; +import org.rhq.core.pluginapi.inventory.ResourceContext; +import org.rhq.plugins.jmx.JMXComponent; + +import me.prettyprint.hector.api.Cluster; +import me.prettyprint.hector.api.ddl.KeyspaceDefinition; +import me.prettyprint.hector.api.factory.HFactory; + +/** + * @author John Sanda + */ +public class KeyspaceComponent implements ResourceComponent, ConfigurationFacet, JMXComponent { + + private ResourceContext context; + + @Override + public void start(ResourceContext context) throws Exception { + this.context = context; + } + + @Override + public void stop() { + } + + @Override + public AvailabilityType getAvailability() { + return AvailabilityType.UP; + } + + @Override + public EmsConnection getEmsConnection() { + JMXComponent parent = (JMXComponent) context.getParentResourceComponent(); + return parent.getEmsConnection(); + } + + @Override + public Configuration loadResourceConfiguration() throws Exception { + Cluster cluster = HFactory.getOrCreateCluster("rhq", "localhost:9160"); + KeyspaceDefinition keyspaceDef = cluster.describeKeyspace(context.getResourceKey()); + + Configuration config = new Configuration(); + config.put(new PropertySimple("name", keyspaceDef.getName())); + config.put(new PropertySimple("replicationFactor", keyspaceDef.getReplicationFactor())); + config.put(new PropertySimple("strategyClass", keyspaceDef.getStrategyClass())); + config.put(new PropertySimple("durableWrites", keyspaceDef.isDurableWrites())); + + PropertyList list = new PropertyList("strategyOptions"); + Map<String, String> strategyOptions = keyspaceDef.getStrategyOptions(); + for (String optionName : strategyOptions.keySet()) { + PropertyMap map = new PropertyMap("strategyOptionsMap"); + map.put(new PropertySimple("strategyOptionName", optionName)); + map.put(new PropertySimple("strategyOptionValue", strategyOptions.get(optionName))); + list.add(map); + } + config.put(list); + + return config; + } + + @Override + public void updateResourceConfiguration(ConfigurationUpdateReport report) { + } + +} diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceDiscoveryComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceDiscoveryComponent.java new file mode 100644 index 0000000..5e3cece --- /dev/null +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/KeyspaceDiscoveryComponent.java @@ -0,0 +1,57 @@ +/* + * + * * RHQ Management Platform + * * Copyright (C) 2005-2012 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.cassandra; + +import java.util.HashSet; +import java.util.Set; + +import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails; +import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent; +import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext; + +import me.prettyprint.hector.api.Cluster; +import me.prettyprint.hector.api.ddl.KeyspaceDefinition; +import me.prettyprint.hector.api.factory.HFactory; + +/** + * @author John Sanda + */ +public class KeyspaceDiscoveryComponent implements ResourceDiscoveryComponent { + + @Override + public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext context) + throws Exception { + Cluster cluster = HFactory.getOrCreateCluster("rhq", "localhost:9160"); + Set<DiscoveredResourceDetails> details = new HashSet<DiscoveredResourceDetails>(); + + for (KeyspaceDefinition keyspaceDef : cluster.describeKeyspaces()) { + details.add(new DiscoveredResourceDetails(context.getResourceType(), keyspaceDef.getName(), + keyspaceDef.getName(), null, null, null, null)); + } + + return details; + } +} diff --git a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml index 0abed08..0d4e885 100644 --- a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml @@ -81,15 +81,32 @@ </operation> </service>
- <service name="ColumnFamily" - discovery="org.rhq.plugins.cassandra.ColumnFamilyDiscoveryComponent" - class="org.rhq.plugins.cassandra.ColumnFamilyComponent"> - <plugin-configuration> - <c:simple-property name="objectName" readOnly="true"/> - </plugin-configuration> - <!--<resource-configuration>--> + <service name="Keyspace" + discovery="org.rhq.plugins.cassandra.KeyspaceDiscoveryComponent" + class="org.rhq.plugins.cassandra.KeyspaceComponent"> + <resource-configuration> + <c:simple-property name="name" type="string" description="The keyspace name" readOnly="true"/> + <c:simple-property name="replicationFactor" type="integer" readOnly="true"/> + <c:simple-property name="strategyClass" type="string" readOnly="true"/> + <c:simple-property name="durableWrites" type="boolean" readOnly="true"/> + <c:list-property name="strategyOptions" readOnly="true"> + <c:map-property name="strategyOptionsMap"> + <c:simple-property name="strategyOptionName" type="string" readOnly="true"/> + <c:simple-property name="strategyOptionValue" type="string" readOnly="true"/> + </c:map-property> + </c:list-property> + </resource-configuration> + + <service name="ColumnFamily" + discovery="org.rhq.plugins.cassandra.ColumnFamilyDiscoveryComponent" + class="org.rhq.plugins.cassandra.ColumnFamilyComponent"> + <plugin-configuration> + <c:simple-property name="objectName" readOnly="true" type="string"/> + </plugin-configuration> + <!--<resource-configuration>--> <!--<c:simple-property name="columnFamilyName" type="string" readOnly="true"/>--> - <!--</resource-configuration>--> + <!--</resource-configuration>--> + </service> </service> </server> </plugin> \ No newline at end of file
commit fa9de8b98b8ef206633ebdf927bb445b8d43feff Author: John Sanda jsanda@redhat.com Date: Thu Sep 13 01:13:10 2012 -0400
Adding initial support for ColumnFamily resource type
Cassandra's JMX API does not expose an attribute or operation for retrieving column families; so, with this commit I discover column families using Hector. The JMX API does expose an attribute to obtain a list of keyspaces, but I am unaware of any attributes or operations to get a list of column families.
This commit just handles discovery and setting the objectName plugin config property of the column family resource component.
diff --git a/modules/plugins/cassandra/pom.xml b/modules/plugins/cassandra/pom.xml index c03d0dd..945c367 100644 --- a/modules/plugins/cassandra/pom.xml +++ b/modules/plugins/cassandra/pom.xml @@ -53,7 +53,7 @@ <dependency> <groupId>org.apache.cassandra</groupId> <artifactId>cassandra-all</artifactId> - <version>1.1.4</version> + <version>1.1.5</version> </dependency> <dependency> <groupId>org.apache.thrift</groupId> @@ -101,7 +101,7 @@ <artifactItem> <groupId>org.apache.cassandra</groupId> <artifactId>cassandra-thrift</artifactId> - <version>1.0.9</version> + <version>1.1.5</version> </artifactItem> <artifactItem> <groupId>com.google.guava</groupId> @@ -114,6 +114,11 @@ <version>1.6</version> </artifactItem> <artifactItem> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <version>2.3</version> + </artifactItem> + <artifactItem> <groupId>com.github.stephenc.eaio-uuid</groupId> <artifactId>uuid</artifactId> <version>3.2.0</version> diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyComponent.java new file mode 100644 index 0000000..3ec51bf --- /dev/null +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyComponent.java @@ -0,0 +1,34 @@ +/* + * + * * RHQ Management Platform + * * Copyright (C) 2005-2012 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.cassandra; + +import org.rhq.plugins.jmx.MBeanResourceComponent; + +/** + * @author John Sanda + */ +public class ColumnFamilyComponent extends MBeanResourceComponent { +} diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyDiscoveryComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyDiscoveryComponent.java new file mode 100644 index 0000000..67196c8 --- /dev/null +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/ColumnFamilyDiscoveryComponent.java @@ -0,0 +1,77 @@ +/* + * + * * RHQ Management Platform + * * Copyright (C) 2005-2012 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.cassandra; + +import java.util.HashSet; +import java.util.Set; + +import org.mc4j.ems.connection.EmsConnection; +import org.mc4j.ems.connection.bean.EmsBean; +import org.mc4j.ems.connection.bean.attribute.EmsAttribute; + +import org.rhq.core.domain.configuration.Configuration; +import org.rhq.core.domain.configuration.PropertySimple; +import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails; +import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent; +import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext; + +import me.prettyprint.hector.api.Cluster; +import me.prettyprint.hector.api.ddl.ColumnFamilyDefinition; +import me.prettyprint.hector.api.ddl.KeyspaceDefinition; +import me.prettyprint.hector.api.factory.HFactory; + +/** + * @author John Sanda + */ +public class ColumnFamilyDiscoveryComponent implements ResourceDiscoveryComponent { + + @Override + public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext context) throws Exception { + CassandraNodeComponent parent = (CassandraNodeComponent) context.getParentResourceComponent(); + EmsConnection emsConnection = parent.getEmsConnection(); + EmsBean emsBean = emsConnection.getBean("org.apache.cassandra.db:type=StorageService"); + + EmsAttribute attribute = emsBean.getAttribute("keyspaces"); + + Cluster cluster = HFactory.getOrCreateCluster("rhq", "localhost:9160"); + Set<DiscoveredResourceDetails> details = new HashSet<DiscoveredResourceDetails>(); + + for (KeyspaceDefinition keyspaceDef : cluster.describeKeyspaces()) { + for (ColumnFamilyDefinition columnFamilyDef : keyspaceDef.getCfDefs()) { + String resourceKey = keyspaceDef.getName() + "." + columnFamilyDef.getName(); + Configuration pluginConfig = new Configuration(); + // org.apache.cassandra.db:type=ColumnFamilies,keyspace=test,columnfamily=users + pluginConfig.put(new PropertySimple("objectName", + "org.apache.cassandra.db:type=ColumnFamilies,keyspace=" + keyspaceDef.getName() + + ",columnfamily=" + columnFamilyDef.getName())); + details.add(new DiscoveredResourceDetails(context.getResourceType(), resourceKey, + columnFamilyDef.getName(), null, null, pluginConfig, null)); + } + } + + return details; + } +} diff --git a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml index 9816f57..0abed08 100644 --- a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml @@ -80,5 +80,16 @@ </parameters> </operation> </service> + + <service name="ColumnFamily" + discovery="org.rhq.plugins.cassandra.ColumnFamilyDiscoveryComponent" + class="org.rhq.plugins.cassandra.ColumnFamilyComponent"> + <plugin-configuration> + <c:simple-property name="objectName" readOnly="true"/> + </plugin-configuration> + <!--<resource-configuration>--> + <!--<c:simple-property name="columnFamilyName" type="string" readOnly="true"/>--> + <!--</resource-configuration>--> + </service> </server> </plugin> \ No newline at end of file
commit 43d938c374d35268bab045d14a06db23b90d9a7b Author: John Sanda jsanda@redhat.com Date: Wed Sep 12 21:34:02 2012 -0400
Add some docs around what versions of cassandra are currently supported.
diff --git a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml index 05fe2d5..9816f57 100644 --- a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml @@ -1,12 +1,24 @@ <?xml version="1.0"?> <plugin name="Cassandra" displayName="Cassandra" - description="Monitor and manage a Cassandra node" + description="Monitor and manage a Cassandra node. This plugin is currently being developed against the 1.1.x + code base of Cassandra which comes from the cassandra-1.1 branch of the Cassandra git repo. The plugin will not + yet work with 1.2.x Cassandra builds which come out of its trunk (i.e., master) branch." package="org.rhq.plugins.cassandra" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" xmlns:c="urn:xmlns:rhq-configuration">
+ <!-- + Note that the plugin does yet work with Cassandra builds coming from the trunk/master + branch of the cassandra git repo. I have already run into a couple differences that need + to be addressed. A different process scan for CassandraDaemon is needed because + CassandraDaemon is in a different package. There are also new properties in + cassandra.yaml that are not recognized in 1.1.x builds. + + jsanda - 09/12/12 + --> + <depends plugin="JMX" useClasses="true"/>
<server name="Cassandra Node" discovery="CassandraNodeDiscoveryComponent" class="CassandraNodeComponent"> @@ -31,15 +43,6 @@ <process-scan name="CassandraDaemon" query="process|basename|match=^java.*,arg|org.apache.cassandra.thrift.CassandraDaemon|match=.*"/>
- <!--<server name="Cassandra JVM"--> - <!--description="The JVM of the Cassandra node"--> - <!--sourcePlugin="JMX"--> - <!--sourceType="JMX Server"--> - <!--discovery="org.rhq.plugins.jmx.EmbeddedJMXServerDiscoveryComponent"--> - <!--class="org.rhq.plugins.jmx.EmbeddedJMXServerComponent"--> - <!--singleton="true">--> - <!--</server>--> - <service name="StorageProxy" discovery="org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent" class="org.rhq.plugins.jmx.MBeanResourceComponent">
commit 4682d922434ecd4c5fe104bd8c9ac814e063af5f Author: John Sanda jsanda@redhat.com Date: Wed Sep 12 17:27:37 2012 -0400
Adding operation taking snapshot of an entire keyspace
Snapshots are the way to perform point in time backups. A snapshot creates a full copy of the data. Data files are not actually copied. Cassandra instead uses hard links.
diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java new file mode 100644 index 0000000..07b93e5 --- /dev/null +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java @@ -0,0 +1,60 @@ +/* + * + * * RHQ Management Platform + * * Copyright (C) 2005-2012 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.cassandra; + +import org.mc4j.ems.connection.bean.EmsBean; +import org.mc4j.ems.connection.bean.operation.EmsOperation; + +import org.rhq.core.domain.configuration.Configuration; +import org.rhq.core.pluginapi.operation.OperationResult; +import org.rhq.plugins.jmx.MBeanResourceComponent; + +/** + * @author John Sanda + */ +public class StorageServiceComponent extends MBeanResourceComponent { + + @Override + public OperationResult invokeOperation(String name, Configuration parameters) throws Exception { + if (name.equals("takeKeyspaceSnapshot")) { + return takeSnapshot(parameters); + } + + return super.invokeOperation(name, parameters); + } + + private OperationResult takeSnapshot(Configuration params) { + EmsBean emsBean = getEmsBean(); + EmsOperation operation = emsBean.getOperation("takeSnapshot", String.class, String[].class); + + String snapshotName = params.getSimpleValue("snapshotName"); + String keyspaceName = params.getSimpleValue("keyspaceName"); + + operation.invoke(snapshotName, new String[] {keyspaceName}); + + return new OperationResult(); + } +} diff --git a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml index fe44a18..05fe2d5 100644 --- a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml @@ -29,7 +29,7 @@ </plugin-configuration>
<process-scan name="CassandraDaemon" - query="process|basename|match=^java.*,arg|org.apache.cassandra.service.CassandraDaemon|match=.*"/> + query="process|basename|match=^java.*,arg|org.apache.cassandra.thrift.CassandraDaemon|match=.*"/>
<!--<server name="Cassandra JVM"--> <!--description="The JVM of the Cassandra node"--> @@ -54,7 +54,7 @@
<service name="StorageService" discovery="org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent" - class="org.rhq.plugins.jmx.MBeanResourceComponent"> + class="org.rhq.plugins.cassandra.StorageServiceComponent"> <plugin-configuration> <c:simple-property name="objectName" readOnly="true" default="org.apache.cassandra.db:type=StorageService"/> </plugin-configuration> @@ -63,17 +63,19 @@
<operation name="stopRPCServer" description="Stop the Thrift server"/>
- <!--<operation name="takeSnapshot"--> - <!--description="Takes the snapshot for the given tables. A snapshot name must be specified.">--> - <!--<parameters>--> - <!--<c:simple-property name="p1" displayName="tag" required="true" type="string"/>--> - <!--<c:list-property name="p2" displayName="columnFamilies">--> - <!--<c:map-property name="columnFamiliesMap">--> - <!--<c:simple-property name="columnFamily" type="string"/>--> - <!--</c:map-property>--> - <!--</c:list-property>--> - <!--</parameters>--> - <!--</operation>--> + <operation name="takeKeyspaceSnapshot" + description="Takes a snapshot of all column families in a keyspace."> + <parameters> + <c:simple-property name="snapshotName" + required="true" + type="string" + description="A snapshot first flushes all in-memory writes to disk and then creates a hard + link of each SSTable file for the keyspace. Note that a column family can have multiple + SSTables on disk. By default snapshots are stored in the <cassandra_data_dir>/<keyspace_name>/<column_family_name>/snapshots + directory. On Linux/UNIX systems cassandra_data_dir defaults to /var/lib/cassandra/data"/> + <c:simple-property name="keyspaceName" required="true" type="string"/> + </parameters> + </operation> </service> </server> </plugin> \ No newline at end of file
commit 2d6afc7857f060657b4d643fc6bc30eba0808a65 Author: John Sanda jsanda@redhat.com Date: Tue Sep 11 17:06:49 2012 -0400
Initial commit for Cassandra plugin
This commit adds some basic support for discovery for CassandraDaemon, StorageProxy, and StorageService. I have also started adding in some configuration properties and operations. Most of the work is delegated to the JMX plugin.
diff --git a/modules/plugins/cassandra/pom.xml b/modules/plugins/cassandra/pom.xml new file mode 100644 index 0000000..c03d0dd --- /dev/null +++ b/modules/plugins/cassandra/pom.xml @@ -0,0 +1,184 @@ +<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%22%3E + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.rhq</groupId> + <artifactId>rhq-plugins-parent</artifactId> + <version>4.5.0-SNAPSHOT</version> + </parent> + + <groupId>org.rhq</groupId> + <artifactId>rhq-cassandra-plugin</artifactId> + <name>RHQ Cassandra Plugin</name> + <description>An RHQ plugin for monitoring and managing a Cassandra cluster</description> + + <properties> + <rhq.rootDir>../../..</rhq.rootDir> + <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> + <rhq.deploymentDir>${rhq.containerDir}/jbossas/server/default/deploy/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir> + </properties> + + <dependencies> + <dependency> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + <version>${commons-logging.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>rhq-core-domain</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>rhq-core-plugin-api</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>rhq-core-native-system</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>rhq-jmx-plugin</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.cassandra</groupId> + <artifactId>cassandra-all</artifactId> + <version>1.1.4</version> + </dependency> + <dependency> + <groupId>org.apache.thrift</groupId> + <artifactId>libthrift</artifactId> + <version>0.7.0</version> + </dependency> + <dependency> + <groupId>org.hectorclient</groupId> + <artifactId>hector-core</artifactId> + <version>1.1-1</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>copy-libs</id> + <phase>package</phase> + <goals> + <goal>copy</goal> + </goals> + <configuration> + <outputDirectory>${project.build.outputDirectory}/lib</outputDirectory> + <artifactItems> + <artifactItem> + <groupId>org.hectorclient</groupId> + <artifactId>hector-core</artifactId> + </artifactItem> + <artifactItem> + <groupId>org.apache.cassandra</groupId> + <artifactId>cassandra-all</artifactId> + </artifactItem> + <artifactItem> + <groupId>org.apache.thrift</groupId> + <artifactId>libthrift</artifactId> + </artifactItem> + <artifactItem> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <version>1.6.0</version> + </artifactItem> + <artifactItem> + <groupId>org.apache.cassandra</groupId> + <artifactId>cassandra-thrift</artifactId> + <version>1.0.9</version> + </artifactItem> + <artifactItem> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + <version>12.0</version> + </artifactItem> + <artifactItem> + <groupId>commons-pool</groupId> + <artifactId>commons-pool</artifactId> + <version>1.6</version> + </artifactItem> + <artifactItem> + <groupId>com.github.stephenc.eaio-uuid</groupId> + <artifactId>uuid</artifactId> + <version>3.2.0</version> + </artifactItem> + </artifactItems> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-antrun-plugin</artifactId> + <executions> + <execution> + <id>deploy</id> + <phase>package</phase> + <configuration> + <target> + <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}"/> + </target> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + <execution> + <id>deploy-jar-meta-inf</id> + <phase>package</phase> + <configuration> + <target> + <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> + </target> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + <execution> + <id>undeploy</id> + <phase>clean</phase> + <configuration> + <target> + <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar"/> + <echo>*** Deleting ${deployment.file}...</echo> + <delete file="${deployment.file}"/> + </target> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeComponent.java new file mode 100644 index 0000000..619350e --- /dev/null +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeComponent.java @@ -0,0 +1,102 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.cassandra; + +import org.mc4j.ems.connection.ConnectionFactory; +import org.mc4j.ems.connection.EmsConnection; +import org.mc4j.ems.connection.settings.ConnectionSettings; +import org.mc4j.ems.connection.support.ConnectionProvider; +import org.mc4j.ems.connection.support.metadata.ConnectionTypeDescriptor; + +import org.rhq.core.domain.configuration.Configuration; +import org.rhq.core.domain.configuration.PropertySimple; +import org.rhq.core.domain.measurement.AvailabilityType; +import org.rhq.core.pluginapi.inventory.ResourceContext; +import org.rhq.plugins.jmx.JMXDiscoveryComponent; +import org.rhq.plugins.jmx.JMXServerComponent; + +/** + * @author John Sanda + */ +public class CassandraNodeComponent extends JMXServerComponent { + + private ResourceContext context; + + private EmsConnection emsConnection; + + @Override + public void start(ResourceContext context) throws Exception { + this.context = context; + } + + @Override + public void stop() { + emsConnection = null; + } + + @Override + public AvailabilityType getAvailability() { + if (emsConnection == null) { + getEmsConnection(); + } + return AvailabilityType.UP; + } + + @Override + public EmsConnection getEmsConnection() { + if (emsConnection != null) { + return emsConnection; + } + + try { + Configuration pluginConfig = context.getPluginConfiguration(); + + ConnectionSettings connectionSettings = new ConnectionSettings(); + + String connectionTypeDescriptorClass = pluginConfig.getSimple(JMXDiscoveryComponent.CONNECTION_TYPE) + .getStringValue(); + PropertySimple serverUrl = pluginConfig + .getSimple(JMXDiscoveryComponent.CONNECTOR_ADDRESS_CONFIG_PROPERTY); + + connectionSettings.initializeConnectionType((ConnectionTypeDescriptor) Class.forName( + connectionTypeDescriptorClass).newInstance()); + // if not provided use the default serverUrl + if (null != serverUrl) { + connectionSettings.setServerUrl(serverUrl.getStringValue()); + } + + ConnectionFactory connectionFactory = new ConnectionFactory(); + ConnectionProvider connectionProvider = connectionFactory.getConnectionProvider(connectionSettings); + emsConnection = connectionProvider.connect(); + emsConnection.loadSynchronous(false); + + return emsConnection; + } catch (InstantiationException e) { + throw new RuntimeException("Failed to get EMS connection", e); + } catch (IllegalAccessException e) { + throw new RuntimeException("Failed to get EMS connection", e); + } catch (ClassNotFoundException e) { + throw new RuntimeException("Failed to get EMS connection", e); + } + } +} diff --git a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeDiscoveryComponent.java b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeDiscoveryComponent.java new file mode 100644 index 0000000..b3bf024 --- /dev/null +++ b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeDiscoveryComponent.java @@ -0,0 +1,77 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.cassandra; + +import org.rhq.plugins.jmx.JMXDiscoveryComponent; + +/** + * @author John Sanda + */ +public class CassandraNodeDiscoveryComponent extends JMXDiscoveryComponent { + +// @Override +// public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext context) throws Exception { +// Set<DiscoveredResourceDetails> details = new HashSet<DiscoveredResourceDetails>(); +// List<ProcessScanResult> processScanResults = context.getAutoDiscoveredProcesses(); +// +// for (ProcessScanResult processScanResult : processScanResults) { +// DiscoveredResourceDetails discoveredDetails = getDetails(context, processScanResult); +// if (discoveredDetails != null) { +// details.add(discoveredDetails); +// } +// } +// +// return details; +// } +// +// private DiscoveredResourceDetails getDetails(ResourceDiscoveryContext context, +// ProcessScanResult processScanResult) { +// ProcessInfo processInfo = processScanResult.getProcessInfo(); +// String jmxPort = null; +// +// for (String arg : processInfo.getCommandLine()) { +// if (arg.startsWith("-Dcom.sun.management.jmxremote.port")) { +// String[] jmxPortArg = arg.split("="); +// jmxPort = jmxPortArg[1]; +// break; +// } +// } +// +// if (jmxPort == null) { +// return null; +// } +// +// String resourceKey = "CassandraDaemon:" + jmxPort; +// String resourceName = "CassandraDaemon"; +// +// Configuration pluginConfig = new Configuration(); +// pluginConfig.put(new PropertySimple(JMXDiscoveryComponent.CONNECTION_TYPE, +// J2SE5ConnectionTypeDescriptor.class.getName())); +// pluginConfig.put(new PropertySimple(JMXDiscoveryComponent.CONNECTOR_ADDRESS_CONFIG_PROPERTY, +// //service:jmx:rmi:///jndi/rmi://127.0.0.1:7199/jmxrmi +// "service:jmx:rmi:///jndi/rmi://127.0.0.1:" + jmxPort + "/jmxrmi")); +// +// return new DiscoveredResourceDetails(context.getResourceType(), resourceKey, resourceName, null, null, +// pluginConfig, processInfo); +// } +} diff --git a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml new file mode 100644 index 0000000..fe44a18 --- /dev/null +++ b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml @@ -0,0 +1,79 @@ +<?xml version="1.0"?> +<plugin name="Cassandra" + displayName="Cassandra" + description="Monitor and manage a Cassandra node" + package="org.rhq.plugins.cassandra" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="urn:xmlns:rhq-plugin" + xmlns:c="urn:xmlns:rhq-configuration"> + + <depends plugin="JMX" useClasses="true"/> + + <server name="Cassandra Node" discovery="CassandraNodeDiscoveryComponent" class="CassandraNodeComponent"> + <plugin-configuration> + <c:simple-property + name="connectorAddress" + displayName="Manager URL" + description="The RMI URL with which to connect to the Cassandra node (e.g. service:jmx:rmi:///jndi/rmi://localhost:7199/jmxrmi)." + default="service:jmx:rmi:///jndi/rmi://localhost:7199/jmxrmi"/> + <c:simple-property + name="type" + description="The type used to establish the EMS connection to the Cassandra node." + default="org.mc4j.ems.connection.support.metadata.J2SE5ConnectionTypeDescriptor" + readOnly="true"/> + <c:simple-property name="installURI" required="false" type="string" description="The installation path for the selected server type which will be used to find client libraries (if appropriate)"/> + <c:simple-property name="principal" required="false" description="The login principal/username"/> + <c:simple-property name="credentials" required="false" type="password" description="The login credentials/password"/> + <c:simple-property name="additionalClassPathEntries" required="false" type="string" description="Comma-separated list of directories and filenames that contain resources and classes needed to communicate with the JMX Server and its MBeans. If you specify 'some/directory/*.jar', all jars found in the given directory will be added."/> + <c:simple-property name="commandLine" required="false" type="string" description="the command line of the JVM at the time it was discovered - only used by JVMs with type Local; if the command line of the JVM changes, this property's value will need to be updated accordingly in order for RHQ to connect to the JVM"/> + </plugin-configuration> + + <process-scan name="CassandraDaemon" + query="process|basename|match=^java.*,arg|org.apache.cassandra.service.CassandraDaemon|match=.*"/> + + <!--<server name="Cassandra JVM"--> + <!--description="The JVM of the Cassandra node"--> + <!--sourcePlugin="JMX"--> + <!--sourceType="JMX Server"--> + <!--discovery="org.rhq.plugins.jmx.EmbeddedJMXServerDiscoveryComponent"--> + <!--class="org.rhq.plugins.jmx.EmbeddedJMXServerComponent"--> + <!--singleton="true">--> + <!--</server>--> + + <service name="StorageProxy" + discovery="org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent" + class="org.rhq.plugins.jmx.MBeanResourceComponent"> + <plugin-configuration> + <c:simple-property name="objectName" readOnly="true" default="org.apache.cassandra.db:type=StorageProxy"/> + </plugin-configuration> + + <resource-configuration> + <c:simple-property name="readOperations" type="long" readOnly="true"/> + </resource-configuration> + </service> + + <service name="StorageService" + discovery="org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent" + class="org.rhq.plugins.jmx.MBeanResourceComponent"> + <plugin-configuration> + <c:simple-property name="objectName" readOnly="true" default="org.apache.cassandra.db:type=StorageService"/> + </plugin-configuration> + + <operation name="startRPCServer" description="Start the Thrift server"/> + + <operation name="stopRPCServer" description="Stop the Thrift server"/> + + <!--<operation name="takeSnapshot"--> + <!--description="Takes the snapshot for the given tables. A snapshot name must be specified.">--> + <!--<parameters>--> + <!--<c:simple-property name="p1" displayName="tag" required="true" type="string"/>--> + <!--<c:list-property name="p2" displayName="columnFamilies">--> + <!--<c:map-property name="columnFamiliesMap">--> + <!--<c:simple-property name="columnFamily" type="string"/>--> + <!--</c:map-property>--> + <!--</c:list-property>--> + <!--</parameters>--> + <!--</operation>--> + </service> + </server> +</plugin> \ No newline at end of file diff --git a/modules/plugins/pom.xml b/modules/plugins/pom.xml index 0afa6fd..e6fbe33 100644 --- a/modules/plugins/pom.xml +++ b/modules/plugins/pom.xml @@ -196,6 +196,7 @@ <module>virt</module> <module>kickstart</module> <module>pattern-generator</module> + <module>cassandra</module> </modules> </profile>
commit 615ec8ce565413623e0915fa96d25575f505ad61 Author: John Mazzitelli mazz@redhat.com Date: Thu Dec 6 14:16:20 2012 -0500
added a commented out section in server/jar pom.
diff --git a/modules/enterprise/server/jar/pom.xml b/modules/enterprise/server/jar/pom.xml index d04738c..9694c68 100644 --- a/modules/enterprise/server/jar/pom.xml +++ b/modules/enterprise/server/jar/pom.xml @@ -456,6 +456,16 @@ <configuration> <ejbVersion>3.0</ejbVersion> <generateClient>true</generateClient> + <!-- We shoudn't need Class-Path manifest entry, at least when deployed in AS + but we might need it for CLI. If we don't need the manifest entry in CLI, + then we should uncomment this because we get annoying errors in AS7 logs + with the manifest entry. + <archive> + <manifest> + <addClasspath>false</addClasspath> + </manifest> + </archive> + --> </configuration> </plugin>
commit 4f883c6471da3e8ff4a943bb3c74728d66d41385 Merge: 8ee741b c583495 Author: John Mazzitelli mazz@redhat.com Date: Thu Dec 6 13:03:50 2012 -0500
Merge remote-tracking branch 'origin/master' into rhq-on-as7
commit c583495131a94424e9fb833a7dd842b950452b4d Author: John Mazzitelli mazz@redhat.com Date: Thu Dec 6 12:58:25 2012 -0500
be alittle better at knowing how long we should wait before we can start the comm layer
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/ShutdownListener.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/ShutdownListener.java index 8ab4d9d..3490df6 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/ShutdownListener.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/ShutdownListener.java @@ -18,6 +18,8 @@ */ package org.rhq.enterprise.server.core;
+import java.io.ByteArrayInputStream; +import java.io.File; import java.sql.Connection; import java.sql.SQLException; import java.sql.Statement; @@ -36,11 +38,13 @@ import org.apache.commons.logging.LogFactory;
import org.rhq.core.domain.cloud.Server; import org.rhq.core.domain.cloud.Server.OperationMode; +import org.rhq.core.util.file.FileUtil; import org.rhq.core.util.jdbc.JDBCUtil; import org.rhq.enterprise.server.RHQConstants; import org.rhq.enterprise.server.cloud.CloudManagerLocal; import org.rhq.enterprise.server.cloud.instance.ServerManagerLocal; import org.rhq.enterprise.server.scheduler.SchedulerLocal; +import org.rhq.enterprise.server.util.LookupUtil;
/** * This listens for the RHQ server's shutdown notification and when it hears it, will start shutting down RHQ components @@ -56,6 +60,7 @@ import org.rhq.enterprise.server.scheduler.SchedulerLocal; public class ShutdownListener { private final Log log = LogFactory.getLog(ShutdownListener.class);
+ private final String RHQ_SHUTDOWN_TIME_LOG_FILE = "rhq-shutdown-time.dat"; private final String RHQ_DB_TYPE_MAPPING_PROPERTY = "rhq.server.database.type-mapping";
@EJB @@ -70,6 +75,8 @@ public class ShutdownListener { @Resource(name = "RHQ_DS", mappedName = RHQConstants.DATASOURCE_JNDI_NAME) private DataSource dataSource;
+ private File shutdownTimeLogFile; + /** * This is called when the shutdown notification is received from the JBoss server. This gives a chance for us to * cleanly shutdown our application in an orderly fashion. @@ -81,6 +88,7 @@ public class ShutdownListener { // JBossAS 4.2.3 used to send us this JMX notification on shutdown - AS7 does not have shutdown notifications. // So we are using the @PreDestroy mechanism on a singleton EJB to attempt to clean up the application before it is shutdown log.info("Shutdown listener has been told we are shutting down - starting to clean up now..."); + logShutdownTime(); stopScheduler(); updateServerOperationMode(); stopEmbeddedDatabase(); @@ -88,6 +96,57 @@ public class ShutdownListener { }
/** + * This is the file that the {@link ShutdownListener} will write to when it logs + * the last time the server was shutdown. + * + * @return shutdown time log file location + * @throws Exception + */ + public File getShutdownTimeLogFile() throws Exception { + if (shutdownTimeLogFile == null) { + try { + CoreServerMBean coreServer = LookupUtil.getCoreServer(); + File dataDir = coreServer.getJBossServerDataDir(); + File timeFile = new File(dataDir, RHQ_SHUTDOWN_TIME_LOG_FILE); + if (!timeFile.exists()) { + ByteArrayInputStream data = new ByteArrayInputStream("0".getBytes()); + FileUtil.writeFile(data, timeFile); + } + shutdownTimeLogFile = timeFile; + } catch (Exception e) { + // only show ugly stack traces if the user runs the server in debug mode + if (log.isDebugEnabled()) { + log.warn("Failed to get shutdown time log file", e); + } else { + log.warn("Failed to get shutdown time log file: " + e.getMessage()); + } + throw e; + } + } + + return shutdownTimeLogFile; + } + + /** + * Stores the current epoch millis time in a file in the data directory. This is used by the + * StartupBean so it knows how long to wait (if at all) before completing startup (this is to + * give enough time to allow agents to realize the server has been down). + */ + private void logShutdownTime() { + try { + File shutdownTimeLogFile = getShutdownTimeLogFile(); + ByteArrayInputStream input = new ByteArrayInputStream(String.valueOf(System.currentTimeMillis()).getBytes()); + FileUtil.writeFile(input, shutdownTimeLogFile); + } catch (Throwable t) { + // only show ugly stack traces if the user runs the server in debug mode + if (log.isDebugEnabled()) { + log.warn("Failed to store shutdown time", t); + } else { + log.warn("Failed to store shutdown time: " + t.getMessage()); + } + } + } + /** * This will shutdown the scheduler. */ private void stopScheduler() { diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java index 9e92a69..a5a38d3 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java @@ -18,6 +18,9 @@ */ package org.rhq.enterprise.server.core;
+import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.lang.management.ManagementFactory; import java.net.InetAddress; import java.net.UnknownHostException; @@ -53,6 +56,7 @@ import org.rhq.core.domain.common.ProductInfo; import org.rhq.core.domain.resource.Agent; import org.rhq.core.util.ObjectNameFactory; import org.rhq.core.util.exception.ThrowableUtil; +import org.rhq.core.util.stream.StreamUtil; import org.rhq.enterprise.communications.ServiceContainerConfigurationConstants; import org.rhq.enterprise.communications.util.SecurityUtil; import org.rhq.enterprise.server.RHQConstants; @@ -124,6 +128,9 @@ public class StartupBean { @EJB private SystemManagerLocal systemManager;
+ @EJB + private ShutdownListener shutdownListener; + @Resource private TimerService timerService; // needed to schedule our plugin scanner
@@ -190,6 +197,31 @@ public class StartupBean { return; }
+ private long readShutdownTimeLogFile() throws Exception { + File timeFile = shutdownListener.getShutdownTimeLogFile(); + if (!timeFile.exists()) { + // this is probably ok, perhaps its the first time we started this server, so this exception + // just forces the caller to use startup time instead + throw new FileNotFoundException(); + } + + try { + FileInputStream input = new FileInputStream(timeFile); + String timeString = new String(StreamUtil.slurp(input)); + return Long.parseLong(timeString); + } catch (Exception e) { + if (log.isDebugEnabled()) { + log.warn("Failed to read the shutdown time log file", e); + } else { + log.warn("Failed to read the shutdown time log file: " + e.getMessage()); + } + throw e; + } finally { + // since we are starting again, we want to remove the now obsolete shutdown time file + timeFile.delete(); + } + } + private void initializeServer() { // Ensure the class is loaded and the dbType is set for our current db Connection conn = null; @@ -414,7 +446,7 @@ public class StartupBean { } catch (Exception e) { ensureDownTimeSecs = 70; } - long elapsed = getElapsedTimeSinceStartup(); + long elapsed = getElapsedTimeSinceLastShutdown(); long sleepTime = (ensureDownTimeSecs * 1000L) - elapsed; if (sleepTime > 0) { try { @@ -757,19 +789,30 @@ public class StartupBean { }
/** - * Gets the number of milliseconds since the time when the server was started. + * Gets the number of milliseconds since the time when the server was last shutdown. + * If we don't know, then return the time since it was started. * @return elapsed time since server started, 0 if not known */ - private long getElapsedTimeSinceStartup() throws RuntimeException { + private long getElapsedTimeSinceLastShutdown() throws RuntimeException { long elapsed; + try { - CoreServerMBean coreServer = LookupUtil.getCoreServer(); - Date startTime = coreServer.getBootTime(); + long shutdownTime = readShutdownTimeLogFile(); long currentTime = System.currentTimeMillis(); - elapsed = currentTime - startTime.getTime(); - } catch (Exception e) { - elapsed = 0; + elapsed = currentTime - shutdownTime; + } catch (Exception ignore) { + // we will have already logged an error, don't bother logging more + // but now at least try to see how long its been since we've started + try { + CoreServerMBean coreServer = LookupUtil.getCoreServer(); + Date startTime = coreServer.getBootTime(); + long currentTime = System.currentTimeMillis(); + elapsed = currentTime - startTime.getTime(); + } catch (Exception e1) { + elapsed = 0; + } } + return elapsed; }
commit 8ee741be7686f3b218d820a229caa43b7d55ab99 Author: John Mazzitelli mazz@redhat.com Date: Thu Dec 6 12:58:25 2012 -0500
be alittle better at knowing how long we should wait before we can start the comm layer
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/ShutdownListener.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/ShutdownListener.java index 8ab4d9d..3490df6 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/ShutdownListener.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/ShutdownListener.java @@ -18,6 +18,8 @@ */ package org.rhq.enterprise.server.core;
+import java.io.ByteArrayInputStream; +import java.io.File; import java.sql.Connection; import java.sql.SQLException; import java.sql.Statement; @@ -36,11 +38,13 @@ import org.apache.commons.logging.LogFactory;
import org.rhq.core.domain.cloud.Server; import org.rhq.core.domain.cloud.Server.OperationMode; +import org.rhq.core.util.file.FileUtil; import org.rhq.core.util.jdbc.JDBCUtil; import org.rhq.enterprise.server.RHQConstants; import org.rhq.enterprise.server.cloud.CloudManagerLocal; import org.rhq.enterprise.server.cloud.instance.ServerManagerLocal; import org.rhq.enterprise.server.scheduler.SchedulerLocal; +import org.rhq.enterprise.server.util.LookupUtil;
/** * This listens for the RHQ server's shutdown notification and when it hears it, will start shutting down RHQ components @@ -56,6 +60,7 @@ import org.rhq.enterprise.server.scheduler.SchedulerLocal; public class ShutdownListener { private final Log log = LogFactory.getLog(ShutdownListener.class);
+ private final String RHQ_SHUTDOWN_TIME_LOG_FILE = "rhq-shutdown-time.dat"; private final String RHQ_DB_TYPE_MAPPING_PROPERTY = "rhq.server.database.type-mapping";
@EJB @@ -70,6 +75,8 @@ public class ShutdownListener { @Resource(name = "RHQ_DS", mappedName = RHQConstants.DATASOURCE_JNDI_NAME) private DataSource dataSource;
+ private File shutdownTimeLogFile; + /** * This is called when the shutdown notification is received from the JBoss server. This gives a chance for us to * cleanly shutdown our application in an orderly fashion. @@ -81,6 +88,7 @@ public class ShutdownListener { // JBossAS 4.2.3 used to send us this JMX notification on shutdown - AS7 does not have shutdown notifications. // So we are using the @PreDestroy mechanism on a singleton EJB to attempt to clean up the application before it is shutdown log.info("Shutdown listener has been told we are shutting down - starting to clean up now..."); + logShutdownTime(); stopScheduler(); updateServerOperationMode(); stopEmbeddedDatabase(); @@ -88,6 +96,57 @@ public class ShutdownListener { }
/** + * This is the file that the {@link ShutdownListener} will write to when it logs + * the last time the server was shutdown. + * + * @return shutdown time log file location + * @throws Exception + */ + public File getShutdownTimeLogFile() throws Exception { + if (shutdownTimeLogFile == null) { + try { + CoreServerMBean coreServer = LookupUtil.getCoreServer(); + File dataDir = coreServer.getJBossServerDataDir(); + File timeFile = new File(dataDir, RHQ_SHUTDOWN_TIME_LOG_FILE); + if (!timeFile.exists()) { + ByteArrayInputStream data = new ByteArrayInputStream("0".getBytes()); + FileUtil.writeFile(data, timeFile); + } + shutdownTimeLogFile = timeFile; + } catch (Exception e) { + // only show ugly stack traces if the user runs the server in debug mode + if (log.isDebugEnabled()) { + log.warn("Failed to get shutdown time log file", e); + } else { + log.warn("Failed to get shutdown time log file: " + e.getMessage()); + } + throw e; + } + } + + return shutdownTimeLogFile; + } + + /** + * Stores the current epoch millis time in a file in the data directory. This is used by the + * StartupBean so it knows how long to wait (if at all) before completing startup (this is to + * give enough time to allow agents to realize the server has been down). + */ + private void logShutdownTime() { + try { + File shutdownTimeLogFile = getShutdownTimeLogFile(); + ByteArrayInputStream input = new ByteArrayInputStream(String.valueOf(System.currentTimeMillis()).getBytes()); + FileUtil.writeFile(input, shutdownTimeLogFile); + } catch (Throwable t) { + // only show ugly stack traces if the user runs the server in debug mode + if (log.isDebugEnabled()) { + log.warn("Failed to store shutdown time", t); + } else { + log.warn("Failed to store shutdown time: " + t.getMessage()); + } + } + } + /** * This will shutdown the scheduler. */ private void stopScheduler() { diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java index 0057d83..10cbc77 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java @@ -18,6 +18,9 @@ */ package org.rhq.enterprise.server.core;
+import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.lang.management.ManagementFactory; import java.net.InetAddress; import java.net.UnknownHostException; @@ -53,6 +56,7 @@ import org.rhq.core.domain.common.ProductInfo; import org.rhq.core.domain.resource.Agent; import org.rhq.core.util.ObjectNameFactory; import org.rhq.core.util.exception.ThrowableUtil; +import org.rhq.core.util.stream.StreamUtil; import org.rhq.enterprise.communications.ServiceContainerConfigurationConstants; import org.rhq.enterprise.communications.util.SecurityUtil; import org.rhq.enterprise.server.RHQConstants; @@ -124,6 +128,9 @@ public class StartupBean { @EJB private SystemManagerLocal systemManager;
+ @EJB + private ShutdownListener shutdownListener; + @Resource private TimerService timerService; // needed to schedule our plugin scanner
@@ -187,6 +194,31 @@ public class StartupBean { return; }
+ private long readShutdownTimeLogFile() throws Exception { + File timeFile = shutdownListener.getShutdownTimeLogFile(); + if (!timeFile.exists()) { + // this is probably ok, perhaps its the first time we started this server, so this exception + // just forces the caller to use startup time instead + throw new FileNotFoundException(); + } + + try { + FileInputStream input = new FileInputStream(timeFile); + String timeString = new String(StreamUtil.slurp(input)); + return Long.parseLong(timeString); + } catch (Exception e) { + if (log.isDebugEnabled()) { + log.warn("Failed to read the shutdown time log file", e); + } else { + log.warn("Failed to read the shutdown time log file: " + e.getMessage()); + } + throw e; + } finally { + // since we are starting again, we want to remove the now obsolete shutdown time file + timeFile.delete(); + } + } + private void initializeServer() { // Ensure the class is loaded and the dbType is set for our current db Connection conn = null; @@ -411,7 +443,7 @@ public class StartupBean { } catch (Exception e) { ensureDownTimeSecs = 70; } - long elapsed = getElapsedTimeSinceStartup(); + long elapsed = getElapsedTimeSinceLastShutdown(); long sleepTime = (ensureDownTimeSecs * 1000L) - elapsed; if (sleepTime > 0) { try { @@ -754,19 +786,30 @@ public class StartupBean { }
/** - * Gets the number of milliseconds since the time when the server was started. + * Gets the number of milliseconds since the time when the server was last shutdown. + * If we don't know, then return the time since it was started. * @return elapsed time since server started, 0 if not known */ - private long getElapsedTimeSinceStartup() throws RuntimeException { + private long getElapsedTimeSinceLastShutdown() throws RuntimeException { long elapsed; + try { - CoreServerMBean coreServer = LookupUtil.getCoreServer(); - Date startTime = coreServer.getBootTime(); + long shutdownTime = readShutdownTimeLogFile(); long currentTime = System.currentTimeMillis(); - elapsed = currentTime - startTime.getTime(); - } catch (Exception e) { - elapsed = 0; + elapsed = currentTime - shutdownTime; + } catch (Exception ignore) { + // we will have already logged an error, don't bother logging more + // but now at least try to see how long its been since we've started + try { + CoreServerMBean coreServer = LookupUtil.getCoreServer(); + Date startTime = coreServer.getBootTime(); + long currentTime = System.currentTimeMillis(); + elapsed = currentTime - startTime.getTime(); + } catch (Exception e1) { + elapsed = 0; + } } + return elapsed; }
commit af23499335a2509bababbf5008c45c988ed641d5 Merge: 90238a3 ab417ec Author: John Mazzitelli mazz@redhat.com Date: Thu Dec 6 11:05:38 2012 -0500
Merge remote-tracking branch 'origin/master' into rhq-on-as7
commit ab417ec5cd4bfc2c27f345f3bdc4a24e346252ec Author: Jay Shaughnessy jshaughn@redhat.com Date: Wed Dec 5 17:19:45 2012 -0500
Moving the db-upgrade jenkins job to 2.4.0 as 2.3.1 is no longer supported by db-upgrade.xml.
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/2.3.1/db-data-combined-2.3.1.xml b/modules/core/dbutils/src/main/scripts/dbsetup/2.3.1/db-data-combined-2.3.1.xml deleted file mode 100644 index 7d83798..0000000 --- a/modules/core/dbutils/src/main/scripts/dbsetup/2.3.1/db-data-combined-2.3.1.xml +++ /dev/null @@ -1,663 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<dbsetup name="data.xml"> -<!-- BEGIN: rhq-data.xml --> -<!-- BEGIN: auth-data.xml --> - - - <table name="RHQ_PRINCIPAL"> - <data id="2" PRINCIPAL="rhqadmin" PASSWORD="x1XwrxKuPvYUILiOnOZTLg=="/> - </table> - -<!-- END: auth-data.xml --> -<!-- BEGIN: authz-data.xml --> - - - <!-- the overlord user --> - <table name="RHQ_SUBJECT"> - <data ID="1" - NAME="admin" - FIRST_NAME="Super" - LAST_NAME="User" - FSYSTEM="TRUE"/> - </table> - - <!-- the initial rhqadmin user --> - <table name="RHQ_SUBJECT"> - <data ID="2" - NAME="rhqadmin" - FIRST_NAME="RHQ" - LAST_NAME="Administrator" - EMAIL_ADDRESS="rhqadmin@localhost" - FSYSTEM="FALSE"/> - </table> - - <!-- Define the system root role which includes our overlord and rhqadmin users --> - <table name="RHQ_ROLE"> - <data ID="1" - NAME="Super User Role" - FSYSTEM="TRUE" - DESCRIPTION="System superuser role that provides full access to everything. This role cannot be modified."/> - <data ID="2" - NAME="All Resources Role" - FSYSTEM="FALSE" - DESCRIPTION="Provides full access to all resources in inventory. Cannot modify users, roles or server settings."/> - </table> - - <!-- associate the root users with all security permissions --> - <table name="RHQ_SUBJECT_ROLE_MAP"> - <data SUBJECT_ID="1" ROLE_ID="1"/> - <!-- overlord user --> - <data SUBJECT_ID="2" ROLE_ID="1"/> - <!-- rhqadmin user --> - </table> - - <table name="RHQ_PERMISSION"> - <!-- give super-user-role all permissions (resource perms is mainly just to show on view-role page) --> - <data ROLE_ID="1" OPERATION="0"/> - <!-- Permission.MANAGE_SECURITY --> - <data ROLE_ID="1" OPERATION="1"/> - <!-- Permission.MANAGE_INVENTORY --> - <data ROLE_ID="1" OPERATION="2"/> - <!-- Permission.MANAGE_SETTINGS --> - <!-- resource permissions start here--> - <data ROLE_ID="1" OPERATION="3"/> - <!-- Permission.VIEW_RESOURCE --> - <data ROLE_ID="1" OPERATION="4"/> - <!-- Permission.MODIFY_RESOURCE --> - <data ROLE_ID="1" OPERATION="5"/> - <!-- Permission.DELETE_RESOURCE --> - <data ROLE_ID="1" OPERATION="6"/> - <!-- Permission.CREATE_CHILD_RESOURCES --> - <data ROLE_ID="1" OPERATION="7"/> - <!-- Permission.MANAGE_ALERTS --> - <data ROLE_ID="1" OPERATION="8"/> - <!-- Permission.MANAGE_MEASUREMENTS --> - <data ROLE_ID="1" OPERATION="9"/> - <!-- Permission.MANAGE_CONTENT --> - <data ROLE_ID="1" OPERATION="10"/> - <!-- Permission.CONTROL --> - <data ROLE_ID="1" OPERATION="11"/> - <!-- Permission.CONFIGURE --> - - <!-- give all-resources-role all permissions (resource perms is mainly just to show on view-role page) --> - <data ROLE_ID="2" OPERATION="1"/> - <!-- Permission.MANAGE_INVENTORY --> - <!-- resource permissions start here--> - <data ROLE_ID="2" OPERATION="3"/> - <!-- Permission.VIEW_RESOURCE --> - <data ROLE_ID="2" OPERATION="4"/> - <!-- Permission.MODIFY_RESOURCE --> - <data ROLE_ID="2" OPERATION="5"/> - <!-- Permission.DELETE_RESOURCE --> - <data ROLE_ID="2" OPERATION="6"/> - <!-- Permission.CREATE_CHILD_RESOURCES --> - <data ROLE_ID="2" OPERATION="7"/> - <!-- Permission.MANAGE_ALERTS --> - <data ROLE_ID="2" OPERATION="8"/> - <!-- Permission.MANAGE_MEASUREMENTS --> - <data ROLE_ID="2" OPERATION="9"/> - <!-- Permission.MANAGE_CONTENT --> - <data ROLE_ID="2" OPERATION="10"/> - <!-- Permission.CONTROL --> - <data ROLE_ID="2" OPERATION="11"/> - <!-- Permission.CONFIGURE --> - </table> - -<!-- END: authz-data.xml --> -<!-- BEGIN: sysconfig-data.xml --> - - - <!-- - This file contains the seed data for the configuration table. - All keys mentioned here should be referenced via the RHQConstants class - --> - <table name="RHQ_SYSTEM_CONFIG"> - <data ID="1" PROPERTY_KEY="SERVER_VERSION" PROPERTY_VALUE="1.3.1.GA" - DEFAULT_PROPERTY_VALUE="1.3.1.GA" FREAD_ONLY="TRUE"/> - <data ID="2" PROPERTY_KEY="DB_SCHEMA_VERSION" PROPERTY_VALUE="2.59" - DEFAULT_PROPERTY_VALUE="2.59" FREAD_ONLY="TRUE"/> - <data ID="3" PROPERTY_KEY="CAM_JAAS_PROVIDER" PROPERTY_VALUE="JDBC" - DEFAULT_PROPERTY_VALUE="JDBC" FREAD_ONLY="FALSE"/> - <data ID="4" PROPERTY_KEY="CAM_BASE_URL" PROPERTY_VALUE="http://169.254.222.60:7080/" - DEFAULT_PROPERTY_VALUE="http://169.254.222.60:7080/" FREAD_ONLY="FALSE"/> - <data ID="9" PROPERTY_KEY="CAM_HELP_USER" PROPERTY_VALUE="web" - DEFAULT_PROPERTY_VALUE="web" FREAD_ONLY="FALSE"/> - <data ID="10" PROPERTY_KEY="CAM_HELP_PASSWORD" PROPERTY_VALUE="user" - DEFAULT_PROPERTY_VALUE="user" FREAD_ONLY="FALSE"/> - - <!-- default LDAP configuration options --> - <data ID="11" PROPERTY_KEY="CAM_LDAP_NAMING_FACTORY_INITIAL" - PROPERTY_VALUE="com.sun.jndi.ldap.LdapCtxFactory" - DEFAULT_PROPERTY_VALUE="com.sun.jndi.ldap.LdapCtxFactory" - FREAD_ONLY="FALSE"/> - <data ID="12" PROPERTY_KEY="CAM_LDAP_NAMING_PROVIDER_URL" - PROPERTY_VALUE="ldap://localhost/" - DEFAULT_PROPERTY_VALUE="ldap://localhost/" - FREAD_ONLY="FALSE"/> - <data ID="13" PROPERTY_KEY="CAM_LDAP_LOGIN_PROPERTY" - PROPERTY_VALUE="cn" - DEFAULT_PROPERTY_VALUE="cn" FREAD_ONLY="FALSE"/> - <data ID="14" PROPERTY_KEY="CAM_LDAP_BASE_DN" - PROPERTY_VALUE="o=JBoss,c=US" - DEFAULT_PROPERTY_VALUE="o=JBoss,c=US" - FREAD_ONLY="FALSE"/> - <data ID="15" PROPERTY_KEY="CAM_LDAP_BIND_DN" - PROPERTY_VALUE="" - DEFAULT_PROPERTY_VALUE="" FREAD_ONLY="FALSE"/> - <data ID="16" PROPERTY_KEY="CAM_LDAP_BIND_PW" - PROPERTY_VALUE="" - DEFAULT_PROPERTY_VALUE="" FREAD_ONLY="FALSE"/> - <data ID="17" PROPERTY_KEY="CAM_LDAP_PROTOCOL" - PROPERTY_VALUE="" DEFAULT_PROPERTY_VALUE="" - FREAD_ONLY="FALSE"/> - <data ID="18" PROPERTY_KEY="CAM_LDAP_FILTER" - PROPERTY_VALUE="" DEFAULT_PROPERTY_VALUE="" - FREAD_ONLY="FALSE"/> - - <!-- Does this build support Syslog actions? --> - <data ID="21" PROPERTY_KEY="CAM_SYSLOG_ACTIONS_ENABLED" - PROPERTY_VALUE="false" DEFAULT_PROPERTY_VALUE="false" - FREAD_ONLY="FALSE"/> - <data ID="23" PROPERTY_KEY="CAM_GUIDE_ENABLED" - PROPERTY_VALUE="true" - DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> - <data ID="24" PROPERTY_KEY="CAM_RT_COLLECT_IP_ADDRS" - PROPERTY_VALUE="true" - DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> - - <!-- Default data storage options --> - <!-- Default 14 days --> - <data ID="26" PROPERTY_KEY="CAM_DATA_PURGE_1H" - PROPERTY_VALUE="1209600000" DEFAULT_PROPERTY_VALUE="1209600000" - FREAD_ONLY="FALSE"/> - <!-- Default 31 days --> - <data ID="27" PROPERTY_KEY="CAM_DATA_PURGE_6H" - PROPERTY_VALUE="2678400000" DEFAULT_PROPERTY_VALUE="2678400000" - FREAD_ONLY="FALSE"/> - <!-- Default 1 year --> - <data ID="28" PROPERTY_KEY="CAM_DATA_PURGE_1D" - PROPERTY_VALUE="31536000000" DEFAULT_PROPERTY_VALUE="31536000000" - FREAD_ONLY="FALSE"/> - - <!-- Baseline options --> - <!-- How often to calculate, default 3 days; if 0, never calculate them automatically --> - <data ID="29" PROPERTY_KEY="CAM_BASELINE_FREQUENCY" - PROPERTY_VALUE="259200000" DEFAULT_PROPERTY_VALUE="259200000" - FREAD_ONLY="FALSE"/> - <!-- How much data to include in the calulation, default 7 days --> - <data ID="30" PROPERTY_KEY="CAM_BASELINE_DATASET" - PROPERTY_VALUE="604800000" DEFAULT_PROPERTY_VALUE="604800000" - FREAD_ONLY="FALSE"/> - - <!-- ID 31 has been deleted --> - - <!-- How often to run database maintainence routines --> - <data ID="32" PROPERTY_KEY="CAM_DATA_MAINTENANCE" - PROPERTY_VALUE="3600000" DEFAULT_PROPERTY_VALUE="3600000" FREAD_ONLY="FALSE"/> - - <!-- How long to keep RT data around --> - <data ID="34" PROPERTY_KEY="RT_DATA_PURGE" PROPERTY_VALUE="2678400000" - DEFAULT_PROPERTY_VALUE="2678400000" FREAD_ONLY="FALSE"/> - - <!-- Whether to reindex the data tables nightly --> - <data ID="35" PROPERTY_KEY="DATA_REINDEX_NIGHTLY" PROPERTY_VALUE="true" - DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> - - <!-- How long to keep alerts around --> - <data ID="36" PROPERTY_KEY="ALERT_PURGE" PROPERTY_VALUE="2678400000" - DEFAULT_PROPERTY_VALUE="2678400000" FREAD_ONLY="FALSE"/> - - <!-- Determines if SNMP actions will be used --> - <data ID="37" PROPERTY_KEY="SNMP_VERSION" PROPERTY_VALUE="" DEFAULT_PROPERTY_VALUE="" FREAD_ONLY="FALSE"/> - <data ID="38" PROPERTY_KEY="SNMP_AUTH_PROTOCOL" PROPERTY_VALUE="MD5" DEFAULT_PROPERTY_VALUE="" - FREAD_ONLY="FALSE"/> - <data ID="39" PROPERTY_KEY="SNMP_AUTH_PASSPHRASE" PROPERTY_VALUE="" DEFAULT_PROPERTY_VALUE="" - FREAD_ONLY="FALSE"/> - <data ID="40" PROPERTY_KEY="SNMP_PRIV_PASSPHRASE" PROPERTY_VALUE="" DEFAULT_PROPERTY_VALUE="" - FREAD_ONLY="FALSE"/> - <data ID="41" PROPERTY_KEY="SNMP_COMMUNITY" PROPERTY_VALUE="public" DEFAULT_PROPERTY_VALUE="" - FREAD_ONLY="FALSE"/> - <data ID="42" PROPERTY_KEY="SNMP_ENGINE_ID" PROPERTY_VALUE="" DEFAULT_PROPERTY_VALUE="" FREAD_ONLY="FALSE"/> - <data ID="43" PROPERTY_KEY="SNMP_CONTEXT_NAME" PROPERTY_VALUE="" DEFAULT_PROPERTY_VALUE="" FREAD_ONLY="FALSE"/> - <data ID="44" PROPERTY_KEY="SNMP_SECURITY_NAME" PROPERTY_VALUE="" DEFAULT_PROPERTY_VALUE="" FREAD_ONLY="FALSE"/> - <data ID="45" PROPERTY_KEY="SNMP_TRAP_OID" PROPERTY_VALUE="" DEFAULT_PROPERTY_VALUE="" FREAD_ONLY="FALSE"/> - <data ID="46" PROPERTY_KEY="SNMP_ENTERPRISE_OID" PROPERTY_VALUE="" DEFAULT_PROPERTY_VALUE="" - FREAD_ONLY="FALSE"/> - <data ID="47" PROPERTY_KEY="SNMP_GENERIC_ID" PROPERTY_VALUE="" DEFAULT_PROPERTY_VALUE="" FREAD_ONLY="FALSE"/> - <data ID="48" PROPERTY_KEY="SNMP_SPECIFIC_ID" PROPERTY_VALUE="" DEFAULT_PROPERTY_VALUE="" FREAD_ONLY="FALSE"/> - <data ID="49" PROPERTY_KEY="SNMP_AGENT_ADDRESS" PROPERTY_VALUE="" DEFAULT_PROPERTY_VALUE="" FREAD_ONLY="FALSE"/> - <data ID="50" PROPERTY_KEY="SNMP_PRIVACY_PROTOCOL" PROPERTY_VALUE="" DEFAULT_PROPERTY_VALUE="" - FREAD_ONLY="FALSE"/> - - <!-- How long to keep events around (1209600000 millis == 14 days) --> - <data ID="51" PROPERTY_KEY="EVENT_PURGE" PROPERTY_VALUE="1209600000" - DEFAULT_PROPERTY_VALUE="1209600000" FREAD_ONLY="FALSE"/> - - <!-- How long an agent is allowed to be quiet before we consider it down and backfill it --> - <data ID="52" PROPERTY_KEY="AGENT_MAX_QUIET_TIME_ALLOWED" PROPERTY_VALUE="900000" - DEFAULT_PROPERTY_VALUE="900000" FREAD_ONLY="FALSE"/> - - <!-- Will our server-cloud support agents auto-updating themselves? --> - <data ID="53" PROPERTY_KEY="ENABLE_AGENT_AUTO_UPDATE" PROPERTY_VALUE="true" - DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> - - <!-- How old does a trait have to be in order to get purged --> - <data ID="54" PROPERTY_KEY="TRAIT_PURGE" PROPERTY_VALUE="31536000000" - DEFAULT_PROPERTY_VALUE="31536000000" FREAD_ONLY="FALSE"/> - - <!-- How old does availability have to be in order to get purged --> - <data ID="55" PROPERTY_KEY="AVAILABILITY_PURGE" PROPERTY_VALUE="31536000000" - DEFAULT_PROPERTY_VALUE="31536000000" FREAD_ONLY="FALSE"/> - - </table> - -<!-- END: sysconfig-data.xml --> -<!-- BEGIN: measurement-data.xml --> - - <table name="RHQ_NUMBERS"> - <data i="0"/> - <data i="1"/> - <data i="2"/> - <data i="3"/> - <data i="4"/> - <data i="5"/> - <data i="6"/> - <data i="7"/> - <data i="8"/> - <data i="9"/> - <data i="10"/> - <data i="11"/> - <data i="12"/> - <data i="13"/> - <data i="14"/> - <data i="15"/> - <data i="16"/> - <data i="17"/> - <data i="18"/> - <data i="19"/> - <data i="20"/> - <data i="21"/> - <data i="22"/> - <data i="23"/> - <data i="24"/> - <data i="25"/> - <data i="26"/> - <data i="27"/> - <data i="28"/> - <data i="29"/> - <data i="30"/> - <data i="31"/> - <data i="32"/> - <data i="33"/> - <data i="34"/> - <data i="35"/> - <data i="36"/> - <data i="37"/> - <data i="38"/> - <data i="39"/> - <data i="40"/> - <data i="41"/> - <data i="42"/> - <data i="43"/> - <data i="44"/> - <data i="45"/> - <data i="46"/> - <data i="47"/> - <data i="48"/> - <data i="49"/> - <data i="50"/> - <data i="51"/> - <data i="52"/> - <data i="53"/> - <data i="54"/> - <data i="55"/> - <data i="56"/> - <data i="57"/> - <data i="58"/> - <data i="59"/> - </table> - -<!-- END: measurement-data.xml --> -<!-- BEGIN: content-data.xml --> - - <table name="RHQ_ARCHITECTURE"> - <data id="1" name="noarch"/> - <data id="2" name="i386"/> - <data id="3" name="i486"/> - <data id="4" name="i586"/> - <data id="5" name="i686"/> - <data id="6" name="alpha"/> - <data id="7" name="alphaev6"/> - <data id="8" name="ia64"/> - <data id="9" name="sparc"/> - <data id="10" name="sparcv9"/> - <data id="11" name="sparc64"/> - <data id="12" name="src"/> - <data id="13" name="s390"/> - <data id="14" name="athlon"/> - <data id="15" name="s390x"/> - <data id="16" name="ppc"/> - <data id="17" name="ppc64"/> - <data id="18" name="pSeries"/> - <data id="19" name="iSeries"/> - <data id="20" name="x86_64"/> - <data id="21" name="ppc64iseries"/> - <data id="22" name="ppc64pseries"/> - <data id="23" name="sparc-solaris"/> - <data id="24" name="sparc.sun4u-solaris"/> - <data id="25" name="tar"/> - <data id="26" name="ia32e"/> - <data id="27" name="amd64"/> - <data id="28" name="i386-solaris"/> - <data id="29" name="nosrc"/> - <data id="30" name="sparc-solaris-patch"/> - <data id="31" name="i386-solaris-patch"/> - <data id="32" name="sparc-solaris-patch-cluster"/> - <data id="33" name="i386-solaris-patch-cluster"/> - <data id="34" name="noarch-solaris"/> - <data id="35" name="noarch-solaris-patch"/> - <data id="36" name="noarch-solaris-patch-cluster"/> - <data id="37" name="solaris-patch"/> - <data id="38" name="solaris-patch-cluster"/> - </table> -<!-- END: content-data.xml --> -<!-- BEGIN: jms-data.xml --> - -<!-- the schema matches that which would be automatically created by the JMS subsystem --> -<!-- see deploy/jms/rhq-jdbc-state-service.xml and rhq-jdbc2-service.xml --> -<!-- the data must match that which is expected in conf/login-config.xml --> - - - <table name="JMS_USERS"> - <data USERID="guest" PASSWD="guest" /> - </table> - - <table name="JMS_ROLES"> - <data ROLEID="guest" USERID="guest" /> - </table> - -<!-- END: jms-data.xml --> -<!-- END: rhq-data.xml --> -<!-- BEGIN: jon-data.xml --> - - - <!-- *** metadata *** --> - - <table name="RHQ_CONFIG_DEF"> - <data ID="101" - NAME="JBossASPatchSource"/> - </table> - - <table name="RHQ_CONFIG_PROP_DEF"> - <data ID="101" - NAME="url" - DISPLAY_NAME="Feed URL" - DESCRIPTION="Destination URL of the feed." - REQUIRED="1" - READONLY="0" - SUMMARY="0" - ACTIVATION_POLICY="IMMEDIATE" - ORDER_INDEX="0" - SIMPLE_TYPE="STRING" - ALLOW_CUSTOM_ENUM_VALUE="0" - DTYPE="property" - CONFIG_DEF_ID="101" - UNITS="0"/> - <data ID="102" - NAME="username" - DISPLAY_NAME="Username" - DESCRIPTION="Username used to log into the feed." - REQUIRED="0" - READONLY="0" - SUMMARY="0" - ACTIVATION_POLICY="IMMEDIATE" - ORDER_INDEX="1" - SIMPLE_TYPE="STRING" - ALLOW_CUSTOM_ENUM_VALUE="0" - DTYPE="property" - CONFIG_DEF_ID="101" - UNITS="0"/> - <data ID="103" - NAME="password" - DISPLAY_NAME="Password" - DESCRIPTION="Password used to log into the feed." - REQUIRED="0" - READONLY="0" - SUMMARY="0" - ACTIVATION_POLICY="IMMEDIATE" - ORDER_INDEX="2" - SIMPLE_TYPE="PASSWORD" - ALLOW_CUSTOM_ENUM_VALUE="0" - DTYPE="property" - CONFIG_DEF_ID="101" - UNITS="0"/> - <data ID="104" - NAME="active" - DISPLAY_NAME="Active" - DESCRIPTION="Indicates if this instance should go out and check the feed for packages." - REQUIRED="1" - READONLY="0" - SUMMARY="0" - ACTIVATION_POLICY="IMMEDIATE" - ORDER_INDEX="3" - SIMPLE_TYPE="BOOLEAN" - ALLOW_CUSTOM_ENUM_VALUE="0" - DTYPE="property" - CONFIG_DEF_ID="101" - UNITS="0"/> - <data ID="105" - NAME="proxyUrl" - DISPLAY_NAME="Proxy URL" - REQUIRED="0" - READONLY="0" - SUMMARY="0" - ACTIVATION_POLICY="IMMEDIATE" - ORDER_INDEX="4" - SIMPLE_TYPE="STRING" - ALLOW_CUSTOM_ENUM_VALUE="0" - DTYPE="property" - CONFIG_DEF_ID="101" - UNITS="0"/> - <data ID="106" - NAME="proxyPort" - DISPLAY_NAME="Proxy Port" - REQUIRED="0" - READONLY="0" - SUMMARY="0" - ACTIVATION_POLICY="IMMEDIATE" - ORDER_INDEX="5" - SIMPLE_TYPE="STRING" - ALLOW_CUSTOM_ENUM_VALUE="0" - DTYPE="property" - CONFIG_DEF_ID="101" - UNITS="0"/> - <data ID="107" - NAME="proxyUsername" - DISPLAY_NAME="Proxy Username" - REQUIRED="0" - READONLY="0" - SUMMARY="0" - ACTIVATION_POLICY="IMMEDIATE" - ORDER_INDEX="6" - SIMPLE_TYPE="STRING" - ALLOW_CUSTOM_ENUM_VALUE="0" - DTYPE="property" - CONFIG_DEF_ID="101" - UNITS="0"/> - <data ID="108" - NAME="proxyPassword" - DISPLAY_NAME="Proxy Password" - REQUIRED="0" - READONLY="0" - SUMMARY="0" - ACTIVATION_POLICY="IMMEDIATE" - ORDER_INDEX="7" - SIMPLE_TYPE="STRING" - ALLOW_CUSTOM_ENUM_VALUE="0" - DTYPE="property" - CONFIG_DEF_ID="101" - UNITS="0"/> - </table> - - <table name="RHQ_CONTENT_SOURCE_TYPE"> - <data ID="101" - NAME="JBossASPatchSource" - DISPLAY_NAME="JBoss CSP Patch Content Source" - DESCRIPTION="This content source retrieves packages from the JBoss CSP RSS feed." - PLUGIN_NAME="JBossASPatchContentSourcePlugin" - DEFAULT_LAZY_LOAD="1" - DEFAULT_DOWNLOAD_MODE="FILESYSTEM" - DEFAULT_SYNC_SCHEDULE="0 0 3 * * ?" - API_CLASS="org.rhq.enterprise.server.plugins.jboss.software.JBossSoftwareContentSourceAdapter" - SOURCE_CONFIG_DEF_ID="101"/> - </table> - - - <!-- Default template for the AS software content source type's configuration --> - <table name="RHQ_CONFIG"> - <data ID="101" - VERSION="0" - CTIME="1267099200000" - MTIME="1267099200000"/> - </table> - - <table name="RHQ_CONFIG_PROPERTY"> - <data ID="101" - NAME="url" - CONFIGURATION_ID="101" - STRING_VALUE="" - OVERRIDE="0" - DTYPE="property"/> - <data ID="102" - NAME="username" - CONFIGURATION_ID="101" - OVERRIDE="0" - DTYPE="property"/> - <data ID="103" - NAME="password" - CONFIGURATION_ID="101" - OVERRIDE="0" - DTYPE="property"/> - <data ID="104" - NAME="proxyUrl" - CONFIGURATION_ID="101" - OVERRIDE="0" - DTYPE="property"/> - <data ID="105" - NAME="proxyPort" - CONFIGURATION_ID="101" - OVERRIDE="0" - DTYPE="property"/> - <data ID="106" - NAME="active" - CONFIGURATION_ID="101" - STRING_VALUE="true" - OVERRIDE="0" - DTYPE="property"/> - <data ID="107" - NAME="proxyUsername" - CONFIGURATION_ID="101" - OVERRIDE="0" - DTYPE="property"/> - <data ID="108" - NAME="proxyPassword" - CONFIGURATION_ID="101" - OVERRIDE="0" - DTYPE="property"/> - </table> - - <table name="RHQ_CONFIG_TEMPLATE"> - <data ID="101" - NAME="default" - DESCRIPTION="the default template" - CONFIG_ID="101" - CONFIG_DEF_ID="101" - IS_DEFAULT="1"/> - </table> - - - <!-- *** data *** --> - - <table name="RHQ_CONFIG"> - <data ID="102" - VERSION="0" - CTIME="1267099200000" - MTIME="1267099200000"/> - </table> - - <!-- Data for the content source itself --> - <table name="RHQ_CONFIG_PROPERTY"> - <data ID="111" - NAME="url" - CONFIGURATION_ID="102" - STRING_VALUE="https://support.redhat.com/jbossnetwork/restricted/feed/software.html?produc..." - OVERRIDE="0" - DTYPE="property"/> - <data ID="112" - NAME="username" - CONFIGURATION_ID="102" - OVERRIDE="0" - DTYPE="property"/> - <data ID="113" - NAME="password" - CONFIGURATION_ID="102" - OVERRIDE="0" - DTYPE="property"/> - <data ID="114" - NAME="proxyUrl" - CONFIGURATION_ID="102" - OVERRIDE="0" - DTYPE="property"/> - <data ID="115" - NAME="proxyPort" - CONFIGURATION_ID="102" - OVERRIDE="0" - DTYPE="property"/> - <data ID="116" - NAME="active" - CONFIGURATION_ID="102" - STRING_VALUE="false" - OVERRIDE="0" - DTYPE="property"/> - <data ID="117" - NAME="proxyUsername" - CONFIGURATION_ID="102" - OVERRIDE="0" - DTYPE="property"/> - <data ID="118" - NAME="proxyPassword" - CONFIGURATION_ID="102" - OVERRIDE="0" - DTYPE="property"/> - </table> - - <table name="RHQ_CONTENT_SOURCE"> - <data ID="101" - NAME="JBoss Patch Content Source" - DESCRIPTION="All patches provided by the JBoss Subscription" - LAZY_LOAD="1" - DOWNLOAD_MODE="FILESYSTEM" - SYNC_SCHEDULE="0 0 3 * * ?" - CREATION_TIME="1267099200000" - LAST_MODIFIED_TIME="1267099200000" - CONTENT_SOURCE_TYPE_ID="101" - CONFIGURATION_ID="102"/> - </table> - - <table name="RHQ_CHANNEL"> - <data ID="101" - NAME="JBoss Patch Channel" - DESCRIPTION="JBoss Subscription Channel" - CREATION_TIME="1267099200000" - LAST_MODIFIED_TIME="1267099200000"/> - </table> - - <table name="RHQ_CHANNEL_CONTENT_SRC_MAP"> - <data CHANNEL_ID="101" - CONTENT_SRC_ID="101" - CTIME="1267099200000"/> - </table> - - -<!-- END: jon-data.xml --> -</dbsetup> diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/2.3.1/db-schema-combined-2.3.1.xml b/modules/core/dbutils/src/main/scripts/dbsetup/2.3.1/db-schema-combined-2.3.1.xml deleted file mode 100644 index 923c0b5..0000000 --- a/modules/core/dbutils/src/main/scripts/dbsetup/2.3.1/db-schema-combined-2.3.1.xml +++ /dev/null @@ -1,1916 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<dbsetup name="schema"> -<!-- BEGIN: config-schema.xml --> - - - <!-- Definition or Metadata tables --> - - <table name="RHQ_CONFIG_DEF"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="NAME" type="VARCHAR2" required="true" size="100"/> - <column name="DESCRIPTION" type="VARCHAR2" required="false" size="250"/> - <column name="VERSION" type="VARCHAR2" required="false" size="50"/> - </table> - - <table name="RHQ_CONFIG_PROP_GRP_DEF"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="NAME" type="VARCHAR2" required="true" size="100"/> - <column name="DISPLAY_NAME" type="VARCHAR2" required="false" size="100"/> - <column name="DESCRIPTION" type="VARCHAR2" required="false" size="250"/> - <column name="DEFAULT_HIDDEN" type="BOOLEAN" required="false"/> - <column name="ORDER_INDEX" type="INTEGER" required="false"/> - </table> - - <table name="RHQ_CONFIG_PROP_DEF"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="NAME" type="VARCHAR2" required="false" size="100"/> - <column name="DISPLAY_NAME" type="VARCHAR2" required="false" size="100"/> - <column name="DESCRIPTION" type="VARCHAR2" required="false" size="1000"/> - <column name="DEFAULT_VALUE" type="VARCHAR2" required="false" size="2000"/> - <column name="REQUIRED" type="BOOLEAN" required="false"/> - <column name="READONLY" type="BOOLEAN" required="false"/> - <column name="SUMMARY" type="BOOLEAN" required="false"/> - <column name="ACTIVATION_POLICY" type="VARCHAR2" required="false" size="20"/> - <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_GRP_DEF"/> - <column name="ORDER_INDEX" type="INTEGER" required="false"/> - <column name="VERSION" type="VARCHAR2" required="false" size="50"/> - <column name="PARENT_MAP_DEFINITION_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> - <column name="PARENT_LIST_DEFINITION_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> - <column name="SIMPLE_TYPE" type="VARCHAR2" required="false" size="20"/> - <column name="ALLOW_CUSTOM_ENUM_VALUE" type="BOOLEAN" required="false"/> - <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> - <column name="CONFIG_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_DEF"/> - - <!-- only simple properties (not lists and maps) have this --> - <column name="UNITS" type="SMALLINT" required="false"/> - </table> - - <table name="RHQ_CONF_PROP_DEF_ENUM"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="STRING_VALUE" type="VARCHAR2" required="false" size="500"/> - <column name="ORDER_INDEX" type="INTEGER" required="false"/> - <column name="IS_DEFAULT" type="BOOLEAN" required="false"/> - <column name="NAME" type="VARCHAR2" required="false" size="100"/> - <column name="PROPERTY_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> - </table> - - <table name="RHQ_CONFIG_PROP_CONSTR"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="DTYPE" type="VARCHAR2" required="true" size="15"/> - <column name="DETAILS" type="VARCHAR2" required="false" size="250"/> - <column name="CONFIG_PROP_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> - <column name="ORDER_INDEX" type="INTEGER" required="false"/> - </table> - - - <!-- Content or value tables --> - - <table name="RHQ_CONFIG"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="NOTES" type="VARCHAR2" required="false" size="512"/> - <column name="VERSION" type="VARCHAR2" required="false" size="50"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - </table> - - <table name="RHQ_CONFIG_PROPERTY"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="CONFIGURATION_ID" type="INTEGER" required="false" references="RHQ_CONFIG" ondelete="cascade"/> - <column name="STRING_VALUE" type="VARCHAR2" required="false" size="2000"/> - <column name="OVERRIDE" type="BOOLEAN" required="false"/> - <column name="NAME" type="VARCHAR2" required="true" size="100"/> - <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> - <!-- Recursive cascade path to RHQ_CONFIG_PROPERTY causes constraint creation errors on SQL Server, see - http://support.microsoft.com/kb/321843 --> - <column name="PARENT_LIST_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROPERTY" ondelete="cascade" /> - <column name="PARENT_MAP_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROPERTY" ondelete="cascade" /> - <column name="LIST_INDEX" type="INTEGER"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <index name="RHQ_CONFIG_PROP_idx_prop_key" unique="false"> - <field ref="CONFIGURATION_ID"/> - <field ref="NAME"/> - </index> - <index name="RHQ_CONFIG_PROP_idx_map_key" unique="false"> - <field ref="PARENT_MAP_ID"/> - <field ref="NAME"/> - </index> - <index name="RHQ_CONFIG_PROP_idx_list_key" unique="false"> - <field ref="PARENT_LIST_ID"/> - </index> - <!-- List entries all have the same name --> - </table> - - <table name="RHQ_CONFIG_TEMPLATE"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="NAME" type="VARCHAR2" required="false" size="100"/> - <column name="DESCRIPTION" type="VARCHAR2" required="false" size="500"/> - <column name="CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> - <column name="CONFIG_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_DEF"/> - <column name="IS_DEFAULT" type="BOOLEAN" required="false"/> - </table> - -<!-- END: config-schema.xml --> -<!-- BEGIN: cluster-schema.xml --> - - <table name="RHQ_AFFINITY_GROUP"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" required="true" size="255" type="VARCHAR2"/> - </table> - - <table name="RHQ_SERVER"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" required="true" size="255" type="VARCHAR2"/> - <column name="ADDRESS" required="true" size="255" type="VARCHAR2"/> - <column name="PORT" required="true" type="INTEGER"/> - <column name="SECURE_PORT" required="true" type="INTEGER"/> - <column name="CTIME" required="true" type="LONG"/> - <column name="MTIME" required="true" type="LONG"/> - <column name="AFFINITY_GROUP_ID" type="INTEGER" references="RHQ_AFFINITY_GROUP" required="false"/> - <column name="COMPUTE_POWER" required="true" type="INTEGER"/> - <column name="OPERATION_MODE" required="true" size="32" type="VARCHAR2"/> - <column name="STATUS" type="INTEGER" required="false" default="0" /> - - <!-- This index is for constraint, not performance --> - <index name="RHQ_SERVER_NAME_UNIQUE" unique="true"> - <field ref="NAME"/> - </index> - </table> - - <!-- new agent --> - <table name="RHQ_AGENT"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" required="true" size="255" type="VARCHAR2"/> - <column name="ADDRESS" required="true" size="255" type="VARCHAR2"/> - <column name="PORT" required="true" type="INTEGER"/> - <column name="AGENTTOKEN" required="true" size="100" type="VARCHAR2"/> - <column name="REMOTE_ENDPOINT" required="false" size="4000" type="VARCHAR2"/> - <column name="CTIME" required="true" type="LONG"/> - <column name="MTIME" required="true" type="LONG"/> - <column name="LAST_AVAILABILITY_REPORT" required="false" type="LONG"/> - <column name="AFFINITY_GROUP_ID" type="INTEGER" references="RHQ_AFFINITY_GROUP" required="false"/> - <column name="SERVER_ID" type="INTEGER" references="RHQ_SERVER" required="false"/> - <column name="STATUS" type="INTEGER" required="false" default="0" /> - <column name="BACKFILLED" type="BOOLEAN" required="true" /> - - <index name="RHQ_AGENT_NAME_UNIQUE" unique="true"> - <field ref="NAME"/> - </index> - - <index name="RHQ_AGENT_ADDRESS_PORT" unique="true"> - <field ref="ADDRESS"/> - <field ref="PORT"/> - </index> - - <index name="RHQ_AGENT_TOKEN_UNIQUE" unique="true"> - <field ref="AGENTTOKEN"/> - </index> - </table> - - <table name="RHQ_PARTITION_EVENT"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="SUBJECT_NAME" required="true" size="255" type="VARCHAR2"/> - <column name="CTIME" required="true" type="LONG"/> - <column name="EVENT_TYPE" required="true" size="50" type="VARCHAR2"/> - <column name="EVENT_DETAIL" required="false" size="512" type="VARCHAR2"/> - <column name="EXECUTION_STATUS" required="true" size="32" type="VARCHAR2"/> - </table> - - <table name="RHQ_PARTITION_DETAILS"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="PARTITION_EVENT_ID" type="INTEGER" references="RHQ_PARTITION_EVENT" required="true"/> - <column name="AGENT_NAME" type="VARCHAR2" size="255" required="true"/> - <column name="SERVER_NAME" type="VARCHAR2" size="255" required="true"/> - </table> - - <table name="RHQ_FAILOVER_LIST"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="PARTITION_EVENT_ID" type="INTEGER" references="RHQ_PARTITION_EVENT" required="true"/> - <column name="AGENT_ID" type="INTEGER" references="RHQ_AGENT" required="true"/> - <column name="CTIME" required="true" type="LONG"/> - </table> - - <table name="RHQ_FAILOVER_DETAILS"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="FAILOVER_LIST_ID" type="INTEGER" references="RHQ_FAILOVER_LIST" required="true"/> - <column name="SERVER_ID" type="INTEGER" references="RHQ_SERVER" required="true"/> - <column name="ORDINAL" type = "INTEGER" required="true"/> - </table> - -<!-- END: cluster-schema.xml --> -<!-- BEGIN: inventory-schema.xml --> - - - <!-- NEW RESOURCE TYPES --> - <table name="RHQ_RESOURCE_TYPE"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" type="VARCHAR2" size="100" required="true"/> - <column name="CATEGORY" type="VARCHAR2" size="16" required="true"/> - <column name="CREATION_DATA_TYPE" type="VARCHAR2" size="16" required="true"/> - <column name="CREATE_DELETE_POLICY" type="VARCHAR2" size="16" required="true"/> - <column name="SINGLETON" type="BOOLEAN" required="true"/> - <column name="SUPPORTS_MANUAL_ADD" type="BOOLEAN" required="true"/> - <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> - <column name="PLUGIN" type="VARCHAR2" size="100"/> - <column name="CTIME" type="LONG"/> - <column name="MTIME" type="LONG"/> - <column name="SUBCATEGORY_ID" type="INTEGER"/> - <!-- - TODO add support to DB setup for tables with circular dependencies and then add back this RI - <column name="SUBCATEGORY_ID" type="INTEGER" references="RHQ_RESOURCE_SUBCAT" /> - --> - <column name="PLUGIN_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> - <column name="RES_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> - - <index name="RHQ_RES_TYPE_IDX_PLG_NAME"> - <field ref="NAME"/> - <field ref="PLUGIN"/> - </index> - </table> - - <!-- NEW RESOURCE SUBCATEGORIES --> - <table name="RHQ_RESOURCE_SUBCAT"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" type="VARCHAR2" size="100"/> - <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> - <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> - <column name="CTIME" type="LONG"/> - <column name="MTIME" type="LONG"/> - <column name="PARENT_SUBCATEGORY_ID" type="INTEGER" references="RHQ_RESOURCE_SUBCAT"/> - <!-- resourceTypeId is not required on child sub categories --> - <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> - </table> - - <!-- Many To Many mapping for resource type to its parents --> - <table name="RHQ_RESOURCE_TYPE_PARENTS"> - <column name="RESOURCE_TYPE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> - <column name="PARENT_RESOURCE_TYPE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> - - <!-- not using full words to fit index name length --> - <constraint name="RHQ_RES_TYPE_PARENTS_KEY"> - <primaryKey> - <field ref="RESOURCE_TYPE_ID"/> - <field ref="PARENT_RESOURCE_TYPE_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_PROCESS_SCAN"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="QUERY" type="VARCHAR2" size="256" required="true"/> - <column name="NAME" type="VARCHAR2" size="100" required="false"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> - - <index name="RHQ_PROCESS_SCAN_QUERY_INDEX" unique="true"> - <field ref="QUERY"/> - <field ref="RESOURCE_TYPE_ID"/> - </index> - </table> - - <table name="RHQ_PRD_VER"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="VERSION" type="VARCHAR2" size="50" required="true"/> - <column name="RES_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> - </table> - - <table name="RHQ_RESOURCE"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> - <column name="UUID" type="CHAR" size="36" required="true"/> - <column name="NAME" type="VARCHAR2" size="500"/> - <column name="RESOURCE_KEY" type="VARCHAR2" required="true" size="500"/> - <column name="AGENT_ID" required="false" type="INTEGER" references="RHQ_AGENT(id)"/> - <column name="INVENTORY_STATUS" type="VARCHAR2" size="20"/> - <column name="CONNECTED" type="BOOLEAN"/> - <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> - <column name="VERSION" type="VARCHAR2" size="50"/> - <column name="CTIME" type="LONG"/> - <column name="MTIME" type="LONG"/> - <column name="ITIME" type="LONG"/> - <column name="RES_CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG"/> - <column name="PLUGIN_CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG"/> - <column name="MODIFIED_BY" required="false" type="INTEGER"/> - <column name="LOCATION" required="false" size="100" type="VARCHAR2"/> - <column name="PARENT_RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE"/> - <column name="PRODUCT_VERSION_ID" type="INTEGER" references="RHQ_PRD_VER"/> - - <index name="RHQ_RESOURCE_idx_key"> - <field ref="RESOURCE_KEY"/> - </index> - - <index name="RHQ_RESOURCE_idx_type"> - <field ref="RESOURCE_TYPE_ID"/> - </index> - - <index name="RHQ_RESOURCE_idx_agent"> - <field ref="AGENT_ID"/> - </index> - - <index name="RHQ_RESOURCE_idx_parent"> - <field ref="PARENT_RESOURCE_ID"/> - </index> - - </table> - - <table name="RHQ_RESOURCE_ERROR"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> - <column name="TIME_OCCURRED" type="LONG" required="true"/> - <column name="ERROR_TYPE" type="VARCHAR2" required="true" size="32"/> - <column name="SUMMARY" type="VARCHAR2" required="true" size="1000"/> - <column name="DETAIL" type="LONGVARCHAR" required="false"/> - - <index name="RHQ_RES_ERROR_IDX_RES_ID"> - <field ref="RESOURCE_ID"/> - </index> - </table> - - <table name="RHQ_GROUP_DEF"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" required="true" size="100" type="VARCHAR2"/> - <column name="DESCRIPTION" size="100" type="VARCHAR2"/> - <column name="CTIME" type="LONG"/> - <column name="MTIME" type="LONG"/> - <column name="CALC_TIME" type="LONG"/> - <column name="CALC_INTERVAL" type="LONG"/> - <column name="RECURSIVE" type="BOOLEAN"/> - <column name="EXPRESSION" type="VARCHAR2" size="1000"/> - - <index name="RHQ_GROUP_DEF_NAME" unique="true"> - <field ref="NAME"/> - </index> - </table> - - <table name="RHQ_RESOURCE_GROUP"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <!-- this name can be longer than the size of the GROUP_BY column, which is used to uniquely identify it --> - <!-- Max bytes for Oracle Varchar2 to accommodate large cluster keys --> - <column name="NAME" required="true" size="4000" type="VARCHAR2"/> - <column name="DESCRIPTION" size="100" type="VARCHAR2"/> - <column name="LOCATION" required="false" size="100" type="VARCHAR2"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> - <!-- Compatible groups only --> - <column name="CTIME" type="LONG"/> - <column name="MTIME" type="LONG"/> - <column name="MODIFIED_BY" required="false" type="INTEGER"/> - <!-- TODO: Reorder to allow this references="RHQ_SUBJECT" --> - <column name="RECURSIVE" type="BOOLEAN"/> - - <column name="GROUP_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_GROUP_DEF"/> - <column name="GROUP_BY" size="500" type="VARCHAR2"/> - - <column name="CATEGORY" type="VARCHAR2" size="20" required="true"/> - - <column name="CLUSTER_KEY" type="VARCHAR2" size="4000" required="false"/> - - <!-- These two only set if this is a backing group for a resource cluster --> - <column name="CLUSTER_RESOURCE_GROUP_ID" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> - - <column name="VISIBLE" type="BOOLEAN"/> - - <index name="RHQ_RES_GROUP_NAME" unique="false"> - <field ref="NAME"/> - </index> - </table> - - <!-- Many To Many mapping for groups to implicit resources --> - <table name="RHQ_RESOURCE_GROUP_RES_IMP_MAP"> - <column name="RESOURCE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE"/> - <column name="RESOURCE_GROUP_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> - - <!-- not using full words to fit index name length --> - <constraint name="RHQ_RES_GROUP_RES_IMP_MAP_KEY"> - <primaryKey> - <field ref="RESOURCE_ID"/> - <field ref="RESOURCE_GROUP_ID"/> - </primaryKey> - </constraint> - </table> - - <!-- Many To Many mapping for groups to explicit resources --> - <table name="RHQ_RESOURCE_GROUP_RES_EXP_MAP"> - <column name="RESOURCE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE"/> - <column name="RESOURCE_GROUP_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> - - <!-- not using full words to fit index name length --> - <constraint name="RHQ_RES_GROUP_RES_EXP_MAP_KEY"> - <primaryKey> - <field ref="RESOURCE_ID"/> - <field ref="RESOURCE_GROUP_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_CONFIG_GROUP_UPDATE"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="GROUP_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_GROUP"/> - <column name="CONFIGURATION_ID" type="INTEGER" required="true" references="RHQ_CONFIG"/> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="SUBJECT_NAME" type="VARCHAR2" required="false" size="100"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> - </table> - - <table name="RHQ_CONFIG_UPDATE"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="CONFIGURATION_ID" type="INTEGER" required="true" references="RHQ_CONFIG" ondelete="cascade"/> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="SUBJECT_NAME" type="VARCHAR2" required="false" size="100"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="CONFIG_RES_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> - <column name="PLUGIN_CONFIG_RES_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> - <column name="AGG_RES_UPDATE_ID" type="INTEGER" required="false" references="RHQ_CONFIG_GROUP_UPDATE"/> - <column name="AGG_PLUGIN_UPDATE_ID" type="INTEGER" required="false" references="RHQ_CONFIG_GROUP_UPDATE"/> - <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> - </table> - -<!-- END: inventory-schema.xml --> -<!-- BEGIN: auth-schema.xml --> - - - <table name="RHQ_PRINCIPAL"> - - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="PRINCIPAL" required="true" type="VARCHAR2" size="100"/> - <column name="PASSWORD" required="true" type="VARCHAR2" size="64"/> - - <!-- ensure that principals are unique --> - <index name="RHQ_PRINCIPAL_PRINCIPAL_KEY" unique="true"> - <field ref="PRINCIPAL"/> - </index> - - </table> - -<!-- END: auth-schema.xml --> -<!-- BEGIN: authz-schema.xml --> - - - <table name="RHQ_ROLE"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" required="true" size="100" type="VARCHAR2"/> - <column name="DESCRIPTION" size="100" type="VARCHAR2"/> - <column name="FSYSTEM" type="BOOLEAN" default="false"/> - - <index name="RHQ_ROLE_NAME_KEY" unique="true"> - <field ref="NAME"/> - </index> - </table> - - <table name="RHQ_ROLE_RESOURCE_GROUP_MAP"> - <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> - <column name="RESOURCE_GROUP_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> - - <constraint name="RHQ_ROLE_RES_GROUP_MAP_KEY"> - <primaryKey> - <field ref="ROLE_ID"/> - <field ref="RESOURCE_GROUP_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_PERMISSION"> - <column name="ROLE_ID" type="INTEGER" references="RHQ_ROLE" required="true"/> - <column name="OPERATION" type="INTEGER" required="true"/> - <constraint name="RHQ_PERMISSION_PK"> - <primaryKey> - <field ref="ROLE_ID"/> - <field ref="OPERATION"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_SUBJECT"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" required="true" size="100" type="VARCHAR2"/> - <column name="CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG"/> - <column name="FIRST_NAME" required="false" size="100" type="VARCHAR2"/> - <column name="LAST_NAME" required="false" size="100" type="VARCHAR2"/> - <column name="EMAIL_ADDRESS" size="100" type="VARCHAR2"/> - <column name="SMS_ADDRESS" size="100" type="VARCHAR2"/> - <column name="PHONE_NUMBER" size="100" type="VARCHAR2"/> - <column name="DEPARTMENT" size="100" type="VARCHAR2"/> - <column name="FACTIVE" required="true" type="BOOLEAN" default="true"/> - <column name="FSYSTEM" required="true" type="BOOLEAN" default="false"/> - - <index name="RHQ_SUBJECT_AUTH_KEY" unique="true"> - <field ref="NAME"/> - </index> - </table> - - <table name="RHQ_SUBJECT_ROLE_MAP"> - <column name="SUBJECT_ID" required="true" type="INTEGER" references="RHQ_SUBJECT"/> - <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> - - <constraint name="RHQ_SUBJECT_ROLE_MAPPING_KEY"> - <primaryKey> - <field ref="SUBJECT_ID"/> - <field ref="ROLE_ID"/> - </primaryKey> - </constraint> - </table> - -<!-- END: authz-schema.xml --> -<!-- BEGIN: operation-schema.xml --> - - - <table name="RHQ_OPERATION_DEF"> - - <!-- === required columns === --> - - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE(ID)"/> - <column name="NAME" type="VARCHAR2" required="true" size="100"/> - - <!-- === optional columns === --> - - <!-- an OSGI version range - if null, the operation def applies to all versions of the associated resource type --> - <column name="RESOURCE_VERSION_RANGE" type="VARCHAR2" size="100"/> - - <!-- A parameter config definition is only required for operations that have parameters. --> - <!-- A results config definition is only required for operations that return data. --> - <column name="PARAMETER_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> - <column name="RESULTS_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> - <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> - <column name="DESCRIPTION" type="VARCHAR2" size="4000"/> - <column name="TIMEOUT" type="INTEGER"/> - - <!-- === business key (RESOURCE_TYPE_ID + NAME) === --> - <index name="RHQ_OPERATION_DEF_KEY_IDX" unique="true"> - <field ref="RESOURCE_TYPE_ID"/> - <field ref="NAME"/> - </index> - - </table> - - <table name="RHQ_OPERATION_HISTORY"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="DTYPE" type="VARCHAR2" required="true" size="8"/> - <column name="JOB_NAME" type="VARCHAR2" required="true" size="100"/> - <column name="JOB_GROUP" type="VARCHAR2" required="true" size="100"/> - <column name="OPERATION_DEF_ID" type="INTEGER" required="true" references="RHQ_OPERATION_DEF"/> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="STIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="PARAMETERS_CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> - - <!-- for resource history --> - <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> - <column name="RESULTS_CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> - <column name="GROUP_HISTORY_ID" type="INTEGER" required="false" references="RHQ_OPERATION_HISTORY"/> - - <!-- for group history --> - <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_RESOURCE_GROUP"/> - - <index name="RHQ_OPERATION_HISTORY_JOB_IDX" unique="true"> - <field ref="JOB_NAME"/> - <field ref="JOB_GROUP"/> - <field ref="CTIME"/> - </index> - - </table> - - <!-- - This table is really just to support some specific use-cases. - Specifically, to be able to get a list of histories for a specific schedule (aka quartz job) - and to be able to query a list of all schedules along with their associated resource/group IDs - possibly sorted by their next fire time. - Note that a NULL next fire time means it won't fire again and the row is probaby about to be deleted; - we can probably not even insert rows with NULL and make it a non-nullable field. But rather than - code special conditions into the session bean, we'll allow a short-lived NULL next fire time row. - --> - <table name="RHQ_OPERATION_SCHEDULE"> - <column name="JOB_NAME" type="VARCHAR2" required="true" size="100"/> - <column name="JOB_GROUP" type="VARCHAR2" required="true" size="100"/> - <column name="DTYPE" type="VARCHAR2" required="true" size="8"/> - <column name="NEXT_FIRE_TIME" type="LONG" required="false"/> - - <!-- for resource history --> - <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> - - <!-- for group history --> - <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_RESOURCE_GROUP"/> - - <!-- - Note that this is the same primary key that Quartz uses for its schedules (RHQ_qrtz_job_details). - We do not need to add DTYPE to the key, because we ensure the name/group are unique - across resource/group schedules - --> - <constraint name="RHQ_OPERATION_SCHEDULE_KEY"> - <primaryKey> - <field ref="JOB_NAME"/> - <field ref="JOB_GROUP"/> - </primaryKey> - </constraint> - </table> - -<!-- END: operation-schema.xml --> -<!-- BEGIN: sysconfig-schema.xml --> - - - <table name="RHQ_SYSTEM_CONFIG"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="PROPERTY_KEY" type="VARCHAR2" size="80"/> - <column name="PROPERTY_VALUE" type="VARCHAR2" size="300"/> - <column name="DEFAULT_PROPERTY_VALUE" type="VARCHAR2" size="300"/> - <column name="FREAD_ONLY" type="BOOLEAN" default="FALSE"/> - - <index name="RHQ_SYSTEM_CONFIG_KEY_INDX" unique="true"> - <field ref="PROPERTY_KEY"/> - </index> - </table> - -<!-- END: sysconfig-schema.xml --> -<!-- BEGIN: scheduler-schema.xml --> - - - <table name="RHQ_QRTZ_JOB_DETAILS"> - <column name="JOB_NAME" required="true" type="VARCHAR2" size="80"/> - <column name="JOB_GROUP" required="true" type="VARCHAR2" size="80"/> - <column name="DESCRIPTION" required="false" type="VARCHAR2" size="120"/> - <column name="JOB_CLASS_NAME" required="true" type="VARCHAR2" size="128"/> - <column name="IS_DURABLE" required="true" type="BOOLEAN" default="FALSE"/> - <column name="IS_VOLATILE" required="true" type="BOOLEAN"/> - <column name="IS_STATEFUL" required="true" type="BOOLEAN" default="FALSE"/> - <column name="REQUESTS_RECOVERY" required="true" type="BOOLEAN" default="FALSE"/> - <column name="JOB_DATA" required="false" type="BLOB"/> - - <constraint name="RHQ_PK_QRTZ_JOB_DETAILS"> - <primaryKey> - <field ref="JOB_NAME"/> - <field ref="JOB_GROUP"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_QRTZ_JOB_LISTENERS"> - <column name="JOB_NAME" required="true" type="VARCHAR2" size="80"/> - <column name="JOB_GROUP" required="true" type="VARCHAR2" size="80"/> - <column name="JOB_LISTENER" required="true" type="VARCHAR2" size="80"/> - - <constraint name="RHQ_PK_QRTZ_JOB_LISTENERS"> - <primaryKey> - <field ref="JOB_NAME"/> - <field ref="JOB_GROUP"/> - <field ref="JOB_LISTENER"/> - </primaryKey> - </constraint> - <constraint name="RHQ_FK_QRTZ_JOB_LSTNRS_JN_JG"> - <foreignKey local="JOB_NAME,JOB_GROUP" - references="RHQ_QRTZ_JOB_DETAILS(JOB_NAME,JOB_GROUP)" - ondelete="cascade"/> - </constraint> - </table> - - <table name="RHQ_QRTZ_TRIGGERS"> - <column name="TRIGGER_NAME" type="VARCHAR2" required="true" size="80"/> - <column name="TRIGGER_GROUP" type="VARCHAR2" required="true" size="80"/> - <column name="JOB_NAME" type="VARCHAR2" required="true" size="80"/> - <column name="JOB_GROUP" type="VARCHAR2" required="true" size="80"/> - <column name="IS_VOLATILE" type="BOOLEAN" required="true"/> - <column name="DESCRIPTION" type="VARCHAR2" required="false" size="120"/> - <column name="NEXT_FIRE_TIME" type="LONG" required="false"/> - <column name="PREV_FIRE_TIME" type="LONG" required="false"/> - <column name="PRIORITY" type="INTEGER" required="false"/> - <column name="TRIGGER_STATE" type="VARCHAR" required="true" size="16"/> - <column name="TRIGGER_TYPE" type="VARCHAR" required="true" size="8"/> - <column name="START_TIME" type="LONG" required="true"/> - <column name="END_TIME" type="LONG" required="false"/> - <column name="CALENDAR_NAME" type="VARCHAR2" required="false" size="80"/> - <column name="MISFIRE_INSTR" type="INTEGER" required="false"/> - <column name="JOB_DATA" type="BLOB" required="false"/> - - <constraint name="RHQ_PK_QRTZ_TRIGGERS"> - <primaryKey> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </primaryKey> - </constraint> - <constraint name="RHQ_FK_QRTZ_TRIGGERS_JN_JG"> - <foreignKey local="JOB_NAME,JOB_GROUP" - references="RHQ_QRTZ_JOB_DETAILS(JOB_NAME,JOB_GROUP)" - ondelete="cascade"/> - </constraint> - - <!-- Quartz docs recommend these indexes. --> - <index name="RHQ_QRTZ_TRIGGERS_JN_JG_IDX"> - <field ref="JOB_NAME"/> - <field ref="JOB_GROUP"/> - </index> - <index name="RHQ_QRTZ_TRIGGERS_NFT_IDX"> - <field ref="NEXT_FIRE_TIME"/> - </index> - <index name="RHQ_QRTZ_TRIGGERS_TS_IDX"> - <field ref="TRIGGER_STATE"/> - </index> - <index name="RHQ_QRTZ_TRIGGERS_TS_NFT_IDX"> - <field ref="TRIGGER_STATE"/> - <field ref="NEXT_FIRE_TIME"/> - </index> - - </table> - - <table name="RHQ_QRTZ_SIMPLE_TRIGGERS"> - <column name="TRIGGER_NAME" type="VARCHAR2" required="true" size="80"/> - <column name="TRIGGER_GROUP" type="VARCHAR2" required="true" size="80"/> - <column name="REPEAT_COUNT" type="LONG" required="true"/> - <column name="REPEAT_INTERVAL" type="LONG" required="true"/> - <column name="TIMES_TRIGGERED" type="LONG" required="true"/> - - <constraint name="RHQ_PK_QRTZ_SIMPLE_TRIGGERS"> - <primaryKey> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </primaryKey> - </constraint> - <constraint name="RHQ_FK_QRTZ_SIMPLE_TRGRS_TN_TG"> - <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" - references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" - ondelete="cascade"/> - </constraint> - - <!-- Quartz docs recommend this index. --> - <!-- Commenting out, because Oracle auto-creates an index for the - primary key column(s) and fails if you try to create another - index for the same column(s) (ips, 03/29/07). - --> - <!-- - <index name="RHQ_QRTZ_SIMPLE_TRGRS_TN_TG_IDX"> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </index> - --> - </table> - - <table name="RHQ_QRTZ_CRON_TRIGGERS"> - <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> - <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> - <column name="CRON_EXPRESSION" type="VARCHAR2" size="80" required="true"/> - <column name="TIME_ZONE_ID" type="VARCHAR2" size="80" required="false"/> - - <constraint name="RHQ_PK_QRTZ_CRON_TRIGGERS"> - <primaryKey> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </primaryKey> - </constraint> - <constraint name="RHQ_FK_QRTZ_CRON_TRIG_TN_TG"> - <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" - references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" - ondelete="cascade"/> - </constraint> - - <!-- Quartz docs recommend this index. --> - <!-- Commenting out, because Oracle auto-creates an index for the - primary key column(s) and fails if you try to create another - index for the same column(s) (ips, 03/29/07). - --> - <!-- - <index name="RHQ_QRTZ_CRON_TRGRS_TN_TG_IDX"> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </index> - --> - </table> - - <table name="RHQ_QRTZ_BLOB_TRIGGERS"> - <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> - <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> - <column name="BLOB_DATA" type="BLOB" required="false"/> - - <constraint name="RHQ_PK_QRTZ_BLOB_TRIGGERS"> - <primaryKey> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </primaryKey> - </constraint> - <constraint name="RHQ_FK_QRTZ_BLOB_TRIGG_TN_TG"> - <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" - references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" - ondelete="cascade"/> - </constraint> - - <!-- Quartz docs recommend this index. --> - <!-- Commenting out, because Oracle auto-creates an index for the - primary key column(s) and fails if you try to create another - index for the same column(s) (ips, 03/29/07). - --> - <!-- - <index name="RHQ_QRTZ_BLOB_TRGRS_TN_TG_IDX"> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </index> - --> - </table> - - <table name="RHQ_QRTZ_TRIGGER_LISTENERS"> - <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> - <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> - <column name="TRIGGER_LISTENER" type="VARCHAR2" size="80" required="true"/> - - <constraint name="RHQ_PK_QRTZ_TRIGGER_LISTENERS"> - <primaryKey> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - <field ref="TRIGGER_LISTENER"/> - </primaryKey> - </constraint> - <constraint name="RHQ_FK_QRTZ_TRGR_LSTNRS_TN_TG"> - <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" - references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" - ondelete="cascade"/> - </constraint> - - <!-- Quartz docs recommend this index. --> - <index name="RHQ_QRTZ_TRGR_LSTNRS_TN_TG_IDX"> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </index> - - </table> - - <table name="RHQ_QRTZ_FIRED_TRIGGERS"> - <column name="ENTRY_ID" primarykey="true" type="VARCHAR2" size="95" required="true"/> - <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> - <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> - <column name="INSTANCE_NAME" type="VARCHAR2" size="80" required="true"/> - <column name="FIRED_TIME" type="LONG" required="true"/> - <column name="PRIORITY" type="INTEGER" required="false"/> - <column name="STATE" type="VARCHAR2" size="16" required="true"/> - <column name="IS_VOLATILE" type="BOOLEAN" required="true"/> - <column name="JOB_NAME" type="VARCHAR2" size="80" required="false"/> - <column name="JOB_GROUP" type="VARCHAR2" size="80" required="false"/> - <column name="IS_STATEFUL" type="BOOLEAN" required="false"/> - <column name="REQUESTS_RECOVERY" type="BOOLEAN" required="false"/> - - <!-- Quartz docs recommend these indexes. --> - <index name="RHQ_QRTZ_FIRED_TRGRS_TN_IDX"> - <field ref="TRIGGER_NAME"/> - </index> - <index name="RHQ_QRTZ_FIRED_TRGRS_TG_IDX"> - <field ref="TRIGGER_GROUP"/> - </index> - <index name="RHQ_QRTZ_FIRED_TRGRS_TN_TG_IDX"> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </index> - <index name="RHQ_QRTZ_FIRED_TRGRS_IN_IDX"> - <field ref="INSTANCE_NAME"/> - </index> - <index name="RHQ_QRTZ_FIRED_TRGRS_JN_IDX"> - <field ref="JOB_NAME"/> - </index> - <index name="RHQ_QRTZ_FIRED_TRGRS_JG_IDX"> - <field ref="JOB_GROUP"/> - </index> - - </table> - - <table name="RHQ_QRTZ_CALENDARS"> - <column name="CALENDAR_NAME" primarykey="true" type="VARCHAR2" size="80" required="true"/> - <column name="CALENDAR" type="BLOB" required="true"/> - </table> - - <table name="RHQ_QRTZ_PAUSED_TRIGGER_GRPS"> - <column name="TRIGGER_GROUP" primarykey="true" type="VARCHAR2" size="80" required="true"/> - </table> - - <table name="RHQ_QRTZ_SCHEDULER_STATE"> - <column name="INSTANCE_NAME" primarykey="true" type="VARCHAR2" size="80" required="true"/> - <column name="LAST_CHECKIN_TIME" type="LONG" required="true"/> - <column name="CHECKIN_INTERVAL" type="LONG" required="true"/> - <column name="RECOVERER" type="VARCHAR2" size="80" required="false"/> - </table> - - <table name="RHQ_QRTZ_LOCKS"> - <column name="LOCK_NAME" primarykey="true" type="VARCHAR2" size="40" required="true"/> - <data LOCK_NAME="TRIGGER_ACCESS"/> - <data LOCK_NAME="JOB_ACCESS"/> - <data LOCK_NAME="CALENDAR_ACCESS"/> - <data LOCK_NAME="STATE_ACCESS"/> - <data LOCK_NAME="MISFIRE_ACCESS"/> - </table> - -<!-- END: scheduler-schema.xml --> -<!-- BEGIN: amps-schema.xml --> - - - - <table name="RHQ_PLUGIN"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="4000" type="VARCHAR2" required="false"/> - <column name="VERSION" size="200" type="VARCHAR2" required="false"/> - <column name="ENABLED" type="BOOLEAN" required="true"/> - <column name="HELP" type="CLOB" required="false"/> - <column name="PATH" size="500" type="VARCHAR2" required="true"/> - <column name="MD5" size="100" type="VARCHAR2" required="true"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="CONTENT" type="BLOB" required="false"/> - - <index name="RHQ_PLUGIN_NAME_IDX" unique="true"> - <field ref="NAME"/> - </index> - </table> - -<!-- END: amps-schema.xml --> -<!-- BEGIN: measurement-schema.xml --> - - <table name="RHQ_MEASUREMENT_DEF"> - - <!-- === required columns === --> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE(ID)"/> - <column name="NAME" type="VARCHAR2" size="100" required="true"/> - - <!-- === optional columns === --> - <!-- an OSGI version range - if null, the metric def applies to all versions of the associated resource type --> - <column name="RESOURCE_VERSION_RANGE" type="VARCHAR2" size="100"/> - <column name="CATEGORY" type="SMALLINT"/> - <column name="UNITS" type="SMALLINT"/> - <column name="NUMERIC_TYPE" type="SMALLINT"/> - <column name="DISPLAY_TYPE" type="SMALLINT"/> - <column name="DATA_TYPE" type="SMALLINT"/> - <column name="RAW_NUMERIC_TYPE" type="SMALLINT"/> - <column name="DEFAULT_ON" type="BOOLEAN" default="false"/> - <column name="DEFAULT_INTERVAL" type="LONG" /> - <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> - <column name="DISPLAY_ORDER" type="INTEGER" default="1000"/> - <column name="DESCRIPTION" type="VARCHAR2" size="500"/> - <column name="DESTINATION_TYPE" type="VARCHAR2" size="100"/> - - <column name="VERSION" type="INTEGER"/> - <!-- for optimistic locking --> - - <!-- === business key (RESOURCE_TYPE_ID + NAME + RAW_NUMERIC_TYPE) === --> - <index name="RHQ_METRIC_DEF_KEY_IDX" unique="true"> - <field ref="RESOURCE_TYPE_ID"/> - <field ref="NAME"/> - <field ref="RAW_NUMERIC_TYPE"/> - </index> - </table> - - - <table name="RHQ_MEASUREMENT_SCHED"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - - <column name="ENABLED" type="BOOLEAN" default="false"/> - <column name="MTIME" type="LONG" /> - <column name="DEFINITION" type="INTEGER" references="RHQ_MEASUREMENT_DEF(ID)"/> - <column name="VERSION" type="INTEGER" /> - <column name="COLL_INTERVAL" type="LONG" /> - <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE(ID)"/> - <index name="RHQ_MEAS_SCHED_UNIQ" unique="true"> - <field ref="RESOURCE_ID"/> - <field ref="DEFINITION"/> - </index> - </table> - - - <table name="RHQ_MEASUREMENT_BLINE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - - <column name="BL_USER_ENTERED" type="BOOLEAN" default="false" required="true"/> - <column name="BL_MIN" type="DOUBLE" required="true"/> - <column name="BL_MAX" type="DOUBLE" required="true"/> - <column name="BL_MEAN" type="DOUBLE" required="true"/> - <column name="BL_COMPUTE_TIME" type="LONG" required="true"/> - <column name="SCHEDULE_ID" type="INTEGER" required="true" references="RHQ_MEASUREMENT_SCHED(ID)"/> - <index name="RHQ_MEAS_BASELINE_CTIME_IDX"> - <field ref="BL_COMPUTE_TIME"/> - </index> - <index name="RHQ_MEAS_BASELINE_SID_IDX"> - <field ref="SCHEDULE_ID"/> - </index> - </table> - - - <table name="RHQ_MEASUREMENT_DATA_NUM_1H" logging="false" cache="true" - tablespace="DEFAULT" storage-options="freelists 20"> - - <column name="TIME_STAMP" required="true" type="LONG"/> - <column name="SCHEDULE_ID" required="true" type="INTEGER"/> - <column name="VALUE" required="false" type="DOUBLE"/> - <column name="MINVALUE" required="false" type="DOUBLE"/> - <column name="MAXVALUE" required="false" type="DOUBLE"/> - - <constraint name="RHQ_MEAS_DATA_1H_ID_TIME_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - - <index name="RHQ_MEAS_DATA_1H_TIME_IDX"> - <field ref="TIME_STAMP"/> - </index> - </table> - - - <table name="RHQ_MEASUREMENT_DATA_NUM_6H" logging="false" cache="true" - tablespace="DEFAULT" storage-options="freelists 20"> - - <column name="TIME_STAMP" required="true" type="LONG"/> - <column name="SCHEDULE_ID" required="true" type="INTEGER"/> - <column name="VALUE" required="false" type="DOUBLE"/> - <column name="MINVALUE" required="false" type="DOUBLE"/> - <column name="MAXVALUE" required="false" type="DOUBLE"/> - - <constraint name="RHQ_MEAS_DATA_6H_ID_TIME_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - - <index name="RHQ_MEAS_DATA_6H_TIME_IDX"> - <field ref="TIME_STAMP"/> - </index> - </table> - - - <table name="RHQ_MEASUREMENT_DATA_NUM_1D" logging="false" cache="true" - tablespace="DEFAULT" storage-options="freelists 20"> - - <column name="TIME_STAMP" required="true" type="LONG"/> - <column name="SCHEDULE_ID" required="true" type="INTEGER"/> - <column name="VALUE" required="false" type="DOUBLE"/> - <column name="MINVALUE" required="false" type="DOUBLE"/> - <column name="MAXVALUE" required="false" type="DOUBLE"/> - - <constraint name="RHQ_MEAS_DATA_1D_ID_TIME_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - - - <table name="RHQ_MEASUREMENT_DATA_TRAIT"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER" /> - <column name="VALUE" type="VARCHAR2" size="4000" /> - <constraint name="RHQ_MEAS_DATA_TRAIT_ID_TIME_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - - - <table name="RHQ_CALLTIME_DATA_KEY"> - <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> - <column name="SCHEDULE_ID" type="INTEGER" required="true"/> - <column name="CALL_DESTINATION" type="VARCHAR2" size="4000" required="true"/> - <index name="RHQ_CALLTIME_DATA_KEY_IDX" unique="true"> - <field ref="SCHEDULE_ID"/> - <field ref="CALL_DESTINATION"/> - </index> - </table> - - - <table name="RHQ_CALLTIME_DATA_VALUE"> - <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> - <column name="KEY_ID" type="INTEGER" references="RHQ_CALLTIME_DATA_KEY" required="true"/> - <column name="BEGIN_TIME" type="LONG" required="true"/> - <column name="END_TIME" type="LONG" required="true"/> - <column name="MINIMUM" type="DOUBLE" required="true"/> - <column name="MAXIMUM" type="DOUBLE" required="true"/> - <column name="TOTAL" type="DOUBLE" required="true"/> - <column name="COUNT" type="LONG" required="true"/> - </table> - - - <table name="RHQ_AVAILABILITY"> - <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE(ID)"/> - <column name="START_TIME" type="LONG" required="true" /> - <column name="END_TIME" type="LONG" required="false" /> - <column name="AVAILABILITY_TYPE" type="SMALLINT" required="false" /> - <index name="RHQ_AVAIL_RESOURCE_START_IDX"> - <field ref="RESOURCE_ID"/> - <field ref="START_TIME"/> - </index> - <!-- only one null row can exist for any resource --> - <index name="RHQ_AVAIL_RESOURCE_END_IDX" condition="END_TIME IS NULL"> - <field ref="RESOURCE_ID"/> - <field ref="END_TIME" /> - </index> - </table> - - <table name="RHQ_RESOURCE_AVAIL"> - <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE(ID)" ondelete="cascade"/> - <column name="AVAILABILITY_TYPE" type="SMALLINT" required="false" /> - <index name="RHQ_RESOURCE_AVAIL_IDX"> - <field ref="RESOURCE_ID" /> - </index> - </table> - - <!-- !!!!! REMOVED !!!!! --> - <table name="RHQ_MEASUREMENT_OOB" obsolete="true"> - <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> - <column name="SCHEDULE_ID" type="INTEGER" references="RHQ_MEASUREMENT_SCHED(ID)" required="true"/> - <column name="OCCURRED" type="LONG" required="true"/> - <column name="DIFF" type="DOUBLE" required="true"/> - - <index name="RHQ_MEASUREMENT_OOB_IDX" unique="true"> - <field ref="SCHEDULE_ID" /> - <field ref="OCCURRED" /> - </index> - </table> - - <table name="RHQ_MEASUREMENT_OOB"> - <column name="SCHEDULE_ID" type="INTEGER" references="RHQ_MEASUREMENT_SCHED(ID)" required="true"/> - <column name="TIME_STAMP" type="LONG" required="true"/> - <column name="OOB_FACTOR" type="INTEGER" required="true" /> - <constraint name="RHQ_MEAS_OOB_ID_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_MEASUREMENT_OOB_TMP"> - <column name="SCHEDULE_ID" type="INTEGER" required="true"/> - <column name="TIME_STAMP" type="LONG" required="true"/> - <column name="OOB_FACTOR" type="INTEGER" required="true" /> - <constraint name="RHQ_MEAS_OOB_TMP_ID_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_NUMBERS"> - <column name="i" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true" /> - </table> - - - <table name="RHQ_MEAS_DATA_NUM_R00"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R00_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R00_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R01"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R01_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R01_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R02"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R02_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R02_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R03"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R03_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R03_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R04"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R04_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R04_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R05"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R05_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R05_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R06"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R06_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R06_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R07"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R07_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R07_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R08"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R08_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R08_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R09"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R09_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R09_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R10"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R10_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R10_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R11"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R11_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R11_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R12"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R12_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R12_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R13"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R13_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R13_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R14"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R14_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R14_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - -<!-- END: measurement-schema.xml --> -<!-- BEGIN: content-schema.xml --> - - - <table name="RHQ_ARCHITECTURE"> - <column name="ID" default="sequence-only" initial="100" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="50" type="VARCHAR2" required="true"/> - <index name="RHQ_ARCHITECTURE_NAME_IDX" unique="true"> - <field ref="NAME"/> - </index> - </table> - - <table name="RHQ_CONTENT_SOURCE_TYPE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="false"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="PLUGIN_NAME" size="100" type="VARCHAR2" required="false"/> - <!-- we might want this as part of natural key --> - <column name="DEFAULT_LAZY_LOAD" type="BOOLEAN" required="true"/> - <column name="DEFAULT_DOWNLOAD_MODE" size="16" type="VARCHAR2" required="true"/> - <column name="DEFAULT_SYNC_SCHEDULE" size="64" type="VARCHAR2" required="false"/> - <column name="API_CLASS" size="100" type="VARCHAR2" required="true"/> - - <column name="SOURCE_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF" required="false"/> - - <index name="RHQ_CONTENT_SOURCE_TYPE_IDX" unique="true"> - <field ref="NAME"/> - <!-- <field ref="PLUGIN_NAME"/> --> - </index> - </table> - - <table name="RHQ_CONTENT_SOURCE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="LAZY_LOAD" type="BOOLEAN" required="true"/> - <column name="DOWNLOAD_MODE" size="16" type="VARCHAR2" required="true"/> - <column name="SYNC_SCHEDULE" size="64" type="VARCHAR2" required="false"/> - <column name="LOAD_ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="CREATION_TIME" type="LONG" required="true"/> - <column name="LAST_MODIFIED_TIME" type="LONG" required="true"/> - - <column name="CONTENT_SOURCE_TYPE_ID" type="INTEGER" references="RHQ_CONTENT_SOURCE_TYPE" required="true"/> - <column name="CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> - - <index name="RHQ_CONTENT_SOURCE_IDX" unique="true"> - <field ref="NAME"/> - <field ref="CONTENT_SOURCE_TYPE_ID"/> - </index> - </table> - - <table name="RHQ_CHANNEL"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="CREATION_TIME" type="LONG" required="true"/> - <column name="LAST_MODIFIED_TIME" type="LONG" required="true"/> - - <index name="RHQ_CHANNEL_IDX" unique="true"> - <field ref="NAME"/> - </index> - </table> - - <table name="RHQ_PACKAGE_TYPE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="false"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="CATEGORY" size="50" type="VARCHAR2" required="false"/> - <column name="DISCOVERY_INTERVAL" type="INTEGER" required="false"/> - <column name="IS_CREATION_DATA" type="BOOLEAN" required="true"/> - <column name="SUPPORTS_ARCHITECTURE" type="BOOLEAN" required="true"/> - - <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE" required="true"/> - <column name="DEPLOYMENT_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF" required="false"/> - <column name="PACKAGE_EXTRA_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG_DEF" required="false"/> - - <index name="RHQ_PACKAGE_TYPE_IDX" unique="true"> - <field ref="NAME"/> - <field ref="RESOURCE_TYPE_ID"/> - </index> - - </table> - - <table name="RHQ_PACKAGE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="CLASSIFICATION" size="200" type="VARCHAR2" required="false"/> - - <column name="PACKAGE_TYPE_ID" type="INTEGER" references="RHQ_PACKAGE_TYPE" required="true"/> - - <index name="RHQ_PACKAGE_IDX" unique="true"> - <field ref="NAME"/> - <field ref="PACKAGE_TYPE_ID"/> - </index> - </table> - - <table name="RHQ_PACKAGE_BITS"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="BITS" type="BLOB" required="false"/> - </table> - - <table name="RHQ_PACKAGE_VERSION"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="false"/> - <column name="SHORT_DESCRIPTION" size="10000" type="CLOB" required="false"/> - <column name="LONG_DESCRIPTION" size="50000" type="CLOB" required="false"/> - <column name="VERSION" size="500" type="VARCHAR2" required="true"/> - <column name="DISPLAY_VERSION" size="500" type="VARCHAR2" required="false"/> - <column name="FILE_NAME" size="255" type="VARCHAR2" required="false"/> - <column name="FILE_SIZE" type="LONG" required="false"/> - <column name="FILE_MD5" size="32" type="VARCHAR2" required="false"/> - <column name="FILE_SHA256" size="64" type="VARCHAR2" required="false"/> - <column name="FILE_CREATION_TIME" type="LONG" required="false"/> - <column name="LICENSE_NAME" size="255" type="VARCHAR2" required="false"/> - <column name="LICENSE_VERSION" size="20" type="VARCHAR2" required="false"/> - <column name="METADATA" type="BLOB" required="false"/> - - <column name="PACKAGE_ID" type="INTEGER" references="RHQ_PACKAGE" required="true"/> - <column name="ARCHITECTURE_ID" type="INTEGER" references="RHQ_ARCHITECTURE" required="true"/> - <column name="CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> - <column name="PACKAGE_BITS_ID" type="INTEGER" references="RHQ_PACKAGE_BITS" required="false"/> - - <index name="RHQ_PACKAGE_VERSION_IDX" unique="true"> - <field ref="PACKAGE_ID"/> - <field ref="VERSION"/> - <field ref="ARCHITECTURE_ID"/> - </index> - - </table> - - <table name="RHQ_CONTENT_REQ"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="REQUEST_TYPE" type="VARCHAR2" required="true" size="20"/> - <column name="NOTES" type="VARCHAR2" required="false" size="512"/> - </table> - - <table name="RHQ_INSTALLED_PACKAGE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="INSTALLATION_TIME" type="LONG" required="false"/> - - <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE" required="true"/> - <column name="PACKAGE_VERSION_ID" type="INTEGER" references="RHQ_PACKAGE_VERSION" required="true"/> - <column name="SUBJECT_ID" type="INTEGER" references="RHQ_SUBJECT" required="false"/> - </table> - - <table name="RHQ_INSTALLED_PKG_HIST"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="STATUS" type="VARCHAR2" size="24" required="true"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="HISTORY_TIMESTAMP" type="LONG" required="false"/> - - <column name="PACKAGE_VERSION_ID" type="INTEGER" references="RHQ_PACKAGE_VERSION" required="true"/> - <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE" required="true"/> - <column name="DEPLOYMENT_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> - <column name="CONTENT_SERVICE_REQUEST_ID" type="INTEGER" references="RHQ_CONTENT_REQ" required="false"/> - </table> - - <table name="RHQ_CONTENT_SRC_SYNC"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="STATUS" type="VARCHAR2" size="16" required="true"/> - <column name="START_TIME" type="LONG" required="true"/> - <column name="END_TIME" type="LONG" required="false"/> - <column name="RESULTS" type="LONGVARCHAR" required="false"/> - - <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> - </table> - - <table name="RHQ_PACKAGE_INST_STEP"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="STEP_KEY" type="VARCHAR2" size="500" required="true"/> - <column name="STEP_ORDER" type="INTEGER" required="true"/> - <column name="DESCRIPTION" type="VARCHAR2" size="4000" required="true"/> - <column name="ERROR_MSG" type="LONGVARCHAR" required="false"/> - <column name="RESULT" type="VARCHAR2" size="25" required="true"/> - - <column name="INSTALLED_PKG_HIST_ID" type="INTEGER" references="RHQ_INSTALLED_PKG_HIST"/> - </table> - - <table name="RHQ_CHANNEL_RESOURCE_MAP"> - <column name="CHANNEL_ID" type="INTEGER" required="true" references="RHQ_CHANNEL"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> - <column name="CTIME" type="LONG" required="true"/> - - <constraint name="RHQ_CHANNEL_RESOURCE_MAP_KEY"> - <primaryKey> - <field ref="CHANNEL_ID"/> - <field ref="RESOURCE_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_CHANNEL_CONTENT_SRC_MAP"> - <column name="CHANNEL_ID" type="INTEGER" required="true" references="RHQ_CHANNEL"/> - <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> - <column name="CTIME" type="LONG" required="true"/> - - <constraint name="RHQ_CHAN_CONTENT_SRC_MAP_KEY"> - <primaryKey> - <field ref="CHANNEL_ID"/> - <field ref="CONTENT_SRC_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_CHANNEL_PKG_VERSION_MAP"> - <column name="CHANNEL_ID" type="INTEGER" required="true" references="RHQ_CHANNEL"/> - <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> - <column name="CTIME" type="LONG" required="true"/> - - <constraint name="RHQ_CHANNEL_PKG_VER_MAP_KEY"> - <primaryKey> - <field ref="CHANNEL_ID"/> - <field ref="PACKAGE_VERSION_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_PKG_VER_CONTENT_SRC_MAP"> - <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> - <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> - <column name="LOCATION" type="VARCHAR2" size="4000" required="true"/> - - <constraint name="RHQ_PKG_VER_CONTENT_SRC_KEY"> - <primaryKey> - <field ref="PACKAGE_VERSION_ID"/> - <field ref="CONTENT_SRC_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_PKG_PRD_MAP"> - <column name="PKG_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> - <column name="PRD_ID" type="INTEGER" required="true" references="RHQ_PRD_VER"/> - - <constraint name="RHQ_PKG_PRD_KEY"> - <primaryKey> - <field ref="PKG_ID"/> - <field ref="PRD_ID"/> - </primaryKey> - </constraint> - - </table> - -<!-- END: content-schema.xml --> -<!-- BEGIN: resource-request-schema.xml --> - - - <table name="RHQ_CREATE_RES_HIST"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="PARENT_RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> - <column name="CREATED_RESOURCE_NAME" type="VARCHAR2" size="500" required="false"/> - <column name="NEW_RESOURCE_KEY" type="VARCHAR2" required="false" size="500"/> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> - <column name="CONFIGURATION_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> - <column name="INSTALLED_PACKAGE_ID" type="INTEGER" required="false" references="RHQ_INSTALLED_PACKAGE"/> - </table> - - <table name="RHQ_DELETE_RES_HIST"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> - </table> - -<!-- END: resource-request-schema.xml --> -<!-- BEGIN: jms-schema.xml --> - -<!-- the schema matches that which would be automatically created by the JMS subsystem --> -<!-- see deploy/jms/rhq-jdbc-state-service.xml and rhq-jdbc2-service.xml --> - - - <table name="JMS_MESSAGES"> - <column name="MESSAGEID" required="true" type="INTEGER" /> - <column name="DESTINATION" required="true" type="VARCHAR2" size="255" /> - <column name="TXID" required="false" type="INTEGER" /> - <column name="TXOP" required="false" type="CHAR" size="1" /> - <column name="MESSAGEBLOB" required="false" type="BLOB" /> - - <constraint name="JMS_MESSAGES_PKEY"> - <primaryKey> - <field ref="MESSAGEID"/> - <field ref="DESTINATION"/> - </primaryKey> - </constraint> - - <index name="JMS_MESSAGES_TXOP_TXID"> - <field ref="TXOP"/> - <field ref="TXID"/> - </index> - <index name="JMS_MESSAGES_DESTINATION"> - <field ref="DESTINATION"/> - </index> - </table> - - <table name="JMS_TRANSACTIONS"> - <column name="TXID" required="true" type="INTEGER" primarykey="true" /> - </table> - - <table name="JMS_USERS"> - <column name="USERID" required="true" type="VARCHAR2" size="32" primarykey="true" /> - <column name="PASSWD" required="true" type="VARCHAR2" size="32" /> - <column name="CLIENTID" required="false" type="VARCHAR2" size="128" /> - </table> - - <table name="JMS_ROLES"> - <column name="ROLEID" required="true" type="VARCHAR2" size="32" /> - <column name="USERID" required="true" type="VARCHAR2" size="32" /> - - <constraint name="JMS_ROLES_PKEY"> - <primaryKey> - <field ref="USERID"/> - <field ref="ROLEID"/> - </primaryKey> - </constraint> - </table> - - <table name="JMS_SUBSCRIPTIONS"> - <column name="CLIENTID" required="true" type="VARCHAR2" size="128" /> - <column name="SUBNAME" required="true" type="VARCHAR2" size="128" /> - <column name="TOPIC" required="true" type="VARCHAR2" size="255" /> - <column name="SELECTOR" required="false" type="VARCHAR2" size="255" /> - - <constraint name="JMS_SUBSCRIPTIONS_PKEY"> - <primaryKey> - <field ref="CLIENTID"/> - <field ref="SUBNAME"/> - </primaryKey> - </constraint> - </table> - -<!-- END: jms-schema.xml --> -<!-- BEGIN: alert-schema.xml --> - - - <table name="RHQ_ALERT_DEFINITION"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" required="true" size="100" type="VARCHAR2"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="PARENT_ID" type="INTEGER" required="false"/> - <column name="GROUP_ALERT_DEF_ID" type="INTEGER" required="false"/> - <column name="DESCRIPTION" required="false" size="250" type="VARCHAR2"/> - <column name="PRIORITY" type="VARCHAR2" size="15" required="true"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE" required="false"/> - <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE" required="false"/> - <column name="RESOURCE_GROUP_ID" type="INTEGER" references="RHQ_RESOURCE_GROUP" required="false"/> - <column name="ENABLED" required="true" default="TRUE" type="BOOLEAN"/> - - <column name="REQUIRED" required="true" type="SMALLINT"/> - - <column name="RECOVERY_ID" type="INTEGER" required="true"/> - <!-- required, but 0 effectively means null --> - <column name="WILL_RECOVER" required="true" default="false" type="BOOLEAN"/> - <column name="NOTIFY_FILTERED" required="true" default="false" type="BOOLEAN"/> - <column name="CONTROL_FILTERED" required="true" default="FALSE" type="BOOLEAN"/> - - <column name="DELETED" required="true" default="FALSE" type="BOOLEAN"/> - <column name="READ_ONLY" required="true" default="FALSE" type="BOOLEAN"/> - - <column name="DAMPENING_CATEGORY" type="SMALLINT" required="true"/> - <column name="DAMPENING_VALUE" type="INTEGER"/> - <column name="DAMPENING_VALUE_UNITS" type="SMALLINT"/> - <column name="DAMPENING_PERIOD" type="INTEGER"/> - <column name="DAMPENING_PERIOD_UNITS" type="SMALLINT"/> - - <column name="OPERATION_DEF_ID" type="INTEGER" references="RHQ_OPERATION_DEF(ID)"/> - </table> - - <table name="RHQ_ALERT_DAMPEN_EVENT"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> - <column name="EVENT_TYPE" required="true" type="SMALLINT"/> - <column name="EVENT_TIMESTAMP" required="true" type="LONG"/> - - <index name="RHQ_DAMPENING_EVENT_TYPE_IDX"> - <field ref="EVENT_TYPE"/> - </index> - <index name="RHQ_DAMPENING_EVENT_TS_IDX"> - <field ref="EVENT_TIMESTAMP"/> - </index> - </table> - - <table name="RHQ_ALERT_CONDITION"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="TYPE" required="true" type="VARCHAR2" size="15"/> - <!-- - <column name="REQUIRED" required="true" type="BOOLEAN"/> - --> - <column name="MEASUREMENT_DEFINITION_ID" required="false" type="INTEGER"/> - <column name="NAME" required="false" size="100" type="VARCHAR2"/> - <column name="COMPARATOR" required="false" size="2" type="VARCHAR2"/> - <column name="THRESHOLD" required="false" type="DOUBLE"/> - <!-- event-based conditions use OPTION_STATUS for the string match, so should be a decent length --> - <column name="OPTION_STATUS" required="false" size="256" type="VARCHAR2"/> - <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> - <column name="TRIGGER_ID" required="false" type="INTEGER"/> - </table> - - <table name="RHQ_ALERT" tablespace="DEFAULT" - storage-options="freelists 5" cache="true" logging="false"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> - <column name="CTIME" required="true" type="LONG"/> - <column name="TRIGGERED_OPERATION" required="false" type="VARCHAR2" size="255"/> - <column name="RECOVERY_ID" type="INTEGER" required="true"/> - <!-- required, but 0 effectively means null --> - <column name="WILL_RECOVER" required="true" default="false" type="BOOLEAN"/> - <index name="RHQ_ALERT_IDX_TIME" unique="false"> - <field ref="CTIME"/> - </index> - <index name="RHQ_ALERT_IDX_ALERTDEF" unique="false"> - <field ref="ALERT_DEFINITION_ID"/> - </index> - </table> - - <table name="RHQ_ALERT_NOTIF_LOG" tablespace="DEFAULT" - storage-options="freelists 5" cache="true" logging="false"> - <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"> - <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"/> - </table> - - <table name="RHQ_ALERT_CONDITION_LOG" tablespace="DEFAULT" - storage-options="freelists 5" cache="true" logging="false"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="CTIME" required="true" type="LONG"/> - <column name="ALERT_ID" required="false" type="INTEGER" references="RHQ_ALERT(ID)"/> - <column name="CONDITION_ID" required="true" type="INTEGER" references="RHQ_ALERT_CONDITION(ID)"/> - <column name="VALUE" required="false" size="250" type="VARCHAR2"/> - <index name="RHQ_ALERT_COND_LOG_IDX_TIME"> - <field ref="CTIME" /> - </index> - <index name="RHQ_ALERT_COND_LOG_IDX_ALERT"> - <field ref="ALERT_ID"/> - </index> - </table> - - <table name="RHQ_ALERT_NOTIFICATION" tablespace="DEFAULT" - storage-options="freelists 5" cache="true" logging="false"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <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="ROLE_ID" type="INTEGER" references="RHQ_ROLE(ID)"/> - <column name="SUBJECT_ID" type="INTEGER" references="RHQ_SUBJECT(ID)"/> - <column name="EMAIL_ADDRESS" size="100" type="VARCHAR2"/> - <column name="SNMP_HOST" size="100" type="VARCHAR2"/> - <column name="SNMP_PORT" type="INTEGER"/> - <column name="SNMP_OID" size="250" type="VARCHAR2"/> - </table> - -<!-- END: alert-schema.xml --> -<!-- BEGIN: event-schema.xml --> - - - <!-- metadata --> - - <table name="RHQ_EVENT_DEF"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE(ID)"/> - - <column name="NAME" type="VARCHAR2" size="100" required="true"/> - <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> - <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> - - <index name="RHQ_EVENT_DEF_IDX" unique="true"> - <field ref="RESOURCE_TYPE_ID"/> - <field ref="NAME"/> - </index> - </table> - - <!-- instance data --> - - <table name="RHQ_EVENT_SOURCE"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="EVENT_DEF_ID" type="INTEGER" required="true" references="RHQ_EVENT_DEF(ID)"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE(ID)"/> - - <column name="LOCATION" required="true" size="2000" type="VARCHAR2"/> - - <index name="RHQ_EVENT_SOURCE_IDX" unique="true"> - <field ref="EVENT_DEF_ID"/> - <field ref="RESOURCE_ID"/> - <field ref="LOCATION"/> - </index> - </table> - - <table name="RHQ_EVENT"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="EVENT_SOURCE_ID" type="INTEGER" required="true" references="RHQ_EVENT_SOURCE(ID)"/> - - <column name="TIMESTAMP" required="true" type="LONG"/> - <column name="SEVERITY" required="true" size="20" type="VARCHAR2"/> - <column name="DETAIL" required="true" size="4000" type="VARCHAR2"/> - <index name="RHQ_EVENT_IDX" unique="false"> - <field ref="EVENT_SOURCE_ID"/> - <field ref="TIMESTAMP"/> - </index> - </table> - -<!-- END: event-schema.xml --> -</dbsetup> diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/2.4.0/db-data-combined-2.4.0.xml b/modules/core/dbutils/src/main/scripts/dbsetup/2.4.0/db-data-combined-2.4.0.xml new file mode 100644 index 0000000..15978a6 --- /dev/null +++ b/modules/core/dbutils/src/main/scripts/dbsetup/2.4.0/db-data-combined-2.4.0.xml @@ -0,0 +1,669 @@ +<?xml version="1.0" encoding="UTF-8"?> +<dbsetup name="data.xml"> +<!-- BEGIN: rhq-data.xml --> +<!-- BEGIN: auth-data.xml --> + + + <table name="RHQ_PRINCIPAL"> + <data id="2" PRINCIPAL="rhqadmin" PASSWORD="x1XwrxKuPvYUILiOnOZTLg=="/> + </table> + +<!-- END: auth-data.xml --> +<!-- BEGIN: authz-data.xml --> + + + <!-- the overlord user --> + <table name="RHQ_SUBJECT"> + <data ID="1" + NAME="admin" + FIRST_NAME="Super" + LAST_NAME="User" + FSYSTEM="TRUE"/> + </table> + + <!-- the initial rhqadmin user --> + <table name="RHQ_SUBJECT"> + <data ID="2" + NAME="rhqadmin" + FIRST_NAME="RHQ" + LAST_NAME="Administrator" + EMAIL_ADDRESS="rhqadmin@localhost" + FSYSTEM="FALSE"/> + </table> + + <!-- Define the system root role which includes our overlord and rhqadmin users --> + <table name="RHQ_ROLE"> + <data ID="1" + NAME="Super User Role" + FSYSTEM="TRUE" + DESCRIPTION="System superuser role that provides full access to everything. This role cannot be modified."/> + <data ID="2" + NAME="All Resources Role" + FSYSTEM="FALSE" + DESCRIPTION="Provides full access to all resources in inventory. Cannot modify users, roles or server settings."/> + </table> + + <!-- associate the root users with all security permissions --> + <table name="RHQ_SUBJECT_ROLE_MAP"> + <data SUBJECT_ID="1" ROLE_ID="1"/> + <!-- overlord user --> + <data SUBJECT_ID="2" ROLE_ID="1"/> + <!-- rhqadmin user --> + </table> + + <table name="RHQ_PERMISSION"> + <!-- give super-user-role all permissions (resource perms is mainly just to show on view-role page) --> + <data ROLE_ID="1" OPERATION="0"/> <!-- Permission.MANAGE_SECURITY --> + <data ROLE_ID="1" OPERATION="1"/> <!-- Permission.MANAGE_INVENTORY --> + <data ROLE_ID="1" OPERATION="2"/> <!-- Permission.MANAGE_SETTINGS --> + <data ROLE_ID="1" OPERATION="12"/> <!-- Permission.MANAGE_BUNDLE --> + <!-- resource permissions start here--> + <data ROLE_ID="1" OPERATION="3"/> <!-- Permission.VIEW_RESOURCE --> + <data ROLE_ID="1" OPERATION="4"/> <!-- Permission.MODIFY_RESOURCE --> + <data ROLE_ID="1" OPERATION="5"/> <!-- Permission.DELETE_RESOURCE --> + <data ROLE_ID="1" OPERATION="6"/> <!-- Permission.CREATE_CHILD_RESOURCES --> + <data ROLE_ID="1" OPERATION="7"/> <!-- Permission.MANAGE_ALERTS --> + <data ROLE_ID="1" OPERATION="8"/> <!-- Permission.MANAGE_MEASUREMENTS --> + <data ROLE_ID="1" OPERATION="9"/> <!-- Permission.MANAGE_CONTENT --> + <data ROLE_ID="1" OPERATION="10"/> <!-- Permission.CONTROL --> + <data ROLE_ID="1" OPERATION="11"/> <!-- Permission.CONFIGURE --> + + <!-- give all-resources-role all permissions (resource perms is mainly just to show on view-role page) --> + <data ROLE_ID="2" OPERATION="1"/> <!-- Permission.MANAGE_INVENTORY --> + <data ROLE_ID="2" OPERATION="12"/> <!-- Permission.MANAGE_BUNDLE --> + <!-- resource permissions start here--> + <data ROLE_ID="2" OPERATION="3"/> <!-- Permission.VIEW_RESOURCE --> + <data ROLE_ID="2" OPERATION="4"/> <!-- Permission.MODIFY_RESOURCE --> + <data ROLE_ID="2" OPERATION="5"/> <!-- Permission.DELETE_RESOURCE --> + <data ROLE_ID="2" OPERATION="6"/> <!-- Permission.CREATE_CHILD_RESOURCES --> + <data ROLE_ID="2" OPERATION="7"/> <!-- Permission.MANAGE_ALERTS --> + <data ROLE_ID="2" OPERATION="8"/> <!-- Permission.MANAGE_MEASUREMENTS --> + <data ROLE_ID="2" OPERATION="9"/> <!-- Permission.MANAGE_CONTENT --> + <data ROLE_ID="2" OPERATION="10"/> <!-- Permission.CONTROL --> + <data ROLE_ID="2" OPERATION="11"/> <!-- Permission.CONFIGURE --> + </table> + +<!-- END: authz-data.xml --> +<!-- BEGIN: 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="availability=down category=platform" + LAST_COMPUTE_TIME="0" + SUBJECT_ID="1" + GLOBAL="TRUE" /> + <data ID="2" + CONTEXT="RESOURCE" + NAME="Downed Servers" + DESCRIPTION="All downed servers across the entire enterprise" + PATTERN="availability=down category=server" + LAST_COMPUTE_TIME="0" + SUBJECT_ID="1" + GLOBAL="TRUE" /> + </table> + +<!-- END: search-data.xml --> +<!-- BEGIN: sysconfig-data.xml --> + + + <!-- + This file contains the seed data for the configuration table. + All keys mentioned here should be referenced via the RHQConstants class + --> + <table name="RHQ_SYSTEM_CONFIG"> + <data ID="1" PROPERTY_KEY="SERVER_VERSION" PROPERTY_VALUE="3.0.0.GA" + DEFAULT_PROPERTY_VALUE="3.0.0.GA" FREAD_ONLY="TRUE"/> + <data ID="2" PROPERTY_KEY="DB_SCHEMA_VERSION" PROPERTY_VALUE="2.91" + DEFAULT_PROPERTY_VALUE="2.91" FREAD_ONLY="TRUE"/> + <data ID="3" PROPERTY_KEY="CAM_JAAS_PROVIDER" PROPERTY_VALUE="JDBC" + DEFAULT_PROPERTY_VALUE="JDBC" FREAD_ONLY="FALSE"/> + <data ID="4" PROPERTY_KEY="CAM_BASE_URL" PROPERTY_VALUE="http://127.0.0.1:7080/" + DEFAULT_PROPERTY_VALUE="http://127.0.0.1:7080/" FREAD_ONLY="FALSE"/> + <data ID="9" PROPERTY_KEY="CAM_HELP_USER" PROPERTY_VALUE="web" + DEFAULT_PROPERTY_VALUE="web" FREAD_ONLY="FALSE"/> + <data ID="10" PROPERTY_KEY="CAM_HELP_PASSWORD" PROPERTY_VALUE="user" + DEFAULT_PROPERTY_VALUE="user" FREAD_ONLY="FALSE"/> + + <!-- default LDAP configuration options --> + <data ID="11" PROPERTY_KEY="CAM_LDAP_NAMING_FACTORY_INITIAL" + PROPERTY_VALUE="com.sun.jndi.ldap.LdapCtxFactory" + DEFAULT_PROPERTY_VALUE="com.sun.jndi.ldap.LdapCtxFactory" + FREAD_ONLY="FALSE"/> + <data ID="12" PROPERTY_KEY="CAM_LDAP_NAMING_PROVIDER_URL" + PROPERTY_VALUE="ldap://localhost/" + DEFAULT_PROPERTY_VALUE="ldap://localhost/" + FREAD_ONLY="FALSE"/> + <data ID="13" PROPERTY_KEY="CAM_LDAP_LOGIN_PROPERTY" + PROPERTY_VALUE="cn" + DEFAULT_PROPERTY_VALUE="cn" FREAD_ONLY="FALSE"/> + <data ID="14" PROPERTY_KEY="CAM_LDAP_BASE_DN" + PROPERTY_VALUE="o=JBoss,c=US" + DEFAULT_PROPERTY_VALUE="o=JBoss,c=US" + FREAD_ONLY="FALSE"/> + <data ID="15" PROPERTY_KEY="CAM_LDAP_BIND_DN" + PROPERTY_VALUE="" + DEFAULT_PROPERTY_VALUE="" FREAD_ONLY="FALSE"/> + <data ID="16" PROPERTY_KEY="CAM_LDAP_BIND_PW" + PROPERTY_VALUE="" + DEFAULT_PROPERTY_VALUE="" FREAD_ONLY="FALSE"/> + <data ID="17" PROPERTY_KEY="CAM_LDAP_PROTOCOL" + PROPERTY_VALUE="" DEFAULT_PROPERTY_VALUE="" + FREAD_ONLY="FALSE"/> + <data ID="18" PROPERTY_KEY="CAM_LDAP_FILTER" + PROPERTY_VALUE="" DEFAULT_PROPERTY_VALUE="" + FREAD_ONLY="FALSE"/> + + <!-- Does this build support Syslog actions? --> + <data ID="21" PROPERTY_KEY="CAM_SYSLOG_ACTIONS_ENABLED" + PROPERTY_VALUE="false" DEFAULT_PROPERTY_VALUE="false" + FREAD_ONLY="FALSE"/> + <data ID="23" PROPERTY_KEY="CAM_GUIDE_ENABLED" + PROPERTY_VALUE="true" + DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> + <data ID="24" PROPERTY_KEY="CAM_RT_COLLECT_IP_ADDRS" + PROPERTY_VALUE="true" + DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> + + <!-- Default data storage options --> + <!-- Default 14 days --> + <data ID="26" PROPERTY_KEY="CAM_DATA_PURGE_1H" + PROPERTY_VALUE="1209600000" DEFAULT_PROPERTY_VALUE="1209600000" + FREAD_ONLY="FALSE"/> + <!-- Default 31 days --> + <data ID="27" PROPERTY_KEY="CAM_DATA_PURGE_6H" + PROPERTY_VALUE="2678400000" DEFAULT_PROPERTY_VALUE="2678400000" + FREAD_ONLY="FALSE"/> + <!-- Default 1 year --> + <data ID="28" PROPERTY_KEY="CAM_DATA_PURGE_1D" + PROPERTY_VALUE="31536000000" DEFAULT_PROPERTY_VALUE="31536000000" + FREAD_ONLY="FALSE"/> + + <!-- Baseline options --> + <!-- How often to calculate, default 3 days; if 0, never calculate them automatically --> + <data ID="29" PROPERTY_KEY="CAM_BASELINE_FREQUENCY" + PROPERTY_VALUE="259200000" DEFAULT_PROPERTY_VALUE="259200000" + FREAD_ONLY="FALSE"/> + <!-- How much data to include in the calulation, default 7 days --> + <data ID="30" PROPERTY_KEY="CAM_BASELINE_DATASET" + PROPERTY_VALUE="604800000" DEFAULT_PROPERTY_VALUE="604800000" + FREAD_ONLY="FALSE"/> + + <!-- ID 31 has been deleted --> + + <!-- How often to run database maintainence routines --> + <data ID="32" PROPERTY_KEY="CAM_DATA_MAINTENANCE" + PROPERTY_VALUE="3600000" DEFAULT_PROPERTY_VALUE="3600000" FREAD_ONLY="FALSE"/> + + <!-- How long to keep RT data around --> + <data ID="34" PROPERTY_KEY="RT_DATA_PURGE" PROPERTY_VALUE="2678400000" + DEFAULT_PROPERTY_VALUE="2678400000" FREAD_ONLY="FALSE"/> + + <!-- Whether to reindex the data tables nightly --> + <data ID="35" PROPERTY_KEY="DATA_REINDEX_NIGHTLY" PROPERTY_VALUE="true" + DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> + + <!-- How long to keep alerts around --> + <data ID="36" PROPERTY_KEY="ALERT_PURGE" PROPERTY_VALUE="2678400000" + DEFAULT_PROPERTY_VALUE="2678400000" FREAD_ONLY="FALSE"/> + + <!-- How long to keep events around (1209600000 millis == 14 days) --> + <data ID="51" PROPERTY_KEY="EVENT_PURGE" PROPERTY_VALUE="1209600000" + DEFAULT_PROPERTY_VALUE="1209600000" FREAD_ONLY="FALSE"/> + + <!-- How long an agent is allowed to be quiet before we consider it down and backfill it --> + <data ID="52" PROPERTY_KEY="AGENT_MAX_QUIET_TIME_ALLOWED" PROPERTY_VALUE="900000" + DEFAULT_PROPERTY_VALUE="900000" FREAD_ONLY="FALSE"/> + + <!-- Will our server-cloud support agents auto-updating themselves? --> + <data ID="53" PROPERTY_KEY="ENABLE_AGENT_AUTO_UPDATE" PROPERTY_VALUE="true" + DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> + + <!-- How old does a trait have to be in order to get purged --> + <data ID="54" PROPERTY_KEY="TRAIT_PURGE" PROPERTY_VALUE="31536000000" + DEFAULT_PROPERTY_VALUE="31536000000" FREAD_ONLY="FALSE"/> + + <!-- How old does availability have to be in order to get purged --> + <data ID="55" PROPERTY_KEY="AVAILABILITY_PURGE" PROPERTY_VALUE="31536000000" + DEFAULT_PROPERTY_VALUE="31536000000" FREAD_ONLY="FALSE"/> + + </table> + +<!-- END: sysconfig-data.xml --> +<!-- BEGIN: measurement-data.xml --> + + <table name="RHQ_NUMBERS"> + <data i="0"/> + <data i="1"/> + <data i="2"/> + <data i="3"/> + <data i="4"/> + <data i="5"/> + <data i="6"/> + <data i="7"/> + <data i="8"/> + <data i="9"/> + <data i="10"/> + <data i="11"/> + <data i="12"/> + <data i="13"/> + <data i="14"/> + <data i="15"/> + <data i="16"/> + <data i="17"/> + <data i="18"/> + <data i="19"/> + <data i="20"/> + <data i="21"/> + <data i="22"/> + <data i="23"/> + <data i="24"/> + <data i="25"/> + <data i="26"/> + <data i="27"/> + <data i="28"/> + <data i="29"/> + <data i="30"/> + <data i="31"/> + <data i="32"/> + <data i="33"/> + <data i="34"/> + <data i="35"/> + <data i="36"/> + <data i="37"/> + <data i="38"/> + <data i="39"/> + <data i="40"/> + <data i="41"/> + <data i="42"/> + <data i="43"/> + <data i="44"/> + <data i="45"/> + <data i="46"/> + <data i="47"/> + <data i="48"/> + <data i="49"/> + <data i="50"/> + <data i="51"/> + <data i="52"/> + <data i="53"/> + <data i="54"/> + <data i="55"/> + <data i="56"/> + <data i="57"/> + <data i="58"/> + <data i="59"/> + </table> + +<!-- END: measurement-data.xml --> +<!-- BEGIN: content-data.xml --> + + <table name="RHQ_ARCHITECTURE"> + <data id="1" name="noarch"/> + <data id="2" name="i386"/> + <data id="3" name="i486"/> + <data id="4" name="i586"/> + <data id="5" name="i686"/> + <data id="6" name="alpha"/> + <data id="7" name="alphaev6"/> + <data id="8" name="ia64"/> + <data id="9" name="sparc"/> + <data id="10" name="sparcv9"/> + <data id="11" name="sparc64"/> + <data id="12" name="src"/> + <data id="13" name="s390"/> + <data id="14" name="athlon"/> + <data id="15" name="s390x"/> + <data id="16" name="ppc"/> + <data id="17" name="ppc64"/> + <data id="18" name="pSeries"/> + <data id="19" name="iSeries"/> + <data id="20" name="x86_64"/> + <data id="21" name="ppc64iseries"/> + <data id="22" name="ppc64pseries"/> + <data id="23" name="sparc-solaris"/> + <data id="24" name="sparc.sun4u-solaris"/> + <data id="25" name="tar"/> + <data id="26" name="ia32e"/> + <data id="27" name="amd64"/> + <data id="28" name="i386-solaris"/> + <data id="29" name="nosrc"/> + <data id="30" name="sparc-solaris-patch"/> + <data id="31" name="i386-solaris-patch"/> + <data id="32" name="sparc-solaris-patch-cluster"/> + <data id="33" name="i386-solaris-patch-cluster"/> + <data id="34" name="noarch-solaris"/> + <data id="35" name="noarch-solaris-patch"/> + <data id="36" name="noarch-solaris-patch-cluster"/> + <data id="37" name="solaris-patch"/> + <data id="38" name="solaris-patch-cluster"/> + </table> + + <table name="RHQ_REPO_GROUP_TYPE"> + <data id="1" name="family"/> + </table> + + <table name="RHQ_REPO_RELATION_TYPE"> + <data id="1" name="parent"/> + <data id="2" name="clone"/> + </table> + + <table name="RHQ_DISTRIBUTION_TYPE"> + <data id="1" name="kickstart" description="Linux kickstart distribution"/> + <data id="2" name="jumpstart" description="solaris jumpstart distribution"/> + </table> + +<!-- END: content-data.xml --> +<!-- BEGIN: jms-data.xml --> + +<!-- the schema matches that which would be automatically created by the JMS subsystem --> +<!-- see deploy/jms/rhq-jdbc-state-service.xml and rhq-jdbc2-service.xml --> +<!-- the data must match that which is expected in conf/login-config.xml --> + + + <table name="JMS_USERS"> + <data USERID="guest" PASSWD="guest" /> + </table> + + <table name="JMS_ROLES"> + <data ROLEID="guest" USERID="guest" /> + </table> + +<!-- END: jms-data.xml --> +<!-- END: rhq-data.xml --> +<!-- BEGIN: jon-data.xml --> + +<!-- This dbsetup config file defines a content source and + associated repo for the JBoss CSP RSS patch feed. --> + + + <!-- ********* metadata (the content source type and its config def) ********* --> + + <table name="RHQ_CONFIG_DEF"> + <data ID="101" + NAME="JBoss CSP Patch Feed Content Source"/> + </table> + + <table name="RHQ_CONFIG_PROP_DEF"> + <data ID="101" + NAME="url" + DISPLAY_NAME="Feed URL" + DESCRIPTION="URL of the feed (e.g. https://support.redhat.com/jbossnetwork/restricted/feed/software.html?produc...)." + REQUIRED="1" + READONLY="0" + SUMMARY="0" + ACTIVATION_POLICY="IMMEDIATE" + ORDER_INDEX="0" + SIMPLE_TYPE="STRING" + ALLOW_CUSTOM_ENUM_VALUE="0" + DTYPE="property" + CONFIG_DEF_ID="101" + UNITS="0"/> + <data ID="102" + NAME="username" + DISPLAY_NAME="Username" + DESCRIPTION="Username used to access the feed URL." + REQUIRED="1" + READONLY="0" + SUMMARY="0" + ACTIVATION_POLICY="IMMEDIATE" + ORDER_INDEX="1" + SIMPLE_TYPE="STRING" + ALLOW_CUSTOM_ENUM_VALUE="0" + DTYPE="property" + CONFIG_DEF_ID="101" + UNITS="0"/> + <data ID="103" + NAME="password" + DISPLAY_NAME="Password" + DESCRIPTION="Password used to access the feed URL." + REQUIRED="1" + READONLY="0" + SUMMARY="0" + ACTIVATION_POLICY="IMMEDIATE" + ORDER_INDEX="2" + SIMPLE_TYPE="PASSWORD" + ALLOW_CUSTOM_ENUM_VALUE="0" + DTYPE="property" + CONFIG_DEF_ID="101" + UNITS="0"/> + <data ID="104" + NAME="active" + DISPLAY_NAME="Active" + DESCRIPTION="Indicates if the feed should be checked for new patches." + REQUIRED="1" + READONLY="0" + SUMMARY="0" + ACTIVATION_POLICY="IMMEDIATE" + ORDER_INDEX="3" + SIMPLE_TYPE="BOOLEAN" + ALLOW_CUSTOM_ENUM_VALUE="0" + DTYPE="property" + CONFIG_DEF_ID="101" + UNITS="0"/> + <data ID="105" + NAME="proxyUrl" + DISPLAY_NAME="Proxy URL" + REQUIRED="0" + READONLY="0" + SUMMARY="0" + ACTIVATION_POLICY="IMMEDIATE" + ORDER_INDEX="4" + SIMPLE_TYPE="STRING" + ALLOW_CUSTOM_ENUM_VALUE="0" + DTYPE="property" + CONFIG_DEF_ID="101" + UNITS="0"/> + <data ID="106" + NAME="proxyPort" + DISPLAY_NAME="Proxy Port" + REQUIRED="0" + READONLY="0" + SUMMARY="0" + ACTIVATION_POLICY="IMMEDIATE" + ORDER_INDEX="5" + SIMPLE_TYPE="STRING" + ALLOW_CUSTOM_ENUM_VALUE="0" + DTYPE="property" + CONFIG_DEF_ID="101" + UNITS="0"/> + <data ID="107" + NAME="proxyUsername" + DISPLAY_NAME="Proxy Username" + REQUIRED="0" + READONLY="0" + SUMMARY="0" + ACTIVATION_POLICY="IMMEDIATE" + ORDER_INDEX="6" + SIMPLE_TYPE="STRING" + ALLOW_CUSTOM_ENUM_VALUE="0" + DTYPE="property" + CONFIG_DEF_ID="101" + UNITS="0"/> + <data ID="108" + NAME="proxyPassword" + DISPLAY_NAME="Proxy Password" + REQUIRED="0" + READONLY="0" + SUMMARY="0" + ACTIVATION_POLICY="IMMEDIATE" + ORDER_INDEX="7" + SIMPLE_TYPE="STRING" + ALLOW_CUSTOM_ENUM_VALUE="0" + DTYPE="property" + CONFIG_DEF_ID="101" + UNITS="0"/> + </table> + + <!-- NOTE: The values of the NAME, PLUGIN_NAME, and API_CLASS columns must match what is + defined in RHQ/modules/enterprise/server/plugins/jboss-software/src/main/resources/META-INF/rhq-serverplugin.xml. --> + <!-- default sync chedule: 1st of every month at 12am --> + <table name="RHQ_CONTENT_SOURCE_TYPE"> + <data ID="101" + NAME="JBossASPatchSource" + DISPLAY_NAME="JBoss Patch Content Source" + DESCRIPTION="a content source that retrieves package metadata from an RSS feed; the feed must be in the format used by the JBoss CSP" + PLUGIN_NAME="JBossASPatchContentSourcePlugin" + DEFAULT_LAZY_LOAD="1" + DEFAULT_DOWNLOAD_MODE="DATABASE" + DEFAULT_SYNC_SCHEDULE="0 0 0 1 * ?" + API_CLASS="org.rhq.enterprise.server.plugins.jboss.software.JBossSoftwareContentSourceAdapter" + SOURCE_CONFIG_DEF_ID="101"/> + </table> + + + <!-- the default template --> + <table name="RHQ_CONFIG"> + <data ID="101" + VERSION="0" + CTIME="1270066600000" + MTIME="1270066600000"/> + </table> + + <table name="RHQ_CONFIG_PROPERTY"> + <data ID="101" + NAME="url" + CONFIGURATION_ID="101" + STRING_VALUE="" + OVERRIDE="0" + DTYPE="property"/> + <data ID="102" + NAME="username" + CONFIGURATION_ID="101" + OVERRIDE="0" + DTYPE="property"/> + <data ID="103" + NAME="password" + CONFIGURATION_ID="101" + OVERRIDE="0" + DTYPE="property"/> + <data ID="104" + NAME="proxyUrl" + CONFIGURATION_ID="101" + OVERRIDE="0" + DTYPE="property"/> + <data ID="105" + NAME="proxyPort" + CONFIGURATION_ID="101" + OVERRIDE="0" + DTYPE="property"/> + <data ID="106" + NAME="active" + CONFIGURATION_ID="101" + STRING_VALUE="true" + OVERRIDE="0" + DTYPE="property"/> + <data ID="107" + NAME="proxyUsername" + CONFIGURATION_ID="101" + OVERRIDE="0" + DTYPE="property"/> + <data ID="108" + NAME="proxyPassword" + CONFIGURATION_ID="101" + OVERRIDE="0" + DTYPE="property"/> + </table> + + <table name="RHQ_CONFIG_TEMPLATE"> + <data ID="101" + NAME="default" + DESCRIPTION="the default initial values for the configuration of a JBossASPatchSource content source" + CONFIG_ID="101" + CONFIG_DEF_ID="101" + IS_DEFAULT="1"/> + </table> + + + <!-- ********* data (the content source and its config) ********* --> + + <table name="RHQ_CONFIG"> + <data ID="102" + VERSION="0" + CTIME="1270066600000" + MTIME="1270066600000"/> + </table> + + <table name="RHQ_CONFIG_PROPERTY"> + <data ID="111" + NAME="url" + CONFIGURATION_ID="102" + STRING_VALUE="https://support.redhat.com/jbossnetwork/restricted/feed/software.html?produc..." + OVERRIDE="0" + DTYPE="property"/> + <data ID="112" + NAME="username" + CONFIGURATION_ID="102" + OVERRIDE="0" + DTYPE="property"/> + <data ID="113" + NAME="password" + CONFIGURATION_ID="102" + OVERRIDE="0" + DTYPE="property"/> + <data ID="114" + NAME="proxyUrl" + CONFIGURATION_ID="102" + OVERRIDE="0" + DTYPE="property"/> + <data ID="115" + NAME="proxyPort" + CONFIGURATION_ID="102" + OVERRIDE="0" + DTYPE="property"/> + <data ID="116" + NAME="active" + CONFIGURATION_ID="102" + STRING_VALUE="false" + OVERRIDE="0" + DTYPE="property"/> + <data ID="117" + NAME="proxyUsername" + CONFIGURATION_ID="102" + OVERRIDE="0" + DTYPE="property"/> + <data ID="118" + NAME="proxyPassword" + CONFIGURATION_ID="102" + OVERRIDE="0" + DTYPE="property"/> + </table> + + <!-- sync chedule: 1st of every month at 12am --> + <table name="RHQ_CONTENT_SOURCE"> + <data ID="101" + NAME="JBoss CSP Patch Feed" + DESCRIPTION="an RSS feed published by the JBoss Customer Service Portal (CSP) website which provides a list of all JBoss product patches available for the subscription of a given CSP user; the feed entries for most cumulative patches (CPs) include automated install instructions that can be used by JON to install those CPs to inventoried server Resources (e.g. JBoss EAP servers)" + LAZY_LOAD="1" + DOWNLOAD_MODE="DATABASE" + SYNC_SCHEDULE="0 0 0 1 * ?" + CREATION_TIME="1270066600000" + LAST_MODIFIED_TIME="1270066600000" + CONTENT_SOURCE_TYPE_ID="101" + CONFIGURATION_ID="102"/> + </table> + + <!-- sync chedule: every Mon at 1am --> + <table name="RHQ_REPO"> + <data ID="101" + NAME="JBoss Patches" + DESCRIPTION="the patches obtained from the JBoss CSP patch feed" + SYNC_SCHEDULE="0 0 1 ? * 1" + CREATION_TIME="1270066600000" + LAST_MODIFIED_TIME="1270066600000" + IS_CANDIDATE="0"/> + </table> + + <table name="RHQ_REPO_CONTENT_SRC_MAP"> + <data REPO_ID="101" + CONTENT_SRC_ID="101" + CTIME="1270066600000"/> + </table> + + +<!-- END: jon-data.xml --> +</dbsetup> diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/2.4.0/db-schema-combined-2.4.0.xml b/modules/core/dbutils/src/main/scripts/dbsetup/2.4.0/db-schema-combined-2.4.0.xml new file mode 100644 index 0000000..8ac0762 --- /dev/null +++ b/modules/core/dbutils/src/main/scripts/dbsetup/2.4.0/db-schema-combined-2.4.0.xml @@ -0,0 +1,2494 @@ +<?xml version="1.0" encoding="UTF-8"?> +<dbsetup name="schema"> +<!-- BEGIN: config-schema.xml --> + + + <!-- Definition or Metadata tables --> + + <table name="RHQ_CONFIG_DEF"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="NAME" type="VARCHAR2" required="true" size="100"/> + <column name="DESCRIPTION" type="VARCHAR2" required="false" size="250"/> + <column name="VERSION" type="VARCHAR2" required="false" size="50"/> + <column name="CONFIG_FORMAT" type="VARCHAR2" required="false" size="32"/> + </table> + + <table name="RHQ_CONFIG_PROP_GRP_DEF"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="NAME" type="VARCHAR2" required="true" size="100"/> + <column name="DISPLAY_NAME" type="VARCHAR2" required="false" size="100"/> + <column name="DESCRIPTION" type="VARCHAR2" required="false" size="250"/> + <column name="DEFAULT_HIDDEN" type="BOOLEAN" required="false"/> + <column name="ORDER_INDEX" type="INTEGER" required="false"/> + </table> + + <table name="RHQ_CONFIG_PROP_DEF"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="NAME" type="VARCHAR2" required="false" size="255"/> + <column name="DISPLAY_NAME" type="VARCHAR2" required="false" size="100"/> + <column name="DESCRIPTION" type="VARCHAR2" required="false" size="1000"/> + <column name="DEFAULT_VALUE" type="VARCHAR2" required="false" size="2000"/> + <column name="REQUIRED" type="BOOLEAN" required="false"/> + <column name="READONLY" type="BOOLEAN" required="false"/> + <column name="SUMMARY" type="BOOLEAN" required="false"/> + <column name="ACTIVATION_POLICY" type="VARCHAR2" required="false" size="20"/> + <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_GRP_DEF"/> + <column name="ORDER_INDEX" type="INTEGER" required="false"/> + <column name="VERSION" type="VARCHAR2" required="false" size="50"/> + <column name="PARENT_MAP_DEFINITION_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> + <column name="PARENT_LIST_DEFINITION_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> + <column name="SIMPLE_TYPE" type="VARCHAR2" required="false" size="20"/> + <column name="ALLOW_CUSTOM_ENUM_VALUE" type="BOOLEAN" required="false"/> + <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> + <column name="CONFIG_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_DEF"/> + + <!-- only simple properties (not lists and maps) have this --> + <column name="UNITS" type="SMALLINT" required="false"/> + + <!-- only dynamic properties (not simple) have this --> + <column name="DYNAMIC_TYPE" type="VARCHAR2" size="20" required="false"/> + <column name="DYNAMIC_KEY" type="VARCHAR2" size="128" required="false"/> + </table> + + <table name="RHQ_CONF_PROP_DEF_ENUM"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="STRING_VALUE" type="VARCHAR2" required="false" size="500"/> + <column name="ORDER_INDEX" type="INTEGER" required="false"/> + <column name="IS_DEFAULT" type="BOOLEAN" required="false"/> + <column name="NAME" type="VARCHAR2" required="false" size="100"/> + <column name="PROPERTY_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> + </table> + + <table name="RHQ_CONFIG_PROP_CONSTR"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="DTYPE" type="VARCHAR2" required="true" size="15"/> + <column name="DETAILS" type="VARCHAR2" required="false" size="250"/> + <column name="CONFIG_PROP_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> + <column name="ORDER_INDEX" type="INTEGER" required="false"/> + </table> + + + <!-- Content or value tables --> + + <table name="RHQ_CONFIG"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="NOTES" type="VARCHAR2" required="false" size="512"/> + <column name="VERSION" type="VARCHAR2" required="false" size="50"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + </table> + + <table name="RHQ_CONFIG_PROPERTY"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="CONFIGURATION_ID" type="INTEGER" required="false" references="RHQ_CONFIG" ondelete="cascade"/> + <column name="STRING_VALUE" type="VARCHAR2" required="false" size="2000"/> + <column name="OVERRIDE" type="BOOLEAN" required="false"/> + <column name="NAME" type="VARCHAR2" required="true" size="255"/> + <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> + <!-- Recursive cascade path to RHQ_CONFIG_PROPERTY causes constraint creation errors on SQL Server, see + http://support.microsoft.com/kb/321843 --> + <column name="PARENT_LIST_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROPERTY" ondelete="cascade" /> + <column name="PARENT_MAP_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROPERTY" ondelete="cascade" /> + <column name="LIST_INDEX" type="INTEGER"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <index name="RHQ_CONFIG_PROP_idx_prop_key" unique="false"> + <field ref="CONFIGURATION_ID"/> + <field ref="NAME"/> + </index> + <index name="RHQ_CONFIG_PROP_idx_map_key" unique="false"> + <field ref="PARENT_MAP_ID"/> + <field ref="NAME"/> + </index> + <index name="RHQ_CONFIG_PROP_idx_list_key" unique="false"> + <field ref="PARENT_LIST_ID"/> + </index> + <!-- List entries all have the same name --> + </table> + + <table name="RHQ_CONFIG_TEMPLATE"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="NAME" type="VARCHAR2" required="false" size="100"/> + <column name="DESCRIPTION" type="VARCHAR2" required="false" size="500"/> + <column name="CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> + <column name="CONFIG_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_DEF"/> + <column name="IS_DEFAULT" type="BOOLEAN" required="false"/> + </table> + + <table name="RHQ_RAW_CONFIG"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="CONFIG_ID" type="INTEGER" required="true" references="RHQ_CONFIG(ID)"/> + <column name="PATH" type="VARCHAR2" required="false" size="512"/> + <column name="CONTENTS" type="CLOB" required="true"/> + <column name="SHA256" type="VARCHAR2" size="64" required="true"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + </table> + +<!-- END: config-schema.xml --> +<!-- BEGIN: cluster-schema.xml --> + + <table name="RHQ_AFFINITY_GROUP"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" required="true" size="255" type="VARCHAR2"/> + </table> + + <table name="RHQ_SERVER"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" required="true" size="255" type="VARCHAR2"/> + <column name="ADDRESS" required="true" size="255" type="VARCHAR2"/> + <column name="PORT" required="true" type="INTEGER"/> + <column name="SECURE_PORT" required="true" type="INTEGER"/> + <column name="CTIME" required="true" type="LONG"/> + <column name="MTIME" required="true" type="LONG"/> + <column name="AFFINITY_GROUP_ID" type="INTEGER" references="RHQ_AFFINITY_GROUP" required="false"/> + <column name="COMPUTE_POWER" required="true" type="INTEGER"/> + <column name="OPERATION_MODE" required="true" size="32" type="VARCHAR2"/> + <column name="STATUS" type="INTEGER" required="false" default="0" /> + + <!-- This index is for constraint, not performance --> + <index name="RHQ_SERVER_NAME_UNIQUE" unique="true"> + <field ref="NAME"/> + </index> + </table> + + <!-- new agent --> + <table name="RHQ_AGENT"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" required="true" size="255" type="VARCHAR2"/> + <column name="ADDRESS" required="true" size="255" type="VARCHAR2"/> + <column name="PORT" required="true" type="INTEGER"/> + <column name="AGENTTOKEN" required="true" size="100" type="VARCHAR2"/> + <column name="REMOTE_ENDPOINT" required="false" size="4000" type="VARCHAR2"/> + <column name="CTIME" required="true" type="LONG"/> + <column name="MTIME" required="true" type="LONG"/> + <column name="LAST_AVAILABILITY_REPORT" required="false" type="LONG"/> + <column name="AFFINITY_GROUP_ID" type="INTEGER" references="RHQ_AFFINITY_GROUP" required="false"/> + <column name="SERVER_ID" type="INTEGER" references="RHQ_SERVER" required="false"/> + <column name="STATUS" type="INTEGER" required="false" default="0" /> + <column name="BACKFILLED" type="BOOLEAN" required="true" /> + + <index name="RHQ_AGENT_NAME_UNIQUE" unique="true"> + <field ref="NAME"/> + </index> + + <index name="RHQ_AGENT_ADDRESS_PORT" unique="true"> + <field ref="ADDRESS"/> + <field ref="PORT"/> + </index> + + <index name="RHQ_AGENT_TOKEN_UNIQUE" unique="true"> + <field ref="AGENTTOKEN"/> + </index> + </table> + + <table name="RHQ_PARTITION_EVENT"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="SUBJECT_NAME" required="true" size="255" type="VARCHAR2"/> + <column name="CTIME" required="true" type="LONG"/> + <column name="EVENT_TYPE" required="true" size="50" type="VARCHAR2"/> + <column name="EVENT_DETAIL" required="false" size="512" type="VARCHAR2"/> + <column name="EXECUTION_STATUS" required="true" size="32" type="VARCHAR2"/> + </table> + + <table name="RHQ_PARTITION_DETAILS"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="PARTITION_EVENT_ID" type="INTEGER" references="RHQ_PARTITION_EVENT" required="true"/> + <column name="AGENT_NAME" type="VARCHAR2" size="255" required="true"/> + <column name="SERVER_NAME" type="VARCHAR2" size="255" required="true"/> + </table> + + <table name="RHQ_FAILOVER_LIST"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="PARTITION_EVENT_ID" type="INTEGER" references="RHQ_PARTITION_EVENT" required="true"/> + <column name="AGENT_ID" type="INTEGER" references="RHQ_AGENT" required="true"/> + <column name="CTIME" required="true" type="LONG"/> + </table> + + <table name="RHQ_FAILOVER_DETAILS"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="FAILOVER_LIST_ID" type="INTEGER" references="RHQ_FAILOVER_LIST" required="true"/> + <column name="SERVER_ID" type="INTEGER" references="RHQ_SERVER" required="true"/> + <column name="ORDINAL" type = "INTEGER" required="true"/> + </table> + +<!-- END: cluster-schema.xml --> +<!-- BEGIN: inventory-schema.xml --> + + + <!-- NEW RESOURCE TYPES --> + <table name="RHQ_RESOURCE_TYPE"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" type="VARCHAR2" size="100" required="true"/> + <column name="CATEGORY" type="VARCHAR2" size="16" required="true"/> + <column name="CREATION_DATA_TYPE" type="VARCHAR2" size="16" required="true"/> + <column name="CREATE_DELETE_POLICY" type="VARCHAR2" size="16" required="true"/> + <column name="SINGLETON" type="BOOLEAN" required="true"/> + <column name="SUPPORTS_MANUAL_ADD" type="BOOLEAN" required="true"/> + <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> + <column name="PLUGIN" type="VARCHAR2" size="100"/> + <column name="CTIME" type="LONG"/> + <column name="MTIME" type="LONG"/> + <column name="SUBCATEGORY_ID" type="INTEGER"/> + <!-- + TODO add support to DB setup for tables with circular dependencies and then add back this RI + <column name="SUBCATEGORY_ID" type="INTEGER" references="RHQ_RESOURCE_SUBCAT" /> + --> + <column name="PLUGIN_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> + <column name="RES_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> + + <index name="RHQ_RES_TYPE_IDX_PLG_NAME" unique="true"> + <field ref="NAME"/> + <field ref="PLUGIN"/> + </index> + </table> + + <!-- NEW RESOURCE SUBCATEGORIES --> + <table name="RHQ_RESOURCE_SUBCAT"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" type="VARCHAR2" size="100"/> + <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> + <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> + <column name="CTIME" type="LONG"/> + <column name="MTIME" type="LONG"/> + <column name="PARENT_SUBCATEGORY_ID" type="INTEGER" references="RHQ_RESOURCE_SUBCAT"/> + <!-- resourceTypeId is not required on child sub categories --> + <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> + </table> + + <!-- Many To Many mapping for resource type to its parents --> + <table name="RHQ_RESOURCE_TYPE_PARENTS"> + <column name="RESOURCE_TYPE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> + <column name="PARENT_RESOURCE_TYPE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> + + <!-- not using full words to fit index name length --> + <constraint name="RHQ_RES_TYPE_PARENTS_KEY"> + <primaryKey> + <field ref="RESOURCE_TYPE_ID"/> + <field ref="PARENT_RESOURCE_TYPE_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_PROCESS_SCAN"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="QUERY" type="VARCHAR2" size="256" required="true"/> + <column name="NAME" type="VARCHAR2" size="100" required="false"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> + + <index name="RHQ_PROCESS_SCAN_QUERY_INDEX" unique="true"> + <field ref="QUERY"/> + <field ref="RESOURCE_TYPE_ID"/> + </index> + </table> + + <table name="RHQ_PRD_VER"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="VERSION" type="VARCHAR2" size="50" required="true"/> + <column name="RES_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> + </table> + + <table name="RHQ_RESOURCE"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> + <column name="UUID" type="CHAR" size="36" required="true"/> + <column name="NAME" type="VARCHAR2" size="500"/> + <column name="RESOURCE_KEY" type="VARCHAR2" required="true" size="500"/> + <column name="AGENT_ID" required="false" type="INTEGER" references="RHQ_AGENT(id)"/> + <column name="INVENTORY_STATUS" type="VARCHAR2" size="20"/> + <column name="CONNECTED" type="BOOLEAN"/> + <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> + <column name="VERSION" type="VARCHAR2" size="50"/> + <column name="CTIME" type="LONG"/> + <column name="MTIME" type="LONG"/> + <column name="ITIME" type="LONG"/> + <column name="RES_CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG"/> + <column name="PLUGIN_CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG"/> + <column name="MODIFIED_BY" required="false" type="INTEGER"/> + <column name="LOCATION" required="false" size="100" type="VARCHAR2"/> + <column name="PARENT_RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE"/> + <column name="PRODUCT_VERSION_ID" type="INTEGER" references="RHQ_PRD_VER"/> + + <index name="RHQ_RESOURCE_idx_key"> + <field ref="RESOURCE_KEY"/> + </index> + + <index name="RHQ_RESOURCE_idx_type"> + <field ref="RESOURCE_TYPE_ID"/> + </index> + + <index name="RHQ_RESOURCE_idx_agent"> + <field ref="AGENT_ID"/> + </index> + + <index name="RHQ_RESOURCE_idx_parent"> + <field ref="PARENT_RESOURCE_ID"/> + </index> + + </table> + + <table name="RHQ_RESOURCE_ERROR"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> + <column name="TIME_OCCURRED" type="LONG" required="true"/> + <column name="ERROR_TYPE" type="VARCHAR2" required="true" size="32"/> + <column name="SUMMARY" type="VARCHAR2" required="true" size="1000"/> + <column name="DETAIL" type="LONGVARCHAR" required="false"/> + + <index name="RHQ_RES_ERROR_IDX_RES_ID"> + <field ref="RESOURCE_ID"/> + </index> + </table> + + <table name="RHQ_GROUP_DEF"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" required="true" size="100" type="VARCHAR2"/> + <column name="DESCRIPTION" size="100" type="VARCHAR2"/> + <column name="CTIME" type="LONG"/> + <column name="MTIME" type="LONG"/> + <column name="CALC_TIME" type="LONG"/> + <column name="CALC_INTERVAL" type="LONG"/> + <column name="RECURSIVE" type="BOOLEAN"/> + <column name="EXPRESSION" type="VARCHAR2" size="1000"/> + + <index name="RHQ_GROUP_DEF_NAME" unique="true"> + <field ref="NAME"/> + </index> + </table> + + <table name="RHQ_RESOURCE_GROUP"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <!-- this name can be longer than the size of the GROUP_BY column, which is used to uniquely identify it --> + <!-- Max bytes for Oracle Varchar2 to accommodate large cluster keys --> + <column name="NAME" required="true" size="4000" type="VARCHAR2"/> + <column name="DESCRIPTION" size="100" type="VARCHAR2"/> + <column name="LOCATION" required="false" size="100" type="VARCHAR2"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> + <!-- Compatible groups only --> + <column name="CTIME" type="LONG"/> + <column name="MTIME" type="LONG"/> + <column name="MODIFIED_BY" required="false" type="INTEGER"/> + <!-- TODO: Reorder to allow this references="RHQ_SUBJECT" --> + <column name="RECURSIVE" type="BOOLEAN"/> + + <column name="GROUP_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_GROUP_DEF"/> + <column name="GROUP_BY" size="500" type="VARCHAR2"/> + + <column name="CATEGORY" type="VARCHAR2" size="20" required="true"/> + + <column name="CLUSTER_KEY" type="VARCHAR2" size="4000" required="false"/> + + <!-- These two only set if this is a backing group for a resource cluster --> + <column name="CLUSTER_RESOURCE_GROUP_ID" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> + + <column name="VISIBLE" type="BOOLEAN"/> + + <index name="RHQ_RES_GROUP_NAME" unique="false"> + <field ref="NAME"/> + </index> + </table> + + <!-- Many To Many mapping for groups to implicit resources --> + <table name="RHQ_RESOURCE_GROUP_RES_IMP_MAP"> + <column name="RESOURCE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE"/> + <column name="RESOURCE_GROUP_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> + + <!-- not using full words to fit index name length --> + <constraint name="RHQ_RES_GROUP_RES_IMP_MAP_KEY"> + <primaryKey> + <field ref="RESOURCE_ID"/> + <field ref="RESOURCE_GROUP_ID"/> + </primaryKey> + </constraint> + </table> + + <!-- Many To Many mapping for groups to explicit resources --> + <table name="RHQ_RESOURCE_GROUP_RES_EXP_MAP"> + <column name="RESOURCE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE"/> + <column name="RESOURCE_GROUP_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> + + <!-- not using full words to fit index name length --> + <constraint name="RHQ_RES_GROUP_RES_EXP_MAP_KEY"> + <primaryKey> + <field ref="RESOURCE_ID"/> + <field ref="RESOURCE_GROUP_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_CONFIG_GROUP_UPDATE"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="GROUP_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_GROUP"/> + <column name="CONFIGURATION_ID" type="INTEGER" required="true" references="RHQ_CONFIG"/> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="SUBJECT_NAME" type="VARCHAR2" required="false" size="100"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> + </table> + + <table name="RHQ_CONFIG_UPDATE"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="CONFIGURATION_ID" type="INTEGER" required="true" references="RHQ_CONFIG" ondelete="cascade"/> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="SUBJECT_NAME" type="VARCHAR2" required="false" size="100"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="CONFIG_RES_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> + <column name="PLUGIN_CONFIG_RES_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> + <column name="AGG_RES_UPDATE_ID" type="INTEGER" required="false" references="RHQ_CONFIG_GROUP_UPDATE"/> + <column name="AGG_PLUGIN_UPDATE_ID" type="INTEGER" required="false" references="RHQ_CONFIG_GROUP_UPDATE"/> + <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> + </table> + + + <table name="RHQ_TAGGING"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="NAMESPACE" type="VARCHAR2" required="false" size="20"/> + <column name="SEMANTIC" type="VARCHAR2" required="false" size="50"/> + <column name="NAME" type="VARCHAR2" required="true" size="100"/> + </table> + + <table name="RHQ_TAGGING_RESOURCE_MAP"> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> + <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> + <constraint name="RHQ_TAGGING_RESOURCE_MAP_KEY"> + <primaryKey> + <field ref="RESOURCE_ID"/> + <field ref="TAG_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_TAGGING_RES_GROUP_MAP"> + <column name="RESOURCE_GROUP_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_GROUP"/> + <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> + <constraint name="RHQ_TAGGING_RES_GROUP_MAP_KEY"> + <primaryKey> + <field ref="RESOURCE_GROUP_ID"/> + <field ref="TAG_ID"/> + </primaryKey> + </constraint> + </table> + +<!-- END: inventory-schema.xml --> +<!-- BEGIN: auth-schema.xml --> + + + <table name="RHQ_PRINCIPAL"> + + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="PRINCIPAL" required="true" type="VARCHAR2" size="100"/> + <column name="PASSWORD" required="true" type="VARCHAR2" size="64"/> + + <!-- ensure that principals are unique --> + <index name="RHQ_PRINCIPAL_PRINCIPAL_KEY" unique="true"> + <field ref="PRINCIPAL"/> + </index> + + </table> + +<!-- END: auth-schema.xml --> +<!-- BEGIN: authz-schema.xml --> + + + <table name="RHQ_ROLE"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" required="true" size="100" type="VARCHAR2"/> + <column name="DESCRIPTION" size="100" type="VARCHAR2"/> + <column name="FSYSTEM" type="BOOLEAN" default="false"/> + + <index name="RHQ_ROLE_NAME_KEY" unique="true"> + <field ref="NAME"/> + </index> + </table> + + <table name="RHQ_ROLE_RESOURCE_GROUP_MAP"> + <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> + <column name="RESOURCE_GROUP_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> + + <constraint name="RHQ_ROLE_RES_GROUP_MAP_KEY"> + <primaryKey> + <field ref="ROLE_ID"/> + <field ref="RESOURCE_GROUP_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_ROLE_LDAP_GROUP"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> + <column name="LDAP_GROUP_NAME" size="128" required="true" type="VARCHAR2"/> + + <index name="RHQ_ROLE_LDAP_GROUP_IDX" unique="true"> + <field ref="ROLE_ID"/> + <field ref="LDAP_GROUP_NAME"/> + </index> + </table> + + <table name="RHQ_PERMISSION"> + <column name="ROLE_ID" type="INTEGER" references="RHQ_ROLE" required="true"/> + <column name="OPERATION" type="INTEGER" required="true"/> + <constraint name="RHQ_PERMISSION_PK"> + <primaryKey> + <field ref="ROLE_ID"/> + <field ref="OPERATION"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_SUBJECT"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" required="true" size="100" type="VARCHAR2"/> + <column name="CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG"/> + <column name="FIRST_NAME" required="false" size="100" type="VARCHAR2"/> + <column name="LAST_NAME" required="false" size="100" type="VARCHAR2"/> + <column name="EMAIL_ADDRESS" size="100" type="VARCHAR2"/> + <column name="SMS_ADDRESS" size="100" type="VARCHAR2"/> + <column name="PHONE_NUMBER" size="100" type="VARCHAR2"/> + <column name="DEPARTMENT" size="100" type="VARCHAR2"/> + <column name="FACTIVE" required="true" type="BOOLEAN" default="true"/> + <column name="FSYSTEM" required="true" type="BOOLEAN" default="false"/> + + <index name="RHQ_SUBJECT_AUTH_KEY" unique="true"> + <field ref="NAME"/> + </index> + </table> + + <table name="RHQ_SUBJECT_ROLE_MAP"> + <column name="SUBJECT_ID" required="true" type="INTEGER" references="RHQ_SUBJECT"/> + <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> + + <constraint name="RHQ_SUBJECT_ROLE_MAPPING_KEY"> + <primaryKey> + <field ref="SUBJECT_ID"/> + <field ref="ROLE_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_SUBJECT_ROLE_LDAP_MAP"> + <column name="SUBJECT_ID" required="true" type="INTEGER" references="RHQ_SUBJECT"/> + <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> + <constraint name="RHQ_SUBJECT_ROLE_LDAP_MAP_PK"> + <primaryKey> + <field ref="SUBJECT_ID" /> + <field ref="ROLE_ID"/> + </primaryKey> + </constraint> + </table> +<!-- END: authz-schema.xml --> +<!-- BEGIN: search-schema.xml --> + + + <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="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="GLOBAL" type="BOOLEAN" required="true"/> + </table> + +<!-- END: search-schema.xml --> +<!-- BEGIN: operation-schema.xml --> + + + <table name="RHQ_OPERATION_DEF"> + + <!-- === required columns === --> + + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE(ID)"/> + <column name="NAME" type="VARCHAR2" required="true" size="100"/> + + <!-- === optional columns === --> + + <!-- an OSGI version range - if null, the operation def applies to all versions of the associated resource type --> + <column name="RESOURCE_VERSION_RANGE" type="VARCHAR2" size="100"/> + + <!-- A parameter config definition is only required for operations that have parameters. --> + <!-- A results config definition is only required for operations that return data. --> + <column name="PARAMETER_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> + <column name="RESULTS_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> + <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> + <column name="DESCRIPTION" type="VARCHAR2" size="4000"/> + <column name="TIMEOUT" type="INTEGER"/> + + <!-- === business key (RESOURCE_TYPE_ID + NAME) === --> + <index name="RHQ_OPERATION_DEF_KEY_IDX" unique="true"> + <field ref="RESOURCE_TYPE_ID"/> + <field ref="NAME"/> + </index> + + </table> + + <table name="RHQ_OPERATION_HISTORY"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="DTYPE" type="VARCHAR2" required="true" size="8"/> + <column name="JOB_NAME" type="VARCHAR2" required="true" size="100"/> + <column name="JOB_GROUP" type="VARCHAR2" required="true" size="100"/> + <column name="OPERATION_DEF_ID" type="INTEGER" required="true" references="RHQ_OPERATION_DEF"/> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="STIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="PARAMETERS_CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> + + <!-- for resource history --> + <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> + <column name="RESULTS_CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> + <column name="GROUP_HISTORY_ID" type="INTEGER" required="false" references="RHQ_OPERATION_HISTORY"/> + + <!-- for group history --> + <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_RESOURCE_GROUP"/> + + <index name="RHQ_OPERATION_HISTORY_JOB_IDX" unique="true"> + <field ref="JOB_NAME"/> + <field ref="JOB_GROUP"/> + <field ref="CTIME"/> + </index> + + </table> + + <!-- + This table is really just to support some specific use-cases. + Specifically, to be able to get a list of histories for a specific schedule (aka quartz job) + and to be able to query a list of all schedules along with their associated resource/group IDs + possibly sorted by their next fire time. + Note that a NULL next fire time means it won't fire again and the row is probaby about to be deleted; + we can probably not even insert rows with NULL and make it a non-nullable field. But rather than + code special conditions into the session bean, we'll allow a short-lived NULL next fire time row. + --> + <table name="RHQ_OPERATION_SCHEDULE"> + <column name="JOB_NAME" type="VARCHAR2" required="true" size="100"/> + <column name="JOB_GROUP" type="VARCHAR2" required="true" size="100"/> + <column name="DTYPE" type="VARCHAR2" required="true" size="8"/> + <column name="NEXT_FIRE_TIME" type="LONG" required="false"/> + + <!-- for resource history --> + <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> + + <!-- for group history --> + <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_RESOURCE_GROUP"/> + + <!-- + Note that this is the same primary key that Quartz uses for its schedules (RHQ_qrtz_job_details). + We do not need to add DTYPE to the key, because we ensure the name/group are unique + across resource/group schedules + --> + <constraint name="RHQ_OPERATION_SCHEDULE_KEY"> + <primaryKey> + <field ref="JOB_NAME"/> + <field ref="JOB_GROUP"/> + </primaryKey> + </constraint> + </table> + +<!-- END: operation-schema.xml --> +<!-- BEGIN: event-schema.xml --> + + + <!-- metadata --> + + <table name="RHQ_EVENT_DEF"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE(ID)"/> + + <column name="NAME" type="VARCHAR2" size="100" required="true"/> + <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> + <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> + + <index name="RHQ_EVENT_DEF_IDX" unique="true"> + <field ref="RESOURCE_TYPE_ID"/> + <field ref="NAME"/> + </index> + </table> + + <!-- instance data --> + + <table name="RHQ_EVENT_SOURCE"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="EVENT_DEF_ID" type="INTEGER" required="true" references="RHQ_EVENT_DEF(ID)"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE(ID)"/> + + <column name="LOCATION" required="true" size="2000" type="VARCHAR2"/> + + <index name="RHQ_EVENT_SOURCE_IDX" unique="true"> + <field ref="EVENT_DEF_ID"/> + <field ref="RESOURCE_ID"/> + <field ref="LOCATION"/> + </index> + </table> + + <table name="RHQ_EVENT"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="EVENT_SOURCE_ID" type="INTEGER" required="true" references="RHQ_EVENT_SOURCE(ID)"/> + + <column name="TIMESTAMP" required="true" type="LONG"/> + <column name="SEVERITY" required="true" size="20" type="VARCHAR2"/> + <column name="DETAIL" required="true" size="4000" type="VARCHAR2"/> + <index name="RHQ_EVENT_IDX" unique="false"> + <field ref="EVENT_SOURCE_ID"/> + <field ref="TIMESTAMP"/> + </index> + </table> + +<!-- END: event-schema.xml --> +<!-- BEGIN: alert-schema.xml --> + + + <table name="RHQ_ALERT_DEFINITION"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" required="true" size="100" type="VARCHAR2"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="PARENT_ID" type="INTEGER" required="false"/> + <column name="GROUP_ALERT_DEF_ID" type="INTEGER" required="false"/> + <column name="DESCRIPTION" required="false" size="250" type="VARCHAR2"/> + <column name="PRIORITY" type="VARCHAR2" size="15" required="true"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE" required="false"/> + <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE" required="false"/> + <column name="RESOURCE_GROUP_ID" type="INTEGER" references="RHQ_RESOURCE_GROUP" required="false"/> + <column name="ENABLED" required="true" default="TRUE" type="BOOLEAN"/> + + <column name="REQUIRED" required="true" type="SMALLINT"/> + + <column name="RECOVERY_ID" type="INTEGER" required="true"/> + <!-- required, but 0 effectively means null --> + <column name="WILL_RECOVER" required="true" default="false" type="BOOLEAN"/> + <column name="NOTIFY_FILTERED" required="true" default="false" type="BOOLEAN"/> + <column name="CONTROL_FILTERED" required="true" default="FALSE" type="BOOLEAN"/> + + <column name="DELETED" required="true" default="FALSE" type="BOOLEAN"/> + <column name="READ_ONLY" required="true" default="FALSE" type="BOOLEAN"/> + + <column name="DAMPENING_CATEGORY" type="SMALLINT" required="true"/> + <column name="DAMPENING_VALUE" type="INTEGER"/> + <column name="DAMPENING_VALUE_UNITS" type="SMALLINT"/> + <column name="DAMPENING_PERIOD" type="INTEGER"/> + <column name="DAMPENING_PERIOD_UNITS" type="SMALLINT"/> + </table> + + <table name="RHQ_ALERT_DAMPEN_EVENT"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> + <column name="EVENT_TYPE" required="true" type="SMALLINT"/> + <column name="EVENT_TIMESTAMP" required="true" type="LONG"/> + + <index name="RHQ_DAMPENING_EVENT_TYPE_IDX"> + <field ref="EVENT_TYPE"/> + </index> + <index name="RHQ_DAMPENING_EVENT_TS_IDX"> + <field ref="EVENT_TIMESTAMP"/> + </index> + </table> + + <table name="RHQ_ALERT_CONDITION"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="TYPE" required="true" type="VARCHAR2" size="15"/> + <!-- + <column name="REQUIRED" required="true" type="BOOLEAN"/> + --> + <column name="MEASUREMENT_DEFINITION_ID" required="false" type="INTEGER"/> + <column name="NAME" required="false" size="100" type="VARCHAR2"/> + <column name="COMPARATOR" required="false" size="2" type="VARCHAR2"/> + <column name="THRESHOLD" required="false" type="DOUBLE"/> + <!-- event-based conditions use OPTION_STATUS for the string match, so should be a decent length --> + <column name="OPTION_STATUS" required="false" size="256" type="VARCHAR2"/> + <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> + <column name="TRIGGER_ID" required="false" type="INTEGER"/> + </table> + + <table name="RHQ_ALERT" tablespace="DEFAULT" + storage-options="freelists 5" cache="true" logging="false"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> + <column name="CTIME" required="true" type="LONG"/> + <column name="RECOVERY_ID" type="INTEGER" required="true"/> + <!-- required, but 0 effectively means null --> + <column name="WILL_RECOVER" required="true" default="false" type="BOOLEAN"/> + <column name="ACK_TIME" required="false" type="LONG"/> + <column name="ACK_SUBJECT" required="false" size="100" type="VARCHAR2"/> + <index name="RHQ_ALERT_IDX_TIME" unique="false"> + <field ref="CTIME"/> + </index> + <index name="RHQ_ALERT_IDX_ALERTDEF" unique="false"> + <field ref="ALERT_DEFINITION_ID"/> + </index> + </table> + + <table name="RHQ_ALERT_NOTIF_LOG" tablespace="DEFAULT" + storage-options="freelists 5" cache="true" logging="false"> + <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="false"> + <field ref="ALERT_ID"/> + </index> + <column name="SENDER" required="false" size="100" type="VARCHAR2"/> + <column name="RESULT_STATE" required="false" size="20" type="VARCHAR2"/> + <column name="MESSAGE" required="false" size="4000" type="VARCHAR2"/> + </table> + + <table name="RHQ_ALERT_CONDITION_LOG" tablespace="DEFAULT" + storage-options="freelists 5" cache="true" logging="false"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="CTIME" required="true" type="LONG"/> + <column name="ALERT_ID" required="false" type="INTEGER" references="RHQ_ALERT(ID)"/> + <column name="CONDITION_ID" required="true" type="INTEGER" references="RHQ_ALERT_CONDITION(ID)"/> + <column name="VALUE" required="false" size="250" type="VARCHAR2"/> + <index name="RHQ_ALERT_COND_LOG_IDX_TIME"> + <field ref="CTIME" /> + </index> + <index name="RHQ_ALERT_COND_LOG_IDX_ALERT"> + <field ref="ALERT_ID"/> + </index> + </table> + + <table name="RHQ_ALERT_NOTIFICATION" tablespace="DEFAULT" + storage-options="freelists 5" cache="true" logging="false"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> + <column name="SENDER_CONFIG_ID" required="false" type="INTEGER" references="RHQ_CONFIG(ID)"/> + <column name="EXTRA_CONFIG_ID" required="false" type="INTEGER" references="RHQ_CONFIG(ID)"/> + <column name="SENDER_NAME" required="true" size="100" type="VARCHAR2" /> + </table> + +<!-- END: alert-schema.xml --> +<!-- BEGIN: sysconfig-schema.xml --> + + + <table name="RHQ_SYSTEM_CONFIG"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="PROPERTY_KEY" type="VARCHAR2" size="80"/> + <column name="PROPERTY_VALUE" type="VARCHAR2" size="300"/> + <column name="DEFAULT_PROPERTY_VALUE" type="VARCHAR2" size="300"/> + <column name="FREAD_ONLY" type="BOOLEAN" default="FALSE"/> + + <index name="RHQ_SYSTEM_CONFIG_KEY_INDX" unique="true"> + <field ref="PROPERTY_KEY"/> + </index> + </table> + +<!-- END: sysconfig-schema.xml --> +<!-- BEGIN: scheduler-schema.xml --> + + + <table name="RHQ_QRTZ_JOB_DETAILS"> + <column name="JOB_NAME" required="true" type="VARCHAR2" size="80"/> + <column name="JOB_GROUP" required="true" type="VARCHAR2" size="80"/> + <column name="DESCRIPTION" required="false" type="VARCHAR2" size="120"/> + <column name="JOB_CLASS_NAME" required="true" type="VARCHAR2" size="128"/> + <column name="IS_DURABLE" required="true" type="BOOLEAN" default="FALSE"/> + <column name="IS_VOLATILE" required="true" type="BOOLEAN"/> + <column name="IS_STATEFUL" required="true" type="BOOLEAN" default="FALSE"/> + <column name="REQUESTS_RECOVERY" required="true" type="BOOLEAN" default="FALSE"/> + <column name="JOB_DATA" required="false" type="BLOB"/> + + <constraint name="RHQ_PK_QRTZ_JOB_DETAILS"> + <primaryKey> + <field ref="JOB_NAME"/> + <field ref="JOB_GROUP"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_QRTZ_JOB_LISTENERS"> + <column name="JOB_NAME" required="true" type="VARCHAR2" size="80"/> + <column name="JOB_GROUP" required="true" type="VARCHAR2" size="80"/> + <column name="JOB_LISTENER" required="true" type="VARCHAR2" size="80"/> + + <constraint name="RHQ_PK_QRTZ_JOB_LISTENERS"> + <primaryKey> + <field ref="JOB_NAME"/> + <field ref="JOB_GROUP"/> + <field ref="JOB_LISTENER"/> + </primaryKey> + </constraint> + <constraint name="RHQ_FK_QRTZ_JOB_LSTNRS_JN_JG"> + <foreignKey local="JOB_NAME,JOB_GROUP" + references="RHQ_QRTZ_JOB_DETAILS(JOB_NAME,JOB_GROUP)" + ondelete="cascade"/> + </constraint> + </table> + + <table name="RHQ_QRTZ_TRIGGERS"> + <column name="TRIGGER_NAME" type="VARCHAR2" required="true" size="80"/> + <column name="TRIGGER_GROUP" type="VARCHAR2" required="true" size="80"/> + <column name="JOB_NAME" type="VARCHAR2" required="true" size="80"/> + <column name="JOB_GROUP" type="VARCHAR2" required="true" size="80"/> + <column name="IS_VOLATILE" type="BOOLEAN" required="true"/> + <column name="DESCRIPTION" type="VARCHAR2" required="false" size="120"/> + <column name="NEXT_FIRE_TIME" type="LONG" required="false"/> + <column name="PREV_FIRE_TIME" type="LONG" required="false"/> + <column name="PRIORITY" type="INTEGER" required="false"/> + <column name="TRIGGER_STATE" type="VARCHAR" required="true" size="16"/> + <column name="TRIGGER_TYPE" type="VARCHAR" required="true" size="8"/> + <column name="START_TIME" type="LONG" required="true"/> + <column name="END_TIME" type="LONG" required="false"/> + <column name="CALENDAR_NAME" type="VARCHAR2" required="false" size="80"/> + <column name="MISFIRE_INSTR" type="INTEGER" required="false"/> + <column name="JOB_DATA" type="BLOB" required="false"/> + + <constraint name="RHQ_PK_QRTZ_TRIGGERS"> + <primaryKey> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </primaryKey> + </constraint> + <constraint name="RHQ_FK_QRTZ_TRIGGERS_JN_JG"> + <foreignKey local="JOB_NAME,JOB_GROUP" + references="RHQ_QRTZ_JOB_DETAILS(JOB_NAME,JOB_GROUP)" + ondelete="cascade"/> + </constraint> + + <!-- Quartz docs recommend these indexes. --> + <index name="RHQ_QRTZ_TRIGGERS_JN_JG_IDX"> + <field ref="JOB_NAME"/> + <field ref="JOB_GROUP"/> + </index> + <index name="RHQ_QRTZ_TRIGGERS_NFT_IDX"> + <field ref="NEXT_FIRE_TIME"/> + </index> + <index name="RHQ_QRTZ_TRIGGERS_TS_IDX"> + <field ref="TRIGGER_STATE"/> + </index> + <index name="RHQ_QRTZ_TRIGGERS_TS_NFT_IDX"> + <field ref="TRIGGER_STATE"/> + <field ref="NEXT_FIRE_TIME"/> + </index> + + </table> + + <table name="RHQ_QRTZ_SIMPLE_TRIGGERS"> + <column name="TRIGGER_NAME" type="VARCHAR2" required="true" size="80"/> + <column name="TRIGGER_GROUP" type="VARCHAR2" required="true" size="80"/> + <column name="REPEAT_COUNT" type="LONG" required="true"/> + <column name="REPEAT_INTERVAL" type="LONG" required="true"/> + <column name="TIMES_TRIGGERED" type="LONG" required="true"/> + + <constraint name="RHQ_PK_QRTZ_SIMPLE_TRIGGERS"> + <primaryKey> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </primaryKey> + </constraint> + <constraint name="RHQ_FK_QRTZ_SIMPLE_TRGRS_TN_TG"> + <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" + references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" + ondelete="cascade"/> + </constraint> + + <!-- Quartz docs recommend this index. --> + <!-- Commenting out, because Oracle auto-creates an index for the + primary key column(s) and fails if you try to create another + index for the same column(s) (ips, 03/29/07). + --> + <!-- + <index name="RHQ_QRTZ_SIMPLE_TRGRS_TN_TG_IDX"> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </index> + --> + </table> + + <table name="RHQ_QRTZ_CRON_TRIGGERS"> + <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> + <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> + <column name="CRON_EXPRESSION" type="VARCHAR2" size="80" required="true"/> + <column name="TIME_ZONE_ID" type="VARCHAR2" size="80" required="false"/> + + <constraint name="RHQ_PK_QRTZ_CRON_TRIGGERS"> + <primaryKey> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </primaryKey> + </constraint> + <constraint name="RHQ_FK_QRTZ_CRON_TRIG_TN_TG"> + <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" + references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" + ondelete="cascade"/> + </constraint> + + <!-- Quartz docs recommend this index. --> + <!-- Commenting out, because Oracle auto-creates an index for the + primary key column(s) and fails if you try to create another + index for the same column(s) (ips, 03/29/07). + --> + <!-- + <index name="RHQ_QRTZ_CRON_TRGRS_TN_TG_IDX"> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </index> + --> + </table> + + <table name="RHQ_QRTZ_BLOB_TRIGGERS"> + <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> + <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> + <column name="BLOB_DATA" type="BLOB" required="false"/> + + <constraint name="RHQ_PK_QRTZ_BLOB_TRIGGERS"> + <primaryKey> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </primaryKey> + </constraint> + <constraint name="RHQ_FK_QRTZ_BLOB_TRIGG_TN_TG"> + <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" + references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" + ondelete="cascade"/> + </constraint> + + <!-- Quartz docs recommend this index. --> + <!-- Commenting out, because Oracle auto-creates an index for the + primary key column(s) and fails if you try to create another + index for the same column(s) (ips, 03/29/07). + --> + <!-- + <index name="RHQ_QRTZ_BLOB_TRGRS_TN_TG_IDX"> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </index> + --> + </table> + + <table name="RHQ_QRTZ_TRIGGER_LISTENERS"> + <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> + <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> + <column name="TRIGGER_LISTENER" type="VARCHAR2" size="80" required="true"/> + + <constraint name="RHQ_PK_QRTZ_TRIGGER_LISTENERS"> + <primaryKey> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + <field ref="TRIGGER_LISTENER"/> + </primaryKey> + </constraint> + <constraint name="RHQ_FK_QRTZ_TRGR_LSTNRS_TN_TG"> + <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" + references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" + ondelete="cascade"/> + </constraint> + + <!-- Quartz docs recommend this index. --> + <index name="RHQ_QRTZ_TRGR_LSTNRS_TN_TG_IDX"> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </index> + + </table> + + <table name="RHQ_QRTZ_FIRED_TRIGGERS"> + <column name="ENTRY_ID" primarykey="true" type="VARCHAR2" size="95" required="true"/> + <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> + <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> + <column name="INSTANCE_NAME" type="VARCHAR2" size="80" required="true"/> + <column name="FIRED_TIME" type="LONG" required="true"/> + <column name="PRIORITY" type="INTEGER" required="false"/> + <column name="STATE" type="VARCHAR2" size="16" required="true"/> + <column name="IS_VOLATILE" type="BOOLEAN" required="true"/> + <column name="JOB_NAME" type="VARCHAR2" size="80" required="false"/> + <column name="JOB_GROUP" type="VARCHAR2" size="80" required="false"/> + <column name="IS_STATEFUL" type="BOOLEAN" required="false"/> + <column name="REQUESTS_RECOVERY" type="BOOLEAN" required="false"/> + + <!-- Quartz docs recommend these indexes. --> + <index name="RHQ_QRTZ_FIRED_TRGRS_TN_IDX"> + <field ref="TRIGGER_NAME"/> + </index> + <index name="RHQ_QRTZ_FIRED_TRGRS_TG_IDX"> + <field ref="TRIGGER_GROUP"/> + </index> + <index name="RHQ_QRTZ_FIRED_TRGRS_TN_TG_IDX"> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </index> + <index name="RHQ_QRTZ_FIRED_TRGRS_IN_IDX"> + <field ref="INSTANCE_NAME"/> + </index> + <index name="RHQ_QRTZ_FIRED_TRGRS_JN_IDX"> + <field ref="JOB_NAME"/> + </index> + <index name="RHQ_QRTZ_FIRED_TRGRS_JG_IDX"> + <field ref="JOB_GROUP"/> + </index> + + </table> + + <table name="RHQ_QRTZ_CALENDARS"> + <column name="CALENDAR_NAME" primarykey="true" type="VARCHAR2" size="80" required="true"/> + <column name="CALENDAR" type="BLOB" required="true"/> + </table> + + <table name="RHQ_QRTZ_PAUSED_TRIGGER_GRPS"> + <column name="TRIGGER_GROUP" primarykey="true" type="VARCHAR2" size="80" required="true"/> + </table> + + <table name="RHQ_QRTZ_SCHEDULER_STATE"> + <column name="INSTANCE_NAME" primarykey="true" type="VARCHAR2" size="80" required="true"/> + <column name="LAST_CHECKIN_TIME" type="LONG" required="true"/> + <column name="CHECKIN_INTERVAL" type="LONG" required="true"/> + <column name="RECOVERER" type="VARCHAR2" size="80" required="false"/> + </table> + + <table name="RHQ_QRTZ_LOCKS"> + <column name="LOCK_NAME" primarykey="true" type="VARCHAR2" size="40" required="true"/> + <data LOCK_NAME="TRIGGER_ACCESS"/> + <data LOCK_NAME="JOB_ACCESS"/> + <data LOCK_NAME="CALENDAR_ACCESS"/> + <data LOCK_NAME="STATE_ACCESS"/> + <data LOCK_NAME="MISFIRE_ACCESS"/> + </table> + +<!-- END: scheduler-schema.xml --> +<!-- BEGIN: amps-schema.xml --> + + + <table name="RHQ_PLUGIN"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="4000" type="VARCHAR2" required="false"/> + <column name="VERSION" size="200" type="VARCHAR2" required="false"/> + <column name="AMPS_VERSION" size="16" type="VARCHAR2" required="false"/> + <column name="ENABLED" type="BOOLEAN" required="true"/> + <column name="STATUS" size="16" type="VARCHAR2" required="true"/> + <column name="HELP" type="CLOB" required="false"/> + <column name="PATH" size="500" type="VARCHAR2" required="true"/> + <column name="MD5" size="100" type="VARCHAR2" required="true"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="DEPLOYMENT" size="8" type="VARCHAR2" required="true"/> + <column name="PTYPE" size="200" type="VARCHAR2" required="false"/> + <column name="PLUGIN_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> + <column name="JOBS_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> + <column name="CONTENT" type="BLOB" required="false"/> + + <index name="RHQ_PLUGIN_NAME_DEPLOY_IDX" unique="true"> + <field ref="NAME"/> + <field ref="DEPLOYMENT"/> + </index> + </table> + +<!-- END: amps-schema.xml --> +<!-- BEGIN: measurement-schema.xml --> + + <table name="RHQ_MEASUREMENT_DEF"> + + <!-- === required columns === --> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE(ID)"/> + <column name="NAME" type="VARCHAR2" size="100" required="true"/> + + <!-- === optional columns === --> + <!-- an OSGI version range - if null, the metric def applies to all versions of the associated resource type --> + <column name="RESOURCE_VERSION_RANGE" type="VARCHAR2" size="100"/> + <column name="CATEGORY" type="SMALLINT"/> + <column name="UNITS" type="SMALLINT"/> + <column name="NUMERIC_TYPE" type="SMALLINT"/> + <column name="DISPLAY_TYPE" type="SMALLINT"/> + <column name="DATA_TYPE" type="SMALLINT"/> + <column name="RAW_NUMERIC_TYPE" type="SMALLINT"/> + <column name="DEFAULT_ON" type="BOOLEAN" default="false"/> + <column name="DEFAULT_INTERVAL" type="LONG" /> + <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> + <column name="DISPLAY_ORDER" type="INTEGER" default="1000"/> + <column name="DESCRIPTION" type="VARCHAR2" size="500"/> + <column name="DESTINATION_TYPE" type="VARCHAR2" size="100"/> + + <column name="VERSION" type="INTEGER"/> + <!-- for optimistic locking --> + + <!-- === business key (RESOURCE_TYPE_ID + NAME + RAW_NUMERIC_TYPE) === --> + <index name="RHQ_METRIC_DEF_KEY_IDX" unique="true"> + <field ref="RESOURCE_TYPE_ID"/> + <field ref="NAME"/> + <field ref="RAW_NUMERIC_TYPE"/> + </index> + <index name="RHQ_METRIC_DEF_NT_IDX"> + <field ref="NUMERIC_TYPE"/> + </index> + </table> + + + <table name="RHQ_MEASUREMENT_SCHED"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + + <column name="ENABLED" type="BOOLEAN" default="false"/> + <column name="MTIME" type="LONG" /> + <column name="DEFINITION" type="INTEGER" references="RHQ_MEASUREMENT_DEF(ID)"/> + <column name="VERSION" type="INTEGER" /> + <column name="COLL_INTERVAL" type="LONG" /> + <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE(ID)"/> + <index name="RHQ_MEAS_SCHED_UNIQ" unique="true"> + <field ref="RESOURCE_ID"/> + <field ref="DEFINITION"/> + </index> + </table> + + + <table name="RHQ_MEASUREMENT_BLINE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + + <column name="BL_USER_ENTERED" type="BOOLEAN" default="false" required="true"/> + <column name="BL_MIN" type="DOUBLE" required="true"/> + <column name="BL_MAX" type="DOUBLE" required="true"/> + <column name="BL_MEAN" type="DOUBLE" required="true"/> + <column name="BL_COMPUTE_TIME" type="LONG" required="true"/> + <column name="SCHEDULE_ID" type="INTEGER" required="true" references="RHQ_MEASUREMENT_SCHED(ID)"/> + <index name="RHQ_MEAS_BASELINE_CTIME_IDX"> + <field ref="BL_COMPUTE_TIME"/> + </index> + <index name="RHQ_MEAS_BASELINE_SID_IDX"> + <field ref="SCHEDULE_ID"/> + </index> + </table> + + + <table name="RHQ_MEASUREMENT_DATA_NUM_1H" logging="false" cache="true" + tablespace="DEFAULT" storage-options="freelists 20"> + + <column name="TIME_STAMP" required="true" type="LONG"/> + <column name="SCHEDULE_ID" required="true" type="INTEGER"/> + <column name="VALUE" required="false" type="DOUBLE"/> + <column name="MINVALUE" required="false" type="DOUBLE"/> + <column name="MAXVALUE" required="false" type="DOUBLE"/> + + <constraint name="RHQ_MEAS_DATA_1H_ID_TIME_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + + <index name="RHQ_MEAS_DATA_1H_TIME_IDX"> + <field ref="TIME_STAMP"/> + </index> + </table> + + + <table name="RHQ_MEASUREMENT_DATA_NUM_6H" logging="false" cache="true" + tablespace="DEFAULT" storage-options="freelists 20"> + + <column name="TIME_STAMP" required="true" type="LONG"/> + <column name="SCHEDULE_ID" required="true" type="INTEGER"/> + <column name="VALUE" required="false" type="DOUBLE"/> + <column name="MINVALUE" required="false" type="DOUBLE"/> + <column name="MAXVALUE" required="false" type="DOUBLE"/> + + <constraint name="RHQ_MEAS_DATA_6H_ID_TIME_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + + <index name="RHQ_MEAS_DATA_6H_TIME_IDX"> + <field ref="TIME_STAMP"/> + </index> + </table> + + + <table name="RHQ_MEASUREMENT_DATA_NUM_1D" logging="false" cache="true" + tablespace="DEFAULT" storage-options="freelists 20"> + + <column name="TIME_STAMP" required="true" type="LONG"/> + <column name="SCHEDULE_ID" required="true" type="INTEGER"/> + <column name="VALUE" required="false" type="DOUBLE"/> + <column name="MINVALUE" required="false" type="DOUBLE"/> + <column name="MAXVALUE" required="false" type="DOUBLE"/> + + <constraint name="RHQ_MEAS_DATA_1D_ID_TIME_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + + + <table name="RHQ_MEASUREMENT_DATA_TRAIT"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER" /> + <column name="VALUE" type="VARCHAR2" size="4000" /> + <constraint name="RHQ_MEAS_DATA_TRAIT_ID_TIME_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + + + <table name="RHQ_CALLTIME_DATA_KEY"> + <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> + <column name="SCHEDULE_ID" type="INTEGER" required="true"/> + <column name="CALL_DESTINATION" type="VARCHAR2" size="4000" required="true"/> + <index name="RHQ_CALLTIME_DATA_KEY_IDX" unique="true"> + <field ref="SCHEDULE_ID"/> + <field ref="CALL_DESTINATION"/> + </index> + </table> + + + <table name="RHQ_CALLTIME_DATA_VALUE"> + <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> + <column name="KEY_ID" type="INTEGER" references="RHQ_CALLTIME_DATA_KEY" required="true"/> + <column name="BEGIN_TIME" type="LONG" required="true"/> + <column name="END_TIME" type="LONG" required="true"/> + <column name="MINIMUM" type="DOUBLE" required="true"/> + <column name="MAXIMUM" type="DOUBLE" required="true"/> + <column name="TOTAL" type="DOUBLE" required="true"/> + <column name="COUNT" type="LONG" required="true"/> + <index name="RHQ_CT_DA_VA_END_TIM_IDX"> + <field ref="END_TIME"/> + </index> + </table> + + + <table name="RHQ_AVAILABILITY"> + <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE(ID)"/> + <column name="START_TIME" type="LONG" required="true" /> + <column name="END_TIME" type="LONG" required="false" /> + <column name="AVAILABILITY_TYPE" type="SMALLINT" required="false" /> + <index name="RHQ_AVAIL_RESOURCE_START_IDX"> + <field ref="RESOURCE_ID"/> + <field ref="START_TIME"/> + </index> + <!-- only one null row can exist for any resource --> + <index name="RHQ_AVAIL_RESOURCE_END_IDX" condition="END_TIME IS NULL"> + <field ref="RESOURCE_ID"/> + <field ref="END_TIME" /> + </index> + </table> + + <table name="RHQ_RESOURCE_AVAIL"> + <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE(ID)" ondelete="cascade"/> + <column name="AVAILABILITY_TYPE" type="SMALLINT" required="false" /> + <index name="RHQ_RESOURCE_AVAIL_IDX"> + <field ref="RESOURCE_ID" /> + </index> + </table> + + <table name="RHQ_MEASUREMENT_OOB"> + <column name="SCHEDULE_ID" type="INTEGER" references="RHQ_MEASUREMENT_SCHED(ID)" required="true"/> + <column name="TIME_STAMP" type="LONG" required="true"/> + <column name="OOB_FACTOR" type="INTEGER" required="true" /> + <constraint name="RHQ_MEAS_OOB_ID_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_MEASUREMENT_OOB_TMP"> + <column name="SCHEDULE_ID" type="INTEGER" required="true"/> + <column name="TIME_STAMP" type="LONG" required="true"/> + <column name="OOB_FACTOR" type="INTEGER" required="true" /> + <constraint name="RHQ_MEAS_OOB_TMP_ID_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_NUMBERS"> + <column name="i" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true" /> + </table> + + + <table name="RHQ_MEAS_DATA_NUM_R00"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R00_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R00_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R01"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R01_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R01_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R02"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R02_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R02_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R03"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R03_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R03_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R04"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R04_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R04_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R05"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R05_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R05_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R06"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R06_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R06_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R07"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R07_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R07_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R08"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R08_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R08_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R09"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R09_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R09_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R10"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R10_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R10_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R11"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R11_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R11_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R12"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R12_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R12_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R13"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R13_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R13_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R14"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R14_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R14_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + +<!-- END: measurement-schema.xml --> +<!-- BEGIN: content-schema.xml --> + + + <table name="RHQ_ARCHITECTURE"> + <column name="ID" default="sequence-only" initial="100" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="50" type="VARCHAR2" required="true"/> + <index name="RHQ_ARCHITECTURE_NAME_IDX" unique="true"> + <field ref="NAME"/> + </index> + </table> + + <table name="RHQ_REPO_GROUP_TYPE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + </table> + + + <table name="RHQ_REPO_GROUP"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + + <column name="REPO_GROUP_TYPE_ID" type="INTEGER" references="RHQ_REPO_GROUP_TYPE" required="true"/> + + <index name="RHQ_REPO_GROUP_IDX" unique="true"> + <field ref="NAME"/> + <field ref="REPO_GROUP_TYPE_ID"/> + </index> + </table> + + + <table name="RHQ_CONTENT_SOURCE_TYPE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="false"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="PLUGIN_NAME" size="100" type="VARCHAR2" required="false"/> + <!-- we might want this as part of natural key --> + <column name="DEFAULT_LAZY_LOAD" type="BOOLEAN" required="true"/> + <column name="DEFAULT_DOWNLOAD_MODE" size="16" type="VARCHAR2" required="true"/> + <column name="DEFAULT_SYNC_SCHEDULE" size="64" type="VARCHAR2" required="false"/> + <column name="API_CLASS" size="100" type="VARCHAR2" required="true"/> + + <column name="SOURCE_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF" required="false"/> + + <index name="RHQ_CONTENT_SOURCE_TYPE_IDX" unique="true"> + <field ref="NAME"/> + <!-- <field ref="PLUGIN_NAME"/> --> + </index> + </table> + + <table name="RHQ_CONTENT_SOURCE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="LAZY_LOAD" type="BOOLEAN" required="true"/> + <column name="DOWNLOAD_MODE" size="16" type="VARCHAR2" required="true"/> + <column name="SYNC_SCHEDULE" size="64" type="VARCHAR2" required="false"/> + <column name="LOAD_ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="CREATION_TIME" type="LONG" required="true"/> + <column name="LAST_MODIFIED_TIME" type="LONG" required="true"/> + + <column name="CONTENT_SOURCE_TYPE_ID" type="INTEGER" references="RHQ_CONTENT_SOURCE_TYPE" required="true"/> + <column name="CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> + + <index name="RHQ_CONTENT_SOURCE_IDX" unique="true"> + <field ref="NAME"/> + <field ref="CONTENT_SOURCE_TYPE_ID"/> + </index> + </table> + + <table name="RHQ_REPO"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="CREATION_TIME" type="LONG" required="true"/> + <column name="LAST_MODIFIED_TIME" type="LONG" required="true"/> + <column name="IS_CANDIDATE" type="BOOLEAN" required="true"/> + <column name="SYNC_SCHEDULE" size="64" type="VARCHAR2" required="false"/> + + <index name="RHQ_REPO_IDX" unique="true"> + <field ref="NAME"/> + </index> + </table> + + + <table name="RHQ_REPO_RELATION_TYPE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + </table> + + + <table name="RHQ_REPO_RELATION"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="RELATED_REPO_ID" type="INTEGER" references="RHQ_REPO" required="true"/> + <column name="REPO_RELATION_TYPE_ID" type="INTEGER" references="RHQ_REPO_RELATION_TYPE" required="true"/> + </table> + + + + <table name="RHQ_PACKAGE_TYPE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="false"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="CATEGORY" size="50" type="VARCHAR2" required="false"/> + <column name="DISCOVERY_INTERVAL" type="INTEGER" required="false"/> + <column name="IS_CREATION_DATA" type="BOOLEAN" required="true"/> + <column name="SUPPORTS_ARCHITECTURE" type="BOOLEAN" required="true"/> + + <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE" required="true"/> + <column name="DEPLOYMENT_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF" required="false"/> + <column name="PACKAGE_EXTRA_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG_DEF" required="false"/> + + <index name="RHQ_PACKAGE_TYPE_IDX" unique="true"> + <field ref="NAME"/> + <field ref="RESOURCE_TYPE_ID"/> + </index> + + </table> + + <table name="RHQ_PACKAGE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="CLASSIFICATION" size="200" type="VARCHAR2" required="false"/> + + <column name="PACKAGE_TYPE_ID" type="INTEGER" references="RHQ_PACKAGE_TYPE" required="true"/> + + <index name="RHQ_PACKAGE_IDX" unique="true"> + <field ref="NAME"/> + <field ref="PACKAGE_TYPE_ID"/> + </index> + </table> + + <table name="RHQ_PACKAGE_BITS"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="BITS" type="LARGEOBJECT" required="false"/> + </table> + + <table name="RHQ_PACKAGE_VERSION"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="false"/> + <column name="SHORT_DESCRIPTION" size="10000" type="CLOB" required="false"/> + <column name="LONG_DESCRIPTION" size="50000" type="CLOB" required="false"/> + <column name="VERSION" size="500" type="VARCHAR2" required="true"/> + <column name="DISPLAY_VERSION" size="500" type="VARCHAR2" required="false"/> + <column name="FILE_NAME" size="255" type="VARCHAR2" required="false"/> + <column name="FILE_SIZE" type="LONG" required="false"/> + <column name="FILE_MD5" size="32" type="VARCHAR2" required="false"/> + <column name="FILE_SHA256" size="64" type="VARCHAR2" required="false"/> + <column name="FILE_CREATION_TIME" type="LONG" required="false"/> + <column name="LICENSE_NAME" size="255" type="VARCHAR2" required="false"/> + <column name="LICENSE_VERSION" size="20" type="VARCHAR2" required="false"/> + <column name="METADATA" type="BLOB" required="false"/> + + <column name="PACKAGE_ID" type="INTEGER" references="RHQ_PACKAGE" required="true"/> + <column name="ARCHITECTURE_ID" type="INTEGER" references="RHQ_ARCHITECTURE" required="true"/> + <column name="CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> + <column name="PACKAGE_BITS_ID" type="INTEGER" references="RHQ_PACKAGE_BITS" required="false"/> + + <index name="RHQ_PACKAGE_VERSION_IDX" unique="true"> + <field ref="PACKAGE_ID"/> + <field ref="VERSION"/> + <field ref="ARCHITECTURE_ID"/> + </index> + + </table> + + <table name="RHQ_CONTENT_REQ"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="REQUEST_TYPE" type="VARCHAR2" required="true" size="20"/> + <column name="NOTES" type="VARCHAR2" required="false" size="512"/> + </table> + + <table name="RHQ_INSTALLED_PACKAGE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="INSTALLATION_TIME" type="LONG" required="false"/> + + <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE" required="true"/> + <column name="PACKAGE_VERSION_ID" type="INTEGER" references="RHQ_PACKAGE_VERSION" required="true"/> + <column name="SUBJECT_ID" type="INTEGER" references="RHQ_SUBJECT" required="false"/> + </table> + + <table name="RHQ_INSTALLED_PKG_HIST"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="STATUS" type="VARCHAR2" size="24" required="true"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="HISTORY_TIMESTAMP" type="LONG" required="false"/> + + <column name="PACKAGE_VERSION_ID" type="INTEGER" references="RHQ_PACKAGE_VERSION" required="true"/> + <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE" required="true"/> + <column name="DEPLOYMENT_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> + <column name="CONTENT_SERVICE_REQUEST_ID" type="INTEGER" references="RHQ_CONTENT_REQ" required="false"/> + </table> + + <table name="RHQ_CONTENT_SRC_SYNC"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="STATUS" type="VARCHAR2" size="16" required="true"/> + <column name="START_TIME" type="LONG" required="true"/> + <column name="END_TIME" type="LONG" required="false"/> + <column name="RESULTS" type="LONGVARCHAR" required="false"/> + <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> + </table> + + <table name="RHQ_REPO_SYNC"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="STATUS" type="VARCHAR2" size="16" required="true"/> + <column name="START_TIME" type="LONG" required="true"/> + <column name="END_TIME" type="LONG" required="false"/> + <column name="RESULTS" type="LONGVARCHAR" required="false"/> + <column name="PERCENT_COMPLETE" type="LONG" required="false"/> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + </table> + + + <table name="RHQ_PACKAGE_INST_STEP"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="STEP_KEY" type="VARCHAR2" size="500" required="true"/> + <column name="STEP_ORDER" type="INTEGER" required="true"/> + <column name="DESCRIPTION" type="VARCHAR2" size="4000" required="true"/> + <column name="ERROR_MSG" type="LONGVARCHAR" required="false"/> + <column name="RESULT" type="VARCHAR2" size="25" required="true"/> + + <column name="INSTALLED_PKG_HIST_ID" type="INTEGER" references="RHQ_INSTALLED_PKG_HIST"/> + </table> + + <table name="RHQ_REPO_RESOURCE_MAP"> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_REPO_RESOURCE_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="RESOURCE_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_REPO_CONTENT_SRC_MAP"> 1 + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_REPO_CONTENT_SRC_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="CONTENT_SRC_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_REPO_REPO_GROUP_MAP"> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="REPO_GROUP_ID" type="INTEGER" required="true" references="RHQ_REPO_GROUP"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_REPO_REPO_GROUP_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="REPO_GROUP_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_REPO_REPO_RELATION_MAP"> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="REPO_RELATION_ID" type="INTEGER" required="true" references="RHQ_REPO_RELATION"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_REPO_REPO_RELATION_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="REPO_RELATION_ID"/> + </primaryKey> + </constraint> + </table> + + + <table name="RHQ_REPO_PKG_VERSION_MAP"> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_REPO_PKG_VER_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="PACKAGE_VERSION_ID"/> + </primaryKey> + </constraint> + <index name="RHQ_REPO_PKG_VER_MAP_IDX" unique="false"> + <field ref="PACKAGE_VERSION_ID"/> + </index> + </table> + + <table name="RHQ_PKG_VER_CONTENT_SRC_MAP"> + <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> + <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> + <column name="LOCATION" type="VARCHAR2" size="4000" required="true"/> + + <constraint name="RHQ_PKG_VER_CONTENT_SRC_KEY"> + <primaryKey> + <field ref="PACKAGE_VERSION_ID"/> + <field ref="CONTENT_SRC_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_PKG_PRD_MAP"> + <column name="PKG_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> + <column name="PRD_ID" type="INTEGER" required="true" references="RHQ_PRD_VER"/> + + <constraint name="RHQ_PKG_PRD_KEY"> + <primaryKey> + <field ref="PKG_ID"/> + <field ref="PRD_ID"/> + </primaryKey> + </constraint> + + </table> + + <table name="RHQ_DISTRIBUTION_TYPE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + + </table> + + <table name="RHQ_DISTRIBUTION"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="DISTRIBUTION_TYPE_ID" type="INTEGER" required="true" references="RHQ_DISTRIBUTION_TYPE"/> + <column name="LABEL" size="64" type="VARCHAR2" required="true"/> + <column name="BASE_PATH" size="256" type="VARCHAR2" required="true"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + + <index name="RHQ_DISTRIBUTION_IDX" unique="true"> + <field ref="LABEL"/> + <field ref="BASE_PATH"/> + </index> + + </table> + + <table name="RHQ_REPO_DISTRIBUTION"> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="DISTRIBUTION_ID" type="INTEGER" required="true" references="RHQ_DISTRIBUTION"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + + <constraint name="RHQ_REPO_DIST_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="DISTRIBUTION_ID"/> + </primaryKey> + </constraint> + </table> + + + + <table name="RHQ_DISTRIBUTION_FILE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="DISTRIBUTION_ID" type="INTEGER" required="true" references="RHQ_DISTRIBUTION"/> + <column name="RELATIVE_FILENAME" size="256" type="VARCHAR2" required="true"/> + <!--<column name="FILE_SIZE" type="NUMBER" required="true"/>--> + <column name="MD5SUM" size="64" type="VARCHAR2" required="true"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + <!--<column name="CTIME" type="LONG" required="true"/>--> + + <index name="RHQ_DISTRIBUTION_FILE_IDX" unique="true"> + <field ref="DISTRIBUTION_ID"/> + <field ref="RELATIVE_FILENAME"/> + </index> + </table> + + + + + <table name="RHQ_ADVISORY"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="ADVISORY" size="64" type="VARCHAR2" required="true"/> + <column name="ADVISORY_TYPE" size="64" type="VARCHAR2" required="true" /> + <column name="ADVISORY_REL" size="64" type="VARCHAR2" required="false"/> + <column name="ADVISORY_NAME" size="64" type="VARCHAR2" required="false"/> + <column name="DESCRIPTION" size="4000" type="VARCHAR2" required="false"/> + <column name="SYNOPSIS" size="4000" type="VARCHAR2" required="true"/> + <column name="TOPIC" size="4000" type="VARCHAR2" required="false"/> + <column name="SOLUTION" size="4000" type="VARCHAR2" required="false"/> + <column name="SEVERITY" size="64" type="VARCHAR2" required="false"/> + <column name="ISSUE_DATE" type="LONG" required="false"/> + <column name="UPDATE_DATE" type="LONG" required="false"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + + <index name="RHQ_ADVISORY_NAME_UQ" unique="true"> + <field ref="ADVISORY_NAME"/> + </index> + + <index name="RHQ_ADVISORY_UQ" unique="true"> + <field ref="ADVISORY"/> + </index> + + <index name="RHQ_ADVISORY_UDATE_IDX" unique="false"> + <field ref="UPDATE_DATE"/> + </index> + </table> + + <table name="RHQ_ADVISORY_PACKAGE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> + <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + + <index name="RHQ_ADVISORY_PKG_IDX" unique="true"> + <field ref="ADVISORY_ID"/> + <field ref="PACKAGE_VERSION_ID"/> + </index> + </table> + + <table name="RHQ_CVE"> + <column name="ID" default="sequence-only" initial="101" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="64" type="VARCHAR2" required="true"/> + </table> + + <table name="RHQ_ADVISORY_CVE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> + <column name="CVE_ID" type="INTEGER" required="true" references="RHQ_CVE"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + + <index name="RHQ_ADVISORY_CVE_IDX" unique="true"> + <field ref="ADVISORY_ID"/> + <field ref="CVE_ID"/> + </index> + + </table> + + <table name="RHQ_ADVISORY_BUGLIST"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> + <column name="BUG_ID" size="256" type="VARCHAR2" required="true"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + + <index name="RHQ_ADVISORY_BUG_IDX" unique="true"> + <field ref="ADVISORY_ID"/> + <field ref="BUG_ID"/> + </index> + </table> + + + <table name="RHQ_REPO_ADVISORY"> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + + <constraint name="RHQ_REPO_ADV_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="ADVISORY_ID"/> + </primaryKey> + </constraint> + </table> + + <!-- BUNDLE_TYPE is things like "Cobbler profile" or "file-based bundle" or "puppet recipe" --> + <table name="RHQ_BUNDLE_TYPE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> + + <!-- This index is for constraint, not performance --> + <index name="RHQ_BUNDLE_TYPE_UNIQUE" unique="true"> + <field ref="NAME"/> + </index> + </table> + + <!-- BUNDLE is a named piece of content that can be versioned and installed somewhere --> + <table name="RHQ_BUNDLE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="BUNDLE_TYPE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_TYPE"/> + <column name="PACKAGE_TYPE_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_TYPE"/> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + + <!-- This index is for constraint, not performance --> + <index name="RHQ_BUNDLE_UNIQUE" unique="true"> + <field ref="BUNDLE_TYPE_ID"/> + <field ref="NAME"/> + </index> + </table> + + <!-- BUNDLE_VERSION represents an actual piece of content that needs to be installed somewhere --> + <table name="RHQ_BUNDLE_VERSION"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="VERSION" size="500" type="VARCHAR2" required="true"/> + <column name="VERSION_ORDER" type="INTEGER" required="true"/> + <column name="ACTION" type="CLOB" required="true"/> + <column name="CONFIG_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_DEF" /> + <column name="BUNDLE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE"/> + + <!-- This index is for constraint, not performance --> + <index name="RHQ_BUNDLE_VERSION_UNIQUE" unique="true"> + <field ref="BUNDLE_ID"/> + <field ref="NAME"/> + <field ref="VERSION"/> + </index> + </table> + + <!-- Many-to-many table that links many repos to a particular bundle version. destination platforms --> + <!-- would be required to have associations to the specified repos (to access required content --> + <table name="RHQ_BUNDLE_VERSION_REPO"> + <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + + <constraint name="RHQ_BUNDLE_VERSION_REPO_KEY"> + <primaryKey> + <field ref="BUNDLE_VERSION_ID"/> + <field ref="REPO_ID"/> + </primaryKey> + </constraint> + </table> + + <!-- BUNDLE_FILE represents a file that is associated with (possibly bundled inside) a bundle version --> + <table name="RHQ_BUNDLE_FILE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> + <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> + </table> + + <!-- A logical destination for a bundle deployment. Defines the platforms and directory on those targets. --> + <table name="RHQ_BUNDLE_DESTINATION"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="BUNDLE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE"/> + <column name="GROUP_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_GROUP"/> + <column name="DEPLOY_DIR" size="256" type="VARCHAR2" required="true"/> + + <!-- This index is for constraint, not performance --> + <index name="RHQ_BUNDLE_DESTINATION_UNIQUE" unique="true"> + <field ref="BUNDLE_ID"/> + <field ref="GROUP_ID"/> + <field ref="DEPLOY_DIR"/> + </index> + </table> + + <!-- An actual deployment of a bundle version to a destination, with a specific config. Bundle deployments + can differ only on ctime, which is assumed to be different --> + <table name="RHQ_BUNDLE_DEPLOYMENT"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> + <column name="BUNDLE_DESTINATION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DESTINATION"/> + <column name="CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG" /> + <column name="SUBJECT_NAME" type="VARCHAR2" required="false" size="255"/> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="IS_LIVE" type="BOOLEAN" required="true"/> + <column name="REPLACED_BUNDLE_DEPLOYMENT_ID" type="INTEGER" required="false" references="RHQ_BUNDLE_DEPLOYMENT"/> + </table> + + <!-- Represents a bundle version that is deployed on a platform resource --> + <table name="RHQ_BUNDLE_RES_DEPLOY"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="BUNDLE_DEPLOYMENT_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DEPLOYMENT" /> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE" /> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="CTIME" type="LONG" required="true"/> + + <index name="RHQ_BUNDLE_RES_DEPLOY_IDX" unique="true"> + <field ref="BUNDLE_DEPLOYMENT_ID"/> + <field ref="RESOURCE_ID"/> + </index> + </table> + + <table name="RHQ_BUNDLE_RES_DEP_HIST"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="BUNDLE_RES_DEPLOY_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_RES_DEPLOY" /> + <column name="SUBJECT_NAME" required="false" size="255" type="VARCHAR2"/> + <column name="AUDIT_TIME" required="true" type="LONG"/> + <column name="ACTION" required="true" size="128" type="VARCHAR2"/> + <column name="INFO" required="true" size="512" type="VARCHAR2"/> + <column name="CATEGORY" required="false" size="32" type="VARCHAR2"/> + <column name="STATUS" required="true" type="VARCHAR2" size="16"/> + <column name="MESSAGE" required="false" type="LONGVARCHAR"/> + <column name="ATTACHMENT" required="false" type="LONGVARCHAR"/> + </table> + + <table name="RHQ_TAGGING_BUNDLE_MAP"> + <column name="BUNDLE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE"/> + <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> + <constraint name="RHQ_TAGGING_BUNDLE_MAP_KEY"> + <primaryKey> + <field ref="BUNDLE_ID"/> + <field ref="TAG_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_TAGGING_BUNDLE_VERSION_MAP"> + <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> + <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> + <constraint name="RHQ_TAGGING_BUNDLE_VER_MAP_KEY"> + <primaryKey> + <field ref="BUNDLE_VERSION_ID"/> + <field ref="TAG_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_TAGGING_BUNDLE_DEPLOY_MAP"> + <column name="BUNDLE_DEPLOYMENT_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DEPLOYMENT"/> + <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> + <constraint name="RHQ_TAGGING_BUNDLE_DEP_MAP_KEY"> + <primaryKey> + <field ref="BUNDLE_DEPLOYMENT_ID"/> + <field ref="TAG_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_TAGGING_BUNDLE_DEST_MAP"> + <column name="BUNDLE_DESTINATION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DESTINATION"/> + <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> + <constraint name="RHQ_TAGGING_BUNDLE_DES_MAP_KEY"> + <primaryKey> + <field ref="BUNDLE_DESTINATION_ID"/> + <field ref="TAG_ID"/> + </primaryKey> + </constraint> + </table> + + +<!-- END: content-schema.xml --> +<!-- BEGIN: resource-request-schema.xml --> + + + <table name="RHQ_CREATE_RES_HIST"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="PARENT_RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> + <column name="CREATED_RESOURCE_NAME" type="VARCHAR2" size="500" required="false"/> + <column name="NEW_RESOURCE_KEY" type="VARCHAR2" required="false" size="500"/> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> + <column name="CONFIGURATION_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> + <column name="INSTALLED_PACKAGE_ID" type="INTEGER" required="false" references="RHQ_INSTALLED_PACKAGE"/> + </table> + + <table name="RHQ_DELETE_RES_HIST"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> + </table> + +<!-- END: resource-request-schema.xml --> +<!-- BEGIN: jms-schema.xml --> + +<!-- the schema matches that which would be automatically created by the JMS subsystem --> +<!-- see deploy/jms/rhq-jdbc-state-service.xml and rhq-jdbc2-service.xml --> + + + <table name="JMS_MESSAGES"> + <column name="MESSAGEID" required="true" type="INTEGER" /> + <column name="DESTINATION" required="true" type="VARCHAR2" size="255" /> + <column name="TXID" required="false" type="INTEGER" /> + <column name="TXOP" required="false" type="CHAR" size="1" /> + <column name="MESSAGEBLOB" required="false" type="BLOB" /> + + <constraint name="JMS_MESSAGES_PKEY"> + <primaryKey> + <field ref="MESSAGEID"/> + <field ref="DESTINATION"/> + </primaryKey> + </constraint> + + <index name="JMS_MESSAGES_TXOP_TXID"> + <field ref="TXOP"/> + <field ref="TXID"/> + </index> + <index name="JMS_MESSAGES_DESTINATION"> + <field ref="DESTINATION"/> + </index> + </table> + + <table name="JMS_TRANSACTIONS"> + <column name="TXID" required="true" type="INTEGER" primarykey="true" /> + </table> + + <table name="JMS_USERS"> + <column name="USERID" required="true" type="VARCHAR2" size="32" primarykey="true" /> + <column name="PASSWD" required="true" type="VARCHAR2" size="32" /> + <column name="CLIENTID" required="false" type="VARCHAR2" size="128" /> + </table> + + <table name="JMS_ROLES"> + <column name="ROLEID" required="true" type="VARCHAR2" size="32" /> + <column name="USERID" required="true" type="VARCHAR2" size="32" /> + + <constraint name="JMS_ROLES_PKEY"> + <primaryKey> + <field ref="USERID"/> + <field ref="ROLEID"/> + </primaryKey> + </constraint> + </table> + + <table name="JMS_SUBSCRIPTIONS"> + <column name="CLIENTID" required="true" type="VARCHAR2" size="128" /> + <column name="SUBNAME" required="true" type="VARCHAR2" size="128" /> + <column name="TOPIC" required="true" type="VARCHAR2" size="255" /> + <column name="SELECTOR" required="false" type="VARCHAR2" size="255" /> + + <constraint name="JMS_SUBSCRIPTIONS_PKEY"> + <primaryKey> + <field ref="CLIENTID"/> + <field ref="SUBNAME"/> + </primaryKey> + </constraint> + </table> + +<!-- END: jms-schema.xml --> +<!-- BEGIN: obsolete-schema.xml --> + + + <!-- NOTE: The tables will be dropped in the *** REVERSE ORDER *** as listed in this file! --> + <!-- NOTE: So, put the table you want dropped first at the bottom, and so on... --> + + + <!-- !!! REMOVED FROM CONTENT-SCHEMA !!!! --> + + <table name="RHQ_BUNDLE_CONFIG" obsolete="true"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG" /> + <!-- this probably needs a DTYPE discriminator so we know if its a bundle or a specific bundle version --> + <column name="BUNDLE_VERSION_ID" type="INTEGER" required="false" references="RHQ_BUNDLE_VERSION"/> + <column name="BUNDLE_ID" type="INTEGER" required="false" references="RHQ_BUNDLE"/> + </table> + + <table name="RHQ_CHANNEL" obsolete="true"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="CREATION_TIME" type="LONG" required="true"/> + <column name="LAST_MODIFIED_TIME" type="LONG" required="true"/> + + <index name="RHQ_CHANNEL_IDX" unique="true"> + <field ref="NAME"/> + </index> + </table> + + <table name="RHQ_CHANNEL_RESOURCE_MAP" obsolete="true"> + <column name="CHANNEL_ID" type="INTEGER" required="true" references="RHQ_CHANNEL"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_CHANNEL_RESOURCE_MAP_KEY"> + <primaryKey> + <field ref="CHANNEL_ID"/> + <field ref="RESOURCE_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_CHANNEL_CONTENT_SRC_MAP" obsolete="true"> + <column name="CHANNEL_ID" type="INTEGER" required="true" references="RHQ_CHANNEL"/> + <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_CHAN_CONTENT_SRC_MAP_KEY"> + <primaryKey> + <field ref="CHANNEL_ID"/> + <field ref="CONTENT_SRC_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_CHANNEL_PKG_VERSION_MAP" obsolete="true"> + <column name="CHANNEL_ID" type="INTEGER" required="true" references="RHQ_CHANNEL"/> + <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_CHANNEL_PKG_VER_MAP_KEY"> + <primaryKey> + <field ref="CHANNEL_ID"/> + <field ref="PACKAGE_VERSION_ID"/> + </primaryKey> + </constraint> + </table> + + <!-- !!! REMOVED FROM MEASUREMENT-SCHEMA !!!! --> + + <table name="RHQ_MEASUREMENT_OOB" obsolete="true"> + <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> + <column name="SCHEDULE_ID" type="INTEGER" references="RHQ_MEASUREMENT_SCHED(ID)" required="true"/> + <column name="OCCURRED" type="LONG" required="true"/> + <column name="DIFF" type="DOUBLE" required="true"/> + + <index name="RHQ_MEASUREMENT_OOB_IDX" unique="true"> + <field ref="SCHEDULE_ID" /> + <field ref="OCCURRED" /> + </index> + </table> + + + <table name="RHQ_TAG" obsolete="true"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + </table> + + <table name="RHQ_REPO_TAG_MAP" obsolete="true"> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAG"/> + + <constraint name="RHQ_REPO_TAG_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="TAG_ID"/> + </primaryKey> + </constraint> + </table> + + +<!-- END: obsolete-schema.xml --> +</dbsetup>
commit 90238a3a62f0c8f27c90b99742cfb865a9bae122 Merge: b2d0b58 ea28ea7 Author: John Mazzitelli mazz@redhat.com Date: Wed Dec 5 16:52:42 2012 -0500
Merge remote-tracking branch 'origin/master' into rhq-on-as7
commit ea28ea72b32ef0d2cb2c096085a5f43fe0e93422 Author: John Mazzitelli mazz@redhat.com Date: Wed Dec 5 16:49:26 2012 -0500
we don't need jboss.zip / jboss.unzip.location since we dont' have to prepare AS7 in this module anymore
diff --git a/modules/enterprise/server/jar/pom.xml b/modules/enterprise/server/jar/pom.xml index 064f01f..87674b0 100644 --- a/modules/enterprise/server/jar/pom.xml +++ b/modules/enterprise/server/jar/pom.xml @@ -17,11 +17,7 @@ <description>RHQ enterprise server main JAR</description>
<properties> - <jboss.zip>${settings.localRepository}/org/jboss/as/jboss-as-dist/${jboss.version}/jboss-as-dist-${jboss.version}.zip</jboss.zip> - <jboss.unzip.location>${basedir}/target/jboss-as-${jboss.version}</jboss.unzip.location> - <clean.db>true</clean.db> - <rhq.internal>false</rhq.internal> </properties>
commit b2d0b58fd4fa2af5659631055f4387ab651e4f94 Merge: 707c6ba 782f15c Author: John Mazzitelli mazz@redhat.com Date: Wed Dec 5 16:45:45 2012 -0500
Merge remote-tracking branch 'origin/master' into rhq-on-as7
commit 782f15c053c7f00c2139ec29efa5d317f5c8ec01 Author: Jay Shaughnessy jshaughn@redhat.com Date: Wed Dec 5 16:39:22 2012 -0500
Remove unnecessary AS711 unzip, the integration tests have moved to server/itests-
diff --git a/modules/enterprise/server/jar/pom.xml b/modules/enterprise/server/jar/pom.xml index dae3778..064f01f 100644 --- a/modules/enterprise/server/jar/pom.xml +++ b/modules/enterprise/server/jar/pom.xml @@ -517,81 +517,6 @@ </goals> </execution>
- <execution> - <id>prepare AS container</id> - <phase>process-test-resources</phase> - <configuration> - <target> - <echo>Unzipping JBossAS ${jboss.version} found at ${jboss.zip}</echo> - <unzip src="${jboss.zip}" dest="${jboss.unzip.location}/.." /> - <echo>JBossAS ${jboss.version} should now be at: ${jboss.unzip.location}</echo> - <property name="jboss.conf" location="${jboss.unzip.location}/standalone/configuration/standalone.xml" /> - <echo>Will now add test configuration to JBossAS config file: ${jboss.conf}</echo> - <replace file="${jboss.conf}"> - <replacefilter> - <replacetoken></drivers></replacetoken> - <replacevalue><![CDATA[ - <!-- FOR RHQ TESTING --> - <driver name="postgres" module="org.rhq.postgres"> - <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class> - </driver> - <driver name="oracle" module="org.rhq.oracle"> - <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class> - </driver> - </drivers>]]></replacevalue> - </replacefilter> - <replacefilter> - <replacetoken></security-domains></replacetoken> - <replacevalue><![CDATA[ - <!-- FOR RHQ TESTING --> - <security-domain name="RHQDSSecurityDomain" cache-type="default"> - <authentication> - <login-module code="SecureIdentity" flag="required"> - <module-option name="username" value="rhqadmin"/> - <module-option name="password" value="1eeb2f255e832171df8592078de921bc"/> - </login-module> - </authentication> - </security-domain> - </security-domains>]]></replacevalue> - </replacefilter> - </replace> - - <property name="jboss.modules.dir" location="${jboss.unzip.location}/modules" /> - <echo>Adding JDBC modules to ${jboss.modules.dir} ...</echo> - <copy file="${settings.localRepository}/com/oracle/ojdbc6/${ojdbc6.version}/ojdbc6-${ojdbc6.version}.jar" - toDir="${jboss.modules.dir}/org/rhq/oracle/main" failonerror="false" verbose="true" /> - <echo file="${jboss.modules.dir}/org/rhq/oracle/main/module.xml"><![CDATA[<?xml version="1.0" encoding="UTF-8"?> -<module xmlns="urn:jboss:module:1.1" name="org.rhq.oracle"> - <resources> - <resource-root path="ojdbc6-${ojdbc6.version}.jar"/> - </resources> - <dependencies> - <module name="javax.api"/> - <module name="javax.transaction.api"/> - </dependencies> -</module> -]]></echo> - <copy file="${settings.localRepository}/postgresql/postgresql/${postgresql.version}/postgresql-${postgresql.version}.jar" - toDir="${jboss.modules.dir}/org/rhq/postgres/main" verbose="true" /> - <echo file="${jboss.modules.dir}/org/rhq/postgres/main/module.xml"><![CDATA[<?xml version="1.0" encoding="UTF-8"?> -<module xmlns="urn:jboss:module:1.1" name="org.rhq.postgres"> - <resources> - <resource-root path="postgresql-${postgresql.version}.jar"/> - </resources> - <dependencies> - <module name="javax.api"/> - <module name="javax.transaction.api"/> - </dependencies> -</module> -]]></echo> - - </target> - </configuration> - <goals> - <goal>run</goal> - </goals> - </execution> - </executions> </plugin>
commit 707c6baf2be162e92e2f40392bbbf965ec9fa728 Author: John Mazzitelli mazz@redhat.com Date: Wed Dec 5 15:27:49 2012 -0500
no need for the separate generate-db-password scripts (which is good because the duplicate alot of script code in the other scripts) we can now generate db passwords from rhq-installer.sh --dbpassword=foo
diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/generate-db-password.bat b/modules/enterprise/server/appserver/src/main/bin-resources/bin/generate-db-password.bat deleted file mode 100644 index a1f05b5..0000000 --- a/modules/enterprise/server/appserver/src/main/bin-resources/bin/generate-db-password.bat +++ /dev/null @@ -1,115 +0,0 @@ -@echo off - -rem =========================================================================== -rem RHQ Server Windows Generate db password script -rem -rem This file is used to execute the generate a new encrypted db password. -rem -rem This script is customizable by setting the following environment variables: -rem -rem RHQ_SERVER_DEBUG - If this is defined, the script will emit debug -rem messages. -rem If not set or set to "false", debug is turned off. -rem -rem RHQ_SERVER_HOME - Defines where the Server's home install directory is. -rem If not defined, it will be assumed to be the parent -rem directory of the directory where this script lives. -rem -rem RHQ_SERVER_JAVA_HOME - The location of the JRE that the Server will -rem use. This will be ignored if -rem RHQ_SERVER_JAVA_EXE_FILE_PATH is set. -rem If this and RHQ_SERVER_JAVA_EXE_FILE_PATH are -rem not set, the Server's embedded JRE will be used. -rem -rem RHQ_SERVER_JAVA_EXE_FILE_PATH - Defines the full path to the Java -rem executable to use. If this is set, -rem RHQ_SERVER_JAVA_HOME is ignored. -rem If this is not set, then -rem %RHQ_SERVER_JAVA_HOME%\bin\java.exe -rem is used. If this and -rem RHQ_SERVER_JAVA_HOME are not set, the -rem Server's embedded JRE will be used. -rem -rem If the embedded JRE is to be used but is not available, the fallback -rem JRE to be used will be determined by the JAVA_HOME environment variable. -rem -rem =========================================================================== - -setlocal - -rem if debug variable is set, it is assumed to be on, unless its value is false -if "%RHQ_SERVER_DEBUG%" == "false" ( - set RHQ_SERVER_DEBUG= -) - -rem ---------------------------------------------------------------------- -rem Ensure password parameter is present -rem ---------------------------------------------------------------------- - -if /i "%1"=="" ( - echo Usage: %0 { plainTextPassword } - goto :done -) - -rem ---------------------------------------------------------------------- -rem Change directory so the current directory is the Server home. -rem ---------------------------------------------------------------------- - -set RHQ_SERVER_BIN_DIR_PATH=%~dp0 - -if not defined RHQ_SERVER_HOME ( - cd "%RHQ_SERVER_BIN_DIR_PATH%.." -) else ( - cd "%RHQ_SERVER_HOME%" || ( - echo Cannot go to the RHQ_SERVER_HOME directory: %RHQ_SERVER_HOME% - exit /B 1 - ) -) - -set RHQ_SERVER_HOME=%CD% - -if defined RHQ_SERVER_DEBUG echo RHQ_SERVER_HOME: %RHQ_SERVER_HOME% - -rem ---------------------------------------------------------------------- -rem Find the Java executable and verify we have a VM available. -rem ---------------------------------------------------------------------- - -if not defined RHQ_SERVER_JAVA_EXE_FILE_PATH ( - if not defined RHQ_SERVER_JAVA_HOME call :prepare_embedded_jre -) - -if not defined RHQ_SERVER_JAVA_EXE_FILE_PATH set RHQ_SERVER_JAVA_EXE_FILE_PATH=%RHQ_SERVER_JAVA_HOME%\bin\java.exe - -if defined RHQ_SERVER_DEBUG echo RHQ_SERVER_JAVA_HOME: %RHQ_SERVER_JAVA_HOME% -if defined RHQ_SERVER_DEBUG echo RHQ_SERVER_JAVA_EXE_FILE_PATH: %RHQ_SERVER_JAVA_EXE_FILE_PATH% - -if not exist "%RHQ_SERVER_JAVA_EXE_FILE_PATH%" ( - echo There is no JVM available. - echo Please set RHQ_SERVER_JAVA_HOME or RHQ_SERVER_JAVA_EXE_FILE_PATH appropriately. - exit /B 1 -) - -set _JB_DIR=%RHQ_SERVER_HOME%\jbossas -"%RHQ_SERVER_JAVA_EXE_FILE_PATH%" -cp %_JB_DIR%\modules\org\picketbox\main\picketbox-4.0.7.Final.jar;%_JB_DIR%\modules\org\jboss\logging\main\jboss-logging-3.1.0.GA.jar org.picketbox.datasource.security.SecureIdentityLoginModule %1 - -goto :done - -rem ---------------------------------------------------------------------- -rem CALL subroutine that prepares to use the embedded JRE -rem ---------------------------------------------------------------------- - -:prepare_embedded_jre -set RHQ_SERVER_JAVA_HOME=%RHQ_SERVER_HOME%\jre -if defined RHQ_SERVER_DEBUG echo Using the embedded JRE -if not exist "%RHQ_SERVER_JAVA_HOME%" ( - if defined RHQ_SERVER_DEBUG echo No embedded JRE found - will try to use JAVA_HOME: %JAVA_HOME% - set RHQ_SERVER_JAVA_HOME=%JAVA_HOME% -) -goto :eof - -rem ---------------------------------------------------------------------- -rem CALL subroutine that exits this script normally -rem ---------------------------------------------------------------------- - -:done -endlocal diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/generate-db-password.sh b/modules/enterprise/server/appserver/src/main/bin-resources/bin/generate-db-password.sh deleted file mode 100755 index 0320c08..0000000 --- a/modules/enterprise/server/appserver/src/main/bin-resources/bin/generate-db-password.sh +++ /dev/null @@ -1,159 +0,0 @@ -#!/bin/sh - -# ============================================================================= -# RHQ Server UNIX Generate db password script -# -# This file is used to execute the generate a new encrypted db password. -# -# This script is customizable by setting the following environment variables: -# -# RHQ_SERVER_HOME - Defines where the server's home install directory is. -# If not defined, it will be assumed to be the parent -# directory of the directory where this script lives. -# -# RHQ_SERVER_JAVA_HOME - The location of the JRE that the server will -# use. This will be ignored if -# RHQ_SERVER_JAVA_EXE_FILE_PATH is set. -# If this and RHQ_SERVER_JAVA_EXE_FILE_PATH are -# not set, the Server's embedded JRE will be used. -# -# RHQ_SERVER_JAVA_EXE_FILE_PATH - Defines the full path to the Java -# executable to use. If this is set, -# RHQ_SERVER_JAVA_HOME is ignored. -# If this is not set, then -# $RHQ_SERVER_JAVA_HOME/bin/java -# is used. If this and -# RHQ_SERVER_JAVA_HOME are not set, the -# Server's embedded JRE will be used. -# -# If the embedded JRE is to be used but is not available, the fallback -# JRE to be used will be determined by the JAVA_HOME environment variable. -# -# ============================================================================= - -# ---------------------------------------------------------------------- -# Environment variables you can set to customize the launch of the RHQ Server. -# ---------------------------------------------------------------------- - -# RHQ_SERVER_HOME=/path/to/server/home -# RHQ_SERVER_DEBUG=true -# JAVA_HOME=/path/to/java/installation -# RHQ_SERVER_JAVA_EXE_FILE_PATH=/path/directly/to/java/executable -# ---------------------------------------------------------------------- -# Make sure we unset any lingering JBossAS environment variables that -# were set in the user's environment. This might happen if the user -# has an external JBossAS configured. -# ---------------------------------------------------------------------- - -unset JBOSS_HOME -unset RUN_CONF -unset JAVAC_JAR -unset JBOSS_CLASSPATH - -# ---------------------------------------------------------------------- -# Dumps a message iff debug mode is enabled -# ---------------------------------------------------------------------- - -debug_msg () -{ - # if debug variable is set, it is assumed to be on, unless its value is false - if [ "x$RHQ_SERVER_DEBUG" != "x" ]; then - if [ "$RHQ_SERVER_DEBUG" != "false" ]; then - echo $1 - fi - fi -} - - -# ---------------------------------------------------------------------- -# Determine what specific platform we are running on. -# Set some platform-specific variables. -# ---------------------------------------------------------------------- - -case "`uname`" in - CYGWIN*) _CYGWIN=true - ;; - Darwin*) _DARWIN=true - ;; - SunOS*) _SOLARIS=true - ;; - AIX*) _AIX=true - ;; -esac - -# ---------------------------------------------------------------------- -# Determine the RHQ Server installation directory. -# If RHQ_SERVER_HOME is not defined, we will assume we are running -# directly from the server installation's bin directory. -# ---------------------------------------------------------------------- - -if [ -z "$RHQ_SERVER_HOME" ]; then - _DOLLARZERO=`readlink "$0" 2>/dev/null || echo "$0"` - RHQ_SERVER_HOME=`dirname "$_DOLLARZERO"`/.. -else - if [ ! -d "$RHQ_SERVER_HOME" ]; then - echo "ERROR! RHQ_SERVER_HOME is not pointing to a valid directory" - echo "RHQ_SERVER_HOME: $RHQ_SERVER_HOME" - exit 1 - fi -fi - -cd "$RHQ_SERVER_HOME" -RHQ_SERVER_HOME=`pwd` - -debug_msg "RHQ_SERVER_HOME: $RHQ_SERVER_HOME" - -if [ ! -f "${RHQ_SERVER_HOME}/jbossas/jboss-modules.jar" ]; then - echo "ERROR! RHQ_SERVER_HOME is not pointing to a valid RHQ Server" - echo "Missing ${RHQ_SERVER_HOME}/jbossas/jboss-modules.jar" - exit 1 -fi - -# ---------------------------------------------------------------------- -# if we are on a Mac and JAVA_HOME is not set, then set it to /usr -# as this is the default location. -# ---------------------------------------------------------------------- -if [ -z "$JAVA_HOME" ]; then - if [ -n "$_DARWIN" ]; then - debug_msg "Running on Mac OS X, setting JAVA_HOME to /usr" - JAVA_HOME=/usr - fi -fi - - -# ---------------------------------------------------------------------- -# Find the Java executable and verify we have a VM available -# ---------------------------------------------------------------------- - -if [ -z "$RHQ_SERVER_JAVA_EXE_FILE_PATH" ]; then - if [ -z "$RHQ_SERVER_JAVA_HOME" ]; then - RHQ_SERVER_JAVA_HOME="${RHQ_SERVER_HOME}/jre" - debug_msg "Using the embedded JRE" - if [ ! -d "$RHQ_SERVER_JAVA_HOME" ]; then - debug_msg "No embedded JRE found - will try to use JAVA_HOME: $JAVA_HOME" - RHQ_SERVER_JAVA_HOME="$JAVA_HOME" - fi - fi - debug_msg "RHQ_SERVER_JAVA_HOME: $RHQ_SERVER_JAVA_HOME" - RHQ_SERVER_JAVA_EXE_FILE_PATH="${RHQ_SERVER_JAVA_HOME}/bin/java" -fi -debug_msg "RHQ_SERVER_JAVA_EXE_FILE_PATH: $RHQ_SERVER_JAVA_EXE_FILE_PATH" - -if [ ! -f "$RHQ_SERVER_JAVA_EXE_FILE_PATH" ]; then - echo "There is no JVM available." - echo "Please set RHQ_SERVER_JAVA_HOME or RHQ_SERVER_JAVA_EXE_FILE_PATH appropriately." - exit 1 -fi - -# run.sh will use JAVA as the full java command -JAVA="$RHQ_SERVER_JAVA_EXE_FILE_PATH" -export JAVA - -if [ $# -eq 0 ] -then - echo "Usage generate-db-password <password>" - exit 1 -fi - -_JB_DIR=${RHQ_SERVER_HOME}/jbossas -$JAVA -cp ${_JB_DIR}/modules/org/picketbox/main/picketbox-4.0.7.Final.jar:${_JB_DIR}/modules/org/jboss/logging/main/jboss-logging-3.1.0.GA.jar org.picketbox.datasource.security.SecureIdentityLoginModule $* diff --git a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml index 1e02470..a9454a5 100644 --- a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml +++ b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml @@ -345,8 +345,8 @@ # If you are using Oracle, comment out the Postgres settings and # uncomment the Oracle settings below, adjusting the values as appropriate. # NOTE: rhq.server.database.password is not to be set to the actual password -# but should instead be that actual password in encrypted form as generated -# by the generate-db-password.sh(.bat) script. +# but instead should be that actual password in encoded form as generated +# by the "rhq-installer.sh(.bat) --dbpassword=<your password>". #############################################################################
# PostgreSQL database diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java index 8f9e477..9f7b619 100644 --- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java +++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java @@ -46,7 +46,7 @@ public class Installer { private InstallerConfiguration installerConfig;
private enum WhatToDo { - DISPLAY_USAGE, TEST, LIST_SERVERS, INSTALL + DISPLAY_USAGE, DO_NOTHING, TEST, LIST_SERVERS, INSTALL }
public static void main(String[] args) { @@ -111,6 +111,9 @@ public class Installer { } continue; } + case DO_NOTHING: { + continue; // this will occur if processArguments() already did the work + } default: { throw new IllegalStateException("Please report this bug: " + whatToDo); } @@ -128,19 +131,23 @@ public class Installer { usage.append("\t--port=<port>, -p: talk to the app server over this management port").append("\n"); usage.append("\t--test, -t: test the validity of the server properties (install not performed)").append("\n"); usage.append("\t--listservers, -l: show list of known installed servers (install not performed)").append("\n"); + usage.append("\t--dbpassword, -d: encodes a DB password for rhq-server.properties (install not performed)") + .append("\n"); LOG.info(usage); }
private WhatToDo[] processArguments(String[] args) throws Exception { - String sopts = "-:HD:h:p:lt"; + String sopts = "-:HD:h:p:d:lt"; LongOpt[] lopts = { new LongOpt("help", LongOpt.NO_ARGUMENT, null, 'H'), new LongOpt("host", LongOpt.REQUIRED_ARGUMENT, null, 'h'), new LongOpt("port", LongOpt.REQUIRED_ARGUMENT, null, 'p'), + new LongOpt("dbpassword", LongOpt.REQUIRED_ARGUMENT, null, 'd'), new LongOpt("listservers", LongOpt.NO_ARGUMENT, null, 'l'), new LongOpt("test", LongOpt.NO_ARGUMENT, null, 't') };
boolean test = false; boolean listservers = false; + String dbpassword = null;
Getopt getopt = new Getopt("installer", args, sopts, lopts); int code; @@ -202,6 +209,14 @@ public class Installer { break; }
+ case 'd': { + dbpassword = getopt.getOptarg(); + if (dbpassword == null) { + throw new IllegalArgumentException("Missing password"); + } + break; + } + case 'l': { listservers = true; break; // don't return, we need to allow more args to be processed, like -p or -h @@ -214,6 +229,13 @@ public class Installer { } }
+ // if a password was asked to be obfuscated, that's all we are to do + if (dbpassword != null) { + String pw = new InstallerServiceImpl(installerConfig).obfuscatePassword(dbpassword); + LOG.info("*** Encoded Password: " + pw); + return new WhatToDo[] { WhatToDo.DO_NOTHING }; + } + if (test || listservers) { ArrayList<WhatToDo> whatToDo = new ArrayList<WhatToDo>(); if (test) { diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerService.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerService.java index c27e67a..d597d29 100644 --- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerService.java +++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerService.java @@ -27,6 +27,23 @@ import java.util.HashMap; public interface InstallerService {
/** + * Given a database password, this will obfuscate it. The obfuscated password + * should be used within rhq-server.properties. + * + * @param clearTextPassword the password to obfuscate + * @return the obfuscated password + * @throws Exception + */ + String obfuscatePassword(String clearTextPassword) throws Exception; + + /** + * This simply logs a list of all known registered servers found in the database. + * + * @throws Exception + */ + void listServers() throws Exception; + + /** * This simply verifies the server configuration but doesn't perform the actual install. * You can use this to see if, for example, the database settings are correct or the installer * can successfully connect to the running AS instance where RHQ is to be installed. @@ -38,13 +55,6 @@ public interface InstallerService { void test() throws AutoInstallDisabledException, AlreadyInstalledException, Exception;
/** - * This simply logs a list of all known registered servers found in the database. - * - * @throws Exception - */ - void listServers() throws Exception; - - /** * Call this prior to installing to see if we are ready to install. * This will do some pre-install checks - if the installation should proceed, the map of server properties is returned. * Exceptions are thrown if the install should not proceed. diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java index 5986b06..5b42094 100644 --- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java +++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java @@ -66,6 +66,12 @@ public class InstallerServiceImpl implements InstallerService { }
@Override + public String obfuscatePassword(String clearTextPassword) throws Exception { + String obfuscatedPassword = ServerInstallUtil.obfuscatePassword(clearTextPassword); + return obfuscatedPassword; + } + + @Override public void listServers() throws Exception { HashMap<String, String> serverProperties = getServerProperties(); final String dbUrl = serverProperties.get(ServerProperties.PROP_DATABASE_CONNECTION_URL);
commit b559048d07d3846f9bab4d9f42094b852bd89afe Author: John Mazzitelli mazz@redhat.com Date: Wed Dec 5 15:02:53 2012 -0500
ocd kicking in
diff --git a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml index 091f0bb..1e02470 100644 --- a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml +++ b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml @@ -335,8 +335,7 @@
<property name="rhq.bin.dir" location="${project.build.outputDirectory}/bin" /> <mkdir dir="${rhq.bin.dir}" /> - <echo file="${rhq.bin.dir}/rhq-server.properties"> -#################### RHQ Server Configuration Properties #################### + <echo file="${rhq.bin.dir}/rhq-server.properties">#################### RHQ Server Configuration Properties ####################
############################################################################# # Database Settings
commit 1dfef21b0ea509320c024a25a69579f2b4175086 Author: John Mazzitelli mazz@redhat.com Date: Wed Dec 5 14:57:22 2012 -0500
more rhq-server.properties stuff
diff --git a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml index 0d306d9..091f0bb 100644 --- a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml +++ b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml @@ -335,13 +335,20 @@
<property name="rhq.bin.dir" location="${project.build.outputDirectory}/bin" /> <mkdir dir="${rhq.bin.dir}" /> - <echo file="${rhq.bin.dir}/rhq-server.properties">### RHQ Server Configuration Properties + <echo file="${rhq.bin.dir}/rhq-server.properties"> +#################### RHQ Server Configuration Properties ####################
-## Database Settings +############################################################################# +# Database Settings +# ----------------- # These should point to the database that your RHQ Server will use as # its backend RDBMS storage. # If you are using Oracle, comment out the Postgres settings and # uncomment the Oracle settings below, adjusting the values as appropriate. +# NOTE: rhq.server.database.password is not to be set to the actual password +# but should instead be that actual password in encrypted form as generated +# by the generate-db-password.sh(.bat) script. +#############################################################################
# PostgreSQL database rhq.server.database.connection-url=${rhq.server.database.connection-url} @@ -365,10 +372,13 @@ rhq.server.quartz.driverDelegateClass=${rhq.server.quartz.driverDelegateClass} #hibernate.dialect=org.hibernate.dialect.Oracle10gDialect #rhq.server.quartz.driverDelegateClass=org.quartz.impl.jdbcjobstore.oracle.OracleDelegate
-## Server Settings +############################################################################# +# Server Settings +# --------------- # These are miscallenous settings that the server will use to customize itself # to the environment in which it is running. These are settings you usually # want to change or at least be aware of. +#############################################################################
# Defines what this server's name is to be known as to the RHQ system. # It doesn't necessarily have to be an IP address or hostname, but it can be. @@ -383,13 +393,16 @@ rhq.server.email.smtp-host=localhost rhq.server.email.smtp-port=25 rhq.server.email.from-address=rhqadmin@localhost
-## Host and Port Bindings +############################################################################# +# Host and Port Bindings +# ---------------------- # These define the ports the RHQ Server will bind to. Most of the time # you can leave these alone. You can change these default values to # conform to your own environment's requirements, such as the IP address # the RHQ Server will bind to (jboss.bind.address) and the ports # browsers will use to access the RHQ web application # (rhq.server.socket.binding.port.http, rhq.server.socket.binding.port.https) +#############################################################################
jboss.bind.address=0.0.0.0 jboss.bind.address.management=127.0.0.1 @@ -417,7 +430,9 @@ rhq.server.socket.binding.port.txn-status-manager=3713 # value - setting it to ${jboss.bind.address} will *not* work. #java.rmi.server.hostname=0.0.0.0
-## Installer Settings +############################################################################# +# Installer Settings +# ------------------ # These enable the installer when starting for the first time. # To do so, first ensure all values in this properties file are appropriately # set for your environment. Once you are sure all values are as you want them, @@ -437,15 +452,18 @@ rhq.server.socket.binding.port.txn-status-manager=3713 # will use to talk to this server. # If not set, a value to use is # determined at auto-install time. +#############################################################################
rhq.autoinstall.enabled=${rhq.autoinstall.enabled} rhq.autoinstall.database=auto rhq.autoinstall.public-endpoint-address=
-## Miscellaneous Settings -# The settings below can usually be left as-is. -# These are advanced settings and should only be changed if you know -# what you are doing. +############################################################################# +# Advanced Settings +# ----------------- +# The settings below can usually be left as-is. These are advanced settings +# and should only be changed if you know what you are doing. +#############################################################################
# Set this to true to have the server reject agent requests upon startup. rhq.server.maintenance-mode-at-startup=false
commit d8bd28bc66184c79125ff5f5da7eb5a5fef0bbe2 Author: John Mazzitelli mazz@redhat.com Date: Wed Dec 5 14:32:17 2012 -0500
re-arrange rhq-server.properties to provide example oracle settings and move the settings more likely to be changed towards the top
diff --git a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml index d0b86f9..0d306d9 100644 --- a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml +++ b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml @@ -337,7 +337,13 @@ <mkdir dir="${rhq.bin.dir}" /> <echo file="${rhq.bin.dir}/rhq-server.properties">### RHQ Server Configuration Properties
-# Database +## Database Settings +# These should point to the database that your RHQ Server will use as +# its backend RDBMS storage. +# If you are using Oracle, comment out the Postgres settings and +# uncomment the Oracle settings below, adjusting the values as appropriate. + +# PostgreSQL database rhq.server.database.connection-url=${rhq.server.database.connection-url} rhq.server.database.user-name=${rhq.server.database.user-name} rhq.server.database.password=${rhq.server.database.password} @@ -346,13 +352,45 @@ rhq.server.database.server-name=${rhq.server.database.server-name} rhq.server.database.port=${rhq.server.database.port} rhq.server.database.db-name=${rhq.server.database.db-name} hibernate.dialect=${rhq.server.database.hibernate-dialect} - -# Quartz rhq.server.quartz.driverDelegateClass=${rhq.server.quartz.driverDelegateClass} -rhq.server.quartz.selectWithLockSQL=${rhq.server.quartz.selectWithLockSQL} -rhq.server.quartz.lockHandlerClass=${rhq.server.quartz.lockHandlerClass}
-# Host and Port Bindings +# Oracle database +#rhq.server.database.connection-url=jdbc:oracle:thin:@127.0.0.1:1521:xe +#rhq.server.database.user-name=${rhq.server.database.user-name} +#rhq.server.database.password=${rhq.server.database.password} +#rhq.server.database.type-mapping=Oracle10g +#rhq.server.database.server-name=unused +#rhq.server.database.port=unused +#rhq.server.database.db-name=unused +#hibernate.dialect=org.hibernate.dialect.Oracle10gDialect +#rhq.server.quartz.driverDelegateClass=org.quartz.impl.jdbcjobstore.oracle.OracleDelegate + +## Server Settings +# These are miscallenous settings that the server will use to customize itself +# to the environment in which it is running. These are settings you usually +# want to change or at least be aware of. + +# Defines what this server's name is to be known as to the RHQ system. +# It doesn't necessarily have to be an IP address or hostname, but it can be. +# If left blank, the RHQ Server will pick a name for itself based on the +# hostname it is running on. +# NOTE! If you are upgrading an existing server, this must be the same name +# as the server being upgraded. +rhq.server.high-availability.name= + +# Email settings used to connect to an SMTP server to send alert emails. +rhq.server.email.smtp-host=localhost +rhq.server.email.smtp-port=25 +rhq.server.email.from-address=rhqadmin@localhost + +## Host and Port Bindings +# These define the ports the RHQ Server will bind to. Most of the time +# you can leave these alone. You can change these default values to +# conform to your own environment's requirements, such as the IP address +# the RHQ Server will bind to (jboss.bind.address) and the ports +# browsers will use to access the RHQ web application +# (rhq.server.socket.binding.port.http, rhq.server.socket.binding.port.https) + jboss.bind.address=0.0.0.0 jboss.bind.address.management=127.0.0.1
@@ -374,19 +412,48 @@ rhq.server.socket.binding.port.remoting=3447 rhq.server.socket.binding.port.txn-recovery-environment=3712 rhq.server.socket.binding.port.txn-status-manager=3713
-# ********************************** NOTE ************************************ # If the jboss.bind.address property is set to anything besides 0.0.0.0, # uncomment the java.rmi.server.hostname property below and set it to the same # value - setting it to ${jboss.bind.address} will *not* work. #java.rmi.server.hostname=0.0.0.0
-# High Availability (HA) -rhq.server.high-availability.name= +## Installer Settings +# These enable the installer when starting for the first time. +# To do so, first ensure all values in this properties file are appropriately +# set for your environment. Once you are sure all values are as you want them, +# set rhq.autoinstall.enabled=true and run the server then run the installer. +# +# rhq.autoinstall.enabled: must be true to trigger the automatic install. +# rhq.autoinstall.database: allowed values: auto, overwrite, skip +# "auto" will create a new schema if one does not +# yet exist or, if a schema does exist, will simply +# upgrade it as needed (which keeps existing data). +# "overwrite" if you want to create an empty schema, +# even if one already exists (loses existing data). +# "skip" if you don't want to do any database +# upgrade or creation. WARNING! You must ensure your +# database schema already exists and is up to date. +# rhq.autoinstall.public-endpoint-address: public IP/hostname that all agents +# will use to talk to this server. +# If not set, a value to use is +# determined at auto-install time. + +rhq.autoinstall.enabled=${rhq.autoinstall.enabled} +rhq.autoinstall.database=auto +rhq.autoinstall.public-endpoint-address= + +## Miscellaneous Settings +# The settings below can usually be left as-is. +# These are advanced settings and should only be changed if you know +# what you are doing. + +# Set this to true to have the server reject agent requests upon startup. rhq.server.maintenance-mode-at-startup=false
# RHQ Server's remote endpoint for agents to talk to # bind-address and bind-port are derived from the HA server definition, -# if you set the address/port here, they will override the HA server definition found in the database +# if you set the address/port here, they will override the HA server +# definition found in the database rhq.communications.connector.transport=servlet rhq.communications.connector.bind-address= rhq.communications.connector.bind-port= @@ -399,7 +466,8 @@ rhq.communications.multicast-detector.multicast-address=224.16.16.16 rhq.communications.multicast-detector.port=16162
# Server-side SSL Security Configuration for HTTPS thru Tomcat -# These are used for browser https: access and for incoming messages from agents over sslservlet transport +# These are used for browser https access and +# for incoming messages from agents over sslservlet transport # [you cannot use ${x} variables - see https://jira.jboss.org/jira/browse/JBWEB-74] rhq.server.tomcat.security.client-auth-mode=want rhq.server.tomcat.security.secure-socket-protocol=TLS @@ -441,15 +509,14 @@ rhq.server.client.security.truststore.type=JKS rhq.server.client.security.truststore.password=RHQManagement rhq.server.client.security.server-auth-mode-enabled=false
-# Email -rhq.server.email.smtp-host=localhost -rhq.server.email.smtp-port=25 -rhq.server.email.from-address=rhqadmin@localhost - # Operations/controls timeout # Defines the default timeout for all operations (specified in seconds) rhq.server.operation-timeout=600
+# Additional Quartz settings +rhq.server.quartz.selectWithLockSQL=${rhq.server.quartz.selectWithLockSQL} +rhq.server.quartz.lockHandlerClass=${rhq.server.quartz.lockHandlerClass} + # Concurrency limits for incoming UI and agent messages rhq.server.startup.web.max-connections=200 rhq.server.agent-downloads-limit=45 @@ -485,30 +552,6 @@ rhq.sync.endpoint-address=false # files that are not known binary types. # rhq.server.drift.store-binary-content=${rhq.server.drift.store-binary-content}
-# Auto-Install Setup -# You normally want to install automatically when starting for the first time. -# To do so, first ensure all values in this properties file are appropriately -# set for your environment. Once you are sure all values are as you want them, -# set rhq.autoinstall.enabled=true and run the server. -# -# rhq.autoinstall.enabled: must be true to trigger the automatic install. -# rhq.autoinstall.database: allowed values: auto, overwrite, skip -# "auto" will create a new schema if one does not -# yet exist or, if a schema does exist, will simply -# upgrade it as needed (which keeps existing data). -# "overwrite" if you want to create an empty schema, -# even if one already exists (loses existing data). -# "skip" if you don't want to do any database -# upgrade or creation. WARNING! You must ensure your -# database schema already exists and is up to date. -# rhq.autoinstall.public-endpoint-address: public IP/hostname that all agents -# will use to talk to this server. -# If not set, a value to use is -# determined at auto-install time. -rhq.autoinstall.enabled=${rhq.autoinstall.enabled} -rhq.autoinstall.database=auto -rhq.autoinstall.public-endpoint-address= - </echo>
</target>
commit 8af3decc66297d04ba3e78f84e63223f41d44210 Author: John Mazzitelli mazz@redhat.com Date: Wed Dec 5 13:47:09 2012 -0500
abort on unknown option
diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java index a65bdad..8f9e477 100644 --- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java +++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java @@ -155,9 +155,8 @@ public class Installer { }
case 1: { - // this will catch non-option arguments (which we don't currently care about) - LOG.warn("Unknown option" + getopt.getOptarg()); - break; + // this will catch non-option arguments (which we don't currently support) + throw new IllegalArgumentException("Unknown option: " + getopt.getOptarg()); }
case 'H': {
commit 1f8e40beccf15e7f0e69a704f1ad9bcbb363300a Author: John Mazzitelli mazz@redhat.com Date: Wed Dec 5 13:40:44 2012 -0500
change option name
diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java index 4f52849..a65bdad 100644 --- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java +++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java @@ -127,16 +127,16 @@ public class Installer { usage.append("\t--host=<hostname>, -h: hostname where the app server is running").append("\n"); usage.append("\t--port=<port>, -p: talk to the app server over this management port").append("\n"); usage.append("\t--test, -t: test the validity of the server properties (install not performed)").append("\n"); - usage.append("\t--servers, -s: show list of known installed servers (install not performed)").append("\n"); + usage.append("\t--listservers, -l: show list of known installed servers (install not performed)").append("\n"); LOG.info(usage); }
private WhatToDo[] processArguments(String[] args) throws Exception { - String sopts = "-:HD:h:p:st"; + String sopts = "-:HD:h:p:lt"; LongOpt[] lopts = { new LongOpt("help", LongOpt.NO_ARGUMENT, null, 'H'), new LongOpt("host", LongOpt.REQUIRED_ARGUMENT, null, 'h'), new LongOpt("port", LongOpt.REQUIRED_ARGUMENT, null, 'p'), - new LongOpt("servers", LongOpt.NO_ARGUMENT, null, 's'), + new LongOpt("listservers", LongOpt.NO_ARGUMENT, null, 'l'), new LongOpt("test", LongOpt.NO_ARGUMENT, null, 't') };
boolean test = false; @@ -203,7 +203,7 @@ public class Installer { break; }
- case 's': { + case 'l': { listservers = true; break; // don't return, we need to allow more args to be processed, like -p or -h }
commit df552406d7bbdfb8382274a0d0d4a208c67cb28f Author: John Mazzitelli mazz@redhat.com Date: Wed Dec 5 12:52:07 2012 -0500
fix npe
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/plugin/PluginDeploymentScanner.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/plugin/PluginDeploymentScanner.java index 688359c..202459a 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/plugin/PluginDeploymentScanner.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/plugin/PluginDeploymentScanner.java @@ -80,6 +80,9 @@ public class PluginDeploymentScanner implements PluginDeploymentScannerMBean { //public File getUserPluginDir() { public String getUserPluginDir() { //return this.userPluginDir; + if (this.userPluginDir == null) { + return null; + } return this.userPluginDir.getAbsolutePath(); }
@@ -95,7 +98,11 @@ public class PluginDeploymentScanner implements PluginDeploymentScannerMBean { //public File getServerPluginDir() { public String getServerPluginDir() { //return this.serverPluginScanner.getServerPluginDir(); - return this.serverPluginScanner.getServerPluginDir().getAbsolutePath(); + File dir = this.serverPluginScanner.getServerPluginDir(); + if (dir == null) { + return null; + } + return dir.getAbsolutePath(); }
//public void setServerPluginDir(File dir) { @@ -110,7 +117,11 @@ public class PluginDeploymentScanner implements PluginDeploymentScannerMBean { //public File getAgentPluginDir() { public String getAgentPluginDir() { //return this.agentPluginScanner.getAgentPluginDeployer().getPluginDir(); - return this.agentPluginScanner.getAgentPluginDeployer().getPluginDir().getAbsolutePath(); + File dir = this.agentPluginScanner.getAgentPluginDeployer().getPluginDir(); + if (dir == null) { + return null; + } + return dir.getAbsolutePath(); }
//public void setAgentPluginDir(File dir) {
commit c4b7d4b5ca5d1d2e68a066adcc77fc15d85010e7 Author: John Mazzitelli mazz@redhat.com Date: Wed Dec 5 12:47:48 2012 -0500
installer supports --servers to list all register servers and their details
diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java index 50430de..4f52849 100644 --- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java +++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java @@ -21,6 +21,7 @@ package org.rhq.enterprise.server.installer; import gnu.getopt.Getopt; import gnu.getopt.LongOpt;
+import java.util.ArrayList; import java.util.HashMap;
import org.apache.commons.logging.Log; @@ -44,6 +45,10 @@ public class Installer {
private InstallerConfiguration installerConfig;
+ private enum WhatToDo { + DISPLAY_USAGE, TEST, LIST_SERVERS, INSTALL + } + public static void main(String[] args) { try { LOG.info("Starting installer..."); @@ -67,35 +72,49 @@ public class Installer {
public void doInstall(String[] args) throws Exception {
- try { - processArguments(args); - } catch (DisplayUsageRequestedException dure) { - displayUsage(); - return; - } catch (TestRequestedException vre) { - try { - new InstallerServiceImpl(installerConfig).test(); - } catch (AutoInstallDisabledException e) { - LOG.error(e.getMessage()); - System.exit(EXIT_CODE_AUTOINSTALL_DISABLED); - } catch (AlreadyInstalledException e) { - LOG.info(e.getMessage()); - System.exit(EXIT_CODE_ALREADY_INSTALLED); - } - return; - } + WhatToDo[] thingsToDo = processArguments(args);
- try { - final InstallerService installerService = new InstallerServiceImpl(installerConfig); - final HashMap<String, String> serverProperties = installerService.preInstall(); - installerService.install(serverProperties, null, null); - LOG.info("Installation is complete. The server should be ready shortly."); - } catch (AutoInstallDisabledException e) { - LOG.error(e.getMessage()); - System.exit(EXIT_CODE_AUTOINSTALL_DISABLED); - } catch (AlreadyInstalledException e) { - LOG.info(e.getMessage()); - System.exit(EXIT_CODE_ALREADY_INSTALLED); + for (WhatToDo whatToDo : thingsToDo) { + switch (whatToDo) { + case DISPLAY_USAGE: { + displayUsage(); + continue; + } + case LIST_SERVERS: { + new InstallerServiceImpl(installerConfig).listServers(); + continue; + } + case TEST: { + try { + new InstallerServiceImpl(installerConfig).test(); + } catch (AutoInstallDisabledException e) { + LOG.error(e.getMessage()); + System.exit(EXIT_CODE_AUTOINSTALL_DISABLED); + } catch (AlreadyInstalledException e) { + LOG.info(e.getMessage()); + System.exit(EXIT_CODE_ALREADY_INSTALLED); + } + continue; + } + case INSTALL: { + try { + final InstallerService installerService = new InstallerServiceImpl(installerConfig); + final HashMap<String, String> serverProperties = installerService.preInstall(); + installerService.install(serverProperties, null, null); + LOG.info("Installation is complete. The server should be ready shortly."); + } catch (AutoInstallDisabledException e) { + LOG.error(e.getMessage()); + System.exit(EXIT_CODE_AUTOINSTALL_DISABLED); + } catch (AlreadyInstalledException e) { + LOG.info(e.getMessage()); + System.exit(EXIT_CODE_ALREADY_INSTALLED); + } + continue; + } + default: { + throw new IllegalStateException("Please report this bug: " + whatToDo); + } + } }
return; @@ -108,17 +127,20 @@ public class Installer { usage.append("\t--host=<hostname>, -h: hostname where the app server is running").append("\n"); usage.append("\t--port=<port>, -p: talk to the app server over this management port").append("\n"); usage.append("\t--test, -t: test the validity of the server properties (install not performed)").append("\n"); + usage.append("\t--servers, -s: show list of known installed servers (install not performed)").append("\n"); LOG.info(usage); }
- private void processArguments(String[] args) throws Exception { - String sopts = "-:HD:h:p:t"; + private WhatToDo[] processArguments(String[] args) throws Exception { + String sopts = "-:HD:h:p:st"; LongOpt[] lopts = { new LongOpt("help", LongOpt.NO_ARGUMENT, null, 'H'), new LongOpt("host", LongOpt.REQUIRED_ARGUMENT, null, 'h'), new LongOpt("port", LongOpt.REQUIRED_ARGUMENT, null, 'p'), + new LongOpt("servers", LongOpt.NO_ARGUMENT, null, 's'), new LongOpt("test", LongOpt.NO_ARGUMENT, null, 't') };
boolean test = false; + boolean listservers = false;
Getopt getopt = new Getopt("installer", args, sopts, lopts); int code; @@ -139,7 +161,7 @@ public class Installer { }
case 'H': { - throw new DisplayUsageRequestedException(); + return new WhatToDo[] { WhatToDo.DISPLAY_USAGE }; }
case 'D': { @@ -181,25 +203,29 @@ public class Installer { break; }
+ case 's': { + listservers = true; + break; // don't return, we need to allow more args to be processed, like -p or -h + } + case 't': { test = true; - break; + break; // don't return, we need to allow more args to be processed, like -p or -h } } }
- if (test) { - throw new TestRequestedException(); + if (test || listservers) { + ArrayList<WhatToDo> whatToDo = new ArrayList<WhatToDo>(); + if (test) { + whatToDo.add(WhatToDo.TEST); + } + if (listservers) { + whatToDo.add(WhatToDo.LIST_SERVERS); + } + return whatToDo.toArray(new WhatToDo[whatToDo.size()]); }
- return; - } - - private class DisplayUsageRequestedException extends Exception { - private static final long serialVersionUID = 1L; - } - - private class TestRequestedException extends Exception { - private static final long serialVersionUID = 1L; + return new WhatToDo[] { WhatToDo.INSTALL }; } } diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerService.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerService.java index b192c51..c27e67a 100644 --- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerService.java +++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerService.java @@ -38,6 +38,13 @@ public interface InstallerService { void test() throws AutoInstallDisabledException, AlreadyInstalledException, Exception;
/** + * This simply logs a list of all known registered servers found in the database. + * + * @throws Exception + */ + void listServers() throws Exception; + + /** * Call this prior to installing to see if we are ready to install. * This will do some pre-install checks - if the installation should proceed, the map of server properties is returned. * Exceptions are thrown if the install should not proceed. @@ -95,6 +102,18 @@ public interface InstallerService { ArrayList<String> getServerNames(String connectionUrl, String username, String password) throws Exception;
/** + * Returns details on all servers that are registered in the database. + * + * @param connectionUrl + * @param username + * @param password + * @return the details of all known servers + * @throws Exception + */ + ArrayList<ServerDetails> getAllServerDetails(String connectionUrl, String username, String password) + throws Exception; + + /** * Returns details on a specific server that is registered in the database. * * @param connectionUrl diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java index f9e12d3..5986b06 100644 --- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java +++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java @@ -66,6 +66,45 @@ public class InstallerServiceImpl implements InstallerService { }
@Override + public void listServers() throws Exception { + HashMap<String, String> serverProperties = getServerProperties(); + final String dbUrl = serverProperties.get(ServerProperties.PROP_DATABASE_CONNECTION_URL); + final String dbUsername = serverProperties.get(ServerProperties.PROP_DATABASE_USERNAME); + String obfuscatedDbPassword = serverProperties.get(ServerProperties.PROP_DATABASE_PASSWORD); + String clearTextDbPassword = ServerInstallUtil.deobfuscatePassword(obfuscatedDbPassword); + ArrayList<ServerDetails> allServerDetails = getAllServerDetails(dbUrl, dbUsername, clearTextDbPassword); + if (allServerDetails == null) { + log.warn("Cannot get details on all servers"); + return; + } + if (allServerDetails.size() == 0) { + log.info("There are no known servers currently registered"); + return; + } + + StringBuilder info = new StringBuilder("Details on currently registered servers"); + info.append("\n"); + info.append("Server Name"); + info.append("\t"); + info.append("Public Endpoint Address"); + info.append("\t"); + info.append("Secure Port"); + info.append("\n"); + for (ServerDetails serverDetails : allServerDetails) { + info.append(serverDetails.getName()); + info.append("\t"); + info.append(serverDetails.getEndpointAddress()); + info.append("\t"); + info.append(serverDetails.getEndpointPortString()); + info.append("\t"); + info.append(serverDetails.getEndpointSecurePortString()); + info.append("\n"); + } + log.info(info.toString()); + return; + } + + @Override public void test() throws AutoInstallDisabledException, AlreadyInstalledException, Exception { // checks to make sure we can read rhq-server.properties and auto-install is turned on // checks to make sure we aren't already installed @@ -78,7 +117,7 @@ public class InstallerServiceImpl implements InstallerService { // checks to make sure we can connect to the DB final String dbUrl = serverProperties.get(ServerProperties.PROP_DATABASE_CONNECTION_URL); final String dbUsername = serverProperties.get(ServerProperties.PROP_DATABASE_USERNAME); - String obfuscatedDbPassword = serverProperties.get(ServerProperties.PROP_DATABASE_PASSWORD); + final String obfuscatedDbPassword = serverProperties.get(ServerProperties.PROP_DATABASE_PASSWORD); String clearTextDbPassword = ServerInstallUtil.deobfuscatePassword(obfuscatedDbPassword); String dbErrorStr = testConnection(dbUrl, dbUsername, clearTextDbPassword); if (dbErrorStr != null) { @@ -376,6 +415,25 @@ public class InstallerServiceImpl implements InstallerService { }
@Override + public ArrayList<ServerDetails> getAllServerDetails(String connectionUrl, String username, String password) { + ArrayList<String> serverNames = getServerNames(connectionUrl, username, password); + if (serverNames == null) { + return null; + } + + ArrayList<ServerDetails> serverDetails = new ArrayList<ServerDetails>(serverNames.size()); + for (String serverName : serverNames) { + ServerDetails currentDetails = getServerDetails(connectionUrl, username, password, serverName); + if (currentDetails == null) { + return null; // just abort - this error should not occur unless the db has problems + } + serverDetails.add(currentDetails); + } + + return serverDetails; + } + + @Override public ServerDetails getServerDetails(String connectionUrl, String username, String password, String serverName) { try { final ServerDetails sd = ServerInstallUtil.getServerDetails(connectionUrl, username, password, serverName);
commit a0f1b80e920e769d6ea1d00b1104fd697650d7c4 Author: Lukas Krejci lkrejci@redhat.com Date: Wed Dec 5 17:58:41 2012 +0100
This reverts commit 2de428af239ee6b4af0af2a439e7e27f65755acb.
That commit was not ready for submission to the repo. Sorry about that...
diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/StandardScriptPermissions.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/StandardScriptPermissions.java index 3a7d046..5822d44 100644 --- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/StandardScriptPermissions.java +++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/StandardScriptPermissions.java @@ -23,19 +23,14 @@ import java.io.FilePermission; import java.io.SerializablePermission; import java.lang.reflect.ReflectPermission; import java.net.SocketPermission; -import java.security.CodeSource; import java.security.Permission; import java.security.PermissionCollection; import java.security.Permissions; -import java.security.ProtectionDomain; -import java.security.cert.Certificate; import java.util.Enumeration; import java.util.PropertyPermission; -import java.util.logging.LoggingPermission;
import javax.management.MBeanPermission; import javax.management.ObjectName; -import javax.security.auth.PrivateCredentialPermission;
/** * @author Lukas Krejci @@ -63,11 +58,13 @@ public class StandardScriptPermissions extends PermissionCollection { //JVM defined runtime perms add(new RuntimePermission("createClassLoader")); add(new RuntimePermission("getClassLoader")); + add(new RuntimePermission("setContextClassLoader")); add(new RuntimePermission("getenv.*")); add(new RuntimePermission("getProtectionDomain")); add(new RuntimePermission("getFileSystemAttributes")); add(new RuntimePermission("readFileDescriptor")); add(new RuntimePermission("writeFileDescriptor")); + add(new RuntimePermission("loadLibrary.*")); add(new RuntimePermission("accessClassInPackage.*")); add(new RuntimePermission("defineClassInPackage.*")); add(new RuntimePermission("accessDeclaredMembers")); @@ -88,18 +85,10 @@ public class StandardScriptPermissions extends PermissionCollection {
add(new ReflectPermission("suppressAccessChecks"));
- //these are required for server-side scripts to be able to + //these 2 are required for server-side scripts to be able to //invoke remote EJBs. - add(new SerializablePermission("creator")); - add(new SerializablePermission("allowSerializationReflection")); add(new SerializablePermission("enableSubclassImplementation")); - add(new RuntimePermission("reflectionFactoryAccess")); - - //by default allow the scripts access to any credentials of any user - //we don't consider the scripts malevolent. - add(new PrivateCredentialPermission("* * "*"", "read")); - - add(new LoggingPermission("control", null)); + add(new RuntimePermission("reflectionFactoryAccess")); }
public void add(Permission permission) { diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientFactory.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientFactory.java index 3b993a8..74c0019 100644 --- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientFactory.java +++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientFactory.java @@ -9,6 +9,11 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Set;
+import javax.jws.WebParam; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + import javassist.CannotCompileException; import javassist.ClassPool; import javassist.CtClass; @@ -21,11 +26,6 @@ import javassist.bytecode.annotation.StringMemberValue; import javassist.util.proxy.MethodHandler; import javassist.util.proxy.ProxyFactory;
-import javax.jws.WebParam; - -import org.apache.commons.logging.Log; - -import org.rhq.bindings.security.SecurityActions; import org.rhq.bindings.util.ConfigurationClassBuilder; import org.rhq.bindings.util.ResourceTypeFingerprint; import org.rhq.core.domain.resource.ResourceCreationDataType; @@ -42,7 +42,7 @@ public class ResourceClientFactory { public Class<?> iface; }
- private static final Log LOG = SecurityActions.getLog(ResourceClientFactory.class); + private static final Log LOG = LogFactory.getLog(ResourceClientFactory.class);
//keys are resource type ids private static HashMap<Integer, CacheRecord> CUSTOM_CLASS_CACHE = new HashMap<Integer, CacheRecord>(); diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java index 1b71678..7361fe8 100644 --- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java +++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java @@ -32,8 +32,8 @@ import java.util.Set; import javassist.util.proxy.MethodHandler;
import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory;
-import org.rhq.bindings.security.SecurityActions; import org.rhq.bindings.util.ConfigurationClassBuilder; import org.rhq.bindings.util.LazyLoadScenario; import org.rhq.bindings.util.ResourceTypeFingerprint; @@ -84,7 +84,7 @@ import org.rhq.enterprise.server.resource.ResourceTypeNotFoundException; */ public class ResourceClientProxy {
- private static final Log LOG = SecurityActions.getLog(ResourceClientProxy.class); + private static final Log LOG = LogFactory.getLog(ResourceClientProxy.class);
private ResourceClientFactory proxyFactory; private RhqFacade remoteClient; diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java index 4d33fb2..2a1f944 100644 --- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java +++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java @@ -28,10 +28,10 @@ import java.nio.charset.Charset; import java.util.List;
import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory;
import org.rhq.bindings.StandardBindings; import org.rhq.bindings.client.RhqFacade; -import org.rhq.bindings.security.SecurityActions; import org.rhq.core.domain.content.Repo; import org.rhq.core.domain.content.composite.PackageAndLatestVersionComposite; import org.rhq.core.domain.criteria.PackageCriteria; @@ -53,7 +53,7 @@ import org.rhq.enterprise.server.content.RepoManagerRemote; public class RepoScriptSourceProvider extends BaseRhqSchemeScriptSourceProvider implements StandardBindings.RhqFacadeChangeListener {
- private static final Log LOG = SecurityActions.getLog(RepoScriptSourceProvider.class); + private static final Log LOG = LogFactory.getLog(RepoScriptSourceProvider.class);
private static final String AUTHORITY = "repositories";
diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/security/SecurityActions.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/security/SecurityActions.java deleted file mode 100644 index cdde2ff..0000000 --- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/security/SecurityActions.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * RHQ Management Platform - * Copyright 2012, Red Hat Middleware LLC, and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -package org.rhq.bindings.security; - -import java.security.AccessController; -import java.security.PrivilegedAction; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * @author Lukas Krejci - * - */ -public class SecurityActions { - - private SecurityActions() { - - } - - public static Log getLog(final Class<?> cls) { - return AccessController.doPrivileged(new PrivilegedAction<Log>() { - @Override - public Log run() { - return LogFactory.getLog(cls); - }; - }); - } - - public static Log getLog(final String name) { - return AccessController.doPrivileged(new PrivilegedAction<Log>() { - @Override - public Log run() { - return LogFactory.getLog(name); - }; - }); - } -} diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/util/InterfaceSimplifier.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/util/InterfaceSimplifier.java index d2724d1..8ce7bc6 100644 --- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/util/InterfaceSimplifier.java +++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/util/InterfaceSimplifier.java @@ -52,8 +52,8 @@ import javassist.bytecode.annotation.ShortMemberValue; import javassist.bytecode.annotation.StringMemberValue;
import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory;
-import org.rhq.bindings.security.SecurityActions; import org.rhq.core.domain.auth.Subject;
/** @@ -64,7 +64,7 @@ import org.rhq.core.domain.auth.Subject; * @author Lukas Krejci */ public class InterfaceSimplifier { - private static final Log LOG = SecurityActions.getLog(InterfaceSimplifier.class); + private static final Log LOG = LogFactory.getLog(InterfaceSimplifier.class);
private InterfaceSimplifier() {
diff --git a/modules/enterprise/server/container-lib/pom.xml b/modules/enterprise/server/container-lib/pom.xml index 1b02461..05f8bd4 100644 --- a/modules/enterprise/server/container-lib/pom.xml +++ b/modules/enterprise/server/container-lib/pom.xml @@ -9,6 +9,7 @@ <relativePath>../../../../pom.xml</relativePath> </parent>
+ <groupId>org.rhq</groupId> <artifactId>rhq-container-lib</artifactId> <packaging>jar</packaging>
@@ -16,10 +17,33 @@ <description>A library of classes that will be deployed in the server container itself, above the main EAR</description>
<dependencies> + <dependency> - <groupId>org.jboss.as</groupId> - <artifactId>jboss-as-naming</artifactId> - </dependency> + <groupId>org.jboss.jbossts</groupId> + <artifactId>jbossjts</artifactId> + <version>4.16.2.Final</version> + <scope>provided</scope> <!-- by JBossAS --> + </dependency> + + <dependency> + <groupId>org.jboss</groupId> + <artifactId>jboss-common-core</artifactId> + <scope>provided</scope> <!-- by JBossAS --> + </dependency> + + <dependency> + <groupId>jboss</groupId> + <artifactId>jbosssx</artifactId> + <version>4.2.3.GA</version> + <scope>provided</scope> <!-- by JBossAS --> + </dependency> + + <dependency> + <groupId>jboss</groupId> + <artifactId>jnpserver</artifactId> + <version>4.2.2.GA</version> + <scope>provided</scope> + </dependency> </dependencies>
<profiles> diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/AccessCheckingInitialContextFactoryBuilder.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/AccessCheckingInitialContextFactoryBuilder.java new file mode 100644 index 0000000..1e35a4e --- /dev/null +++ b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/AccessCheckingInitialContextFactoryBuilder.java @@ -0,0 +1,250 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2011 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.jndi; + +import java.net.InetAddress; +import java.net.NetworkInterface; +import java.net.SocketException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.UnknownHostException; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Enumeration; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.Set; + +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NamingException; +import javax.naming.directory.DirContext; +import javax.naming.event.EventContext; +import javax.naming.event.EventDirContext; +import javax.naming.ldap.LdapContext; +import javax.naming.spi.InitialContextFactory; +import javax.naming.spi.InitialContextFactoryBuilder; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import org.rhq.jndi.context.AccessCheckingContextDecorator; +import org.rhq.jndi.context.AccessCheckingContextDecoratorSetContext; +import org.rhq.jndi.context.ContextDecorator; +import org.rhq.jndi.context.URLPreferringContextDecoratorSetContext; +import org.rhq.jndi.util.DecoratorPicker; + +/** + * This initial context factory builder is installed early on during the RHQ server startup + * and is later on used for obtaining the {@link Context}s for all JNDI lookups in the + * RHQ server. + * <p> + * We use a custom initial context factory builder to prevent the potential malicious 3rd party + * code (like CLI alert scripts) from supplying custom environment variables to {@link InitialContext} + * that would modify the JNDI lookup to skip our security access checks. + * <p> + * By using a builder we effectively take control of the initial context creation process + * and are free to ignore whatever the script is trying to supply. + * <p> + * This builder makes sure to install the RHQ server's security access checks to whatever + * initial context that is configured by the standard environment variables + * ({@link Context#INITIAL_CONTEXT_FACTORY}, etc.) + * <p> + * This class is heavily inspired by the implementation of a similar builder in JBoss AS 7. + * + * @see AllowRhqServerInternalsAccessPermission + * + * @author Lukas Krejci + */ +public class AccessCheckingInitialContextFactoryBuilder implements InitialContextFactoryBuilder { + private static final Log LOG = LogFactory.getLog(AccessCheckingInitialContextFactoryBuilder.class); + + /** + * The list of JNDI name schemes that should be checked for security permissions + * (in addition to the names with no scheme). + * + * @see AccessCheckingContextDecorator + */ + private static final String[] CHECKED_SCHEMES = { "java" }; + + private static final Set<Class<? extends Context>> SUPPORTED_CONTEXT_INTERFACES; + + static { + SUPPORTED_CONTEXT_INTERFACES = new HashSet<Class<? extends Context>>(); + SUPPORTED_CONTEXT_INTERFACES.add(Context.class); + SUPPORTED_CONTEXT_INTERFACES.add(DirContext.class); + SUPPORTED_CONTEXT_INTERFACES.add(EventContext.class); + SUPPORTED_CONTEXT_INTERFACES.add(EventDirContext.class); + SUPPORTED_CONTEXT_INTERFACES.add(LdapContext.class); + } + + private static final Set<InetAddress> SERVER_BIND_IPS; + static { + SERVER_BIND_IPS = new HashSet<InetAddress>(); + + try { + String bindingAddressString = System.getProperty("jboss.bind.address"); + InetAddress bindingAddress = InetAddress.getByName(bindingAddressString); + + if (bindingAddress.isAnyLocalAddress()) { + Enumeration<NetworkInterface> ifaces = NetworkInterface.getNetworkInterfaces(); + while (ifaces.hasMoreElements()) { + NetworkInterface iface = ifaces.nextElement(); + SERVER_BIND_IPS.addAll(Collections.list(iface.getInetAddresses())); + } + } else { + SERVER_BIND_IPS.add(bindingAddress); + } + } catch (SocketException e) { + LOG.error("Could not obtain the list of local IPs", e); + } catch (UnknownHostException e) { + LOG.error("Failed to get the binding address of the RHQ server.", e); + } + } + + private static final int JNP_PORT = Integer.parseInt(System.getProperty("rhq.server.startup.namingservice.port", + "2099")); + + /** + * This is the default initial context factory that is returned when no other is + * configured using the environment variables. + * <p> + * It uses {@link NamingContextFactory} as the underlying mechanism - the same + * as the default configuration in JBoss 4. + */ + private static final InitialContextFactory DEFAULT_FACTORY = new InitialContextFactory() { + public Context getInitialContext(Hashtable<?, ?> environment) throws NamingException { + return null; // TODO: how to do this in AS7? createSecureWrapper(new NamingContextFactory(), environment).getInitialContext(environment); + } + }; + + /** + * Create a InitialContext factory. If the environment does not override the factory class it will use the + * default context factory. + * + * @param environment The environment + * @return An initial context factory + * @throws NamingException If an error occurs loading the factory class. + */ + public InitialContextFactory createInitialContextFactory(Hashtable<?, ?> environment) throws NamingException { + final String factoryClassName = (String) environment.get(Context.INITIAL_CONTEXT_FACTORY); + if (factoryClassName == null) { + if (LOG.isDebugEnabled()) { + LOG.debug("No " + Context.INITIAL_CONTEXT_FACTORY + " set. Using the default factory."); + } + return DEFAULT_FACTORY; + } + final ClassLoader classLoader = getContextClassLoader(); + try { + final Class<?> factoryClass = Class.forName(factoryClassName, true, classLoader); + InitialContextFactory configuredFactory = (InitialContextFactory) factoryClass.newInstance(); + return createSecureWrapper(configuredFactory, environment); + } catch (Exception e) { + throw new NamingException("Failed instantiate InitialContextFactory " + factoryClassName + + " from classloader " + classLoader); + } + } + + private ClassLoader getContextClassLoader() { + return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() { + public ClassLoader run() { + return Thread.currentThread().getContextClassLoader(); + } + }); + } + + private static InitialContextFactory + createSecureWrapper(InitialContextFactory factory, Hashtable<?, ?> environment) { + String providerUrl = (String) environment.get(Context.PROVIDER_URL); + + if (providerUrl == null) { + if (LOG.isTraceEnabled()) { + LOG.trace("Wrapping " + factory + " of class " + factory.getClass() + " in an access checking wrapper. No provider URL detected."); + } + return getAccessCheckingFactory(factory); + } else { + try { + URI uri = new URI(providerUrl); + InetAddress providerHost = InetAddress.getByName(uri.getHost()); + + //check if we are accessing the RHQ server through some remoting + //interface. + if (uri.getPort() == JNP_PORT && SERVER_BIND_IPS.contains(providerHost)) { + if (LOG.isTraceEnabled()) { + LOG.trace("Wrapping " + factory + " of class " + factory.getClass() + " in an access checking wrapper. The provider URL points to this server."); + } + return getAccessCheckingFactory(factory); + } else { + if (LOG.isTraceEnabled()) { + LOG.trace("Wrapping " + factory + " of class " + factory.getClass() + " in an URL preferring wrapper to enable remote connections."); + } + return getURLPreferringFactory(factory); + } + } catch (URISyntaxException e) { + if (LOG.isDebugEnabled()) { + LOG.debug("The " + Context.PROVIDER_URL + + " is not a valid URI. Falling back to using the access checking wrapper for the factory " + + factory + " of class " + factory.getClass() + ".", e); + } + return getAccessCheckingFactory(factory); + } catch (UnknownHostException e) { + //let the factory deal with the unknown host... + //this most probably shouldn't be secured because localhost addresses + //should be resolvable. + if (LOG.isDebugEnabled()) { + LOG.debug("The " + Context.PROVIDER_URL + + " is not resolvable. Falling back to using the URL preferring wrapper for the factory " + + factory + " of class " + factory.getClass() + ".", e); + } + return getURLPreferringFactory(factory); + } + } + } + + private static InitialContextFactory getAccessCheckingFactory(InitialContextFactory original) { + ArrayList<DecoratorPicker<Context, ContextDecorator>> pickers = new ArrayList<DecoratorPicker<Context,ContextDecorator>>(); + pickers.add(getURLPreferringDecoratorPicker()); + pickers.add(getAccessCheckingDecoratorPicker()); + + return new DecoratingInitialContextFactory(original, pickers); + } + + private static InitialContextFactory getURLPreferringFactory(InitialContextFactory original) { + ArrayList<DecoratorPicker<Context, ContextDecorator>> pickers = new ArrayList<DecoratorPicker<Context,ContextDecorator>>(); + pickers.add(getURLPreferringDecoratorPicker()); + + return new DecoratingInitialContextFactory(original, pickers); + } + + private static DecoratorPicker<Context, ContextDecorator> getAccessCheckingDecoratorPicker() { + DecoratorPicker<Context, ContextDecorator> ret = new DecoratorPicker<Context, ContextDecorator>(); + ret.setContext(new AccessCheckingContextDecoratorSetContext(SUPPORTED_CONTEXT_INTERFACES, CHECKED_SCHEMES)); + + return ret; + } + + private static DecoratorPicker<Context, ContextDecorator> getURLPreferringDecoratorPicker() { + DecoratorPicker<Context, ContextDecorator> ret = new DecoratorPicker<Context, ContextDecorator>(); + ret.setContext(new URLPreferringContextDecoratorSetContext(SUPPORTED_CONTEXT_INTERFACES)); + + return ret; + } +} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/AllowRhqServerInternalsAccessPermission.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/AllowRhqServerInternalsAccessPermission.java new file mode 100644 index 0000000..aa807d6 --- /dev/null +++ b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/AllowRhqServerInternalsAccessPermission.java @@ -0,0 +1,36 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2011 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.jndi; + +import java.security.BasicPermission; + +/** + * + * + * @author Lukas Krejci + */ +public class AllowRhqServerInternalsAccessPermission extends BasicPermission { + + private static final long serialVersionUID = 1L; + + public AllowRhqServerInternalsAccessPermission() { + super("org.rhq.allow.server.internals.access"); + } +} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/DecoratingInitialContextFactory.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/DecoratingInitialContextFactory.java new file mode 100644 index 0000000..e0f1d84 --- /dev/null +++ b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/DecoratingInitialContextFactory.java @@ -0,0 +1,110 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.jndi; + +import java.lang.reflect.Proxy; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.List; +import java.util.Set; + +import javax.naming.Context; +import javax.naming.NamingException; +import javax.naming.spi.InitialContextFactory; + +import org.rhq.jndi.context.ContextDecorator; +import org.rhq.jndi.util.DecoratorPicker; +import org.rhq.jndi.util.DecoratingInvocationHandler; + +/** + * This class implements an initial context factory that decorates the contexts + * returned from a "wrapped" initial factory passed to this class in the constructor. + * <p> + * The contexts returned from the wrapped initial factory are hidden behind a proxy + * that implements the intersection of interfaces from the <code>supportedContextInterfaces</code> + * constructor parameter and the actual interfaces the wrapped context implements. + * <p> + * The proxy method calls are handled using the {@link DecoratingInvocationHandler} which is initialized + * with the list of {@link DecoratorPicker pickers} that are used to intercept the method + * calls on the wrapped context. + * + * @see DecoratorPicker + * @see DecoratingInvocationHandler + * + * @author Lukas Krejci + */ +public class DecoratingInitialContextFactory implements InitialContextFactory { + + List<DecoratorPicker<Context, ContextDecorator>> pickers; + private InitialContextFactory factory; + private Set<Class<? extends Context>> supportedContextInterfaces; + + public DecoratingInitialContextFactory(InitialContextFactory factory, List<DecoratorPicker<Context, ContextDecorator>> decoratorPickers) { + this.factory = factory; + this.pickers = decoratorPickers; + this.supportedContextInterfaces = new HashSet<Class<? extends Context>>(); + for(DecoratorPicker<Context, ContextDecorator> picker : pickers) { + supportedContextInterfaces.addAll(picker.getContext().getSupportedInterfaces()); + } + } + + public Context getInitialContext(Hashtable<?, ?> environment) throws NamingException { + Context ctx = factory.getInitialContext(environment); + + Set<Class<?>> implementedIfaces = getAllImplementedInterfaces(ctx.getClass()); + Class<?>[] ii = new Class<?>[implementedIfaces.size()]; + implementedIfaces.toArray(ii); + + return (Context) Proxy.newProxyInstance(ctx.getClass().getClassLoader(), ii, new DecoratingInvocationHandler<Context, ContextDecorator>(pickers, ctx)); + } + + private Set<Class<?>> getAllImplementedInterfaces(Class<?> cls) { + HashSet<Class<?>> ret = new HashSet<Class<?>>(); + getAllImplementedInterfaces(cls, ret); + + ret.retainAll(supportedContextInterfaces); + + return ret; + } + + private static void getAllImplementedInterfaces(Class<?> cls, Set<Class<?>> output) { + Class<?>[] ifaces = cls.getInterfaces(); + + for (Class<?> iface : Arrays.asList(ifaces)) { + output.add(iface); + getAllImplementedInterfaces(iface, output); + } + + if (cls.getSuperclass() != null) { + getAllImplementedInterfaces(cls.getSuperclass(), output); + } + } + + @Override + public int hashCode() { + return factory.hashCode(); + } + + @Override + public boolean equals(Object o) { + return factory.equals(o); + } +} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingContextDecorator.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingContextDecorator.java new file mode 100644 index 0000000..8970b0a --- /dev/null +++ b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingContextDecorator.java @@ -0,0 +1,264 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2011 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.jndi.context; + +import java.io.Serializable; +import java.util.Arrays; +import java.util.Hashtable; +import java.util.List; + +import javax.naming.Binding; +import javax.naming.Context; +import javax.naming.Name; +import javax.naming.NameClassPair; +import javax.naming.NameParser; +import javax.naming.NamingEnumeration; +import javax.naming.NamingException; + +import org.rhq.jndi.AllowRhqServerInternalsAccessPermission; + +/** + * This is the "meat" of the RHQ's secured JNDI access. This {@link Context} decorator + * applied security checks in each method (lookups, (un)bindings, etc). + * <p> + * The security check consists of checking if the current callstack has the {@link AllowRhqServerInternalsAccessPermission}. + * <p> + * This decorator applies the security check on any JNDI name without a scheme and + * on any name that has a scheme listed in the {@link #checkedSchemes} list supplied + * in the constructor. + * + * @author Lukas Krejci + */ +public class AccessCheckingContextDecorator implements Context, ContextDecorator, Serializable { + + private static final long serialVersionUID = 1L; + + private static final AllowRhqServerInternalsAccessPermission PERM = new AllowRhqServerInternalsAccessPermission(); + private Context original; + private List<String> checkedSchemes; + + public AccessCheckingContextDecorator(String... checkedSchemes) { + this.checkedSchemes = Arrays.asList(checkedSchemes); + } + + public AccessCheckingContextDecorator(Context original, String... checkedSchemes) { + this.original = original; + this.checkedSchemes = Arrays.asList(checkedSchemes); + } + + public void init(Context ctx) { + this.original = ctx; + } + + protected Context getOriginal() { + return original; + } + + protected static void check() { + SecurityManager sm = System.getSecurityManager(); + if (sm != null) sm.checkPermission(PERM); + } + + private void checkScheme(String scheme) { + if (scheme == null || checkedSchemes.contains(scheme)) { + check(); + } + } + + protected void check(String name) { + checkScheme(getURLScheme(name)); + } + + protected void check(Name name) { + if (name.size() == 0) { + check(); + } else { + String first = name.get(0); + checkScheme(getURLScheme(first)); + } + } + + public Object lookup(Name name) throws NamingException { + check(name); + return original.lookup(name); + } + + public Object lookup(String name) throws NamingException { + check(name); + return original.lookup(name); + } + + public void bind(Name name, Object obj) throws NamingException { + check(name); + original.bind(name, obj); + } + + public void bind(String name, Object obj) throws NamingException { + check(name); + original.bind(name, obj); + } + + public void rebind(Name name, Object obj) throws NamingException { + check(name); + original.rebind(name, obj); + } + + public void rebind(String name, Object obj) throws NamingException { + check(name); + original.rebind(name, obj); + } + + public void unbind(Name name) throws NamingException { + check(name); + original.unbind(name); + } + + public void unbind(String name) throws NamingException { + check(name); + original.unbind(name); + } + + public void rename(Name oldName, Name newName) throws NamingException { + check(oldName); + check(newName); + original.rename(oldName, newName); + } + + public void rename(String oldName, String newName) throws NamingException { + check(oldName); + check(newName); + original.rename(oldName, newName); + } + + public NamingEnumeration<NameClassPair> list(Name name) throws NamingException { + check(name); + return original.list(name); + } + + public NamingEnumeration<NameClassPair> list(String name) throws NamingException { + check(name); + return original.list(name); + } + + public NamingEnumeration<Binding> listBindings(Name name) throws NamingException { + check(name); + return original.listBindings(name); + } + + public NamingEnumeration<Binding> listBindings(String name) throws NamingException { + check(name); + return original.listBindings(name); + } + + public void destroySubcontext(Name name) throws NamingException { + check(name); + original.destroySubcontext(name); + } + + public void destroySubcontext(String name) throws NamingException { + check(name); + original.destroySubcontext(name); + } + + public Context createSubcontext(Name name) throws NamingException { + check(name); + return original.createSubcontext(name); + } + + public Context createSubcontext(String name) throws NamingException { + check(name); + return original.createSubcontext(name); + } + + public Object lookupLink(Name name) throws NamingException { + check(name); + return original.lookupLink(name); + } + + public Object lookupLink(String name) throws NamingException { + check(name); + return original.lookupLink(name); + } + + public NameParser getNameParser(Name name) throws NamingException { + check(name); + return original.getNameParser(name); + } + + public NameParser getNameParser(String name) throws NamingException { + check(name); + return original.getNameParser(name); + } + + public Name composeName(Name name, Name prefix) throws NamingException { + check(name); + return original.composeName(name, prefix); + } + + public String composeName(String name, String prefix) throws NamingException { + check(name); + return original.composeName(name, prefix); + } + + public Object addToEnvironment(String propName, Object propVal) throws NamingException { + check(); + return original.addToEnvironment(propName, propVal); + } + + public Object removeFromEnvironment(String propName) throws NamingException { + check(); + return original.removeFromEnvironment(propName); + } + + public Hashtable<?, ?> getEnvironment() throws NamingException { + check(); + return original.getEnvironment(); + } + + public void close() throws NamingException { + check(); + original.close(); + } + + public String getNameInNamespace() throws NamingException { + check(); + return original.getNameInNamespace(); + } + + //copied from InitialContext + private static String getURLScheme(String str) { + int colon_posn = str.indexOf(':'); + int slash_posn = str.indexOf('/'); + + if (colon_posn > 0 && (slash_posn == -1 || colon_posn < slash_posn)) + return str.substring(0, colon_posn); + return null; + } + + @Override + public int hashCode() { + return getOriginal() == null ? super.hashCode() : getOriginal().hashCode(); + } + + @Override + public boolean equals(Object o) { + return getOriginal() == null ? super.equals(o) : getOriginal().equals(o); + } +} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingContextDecoratorSetContext.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingContextDecoratorSetContext.java new file mode 100644 index 0000000..284fd0c --- /dev/null +++ b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingContextDecoratorSetContext.java @@ -0,0 +1,75 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.jndi.context; + +import java.lang.reflect.Constructor; +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + +import javax.naming.Context; + +import org.rhq.jndi.util.DecoratorSetContext; + +/** + * + * + * @author Lukas Krejci + */ +public class AccessCheckingContextDecoratorSetContext implements DecoratorSetContext<Context, ContextDecorator> { + + private static final Set<Class<? extends ContextDecorator>> DECORATOR_CLASSES; + static { + HashSet<Class<? extends ContextDecorator>> tmp = new HashSet<Class<? extends ContextDecorator>>(); + tmp.add(AccessCheckingContextDecorator.class); + tmp.add(AccessCheckingDirContextDecorator.class); + tmp.add(AccessCheckingEventContextDecorator.class); + tmp.add(AccessCheckingEventDirContextDecorator.class); + tmp.add(AccessCheckingLdapContextDecorator.class); + + DECORATOR_CLASSES = Collections.unmodifiableSet(tmp); + } + + private Set<Class<? extends Context>> supportedInterfaces; + private String[] checkedSchemes; + + public AccessCheckingContextDecoratorSetContext(Set<Class<? extends Context>> supportedInterfaces, String... checkedSchemes) { + this.supportedInterfaces = supportedInterfaces; + this.checkedSchemes = checkedSchemes; + } + + public ContextDecorator instantiate(Class<? extends ContextDecorator> decoratorClass) throws Exception { + Constructor<? extends ContextDecorator> ctor = decoratorClass.getConstructor(String[].class); + + return ctor.newInstance((Object)checkedSchemes); + } + + public Set<Class<? extends Context>> getSupportedInterfaces() { + return supportedInterfaces; + } + + public Set<Class<? extends ContextDecorator>> getDecoratorClasses() { + return DECORATOR_CLASSES; + } + + public void init(ContextDecorator decorator, Context object) throws Exception { + decorator.init(object); + } +} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingDirContextDecorator.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingDirContextDecorator.java new file mode 100644 index 0000000..1614180 --- /dev/null +++ b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingDirContextDecorator.java @@ -0,0 +1,187 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.jndi.context; + +import javax.naming.Name; +import javax.naming.NamingEnumeration; +import javax.naming.NamingException; +import javax.naming.directory.Attributes; +import javax.naming.directory.DirContext; +import javax.naming.directory.ModificationItem; +import javax.naming.directory.SearchControls; +import javax.naming.directory.SearchResult; + +/** + * A decorator of {@link DirContext}. + * + * @author Lukas Krejci + */ +public class AccessCheckingDirContextDecorator extends AccessCheckingContextDecorator implements DirContext { + + private static final long serialVersionUID = 1L; + + public AccessCheckingDirContextDecorator(String... checkedSchemes) { + super(checkedSchemes); + } + + public AccessCheckingDirContextDecorator(DirContext original, String... checkedSchemes) { + super(original, checkedSchemes); + } + + @Override + protected DirContext getOriginal() { + return (DirContext) super.getOriginal(); + } + + public Attributes getAttributes(Name name) throws NamingException { + check(name); + return getOriginal().getAttributes(name); + } + + public Attributes getAttributes(String name) throws NamingException { + check(name); + return getOriginal().getAttributes(name); + } + + public Attributes getAttributes(Name name, String[] attrIds) throws NamingException { + check(name); + return getOriginal().getAttributes(name, attrIds); + } + + public Attributes getAttributes(String name, String[] attrIds) throws NamingException { + check(name); + return getOriginal().getAttributes(name, attrIds); + } + + public void modifyAttributes(Name name, int mod_op, Attributes attrs) throws NamingException { + check(name); + getOriginal().modifyAttributes(name, mod_op, attrs); + } + + public void modifyAttributes(String name, int mod_op, Attributes attrs) throws NamingException { + check(name); + getOriginal().modifyAttributes(name, mod_op, attrs); + } + + public void modifyAttributes(Name name, ModificationItem[] mods) throws NamingException { + check(name); + getOriginal().modifyAttributes(name, mods); + } + + public void modifyAttributes(String name, ModificationItem[] mods) throws NamingException { + check(name); + getOriginal().modifyAttributes(name, mods); + } + + public void bind(Name name, Object obj, Attributes attrs) throws NamingException { + check(name); + getOriginal().bind(name, obj, attrs); + } + + public void bind(String name, Object obj, Attributes attrs) throws NamingException { + check(name); + getOriginal().bind(name, obj, attrs); + } + + public void rebind(Name name, Object obj, Attributes attrs) throws NamingException { + check(name); + getOriginal().rebind(name, obj, attrs); + } + + public void rebind(String name, Object obj, Attributes attrs) throws NamingException { + check(name); + getOriginal().rebind(name, obj, attrs); + } + + public DirContext createSubcontext(Name name, Attributes attrs) throws NamingException { + check(name); + return getOriginal().createSubcontext(name, attrs); + } + + public DirContext createSubcontext(String name, Attributes attrs) throws NamingException { + check(name); + return getOriginal().createSubcontext(name, attrs); + } + + public DirContext getSchema(Name name) throws NamingException { + check(name); + return getOriginal().getSchema(name); + } + + public DirContext getSchema(String name) throws NamingException { + check(name); + return getOriginal().getSchema(name); + } + + public DirContext getSchemaClassDefinition(Name name) throws NamingException { + check(name); + return getOriginal().getSchemaClassDefinition(name); + } + + public DirContext getSchemaClassDefinition(String name) throws NamingException { + check(name); + return getOriginal().getSchema(name); + } + + public NamingEnumeration<SearchResult> + search(Name name, Attributes matchingAttributes, String[] attributesToReturn) throws NamingException { + check(name); + return getOriginal().search(name, matchingAttributes, attributesToReturn); + } + + public NamingEnumeration<SearchResult> search(String name, Attributes matchingAttributes, + String[] attributesToReturn) throws NamingException { + check(name); + return getOriginal().search(name, matchingAttributes, attributesToReturn); + } + + public NamingEnumeration<SearchResult> search(Name name, Attributes matchingAttributes) throws NamingException { + check(name); + return getOriginal().search(name, matchingAttributes); + } + + public NamingEnumeration<SearchResult> search(String name, Attributes matchingAttributes) throws NamingException { + check(name); + return getOriginal().search(name, matchingAttributes); + } + + public NamingEnumeration<SearchResult> search(Name name, String filter, SearchControls cons) throws NamingException { + check(name); + return getOriginal().search(name, filter, cons); + } + + public NamingEnumeration<SearchResult> search(String name, String filter, SearchControls cons) + throws NamingException { + check(name); + return getOriginal().search(name, filter, cons); + } + + public NamingEnumeration<SearchResult> + search(Name name, String filterExpr, Object[] filterArgs, SearchControls cons) throws NamingException { + check(name); + return getOriginal().search(name, filterExpr, filterArgs, cons); + } + + public NamingEnumeration<SearchResult> search(String name, String filterExpr, Object[] filterArgs, + SearchControls cons) throws NamingException { + check(name); + return getOriginal().search(name, filterExpr, filterArgs, cons); + } +} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingEventContextDecorator.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingEventContextDecorator.java new file mode 100644 index 0000000..67a9527 --- /dev/null +++ b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingEventContextDecorator.java @@ -0,0 +1,69 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.jndi.context; + +import javax.naming.Name; +import javax.naming.NamingException; +import javax.naming.event.EventContext; +import javax.naming.event.NamingListener; + +/** + * + * + * @author Lukas Krejci + */ +public class AccessCheckingEventContextDecorator extends AccessCheckingContextDecorator implements EventContext { + + private static final long serialVersionUID = 1L; + + public AccessCheckingEventContextDecorator(String... checkedSchemes) { + super(checkedSchemes); + } + + public AccessCheckingEventContextDecorator(EventContext original, String... checkedSchemes) { + super(original, checkedSchemes); + } + + @Override + protected EventContext getOriginal() { + return (EventContext) super.getOriginal(); + } + + public void addNamingListener(Name target, int scope, NamingListener l) throws NamingException { + check(target); + getOriginal().addNamingListener(target, scope, l); + } + + public void addNamingListener(String target, int scope, NamingListener l) throws NamingException { + check(target); + getOriginal().addNamingListener(target, scope, l); + } + + public void removeNamingListener(NamingListener l) throws NamingException { + check(); + getOriginal().removeNamingListener(l); + } + + public boolean targetMustExist() throws NamingException { + check(); + return getOriginal().targetMustExist(); + } + +} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingEventDirContextDecorator.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingEventDirContextDecorator.java new file mode 100644 index 0000000..ed7a848 --- /dev/null +++ b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingEventDirContextDecorator.java @@ -0,0 +1,96 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.jndi.context; + +import javax.naming.Name; +import javax.naming.NamingException; +import javax.naming.directory.SearchControls; +import javax.naming.event.EventDirContext; +import javax.naming.event.NamingListener; + +/** + * + * + * @author Lukas Krejci + */ +public class AccessCheckingEventDirContextDecorator extends AccessCheckingDirContextDecorator implements + EventDirContext { + + private static final long serialVersionUID = 1L; + + public AccessCheckingEventDirContextDecorator(String... checkedSchemes) { + super(checkedSchemes); + } + + public AccessCheckingEventDirContextDecorator(EventDirContext original, String... checkedSchemes) { + super(original, checkedSchemes); + } + + @Override + protected EventDirContext getOriginal() { + return (EventDirContext) super.getOriginal(); + } + + public void addNamingListener(Name target, int scope, NamingListener l) throws NamingException { + check(target); + getOriginal().addNamingListener(target, scope, l); + } + + public void addNamingListener(String target, int scope, NamingListener l) throws NamingException { + check(target); + getOriginal().addNamingListener(target, scope, l); + } + + public void removeNamingListener(NamingListener l) throws NamingException { + check(); + getOriginal().removeNamingListener(l); + } + + public boolean targetMustExist() throws NamingException { + check(); + return getOriginal().targetMustExist(); + } + + public void addNamingListener(Name target, String filter, SearchControls ctls, NamingListener l) + throws NamingException { + check(target); + getOriginal().addNamingListener(target, filter, ctls, l); + } + + public void addNamingListener(String target, String filter, SearchControls ctls, NamingListener l) + throws NamingException { + check(target); + getOriginal().addNamingListener(target, filter, ctls, l); + } + + public void + addNamingListener(Name target, String filter, Object[] filterArgs, SearchControls ctls, NamingListener l) + throws NamingException { + check(target); + getOriginal().addNamingListener(target, filter, filterArgs, ctls, l); + } + + public void addNamingListener(String target, String filter, Object[] filterArgs, SearchControls ctls, + NamingListener l) throws NamingException { + check(target); + getOriginal().addNamingListener(target, filter, filterArgs, ctls, l); + } + +} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingLdapContextDecorator.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingLdapContextDecorator.java new file mode 100644 index 0000000..e361db8 --- /dev/null +++ b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingLdapContextDecorator.java @@ -0,0 +1,85 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.jndi.context; + +import javax.naming.NamingException; +import javax.naming.ldap.Control; +import javax.naming.ldap.ExtendedRequest; +import javax.naming.ldap.ExtendedResponse; +import javax.naming.ldap.LdapContext; + +/** + * + * + * @author Lukas Krejci + */ +public class AccessCheckingLdapContextDecorator extends AccessCheckingDirContextDecorator implements LdapContext { + + private static final long serialVersionUID = 1L; + + public AccessCheckingLdapContextDecorator(String... checkedSchemes) { + super(checkedSchemes); + } + + public AccessCheckingLdapContextDecorator(LdapContext original, String... checkedSchemes) { + super(original, checkedSchemes); + } + + @Override + protected LdapContext getOriginal() { + return (LdapContext) super.getOriginal(); + } + + public ExtendedResponse extendedOperation(ExtendedRequest request) throws NamingException { + check(); + return getOriginal().extendedOperation(request); + } + + public LdapContext newInstance(Control[] requestControls) throws NamingException { + check(); + return getOriginal().newInstance(requestControls); + } + + public void reconnect(Control[] connCtls) throws NamingException { + check(); + getOriginal().reconnect(connCtls); + } + + public Control[] getConnectControls() throws NamingException { + check(); + return getOriginal().getConnectControls(); + } + + public void setRequestControls(Control[] requestControls) throws NamingException { + check(); + getOriginal().setRequestControls(requestControls); + } + + public Control[] getRequestControls() throws NamingException { + check(); + return getOriginal().getRequestControls(); + } + + public Control[] getResponseControls() throws NamingException { + check(); + return getOriginal().getResponseControls(); + } + +} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/ContextDecorator.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/ContextDecorator.java new file mode 100644 index 0000000..5755ebd --- /dev/null +++ b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/ContextDecorator.java @@ -0,0 +1,33 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.jndi.context; + +import javax.naming.Context; +import javax.naming.NamingException; + +/** + * + * + * @author Lukas Krejci + */ +public interface ContextDecorator extends Context { + + void init(Context context) throws NamingException; +} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringContextDecorator.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringContextDecorator.java new file mode 100644 index 0000000..3f3a95d --- /dev/null +++ b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringContextDecorator.java @@ -0,0 +1,222 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2011 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.jndi.context; + +import java.io.Serializable; +import java.util.Hashtable; + +import javax.naming.Binding; +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.Name; +import javax.naming.NameClassPair; +import javax.naming.NameParser; +import javax.naming.NamingEnumeration; +import javax.naming.NamingException; + +import org.rhq.jndi.AccessCheckingInitialContextFactoryBuilder; + +/** + * This is a wrapper class around another {@link Context} implementation that + * prefers to use an URL context for some operation if the JNDI name contains + * a scheme rather than the original. This is the behavior of {@link InitialContext} + * which we need to restore in the contexts created by the {@link AccessCheckingInitialContextFactoryBuilder} + * (which an {@link InitialContext} uses exclusively if the builder is set). + * <p> + * This is important because RHQ server has its own initial context factory + * builder that creates factories that in turn create contexts. If the default + * {@link InitialContext} implementation was used, we'd never be able to lookup + * scheme-based names because the default implementation of the {@link InitialContext} + * always uses the default context of the builder if one is installed no matter + * the scheme in the name. + * <p> + * The {@link AccessCheckingInitialContextFactoryBuilder} wraps the context returned + * by the factory in an instance of this class and thus is restoring the original + * intended behavior of the {@link InitialContext}. It looks at the name being looked + * up (bound or whatever) and prefers to use the URL context factories if the name + * contains the scheme (as does the {@link InitialContext} if no builder is installed). + * If the name doesn't contain a scheme, the provided default context factory is used to + * look up the name. + * + * @author Lukas Krejci + */ +public class URLPreferringContextDecorator implements Context, ContextDecorator, Serializable { + + private static final long serialVersionUID = 1L; + + private Context original; + + public URLPreferringContextDecorator() { + + } + + public URLPreferringContextDecorator(Context ctx) { + original = ctx; + } + + public void init(Context context) { + original = context; + } + + protected Context getOriginal() throws NamingException { + return original; + } + + protected Context getURLOrDefaultInitCtx(Name name) throws NamingException { + @SuppressWarnings("unchecked") + Context urlContext = URLPreferringContextDecoratorHelper.getURLContext(name, (Hashtable<Object, Object>) getEnvironment()); + return urlContext == null ? getOriginal() : urlContext; + } + + protected Context getURLOrDefaultInitCtx(String name) throws NamingException { + @SuppressWarnings("unchecked") + Context urlContext = URLPreferringContextDecoratorHelper.getURLContext(name, (Hashtable<Object, Object>) getEnvironment()); + return urlContext == null ? getOriginal() : urlContext; + } + + public Object lookup(Name name) throws NamingException { + return getURLOrDefaultInitCtx(name).lookup(name); + } + + public Object lookup(String name) throws NamingException { + return getURLOrDefaultInitCtx(name).lookup(name); + } + + public void bind(Name name, Object obj) throws NamingException { + getURLOrDefaultInitCtx(name).bind(name, obj); + } + + public void bind(String name, Object obj) throws NamingException { + getURLOrDefaultInitCtx(name).bind(name, obj); + } + + public void rebind(Name name, Object obj) throws NamingException { + getURLOrDefaultInitCtx(name).rebind(name, obj); + } + + public void rebind(String name, Object obj) throws NamingException { + getURLOrDefaultInitCtx(name).rebind(name, obj); + } + + public void unbind(Name name) throws NamingException { + getURLOrDefaultInitCtx(name).unbind(name); + } + + public void unbind(String name) throws NamingException { + getURLOrDefaultInitCtx(name).unbind(name); + } + + public void rename(Name oldName, Name newName) throws NamingException { + getURLOrDefaultInitCtx(oldName).rename(oldName, newName); + } + + public void rename(String oldName, String newName) throws NamingException { + getURLOrDefaultInitCtx(oldName).rename(oldName, newName); + } + + public NamingEnumeration<NameClassPair> list(Name name) throws NamingException { + return getURLOrDefaultInitCtx(name).list(name); + } + + public NamingEnumeration<NameClassPair> list(String name) throws NamingException { + return getURLOrDefaultInitCtx(name).list(name); + } + + public NamingEnumeration<Binding> listBindings(Name name) throws NamingException { + return getURLOrDefaultInitCtx(name).listBindings(name); + } + + public NamingEnumeration<Binding> listBindings(String name) throws NamingException { + return getURLOrDefaultInitCtx(name).listBindings(name); + } + + public void destroySubcontext(Name name) throws NamingException { + getURLOrDefaultInitCtx(name).destroySubcontext(name); + } + + public void destroySubcontext(String name) throws NamingException { + getURLOrDefaultInitCtx(name).destroySubcontext(name); + } + + public Context createSubcontext(Name name) throws NamingException { + return getURLOrDefaultInitCtx(name).createSubcontext(name); + } + + public Context createSubcontext(String name) throws NamingException { + return getURLOrDefaultInitCtx(name).createSubcontext(name); + } + + public Object lookupLink(Name name) throws NamingException { + return getURLOrDefaultInitCtx(name).lookupLink(name); + } + + public Object lookupLink(String name) throws NamingException { + return getURLOrDefaultInitCtx(name).lookupLink(name); + } + + public NameParser getNameParser(Name name) throws NamingException { + return getURLOrDefaultInitCtx(name).getNameParser(name); + } + + public NameParser getNameParser(String name) throws NamingException { + return getURLOrDefaultInitCtx(name).getNameParser(name); + } + + public Name composeName(Name name, Name prefix) throws NamingException { + return getOriginal().composeName(name, prefix); + } + + public String composeName(String name, String prefix) throws NamingException { + return getOriginal().composeName(name, prefix); + } + + public Object addToEnvironment(String propName, Object propVal) throws NamingException { + return getOriginal().addToEnvironment(propName, propVal); + } + + public Object removeFromEnvironment(String propName) throws NamingException { + return getOriginal().removeFromEnvironment(propName); + } + + public Hashtable<?, ?> getEnvironment() throws NamingException { + return getOriginal().getEnvironment(); + } + + public void close() throws NamingException { + if (getOriginal() != null) { + getOriginal().close(); + original = null; + } + } + + public String getNameInNamespace() throws NamingException { + return getOriginal().getNameInNamespace(); + } + + @Override + public int hashCode() { + return original == null ? super.hashCode() : original.hashCode(); + } + + @Override + public boolean equals(Object o) { + return original == null ? super.equals(o) : original.equals(o); + } +} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringContextDecoratorHelper.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringContextDecoratorHelper.java new file mode 100644 index 0000000..6e7debc --- /dev/null +++ b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringContextDecoratorHelper.java @@ -0,0 +1,76 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.jndi.context; + +import java.util.Hashtable; + +import javax.naming.Context; +import javax.naming.Name; +import javax.naming.NamingException; +import javax.naming.spi.NamingManager; + +/** + * + * + * @author Lukas Krejci + */ +public class URLPreferringContextDecoratorHelper { + + private URLPreferringContextDecoratorHelper() { + + } + + public static Context getURLContext(String name, Hashtable<Object, Object> env) throws NamingException { + String scheme = getURLScheme(name); + if (scheme != null) { + Context ctx = NamingManager.getURLContext(scheme, env); + if (ctx != null) { + return ctx; + } + } + + return null; + } + + public static Context getURLContext(Name name, Hashtable<Object, Object> env) throws NamingException { + if (name.size() > 0) { + String first = name.get(0); + String scheme = getURLScheme(first); + if (scheme != null) { + Context ctx = NamingManager.getURLContext(scheme, env); + if (ctx != null) { + return ctx; + } + } + } + + return null; + } + + //copied from InitialContext + private static String getURLScheme(String str) { + int colon_posn = str.indexOf(':'); + int slash_posn = str.indexOf('/'); + + if (colon_posn > 0 && (slash_posn == -1 || colon_posn < slash_posn)) + return str.substring(0, colon_posn); + return null; + } +} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringContextDecoratorSetContext.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringContextDecoratorSetContext.java new file mode 100644 index 0000000..828cd74 --- /dev/null +++ b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringContextDecoratorSetContext.java @@ -0,0 +1,71 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.jndi.context; + +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + +import javax.naming.Context; + +import org.rhq.jndi.util.DecoratorSetContext; + +/** + * + * + * @author Lukas Krejci + */ +public class URLPreferringContextDecoratorSetContext implements DecoratorSetContext<Context, ContextDecorator> { + + private static final Set<Class<? extends ContextDecorator>> DECORATOR_CLASSES; + static { + HashSet<Class<? extends ContextDecorator>> tmp = new HashSet<Class<? extends ContextDecorator>>(); + tmp.add(URLPreferringContextDecorator.class); + tmp.add(URLPreferringDirContextDecorator.class); + tmp.add(URLPreferringEventContextDecorator.class); + tmp.add(URLPreferringEventDirContextDecorator.class); + tmp.add(URLPreferringLdapContextDecorator.class); + + DECORATOR_CLASSES = Collections.unmodifiableSet(tmp); + } + + private Set<Class<? extends Context>> supportedInterfaces; + + public URLPreferringContextDecoratorSetContext(Set<Class<? extends Context>> supportedInterfaces) { + this.supportedInterfaces = supportedInterfaces; + } + + public Set<Class<? extends Context>> getSupportedInterfaces() { + return supportedInterfaces; + } + + public Set<Class<? extends ContextDecorator>> getDecoratorClasses() { + return DECORATOR_CLASSES; + } + + public ContextDecorator instantiate(Class<? extends ContextDecorator> decoratorClass) throws Exception { + return decoratorClass.newInstance(); + } + + public void init(ContextDecorator decorator, Context object) throws Exception { + decorator.init(object); + } + +} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringDirContextDecorator.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringDirContextDecorator.java new file mode 100644 index 0000000..6a49942 --- /dev/null +++ b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringDirContextDecorator.java @@ -0,0 +1,185 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.jndi.context; + +import javax.naming.Context; +import javax.naming.Name; +import javax.naming.NamingEnumeration; +import javax.naming.NamingException; +import javax.naming.NoInitialContextException; +import javax.naming.NotContextException; +import javax.naming.directory.Attributes; +import javax.naming.directory.DirContext; +import javax.naming.directory.ModificationItem; +import javax.naming.directory.SearchControls; +import javax.naming.directory.SearchResult; + +/** + * Akin to {@link URLPreferringContextDecorator} this class implements the similar logic + * for {@link DirContext}s. + * + * @author Lukas Krejci + */ +public class URLPreferringDirContextDecorator extends URLPreferringContextDecorator implements DirContext { + + private static final long serialVersionUID = 1L; + + public URLPreferringDirContextDecorator() { + super(null); + } + + public URLPreferringDirContextDecorator(DirContext ctx) { + super(ctx); + } + + protected DirContext checkAndCast(Context ctx) throws NamingException { + if (!(ctx instanceof DirContext)) { + if (ctx == null) { + throw new NoInitialContextException(); + } else { + throw new NotContextException( + "Not an instance of DirContext"); + } + } + + return (DirContext) ctx; + } + + @Override + protected DirContext getURLOrDefaultInitCtx(Name name) throws NamingException { + Context ctx = super.getURLOrDefaultInitCtx(name); + return checkAndCast(ctx); + } + + @Override + protected DirContext getURLOrDefaultInitCtx(String name) throws NamingException { + Context ctx = super.getURLOrDefaultInitCtx(name); + return checkAndCast(ctx); + } + + public Attributes getAttributes(Name name) throws NamingException { + return getURLOrDefaultInitCtx(name).getAttributes(name); + } + + public Attributes getAttributes(String name) throws NamingException { + return getURLOrDefaultInitCtx(name).getAttributes(name); + } + + public Attributes getAttributes(Name name, String[] attrIds) throws NamingException { + return getURLOrDefaultInitCtx(name).getAttributes(name, attrIds); + } + + public Attributes getAttributes(String name, String[] attrIds) throws NamingException { + return getURLOrDefaultInitCtx(name).getAttributes(name, attrIds); + } + + public void modifyAttributes(Name name, int mod_op, Attributes attrs) throws NamingException { + getURLOrDefaultInitCtx(name).modifyAttributes(name, mod_op, attrs); + } + + public void modifyAttributes(String name, int mod_op, Attributes attrs) throws NamingException { + getURLOrDefaultInitCtx(name).modifyAttributes(name, mod_op, attrs); + } + + public void modifyAttributes(Name name, ModificationItem[] mods) throws NamingException { + getURLOrDefaultInitCtx(name).modifyAttributes(name, mods); + } + + public void modifyAttributes(String name, ModificationItem[] mods) throws NamingException { + getURLOrDefaultInitCtx(name).modifyAttributes(name, mods); + } + + public void bind(Name name, Object obj, Attributes attrs) throws NamingException { + getURLOrDefaultInitCtx(name).bind(name, obj, attrs); + } + + public void bind(String name, Object obj, Attributes attrs) throws NamingException { + getURLOrDefaultInitCtx(name).bind(name, obj, attrs); + } + + public void rebind(Name name, Object obj, Attributes attrs) throws NamingException { + getURLOrDefaultInitCtx(name).rebind(name, obj, attrs); + } + + public void rebind(String name, Object obj, Attributes attrs) throws NamingException { + getURLOrDefaultInitCtx(name).rebind(name, obj, attrs); + } + + public DirContext createSubcontext(Name name, Attributes attrs) throws NamingException { + return getURLOrDefaultInitCtx(name).createSubcontext(name, attrs); + } + + public DirContext createSubcontext(String name, Attributes attrs) throws NamingException { + return getURLOrDefaultInitCtx(name).createSubcontext(name, attrs); + } + + public DirContext getSchema(Name name) throws NamingException { + return getURLOrDefaultInitCtx(name).getSchema(name); + } + + public DirContext getSchema(String name) throws NamingException { + return getURLOrDefaultInitCtx(name).getSchema(name); + } + + public DirContext getSchemaClassDefinition(Name name) throws NamingException { + return getURLOrDefaultInitCtx(name).getSchemaClassDefinition(name); + } + + public DirContext getSchemaClassDefinition(String name) throws NamingException { + return getURLOrDefaultInitCtx(name).getSchemaClassDefinition(name); + } + + public NamingEnumeration<SearchResult> + search(Name name, Attributes matchingAttributes, String[] attributesToReturn) throws NamingException { + return getURLOrDefaultInitCtx(name).search(name, matchingAttributes, attributesToReturn); + } + + public NamingEnumeration<SearchResult> search(String name, Attributes matchingAttributes, + String[] attributesToReturn) throws NamingException { + return getURLOrDefaultInitCtx(name).search(name, matchingAttributes, attributesToReturn); + } + + public NamingEnumeration<SearchResult> search(Name name, Attributes matchingAttributes) throws NamingException { + return getURLOrDefaultInitCtx(name).search(name, matchingAttributes); + } + + public NamingEnumeration<SearchResult> search(String name, Attributes matchingAttributes) throws NamingException { + return getURLOrDefaultInitCtx(name).search(name, matchingAttributes); + } + + public NamingEnumeration<SearchResult> search(Name name, String filter, SearchControls cons) throws NamingException { + return getURLOrDefaultInitCtx(name).search(name, filter, cons); + } + + public NamingEnumeration<SearchResult> search(String name, String filter, SearchControls cons) + throws NamingException { + return getURLOrDefaultInitCtx(name).search(name, filter, cons); + } + + public NamingEnumeration<SearchResult> + search(Name name, String filterExpr, Object[] filterArgs, SearchControls cons) throws NamingException { + return getURLOrDefaultInitCtx(name).search(name, filterExpr, filterArgs, cons); + } + + public NamingEnumeration<SearchResult> search(String name, String filterExpr, Object[] filterArgs, + SearchControls cons) throws NamingException { + return getURLOrDefaultInitCtx(name).search(name, filterExpr, filterArgs, cons); + } +} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringEventContextDecorator.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringEventContextDecorator.java new file mode 100644 index 0000000..e3298a0 --- /dev/null +++ b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringEventContextDecorator.java @@ -0,0 +1,81 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.jndi.context; + +import javax.naming.Context; +import javax.naming.Name; +import javax.naming.NamingException; +import javax.naming.NoInitialContextException; +import javax.naming.NotContextException; +import javax.naming.event.EventContext; +import javax.naming.event.NamingListener; + +/** + * + * + * @author Lukas Krejci + */ +public class URLPreferringEventContextDecorator extends URLPreferringContextDecorator implements EventContext { + + private static final long serialVersionUID = 1L; + + public URLPreferringEventContextDecorator() { + super(null); + } + + public URLPreferringEventContextDecorator(EventContext ctx) { + super(ctx); + } + + protected EventContext checkAndCast(Context ctx) throws NamingException { + if (!(ctx instanceof EventContext)) { + if (ctx == null) { + throw new NoInitialContextException(); + } else { + throw new NotContextException( + "Not an instance of EventContext"); + } + } + + return (EventContext) ctx; + } + + @Override + protected EventContext getOriginal() throws NamingException { + return checkAndCast(super.getOriginal()); + } + + public void addNamingListener(Name target, int scope, NamingListener l) throws NamingException { + getOriginal().addNamingListener(target, scope, l); + } + + public void addNamingListener(String target, int scope, NamingListener l) throws NamingException { + getOriginal().addNamingListener(target, scope, l); + } + + public void removeNamingListener(NamingListener l) throws NamingException { + getOriginal().removeNamingListener(l); + } + + public boolean targetMustExist() throws NamingException { + return getOriginal().targetMustExist(); + } + +} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringEventDirContextDecorator.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringEventDirContextDecorator.java new file mode 100644 index 0000000..4925297 --- /dev/null +++ b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringEventDirContextDecorator.java @@ -0,0 +1,104 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.jndi.context; + +import javax.naming.Context; +import javax.naming.Name; +import javax.naming.NamingException; +import javax.naming.NoInitialContextException; +import javax.naming.NotContextException; +import javax.naming.directory.SearchControls; +import javax.naming.event.EventDirContext; +import javax.naming.event.NamingListener; + +/** + * + * + * @author Lukas Krejci + */ +public class URLPreferringEventDirContextDecorator extends URLPreferringDirContextDecorator implements EventDirContext { + + private static final long serialVersionUID = 1L; + + public URLPreferringEventDirContextDecorator() { + super(null); + } + + public URLPreferringEventDirContextDecorator(EventDirContext ctx) { + super(ctx); + } + + @Override + protected EventDirContext checkAndCast(Context ctx) throws NamingException { + if (!(ctx instanceof EventDirContext)) { + if (ctx == null) { + throw new NoInitialContextException(); + } else { + throw new NotContextException( + "Not an instance of EventDirContext"); + } + } + + return (EventDirContext) ctx; + } + + @Override + protected EventDirContext getOriginal() throws NamingException { + return checkAndCast(super.getOriginal()); + } + + public void addNamingListener(Name target, int scope, NamingListener l) throws NamingException { + getOriginal().addNamingListener(target, scope, l); + } + + public void addNamingListener(String target, int scope, NamingListener l) throws NamingException { + getOriginal().addNamingListener(target, scope, l); + } + + public void removeNamingListener(NamingListener l) throws NamingException { + getOriginal().removeNamingListener(l); + } + + public boolean targetMustExist() throws NamingException { + return getOriginal().targetMustExist(); + } + + public void addNamingListener(Name target, String filter, SearchControls ctls, NamingListener l) + throws NamingException { + getOriginal().addNamingListener(target, filter, ctls, l); + } + + public void addNamingListener(String target, String filter, SearchControls ctls, NamingListener l) + throws NamingException { + getOriginal().addNamingListener(target, filter, ctls, l); + } + + public void + addNamingListener(Name target, String filter, Object[] filterArgs, SearchControls ctls, NamingListener l) + throws NamingException { + getOriginal().addNamingListener(target, filter, filterArgs, ctls, l); + } + + public void addNamingListener(String target, String filter, Object[] filterArgs, SearchControls ctls, + NamingListener l) throws NamingException { + getOriginal().addNamingListener(target, filter, filterArgs, ctls, l); + } + +} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringLdapContextDecorator.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringLdapContextDecorator.java new file mode 100644 index 0000000..c74df39 --- /dev/null +++ b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringLdapContextDecorator.java @@ -0,0 +1,94 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.jndi.context; + +import javax.naming.Context; +import javax.naming.NamingException; +import javax.naming.NoInitialContextException; +import javax.naming.NotContextException; +import javax.naming.ldap.Control; +import javax.naming.ldap.ExtendedRequest; +import javax.naming.ldap.ExtendedResponse; +import javax.naming.ldap.LdapContext; + +/** + * + * + * @author Lukas Krejci + */ +public class URLPreferringLdapContextDecorator extends URLPreferringDirContextDecorator implements LdapContext { + + private static final long serialVersionUID = 1L; + + public URLPreferringLdapContextDecorator() { + super(null); + } + + public URLPreferringLdapContextDecorator(LdapContext original) { + super(original); + } + + @Override + protected LdapContext checkAndCast(Context ctx) throws NamingException { + if (!(ctx instanceof LdapContext)) { + if (ctx == null) { + throw new NoInitialContextException(); + } else { + throw new NotContextException("Not an instance of LdapContext"); + } + } + + return (LdapContext) ctx; + } + + @Override + protected LdapContext getOriginal() throws NamingException { + return checkAndCast(super.getOriginal()); + } + + public ExtendedResponse extendedOperation(ExtendedRequest request) throws NamingException { + return getOriginal().extendedOperation(request); + } + + public LdapContext newInstance(Control[] requestControls) throws NamingException { + return new URLPreferringLdapContextDecorator(getOriginal().newInstance(requestControls)); + } + + public void reconnect(Control[] connCtls) throws NamingException { + getOriginal().reconnect(connCtls); + } + + public Control[] getConnectControls() throws NamingException { + return getOriginal().getConnectControls(); + } + + public void setRequestControls(Control[] requestControls) throws NamingException { + getOriginal().setRequestControls(requestControls); + } + + public Control[] getRequestControls() throws NamingException { + return getOriginal().getRequestControls(); + } + + public Control[] getResponseControls() throws NamingException { + return getOriginal().getResponseControls(); + } + +} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/mbean/AccessCheckingInitialContextFactoryBuilderInstaller.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/mbean/AccessCheckingInitialContextFactoryBuilderInstaller.java index 69571da..a1ccb4f 100644 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/mbean/AccessCheckingInitialContextFactoryBuilderInstaller.java +++ b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/mbean/AccessCheckingInitialContextFactoryBuilderInstaller.java @@ -24,7 +24,7 @@ import javax.naming.spi.NamingManager; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory;
-import org.rhq.enterprise.server.naming.AccessCheckingInitialContextFactoryBuilder; +import org.rhq.jndi.AccessCheckingInitialContextFactoryBuilder;
/** * diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/util/DecoratingInvocationHandler.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/util/DecoratingInvocationHandler.java new file mode 100644 index 0000000..1bfa7ac --- /dev/null +++ b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/util/DecoratingInvocationHandler.java @@ -0,0 +1,55 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.jndi.util; + +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.List; + +public class DecoratingInvocationHandler<Type, Decorator extends Type> implements InvocationHandler { + + private final List<DecoratorPicker<Type, Decorator>> pickers; + private Type object; + + public DecoratingInvocationHandler(List<DecoratorPicker<Type, Decorator>> pickers, Type object) { + this.pickers = pickers; + this.object = object; + } + + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + Type target = object; + Class<?> methodClass = method.getDeclaringClass(); + + for(DecoratorPicker<Type, Decorator> picker : pickers) { + target = picker.decorate(target, methodClass); + } + + try { + return method.invoke(target, args); + } catch (InvocationTargetException e) { + if (e.getCause() != null) { + throw e.getCause(); + } else { + throw e; + } + } + } +} \ No newline at end of file diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/util/DecoratorPicker.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/util/DecoratorPicker.java new file mode 100644 index 0000000..017d29f --- /dev/null +++ b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/util/DecoratorPicker.java @@ -0,0 +1,195 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.jndi.util; + +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +/** + * Given as set of decorators extending given type, this class can pick + * the most appropriate set of decorators for a class or a method call. + * <p> + * To configure the decorator, one has to provide a {@link DecoratorSetContext} that + * is then used to obtain the list of + * {@link DecoratorSetContext#getSupportedInterfaces() supported interfaces}, which are + * all the interfaces that should be used for decorator resolution (i.e. all other interfaces + * that a class might implement are ignored during decorator resolution), the list of + * {@link DecoratorSetContext#getDecoratorClasses() decorator classes}, which is a list + * of decorators the picker can choose from and is also used to instantiate and initialize + * the decorators. + * + * @author Lukas Krejci + */ +public class DecoratorPicker<Type, Decorator extends Type> { + + private DecoratorSetContext<Type, Decorator> context; + + public DecoratorSetContext<Type, Decorator> getContext() { + return context; + } + + public void setContext(DecoratorSetContext<Type, Decorator> decoratorSetContext) { + this.context = decoratorSetContext; + } + + /** + * Returns a set of decorators applicable for given method. The set is established based + * on the declaring class of the method. + * + * @param method the method to inspect + * @return the set of decorators that can be used to wrap a method call + * @throws Exception + */ + public Set<Decorator> getDecoratorsForMethod(Method method) throws Exception { + return getDecoratorsForClass_Private(method.getDeclaringClass()); + } + + /** + * Returns a set of decorators that can be used on instances of given class. + * @param cls the class to inspect + * @return + * @throws Exception + */ + public Set<Decorator> getDecoratorsForClass(Class<? extends Type> cls) throws Exception { + return getDecoratorsForClass_Private(cls); + } + + /** + * This method first establishes the set of decorators to use based on the class of the supplied + * object and then chains the decorators (in arbitrary order) with the supplied object at the + * "root" of the chain. + * <p> + * If a method is then called on the returned object, the methods of all the decorators are called + * in chain (each supposedly calling the next) and finally, at the end of the chain, the method on + * the original object (the one supplied to this method) is called. + * <p> + * Note that the above is only an intended behavior and actually depends on the implementation of + * the decorators that are resposinble for the chaining. Each decorator is initialized + * (@{link {@link DecoratorSetContext#init(Object, Object)} which should set it up for such chaining. + * + * @param object + * @return + * @throws Exception + */ + public Type decorate(Type object) throws Exception { + Set<Decorator> decs = getDecoratorsForClass_Private(object.getClass()); + Type ret = object; + for(Decorator d : decs) { + context.init(d, ret); + ret = d; + } + + return ret; + } + + /** + * Similar to {@link #decorate(Object)} but instead of the class of the object itself, + * uses the significantSuperClass as the basis for the decorator resolution. + * <p> + * This is important, because if the object implements two mutually incompatible sub-interfaces of <code>Type</code>, + * the chained decorators might fail to execute a method later on if the decorator depends on the upper part + * of the chain to implement certain sub-interface of <code>Type</code>. + * + * @param object the object to wrap in decorators + * @param significantSuperClass the class to base the decorator resolution on + * @return + * @throws Exception + */ + public Type decorate(Type object, Class<?> significantSuperClass) throws Exception { + Set<Decorator> decs = getDecoratorsForClass_Private(significantSuperClass); + Type ret = object; + for(Decorator d : decs) { + context.init(d, ret); + ret = d; + } + + return ret; + } + + private Set<Decorator> getDecoratorsForClass_Private(Class<?> cls) throws Exception { + Set<Class<? extends Type>> ifaces = getNearestApplicableInterfaces(cls); + + HashSet<Decorator> ret = new HashSet<Decorator>(); + + for (Class<? extends Type> iface : ifaces) { + for (Class<? extends Decorator> decClass : getMatch(iface)) { + ret.add(context.instantiate(decClass)); + } + } + + return ret; + } + + private Set<Class<? extends Type>> getNearestApplicableInterfaces(Class<?> cls) { + List<Class<? extends Type>> ifaces = new ArrayList<Class<? extends Type>>(getAllApplicableInterfaces(cls)); + + //now compact the set to only contain the most concrete interfaces + + Iterator<Class<? extends Type>> it = ifaces.iterator(); + while (it.hasNext()) { + Class<? extends Type> c = it.next(); + + for (int i = 0; i < ifaces.size(); ++i) { + Class<? extends Type> nextC = ifaces.get(i); + if (!c.equals(nextC) && c.isAssignableFrom(nextC)) { + it.remove(); + break; + } + } + } + + return new HashSet<Class<? extends Type>>(ifaces); + } + + private Set<Class<? extends Type>> getAllApplicableInterfaces(Class<?> cls) { + Set<Class<? extends Type>> ifaces = new HashSet<Class<? extends Type>>(); + + for (Class<? extends Type> iface : context.getSupportedInterfaces()) { + if (iface.isAssignableFrom(cls)) { + ifaces.add(iface); + } + } + + if (ifaces.isEmpty()) { + throw new IllegalArgumentException("Class " + cls + + " doesn't implement any of the applicable interfaces. Cannot find decorators for it."); + } + + return ifaces; + } + + private Set<Class<? extends Decorator>> getMatch(Class<?> targetIface) { + + Set<Class<? extends Decorator>> ret = new HashSet<Class<? extends Decorator>>(); + + for (Class<? extends Decorator> cls : context.getDecoratorClasses()) { + if (Arrays.asList(cls.getInterfaces()).contains(targetIface)) { + ret.add(cls); + } + } + + return ret; + } +} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/util/DecoratorSetContext.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/util/DecoratorSetContext.java new file mode 100644 index 0000000..d7b1676 --- /dev/null +++ b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/util/DecoratorSetContext.java @@ -0,0 +1,59 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.jndi.util; + +import java.util.Set; + +/** + * Implementations of this interface provide a context to the {@link DecoratorPicker}. + * + * @author Lukas Krejci + */ +public interface DecoratorSetContext<Type, Decorator> { + + /** + * @return the set of interfaces that the decorators are able support. + * Usually this should be just a union of all interfaces the decorators implement + * but can be trimmed down. + */ + Set<Class<? extends Type>> getSupportedInterfaces(); + + /** + * @return the set of all decorator classes in this set + */ + Set<Class<? extends Decorator>> getDecoratorClasses(); + + /** + * Instantiates a new decorator of given class. + * @param decoratorClass + * @return + * @throws Exception + */ + Decorator instantiate(Class<? extends Decorator> decoratorClass) throws Exception; + + /** + * Initializes the decorator to decorate given object. + * + * @param decorator + * @param object + * @throws Exception on error + */ + void init(Decorator decorator, Type object) throws Exception; +} diff --git a/modules/enterprise/server/container-lib/src/test/java/org/rhq/jndi/context/DecoratingInvocationHandlerTest.java b/modules/enterprise/server/container-lib/src/test/java/org/rhq/jndi/context/DecoratingInvocationHandlerTest.java new file mode 100644 index 0000000..45ba114 --- /dev/null +++ b/modules/enterprise/server/container-lib/src/test/java/org/rhq/jndi/context/DecoratingInvocationHandlerTest.java @@ -0,0 +1,145 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.jndi.context; + +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.Properties; +import java.util.Set; + +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.Name; +import javax.naming.NamingException; +import javax.naming.directory.DirContext; +import javax.naming.event.EventContext; +import javax.naming.event.NamingListener; +import javax.naming.spi.InitialContextFactory; +import javax.naming.spi.NamingManager; + +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +import org.rhq.jndi.AccessCheckingInitialContextFactoryBuilder; + +/** + * + * + * @author Lukas Krejci + */ +@Test +public class DecoratingInvocationHandlerTest { + private static final Set<String> INVOKED_METHODS = new HashSet<String>(); + + private static final InvocationHandler NOTE_TAKING_HANDLER = new InvocationHandler() { + + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + INVOKED_METHODS.add(method.getName()); + + if ("hashCode".equals(method.getName())) { + return 0; + } else if ("equals".equals(method.getName())) { + return false; + } + + return null; + } + }; + + private static Class<?>[] CONTEXT_INTERFACES; + + public static class Factory implements InitialContextFactory { + public Context getInitialContext(Hashtable<?, ?> environment) + throws NamingException { + + return (Context) Proxy.newProxyInstance(DecoratingInvocationHandlerTest.class.getClassLoader(), CONTEXT_INTERFACES, NOTE_TAKING_HANDLER); + } + } + + private static class DummyInitialEventContext extends InitialContext implements EventContext { + + /** + * @param environment + * @throws NamingException + */ + public DummyInitialEventContext(Hashtable<?, ?> environment) throws NamingException { + super(environment); + } + + public void addNamingListener(Name target, int scope, NamingListener l) throws NamingException { + ((EventContext)getURLOrDefaultInitCtx(target)).addNamingListener(target, scope, l); + } + + public void addNamingListener(String target, int scope, NamingListener l) throws NamingException { + ((EventContext)getURLOrDefaultInitCtx(target)).addNamingListener(target, scope, l); + } + + public void removeNamingListener(NamingListener l) throws NamingException { + ((EventContext)getDefaultInitCtx()).removeNamingListener(l); + } + + public boolean targetMustExist() throws NamingException { + return ((EventContext)getDefaultInitCtx()).targetMustExist(); + } + + + } + + @BeforeClass + public void setBuilder() throws Exception { + NamingManager.setInitialContextFactoryBuilder(new AccessCheckingInitialContextFactoryBuilder()); + } + + public void testSimpleDispatch() throws Exception { + INVOKED_METHODS.clear(); + Properties env = new Properties(); + env.put(Context.INITIAL_CONTEXT_FACTORY, Factory.class.getName()); + + CONTEXT_INTERFACES = new Class<?>[] { Context.class }; + + InitialContext ctx = new InitialContext(env); + + ctx.lookup("asdf"); + + assert INVOKED_METHODS.contains("lookup") : "The lookup doesn't seem to have propagated to the actual context to be used."; + } + + public void testMultiInterfaceDispatch() throws Exception { + INVOKED_METHODS.clear(); + Properties env = new Properties(); + env.put(Context.INITIAL_CONTEXT_FACTORY, Factory.class.getName()); + + CONTEXT_INTERFACES = new Class<?>[] { EventContext.class, DirContext.class }; + + InitialContext ctx = new InitialContext(env); + + ctx.lookup("asdf"); + + DummyInitialEventContext ectx = new DummyInitialEventContext(env); + + ectx.addNamingListener("hodiny", 0, null); + + assert INVOKED_METHODS.contains("lookup") : "The lookup doesn't seem to have propagated to the actual context to be used."; + assert INVOKED_METHODS.contains("addNamingListener") : "The addNamingListener doesn't seem to have propagated to the actual context to be used."; + } +} diff --git a/modules/enterprise/server/container-lib/src/test/java/org/rhq/jndi/context/DecoratorPickerTest.java b/modules/enterprise/server/container-lib/src/test/java/org/rhq/jndi/context/DecoratorPickerTest.java new file mode 100644 index 0000000..e2d7429 --- /dev/null +++ b/modules/enterprise/server/container-lib/src/test/java/org/rhq/jndi/context/DecoratorPickerTest.java @@ -0,0 +1,180 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.jndi.context; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertTrue; + +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +import javax.naming.Context; +import javax.naming.directory.DirContext; +import javax.naming.event.EventContext; +import javax.naming.ldap.LdapContext; + +import org.testng.annotations.Test; + +import org.rhq.jndi.util.DecoratorPicker; +import org.rhq.jndi.util.DecoratorSetContext; + +/** + * @author Lukas Krejci + */ +@Test +public class DecoratorPickerTest { + + private static final InvocationHandler DUMMY_HANDLER = new InvocationHandler() { + + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + if ("hashCode".equals(method.getName())) { + return 0; + } else if ("equals".equals(method.getName())) { + return false; + } + + return null; + } + }; + + private static final Class<?> TEST_OBJECT_CLASS1 = createProxyClass(Context.class); + private static final Class<?> TEST_OBJECT_CLASS2 = createProxyClass(DirContext.class); + private static final Class<?> TEST_OBJECT_CLASS3 = createProxyClass(LdapContext.class); + private static final Class<?> TEST_OBJECT_CLASS4 = createProxyClass(LdapContext.class, EventContext.class); + private static final Class<?> DECORATOR_CLASS1 = createProxyClass(Context.class); + private static final Class<?> DECORATOR_CLASS2 = createProxyClass(EventContext.class); + private static final Class<?> DECORATOR_CLASS3 = createProxyClass(LdapContext.class); + private static final Class<?> DECORATOR_CLASS4 = createProxyClass(DirContext.class); + + public void testSimpleDecoratorIdentifiedByClass() throws Exception { + DecoratorPicker<Object, Object> picker = createTestPicker(); + + Set<Object> contextDecorators = picker.getDecoratorsForClass(TEST_OBJECT_CLASS1); + assertEquals(contextDecorators.size(), 1, "Expected exactly one decorator for Context class"); + assertEquals(contextDecorators.iterator().next().getClass().getInterfaces()[0], Context.class); + } + + public void testSuperClassDecoratorHasPrecedenceOverSubClassDecorator() throws Exception { + DecoratorPicker<Object, Object> picker = createTestPicker(); + + //this tests that the LdapContext isn't returned even though it subclasses the DirContext + Set<Object> contextDecorators = picker.getDecoratorsForClass(TEST_OBJECT_CLASS2); + assertEquals(contextDecorators.size(), 1, "Expected exactly one decorator for DirContext class"); + assertEquals(contextDecorators.iterator().next().getClass().getInterfaces()[0], DirContext.class); + } + + public void testSubClassDecoratorCorrectlyIdentified() throws Exception { + DecoratorPicker<Object, Object> picker = createTestPicker(); + + Set<Object> contextDecorators = picker.getDecoratorsForClass(TEST_OBJECT_CLASS3); + assertEquals(contextDecorators.size(), 1, "Expected exactly one decorator for LdapContext class"); + assertEquals(contextDecorators.iterator().next().getClass().getInterfaces()[0], LdapContext.class); + } + + public void testMultipleDecoratorsDetectable() throws Exception { + DecoratorPicker<Object, Object> picker = createTestPicker(); + + Set<Object> decorators = picker.getDecoratorsForClass(TEST_OBJECT_CLASS4); + assertEquals(decorators.size(), 2, + "Exactly 2 decorators should have been found for a class implementing 2 interfaces."); + + boolean ldapContextDecoratorFound = false; + boolean eventContextDecoratorFound = false; + + for (Object d : decorators) { + if (LdapContext.class.isAssignableFrom(d.getClass())) { + ldapContextDecoratorFound = true; + continue; //just to make sure that somehow the decorator doesn't implement both + } + if (EventContext.class.isAssignableFrom(d.getClass())) { + eventContextDecoratorFound = true; + } + } + + assertTrue(ldapContextDecoratorFound && eventContextDecoratorFound, + "The found decorators don't implement the desired interfaces."); + } + + public void testDecoratorsIdentifiedByMethod() throws Exception { + DecoratorPicker<Object, Object> picker = createTestPicker(); + + Set<Object> decorators = + picker.getDecoratorsForMethod(LdapContext.class.getMethod("getConnectControls", (Class<?>[]) null)); + assertEquals(decorators.size(), 1, + "Expected exactly one decorator for method 'getConnectControls()' from LdapContext class"); + assertEquals(decorators.iterator().next().getClass().getInterfaces()[0], LdapContext.class); + } + + public void testMethodFromSubclassMatchesSubclassDecorator() throws Exception { + DecoratorPicker<Object, Object> picker = createTestPicker(); + + //this is a method from the DirContext but we're asking for it from a class + //that implements also an LdapContext + //The LdapContext decorator also inherits from the DirContext decorator + //(by the virtue of LdapContext interface inheriting from the DirContext) + //The picker should therefore match the LdapContext decorator because its + //the "closest" one to the actual class. + Set<Object> decorators = + picker.getDecoratorsForMethod(TEST_OBJECT_CLASS3.getMethod("getSchemaClassDefinition", + new Class<?>[] { String.class })); + assertEquals(decorators.size(), 1, + "Expected exactly one decorator for method 'getSchemaClassDefinition(String)' from LdapContext class"); + assertEquals(decorators.iterator().next().getClass().getInterfaces()[0], LdapContext.class); + } + + private static Class<?> createProxyClass(Class<?>... ifaces) { + return Proxy.getProxyClass(DecoratorPickerTest.class.getClassLoader(), ifaces); + } + + private static DecoratorPicker<Object, Object> createTestPicker() { + DecoratorPicker<Object, Object> picker = new DecoratorPicker<Object, Object>(); + + DecoratorSetContext<Object, Object> decSet = new DecoratorSetContext<Object, Object>() { + + public Object instantiate(Class<? extends Object> decoratorClass) throws Exception { + Constructor<? extends Object> ctor = decoratorClass.getConstructor(InvocationHandler.class); + return ctor.newInstance(DUMMY_HANDLER); + } + + public void init(Object decorator, Object object) throws Exception { + } + + @SuppressWarnings("unchecked") + public Set<Class<? extends Object>> getSupportedInterfaces() { + return new HashSet<Class<? extends Object>>(Arrays.asList(Context.class, EventContext.class, + LdapContext.class, DirContext.class)); + } + + @SuppressWarnings("unchecked") + public Set<Class<? extends Object>> getDecoratorClasses() { + return new HashSet<Class<? extends Object>>(Arrays.asList(DECORATOR_CLASS1, DECORATOR_CLASS2, DECORATOR_CLASS3, DECORATOR_CLASS4)); + } + }; + + picker.setContext(decSet); + + return picker; + } +} diff --git a/modules/enterprise/server/ear/src/main/application/META-INF/jboss-deployment-structure.xml b/modules/enterprise/server/ear/src/main/application/META-INF/jboss-deployment-structure.xml index f3d48d1..8c4ad54 100644 --- a/modules/enterprise/server/ear/src/main/application/META-INF/jboss-deployment-structure.xml +++ b/modules/enterprise/server/ear/src/main/application/META-INF/jboss-deployment-structure.xml @@ -16,7 +16,6 @@ <module name="org.dom4j" export="true" /> <!-- rhq ejb jar module declares this with runtime/provided scope --> <module name="javax.mail.api" export="true" /> <!-- for sending email notifications --> <module name="org.picketbox" export="true" /> <!-- for obfuscating passwords --> - <module name="org.jboss.as.naming" export="true" /> </dependencies> </deployment>
@@ -38,8 +37,6 @@ <module name="org.jboss.msc" export="true" /> <module name="org.jboss.as.controller" export="true" /> <module name="org.jboss.as.server" export="true" /> - <module name="org.jboss.modules" export="true" /> - <module name="org.jboss.as.naming" export="true" /> </dependencies> </sub-deployment>
diff --git a/modules/enterprise/server/itests-2/pom.xml b/modules/enterprise/server/itests-2/pom.xml index 30ccbe5..1b50266 100644 --- a/modules/enterprise/server/itests-2/pom.xml +++ b/modules/enterprise/server/itests-2/pom.xml @@ -23,7 +23,7 @@ <properties> <jboss.zip>${settings.localRepository}/org/jboss/as/jboss-as-dist/${jboss.version}/jboss-as-dist-${jboss.version}.zip</jboss.zip> <jboss.unzip.location>${basedir}/target/jboss-as-${jboss.version}</jboss.unzip.location> - <jboss.vm.args>-Xmx700m -XX:MaxPermSize=200m -Djava.security.manager -Djava.security.policy==${jboss.unzip.location}/security.policy</jboss.vm.args> + <jboss.vm.args>-Xmx700m -XX:MaxPermSize=200m</jboss.vm.args> <jboss.vm.args.debug></jboss.vm.args.debug> <!-- -Ditest.debug can override this, see below --> </properties>
@@ -223,13 +223,7 @@ <echo>Unzipping JBossAS ${jboss.version} found at ${jboss.zip}</echo> <unzip src="${jboss.zip}" dest="${jboss.unzip.location}/.." /> <echo>JBossAS ${jboss.version} should now be at: ${jboss.unzip.location}</echo> - - <echo>Copying security policy to JBossAS</echo> - <copy file="${project.build.directory}/test-classes/security.policy" tofile="${jboss.unzip.location}/security.policy"/> - - <property - name="jboss.conf" - location="${jboss.unzip.location}/standalone/configuration/standalone.xml" /> + <property name="jboss.conf" location="${jboss.unzip.location}/standalone/configuration/standalone.xml" /> <echo>Will now add test configuration to JBossAS config file: ${jboss.conf}</echo> <replace file="${jboss.conf}">
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/security/test/JndiAccessTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/security/test/JndiAccessTest.java index fabe6ae..274e94f 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/security/test/JndiAccessTest.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/security/test/JndiAccessTest.java @@ -24,7 +24,6 @@ import java.io.PrintWriter; import java.security.PermissionCollection; import java.util.Collections;
-import javax.naming.Context; import javax.script.ScriptEngine; import javax.script.ScriptException;
@@ -38,9 +37,10 @@ import org.rhq.bindings.util.PackageFinder; import org.rhq.core.domain.auth.Subject; import org.rhq.enterprise.client.LocalClient; import org.rhq.enterprise.server.RHQConstants; -import org.rhq.enterprise.server.system.SystemManagerBean; +import org.rhq.enterprise.server.auth.SubjectManagerBean; import org.rhq.enterprise.server.test.AbstractEJB3Test; import org.rhq.enterprise.server.util.LookupUtil; +import org.rhq.jndi.AllowRhqServerInternalsAccessPermission;
/** * @@ -50,21 +50,6 @@ import org.rhq.enterprise.server.util.LookupUtil; @Test public class JndiAccessTest extends AbstractEJB3Test {
- public void testScriptCantOverrideSystemProperties() throws Exception { - Subject overlord = LookupUtil.getSubjectManager().getOverlord(); - - ScriptEngine engine = getEngine(overlord); - - try { - engine.eval("java.lang.System.setProperty('java.naming.factory.url.pkgs', 'counterfeit');"); - } catch (ScriptException e) { - Assert.assertTrue( - e.getMessage().contains( - "access denied ("java.util.PropertyPermission" "java.naming.factory.url.pkgs" "write")"), - "The script shouldn't have write access to the system properties."); - } - } - public void testEjbsAccessibleThroughPrivilegedCode() { LookupUtil.getSubjectManager().getOverlord(); } @@ -82,18 +67,14 @@ public class JndiAccessTest extends AbstractEJB3Test {
ScriptEngine engine = getEngine(overlord);
- String jndiName = "java:global/rhq/rhq-enterprise-server-ejb3/" - + SystemManagerBean.class.getSimpleName() - + "!" - + SystemManagerBean.class.getName().replace("Bean", "Local"); + String jndiName = "java:global/rhq/rhq-enterprise-server-ejb3/" + SubjectManagerBean.class.getSimpleName() + + "!" + SubjectManagerBean.class.getName().replace("Bean", "Local");
try { engine.eval("" + "var ctx = new javax.naming.InitialContext();\n" - + "var systemManager = ctx.lookup('" - + jndiName - + "');\n" - + "systemManager.isDebugModeEnabled();"); + + "var subjectManager = ctx.lookup('" + jndiName + "');\n" + + "subjectManager.getOverlord();");
Assert.fail("The script shouldn't have been able to call local SLSB method."); } catch (ScriptException e) { @@ -101,51 +82,19 @@ public class JndiAccessTest extends AbstractEJB3Test { } }
- public void testLocalEjbsInaccessibleThroughJndiLookupWithCustomUrlPackages() throws ScriptException, IOException { - Subject overlord = LookupUtil.getSubjectManager().getOverlord(); - - ScriptEngine engine = getEngine(overlord); - - String jndiName = "java:global/rhq/rhq-enterprise-server-ejb3/" - + SystemManagerBean.class.getSimpleName() - + "!" - + SystemManagerBean.class.getName().replace("Bean", "Local"); - - try { - engine.eval("" - + "var env = new java.util.Hashtable();\n" - + "env.put('" - + Context.URL_PKG_PREFIXES - + "', 'org.jboss.as.naming.interfaces');\n" - + "var ctx = new javax.naming.InitialContext(env);\n" - + "var systemManager = ctx.lookup('" - + jndiName - + "');\n" - + "systemManager.isDebugModeEnabled();"); - - Assert.fail("The script shouldn't have been able to call local SLSB method."); - } catch (ScriptException e) { - checkIsDesiredSecurityException(e); - } - } - public void testRemoteEjbsInaccessibleThroughJndiLookup() throws ScriptException, IOException { Subject overlord = LookupUtil.getSubjectManager().getOverlord();
ScriptEngine engine = getEngine(overlord);
- String jndiName = "java:global/rhq/rhq-enterprise-server-ejb3/" - + SystemManagerBean.class.getSimpleName() - + "!" - + SystemManagerBean.class.getName().replace("Bean", "Remote"); + String jndiName = "java:global/rhq/rhq-enterprise-server-ejb3/" + SubjectManagerBean.class.getSimpleName() + + "!" + SubjectManagerBean.class.getName().replace("Bean", "Remote");
try { engine.eval("" + "var ctx = new javax.naming.InitialContext();\n" - + "var systemManager = ctx.lookup('" - + jndiName - + "');\n" - + "systemManager.getSystemSettings(subject);"); + + "var subjectManager = ctx.lookup('" + jndiName + "');\n" + + "subjectManager.getSubjectByName('rhqadmin');");
Assert.fail("The script shouldn't have been able to call remote SLSB method directly."); } catch (ScriptException e) { @@ -249,29 +198,7 @@ public class JndiAccessTest extends AbstractEJB3Test { checkIsNotASecurityException(e); } } - - //THIS IS A NEW REQUIREMENT THAT DOESN'T CURRENTLY WORK... - // public void testInitialContextFactoryBuilderNotReplaceableUsingScripts() throws Exception { - // Subject overlord = LookupUtil.getSubjectManager().getOverlord(); - // - // ScriptEngine engine = getEngine(overlord); - // - // try { - // engine.eval("" - // + "var mgrCls = java.lang.Class.forName('javax.naming.spi.NamingManager');\n" - // + "var fld = mgrCls.getDeclaredField('initctx_factory_builder');\n" - // + "fld.setAccessible(true);\n" - // + "fld.set(null, null);\n"); - // - // Assert.fail("It should not be possible to use reflection to reset the initial context factory builder."); - // } catch (ScriptException e) { - // checkIsDesiredSecurityException(e); - // } finally { - // //restore the default behavior - // NamingHack.bruteForceInitialContextFactoryBuilder(); - // } - // } - + private ScriptEngine getEngine(Subject subject) throws ScriptException, IOException { StandardBindings bindings = new StandardBindings(new PrintWriter(System.out), new LocalClient(subject));
@@ -283,25 +210,15 @@ public class JndiAccessTest extends AbstractEJB3Test {
private static void checkIsDesiredSecurityException(ScriptException e) { String message = e.getMessage(); - String permissionTrace = "org.rhq.allow.server.internals.access"; + String permissionTrace = AllowRhqServerInternalsAccessPermission.class.getName();
- if (!message.contains(permissionTrace)) { - Assert - .fail( - "The script exception doesn't seem to be caused by the AllowRhqServerInternalsAccessPermission security exception. ", - e); - } + Assert.assertTrue(message.contains(permissionTrace), "The script exception doesn't seem to be caused by the AllowRhqServerInternalsAccessPermission security exception. " + message); }
private static void checkIsNotASecurityException(ScriptException e) { String message = e.getMessage(); - String permissionTrace = "org.rhq.allow.server.internals.access"; + String permissionTrace = AllowRhqServerInternalsAccessPermission.class.getName();
- if (message.contains(permissionTrace)) { - Assert - .fail( - "The script exception does seem to be caused by the AllowRhqServerInternalsAccessPermission security exception although it shouldn't. ", - e); - } + Assert.assertFalse(message.contains(permissionTrace), "The script exception does seem to be caused by the AllowRhqServerInternalsAccessPermission security exception although it shouldn't. " + message); } } diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java index f27a5ba..f1ba91f 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java @@ -39,7 +39,6 @@ import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ArchivePaths; import org.jboss.shrinkwrap.api.Filters; import org.jboss.shrinkwrap.api.ShrinkWrap; -import org.jboss.shrinkwrap.api.asset.ClassAsset; import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.exporter.ZipExporter; import org.jboss.shrinkwrap.api.spec.EnterpriseArchive; @@ -309,13 +308,6 @@ public abstract class AbstractEJB3Test extends Arquillian { testEar.delete(ArchivePaths .create("/rhq-enterprise-server-ejb3.jar/org/rhq/enterprise/server/core/ShutdownListener.class"));
- //replace the above startup beans with stripped down versions - testEar.add(new ClassAsset(StrippedDownStartupBean.class), ArchivePaths - .create("/rhq-enterprise-server-ejb3.jar/org/rhq/enterprise/server/test/StrippedDownStartupBean.class")); - testEar.add(new ClassAsset(StrippedDownStartupBeanPreparation.class), ArchivePaths - .create("/rhq-enterprise-server-ejb3.jar/org/rhq/enterprise/server/test/" - + "StrippedDownStartupBeanPreparation.class")); - // add the test classes to the deployment testEar.addAsLibrary(testClassesJar);
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/StrippedDownStartupBean.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/StrippedDownStartupBean.java deleted file mode 100644 index bfe9f32..0000000 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/StrippedDownStartupBean.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * RHQ Management Platform - * Copyright 2012, Red Hat Middleware LLC, and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -package org.rhq.enterprise.server.test; - -import javax.ejb.Singleton; -import javax.ejb.TransactionAttribute; -import javax.ejb.TransactionAttributeType; - -import org.rhq.enterprise.server.core.StartupBean; -import org.rhq.enterprise.server.naming.NamingHack; - -/** - * This is a replacement for the fullblown {@link StartupBean} of the actual RHQ server. - * @author Lukas Krejci - */ -@Singleton -public class StrippedDownStartupBean { - - @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) - public void secureNaming() { - NamingHack.bruteForceInitialContextFactoryBuilder(); - } - - public void init() { - secureNaming(); - } -} diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/StrippedDownStartupBeanPreparation.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/StrippedDownStartupBeanPreparation.java deleted file mode 100644 index e32d8a4..0000000 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/StrippedDownStartupBeanPreparation.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * RHQ Management Platform - * Copyright 2012, Red Hat Middleware LLC, and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -package org.rhq.enterprise.server.test; - -import javax.annotation.PostConstruct; -import javax.annotation.Resource; -import javax.ejb.EJB; -import javax.ejb.Singleton; -import javax.ejb.Startup; -import javax.ejb.Timeout; -import javax.ejb.TimerConfig; -import javax.ejb.TimerService; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * This startup singleton EJB is here to work around bug AS7-5530 and to - * schedule the real StartupBean's work in a delayed fashion (this is to allow - * AS7 to complete its deployment work before we do our work). - * - * See https://issues.jboss.org/browse/AS7-5530 - * - * This version is a replacement for the original code (identical) code that uses the StrippedDownStartupBean instead - * of the fullblown original. - */ -@Singleton -@Startup -public class StrippedDownStartupBeanPreparation { - private Log log = LogFactory.getLog(this.getClass()); - - @EJB - private StrippedDownStartupBean startupBean; - - @Resource - private TimerService timerService; // needed to schedule our startup bean init call - - @PostConstruct - public void initWithTransactionBecauseAS75530() throws RuntimeException { - log.info("Scheduling the initialization of the testing RHQ deployment"); - timerService.createSingleActionTimer(1, new TimerConfig(null, false)); // call StartupBean in 1ms - } - - @Timeout - public void initializeServer() throws RuntimeException { - try { - log.info("Initializing the testing RHQ deployment"); - this.startupBean.init(); - } catch (Throwable t) { - // do NOT allow exceptions to bubble out of our method because then - // the EJB container would simply re-trigger the timer and call us again - // and we don't want to keep failing over and over filling the logs - // in an infinite loop. - log.fatal("The server failed to start up properly", t); - } - } -} diff --git a/modules/enterprise/server/itests-2/src/test/resources/security.policy b/modules/enterprise/server/itests-2/src/test/resources/security.policy deleted file mode 100644 index 8860b47..0000000 --- a/modules/enterprise/server/itests-2/src/test/resources/security.policy +++ /dev/null @@ -1,10 +0,0 @@ -// We need the SecurityManager installed to enable sandboxing of CLI scripts -// but we don't define any other security measures on the RHQ server itself. -// -// Granting all permissions allows us to run the RHQ server as if no security -// manager was in place (which is assumed by default by JBoss AS) but be able -// to use it when we need it for our own purposes. - -grant { - permission java.security.AllPermission; -}; diff --git a/modules/enterprise/server/jar/pom.xml b/modules/enterprise/server/jar/pom.xml index 760b68c..dae3778 100644 --- a/modules/enterprise/server/jar/pom.xml +++ b/modules/enterprise/server/jar/pom.xml @@ -112,14 +112,10 @@ <dependency> <groupId>org.jboss.as</groupId> <artifactId>jboss-as-server</artifactId> + <version>${jboss.version}</version> <scope>provided</scope> <!-- provided by AS7 --> </dependency>
- <dependency> - <groupId>org.jboss.as</groupId> - <artifactId>jboss-as-naming</artifactId> - <scope>provided</scope> <!-- provided by AS7 --> - </dependency>
<!--================ Test Deps ================-->
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/AllowRhqServerInternalsAccessPermission.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/AllowRhqServerInternalsAccessPermission.java deleted file mode 100644 index d448049..0000000 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/AllowRhqServerInternalsAccessPermission.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2011 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; - -import java.security.BasicPermission; - -/** - * - * - * @author Lukas Krejci - */ -public class AllowRhqServerInternalsAccessPermission extends BasicPermission { - - private static final long serialVersionUID = 1L; - - public AllowRhqServerInternalsAccessPermission() { - super("org.rhq.allow.server.internals.access"); - } -} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SessionManager.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SessionManager.java index 8819cab..ecf2f6f 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SessionManager.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SessionManager.java @@ -25,8 +25,8 @@ import java.util.Map; import java.util.Random;
import org.rhq.core.domain.auth.Subject; -import org.rhq.enterprise.server.AllowRhqServerInternalsAccessPermission; import org.rhq.enterprise.server.util.LookupUtil; +import org.rhq.jndi.AllowRhqServerInternalsAccessPermission;
/** * This is the JON Server's own session ID generator. It is outside any container-provided session mechanism. Its sole diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java index cb46440..9e92a69 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java @@ -65,7 +65,6 @@ import org.rhq.enterprise.server.cloud.instance.ServerManagerLocal; import org.rhq.enterprise.server.cloud.instance.SyncEndpointAddressException; import org.rhq.enterprise.server.core.comm.ServerCommunicationsServiceUtil; import org.rhq.enterprise.server.core.plugin.PluginDeploymentScannerMBean; -import org.rhq.enterprise.server.naming.NamingHack; import org.rhq.enterprise.server.plugin.pc.MasterServerPluginContainer; import org.rhq.enterprise.server.plugin.pc.ServerPluginServiceMBean; import org.rhq.enterprise.server.resource.ResourceTypeManagerLocal; @@ -132,16 +131,6 @@ public class StartupBean { private DataSource dataSource;
/** - * Modifies the naming subsystem to be able to check for Java security permissions on JNDI lookup. - * <p> - * Made public so that this can be reused in tests. - */ - @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) - public void secureNaming() { - NamingHack.bruteForceInitialContextFactoryBuilder(); - } - - /** * Performs the final RHQ Server initialization work that needs to talk place. EJBs are available in this method. * * @throws RuntimeException @@ -149,8 +138,6 @@ public class StartupBean { //@PostConstruct // when AS7-5530 is fixed, uncomment this and remove class StartupBeanToWorkaroundAS7_5530 @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) public void init() throws RuntimeException { - secureNaming(); - initialized = false;
log.info("All business tier deployments are complete - finishing the startup..."); @@ -794,4 +781,5 @@ public class StartupBean { + ") Server started."); log.info("--------------------------------------------------"); // 50 dashes } + } diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/AccessCheckingInitialContextFactoryBuilder.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/AccessCheckingInitialContextFactoryBuilder.java deleted file mode 100644 index 9681014..0000000 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/AccessCheckingInitialContextFactoryBuilder.java +++ /dev/null @@ -1,295 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2011 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.naming; - -import java.net.InetAddress; -import java.net.NetworkInterface; -import java.net.SocketException; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.UnknownHostException; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.ArrayList; -import java.util.Collections; -import java.util.EnumMap; -import java.util.Enumeration; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.Set; - -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.NamingException; -import javax.naming.directory.DirContext; -import javax.naming.event.EventContext; -import javax.naming.event.EventDirContext; -import javax.naming.ldap.LdapContext; -import javax.naming.spi.InitialContextFactory; -import javax.naming.spi.InitialContextFactoryBuilder; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import org.rhq.enterprise.server.AllowRhqServerInternalsAccessPermission; -import org.rhq.enterprise.server.naming.context.AccessCheckingContextDecorator; -import org.rhq.enterprise.server.naming.context.AccessCheckingContextDecoratorSetContext; -import org.rhq.enterprise.server.naming.context.ContextDecorator; -import org.rhq.enterprise.server.naming.context.URLPreferringContextDecoratorSetContext; -import org.rhq.enterprise.server.naming.util.DecoratorPicker; - -/** - * This initial context factory builder is installed early on during the RHQ server startup - * and is later on used for obtaining the {@link Context}s for all JNDI lookups in the - * RHQ server. - * <p> - * We use a custom initial context factory builder to prevent the potential malicious 3rd party - * code (like CLI alert scripts) from supplying custom environment variables to {@link InitialContext} - * that would modify the JNDI lookup to skip our security access checks. - * <p> - * By using a builder we effectively take control of the initial context creation process - * and are free to ignore whatever the script is trying to supply. - * <p> - * This builder makes sure to install the RHQ server's security access checks to whatever - * initial context that is configured by the standard environment variables - * ({@link Context#INITIAL_CONTEXT_FACTORY}, etc.) - * - * @see AllowRhqServerInternalsAccessPermission - * - * @author Lukas Krejci - */ -public class AccessCheckingInitialContextFactoryBuilder implements InitialContextFactoryBuilder { - private static final Log LOG = LogFactory.getLog(AccessCheckingInitialContextFactoryBuilder.class); - - /** - * The list of JNDI name schemes that should be checked for security permissions - * (in addition to the names with no scheme). - * - * @see AccessCheckingContextDecorator - */ - private static final String[] CHECKED_SCHEMES = { "java" }; - - private static final Set<Class<? extends Context>> SUPPORTED_CONTEXT_INTERFACES; - - static { - SUPPORTED_CONTEXT_INTERFACES = new HashSet<Class<? extends Context>>(); - SUPPORTED_CONTEXT_INTERFACES.add(Context.class); - SUPPORTED_CONTEXT_INTERFACES.add(DirContext.class); - SUPPORTED_CONTEXT_INTERFACES.add(EventContext.class); - SUPPORTED_CONTEXT_INTERFACES.add(EventDirContext.class); - SUPPORTED_CONTEXT_INTERFACES.add(LdapContext.class); - } - - private static final Set<InetAddress> SERVER_BIND_IPS; - static { - SERVER_BIND_IPS = new HashSet<InetAddress>(); - - try { - String bindingAddressString = System.getProperty("jboss.bind.address"); - InetAddress bindingAddress = InetAddress.getByName(bindingAddressString); - - if (bindingAddress.isAnyLocalAddress()) { - Enumeration<NetworkInterface> ifaces = NetworkInterface.getNetworkInterfaces(); - while (ifaces.hasMoreElements()) { - NetworkInterface iface = ifaces.nextElement(); - SERVER_BIND_IPS.addAll(Collections.list(iface.getInetAddresses())); - } - } else { - SERVER_BIND_IPS.add(bindingAddress); - } - } catch (SocketException e) { - LOG.error("Could not obtain the list of local IPs", e); - } catch (UnknownHostException e) { - LOG.error("Failed to get the binding address of the RHQ server.", e); - } - } - - //TODO this most probably no longer applies because AS7 doesn't use JNP for JNDI - private static final int JNP_PORT = Integer.parseInt(System.getProperty("rhq.server.startup.namingservice.port", - "2099")); - - private static InitialContextFactory getJbossDefaultInitialContextFactory() throws NamingException { - try { - Class<?> cls = Class.forName("org.jboss.as.naming.InitialContextFactory"); - return (InitialContextFactory) cls.newInstance(); - } catch (Exception e) { - NamingException ne = new NamingException( - "Failed to obtain the default initial context factory from JBoss AS."); - ne.initCause(e); - - throw ne; - } - } - - private enum FactoryType { - ACCESS_CHECKING { - - @Override - public InitialContextFactory wrap(InitialContextFactory factory) { - ArrayList<DecoratorPicker<Context, ContextDecorator>> pickers = new ArrayList<DecoratorPicker<Context, ContextDecorator>>(); - pickers.add(getURLPreferringDecoratorPicker()); - pickers.add(getAccessCheckingDecoratorPicker()); - - return new DecoratingInitialContextFactory(factory, pickers); - } - }, - URL_PREFERRING { - - @Override - public InitialContextFactory wrap(InitialContextFactory factory) { - ArrayList<DecoratorPicker<Context, ContextDecorator>> pickers = new ArrayList<DecoratorPicker<Context, ContextDecorator>>(); - pickers.add(getURLPreferringDecoratorPicker()); - - return new DecoratingInitialContextFactory(factory, pickers); - } - }; - - public abstract InitialContextFactory wrap(InitialContextFactory factory); - - public static FactoryType detect(Hashtable<?, ?> environment) { - String providerUrl = (String) environment.get(Context.PROVIDER_URL); - - if (providerUrl == null) { - return ACCESS_CHECKING; - } else { - try { - URI uri = new URI(providerUrl); - InetAddress providerHost = InetAddress.getByName(uri.getHost()); - - //check if we are accessing the RHQ server through some remoting - //interface. - if (uri.getPort() == JNP_PORT && SERVER_BIND_IPS.contains(providerHost)) { - return ACCESS_CHECKING; - } else { - return URL_PREFERRING; - } - } catch (URISyntaxException e) { - if (LOG.isDebugEnabled()) { - LOG.debug("The " - + Context.PROVIDER_URL - + " is not a valid URI. Falling back to using the access checking wrapper.", e); - } - return ACCESS_CHECKING; - } catch (UnknownHostException e) { - //let the factory deal with the unknown host... - //this most probably shouldn't be secured because localhost addresses - //should be resolvable. - if (LOG.isDebugEnabled()) { - LOG.debug("The " - + Context.PROVIDER_URL - + " is not resolvable. Falling back to using the URL preferring wrapper.", e); - } - return URL_PREFERRING; - } - } - } - - private static DecoratorPicker<Context, ContextDecorator> getAccessCheckingDecoratorPicker() { - DecoratorPicker<Context, ContextDecorator> ret = new DecoratorPicker<Context, ContextDecorator>(); - ret.setContext(new AccessCheckingContextDecoratorSetContext(SUPPORTED_CONTEXT_INTERFACES, CHECKED_SCHEMES)); - - return ret; - } - - private static DecoratorPicker<Context, ContextDecorator> getURLPreferringDecoratorPicker() { - DecoratorPicker<Context, ContextDecorator> ret = new DecoratorPicker<Context, ContextDecorator>(); - ret.setContext(new URLPreferringContextDecoratorSetContext(SUPPORTED_CONTEXT_INTERFACES)); - - return ret; - } - } - - private final EnumMap<FactoryType, InitialContextFactory> typeDefaults = new EnumMap<FactoryType, InitialContextFactory>( - FactoryType.class); - - private final String defaultFactoryClassName; - - /** - * @param defaultFactory the default factory to use if none can be deduced from the environment. If null, an attempt - * is made to obtain the default InitialContextFactory of JBoss AS (which may fail depending on the classloading - * "situation"). - * - * @throws NamingException - */ - public AccessCheckingInitialContextFactoryBuilder(InitialContextFactory defaultFactory) throws NamingException { - if (defaultFactory == null) { - defaultFactory = getJbossDefaultInitialContextFactory(); - } - - defaultFactoryClassName = defaultFactory.getClass().getName(); - - for (FactoryType ft : FactoryType.values()) { - typeDefaults.put(ft, ft.wrap(defaultFactory)); - } - } - - /** - * This is the default initial context factory that is returned when no other is - * configured using the environment variables. - * <p> - * It uses {@link NamingContextFactory} as the underlying mechanism - the same - * as the default configuration in JBoss 4. - */ - private final InitialContextFactory defaultFactory = new InitialContextFactory() { - public Context getInitialContext(Hashtable<?, ?> environment) throws NamingException { - return typeDefaults.get(FactoryType.detect(environment)).getInitialContext( - environment); - } - }; - - /** - * Create a InitialContext factory. If the environment does not override the factory class it will use the - * default context factory. - * - * @param environment The environment - * @return An initial context factory - * @throws NamingException If an error occurs loading the factory class. - */ - public InitialContextFactory createInitialContextFactory(Hashtable<?, ?> environment) throws NamingException { - final String factoryClassName = (String) environment.get(Context.INITIAL_CONTEXT_FACTORY); - if (factoryClassName == null || factoryClassName.equals(defaultFactoryClassName)) { - if (LOG.isDebugEnabled()) { - LOG.debug("No " + Context.INITIAL_CONTEXT_FACTORY + " set. Using the default factory."); - } - return defaultFactory; - } - final ClassLoader classLoader = getContextClassLoader(); - try { - final Class<?> factoryClass = Class.forName(factoryClassName, true, classLoader); - InitialContextFactory configuredFactory = (InitialContextFactory) factoryClass.newInstance(); - return FactoryType.detect(environment).wrap(configuredFactory); - } catch (Exception e) { - NamingException ne = new NamingException("Failed instantiate InitialContextFactory " - + factoryClassName - + " from classloader " - + classLoader); - ne.initCause(e); - - throw ne; - } - } - - private ClassLoader getContextClassLoader() { - return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() { - public ClassLoader run() { - return Thread.currentThread().getContextClassLoader(); - } - }); - } -} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/DecoratingInitialContextFactory.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/DecoratingInitialContextFactory.java deleted file mode 100644 index 602a68c..0000000 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/DecoratingInitialContextFactory.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.naming; - -import java.lang.reflect.Proxy; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.List; -import java.util.Set; - -import javax.naming.Context; -import javax.naming.NamingException; -import javax.naming.spi.InitialContextFactory; - -import org.rhq.enterprise.server.naming.context.ContextDecorator; -import org.rhq.enterprise.server.naming.util.DecoratingInvocationHandler; -import org.rhq.enterprise.server.naming.util.DecoratorPicker; - -/** - * This class implements an initial context factory that decorates the contexts - * returned from a "wrapped" initial factory passed to this class in the constructor. - * <p> - * The contexts returned from the wrapped initial factory are hidden behind a proxy - * that implements the intersection of interfaces from the <code>supportedContextInterfaces</code> - * constructor parameter and the actual interfaces the wrapped context implements. - * <p> - * The proxy method calls are handled using the {@link DecoratingInvocationHandler} which is initialized - * with the list of {@link DecoratorPicker pickers} that are used to intercept the method - * calls on the wrapped context. - * - * @see DecoratorPicker - * @see DecoratingInvocationHandler - * - * @author Lukas Krejci - */ -public class DecoratingInitialContextFactory implements InitialContextFactory { - - List<DecoratorPicker<Context, ContextDecorator>> pickers; - private InitialContextFactory factory; - private Set<Class<? extends Context>> supportedContextInterfaces; - - public DecoratingInitialContextFactory(InitialContextFactory factory, List<DecoratorPicker<Context, ContextDecorator>> decoratorPickers) { - this.factory = factory; - this.pickers = decoratorPickers; - this.supportedContextInterfaces = new HashSet<Class<? extends Context>>(); - for(DecoratorPicker<Context, ContextDecorator> picker : pickers) { - supportedContextInterfaces.addAll(picker.getContext().getSupportedInterfaces()); - } - } - - public Context getInitialContext(Hashtable<?, ?> environment) throws NamingException { - Context ctx = factory.getInitialContext(environment); - - Set<Class<?>> implementedIfaces = getAllImplementedInterfaces(ctx.getClass()); - Class<?>[] ii = new Class<?>[implementedIfaces.size()]; - implementedIfaces.toArray(ii); - - return (Context) Proxy.newProxyInstance(ctx.getClass().getClassLoader(), ii, new DecoratingInvocationHandler<Context, ContextDecorator>(pickers, ctx)); - } - - private Set<Class<?>> getAllImplementedInterfaces(Class<?> cls) { - HashSet<Class<?>> ret = new HashSet<Class<?>>(); - getAllImplementedInterfaces(cls, ret); - - ret.retainAll(supportedContextInterfaces); - - return ret; - } - - private static void getAllImplementedInterfaces(Class<?> cls, Set<Class<?>> output) { - Class<?>[] ifaces = cls.getInterfaces(); - - for (Class<?> iface : Arrays.asList(ifaces)) { - output.add(iface); - getAllImplementedInterfaces(iface, output); - } - - if (cls.getSuperclass() != null) { - getAllImplementedInterfaces(cls.getSuperclass(), output); - } - } - - @Override - public int hashCode() { - return factory.hashCode(); - } - - @Override - public boolean equals(Object o) { - return factory.equals(o); - } -} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/NamingHack.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/NamingHack.java deleted file mode 100644 index b9ff8a9..0000000 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/NamingHack.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * RHQ Management Platform - * Copyright 2012, Red Hat Middleware LLC, and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -package org.rhq.enterprise.server.naming; - -import java.lang.reflect.Field; -import java.util.Hashtable; - -import javax.naming.spi.InitialContextFactory; -import javax.naming.spi.InitialContextFactoryBuilder; -import javax.naming.spi.NamingManager; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * @author Lukas Krejci - */ -public class NamingHack { - - private static final Log LOG = LogFactory.getLog(NamingHack.class); - - //in case this method is called multiple times, which can happen during the tests, - //remember the builder encountered the first time... - private static InitialContextFactoryBuilder originalBuilder; - - public static void bruteForceInitialContextFactoryBuilder() { - LOG.info("Hacking the naming subsystem to enable secure execution of scripts inside the server..."); - - //it is important to synchronize on the NamingManager class because the get/setInitialContextFactoryBuilder - //methods in that class are static synchronized. By holding the lock on the NamingManager class we prevent - //any other thread to check for the initial context factory builder (and therefore de-facto do any JNDI lookup). - synchronized (NamingManager.class) { - - if (NamingManager.hasInitialContextFactoryBuilder()) { - //if anyone ever changes the implementation of the NamingManager, we will break here... - //but as of now, we have no other option but to do this and wait for JBAS-XXX to be resolved and - //incorporated into our underlying container - - try { - Field f = NamingManager.class.getDeclaredField("initctx_factory_builder"); - f.setAccessible(true); - - if (originalBuilder == null) { - originalBuilder = (InitialContextFactoryBuilder) f.get(null); - } - - f.set(null, null); - } catch (Exception e) { - LOG.error( - "Failed to install a custom initial context factory builder. RHQ installation is unsecure!", e); - - return; - } - } - - try { - InitialContextFactory defaultFactory = null; - if (originalBuilder != null) { - defaultFactory = originalBuilder - .createInitialContextFactory(new Hashtable<String, String>()); - } - - NamingManager.setInitialContextFactoryBuilder(new AccessCheckingInitialContextFactoryBuilder( - defaultFactory)); - } catch (Exception e) { - LOG.error("Failed to install a custom initial context factory builder. RHQ installation is unsecure!", - e); - - if (originalBuilder != null) { - if (LOG.isDebugEnabled()) { - LOG.debug("Trying to restore the original initial context factory builder: " + originalBuilder); - } - - try { - NamingManager.setInitialContextFactoryBuilder(originalBuilder); - } catch (Exception e2) { - LOG.error("Failed to restore the original initial context factory builder. The JNDI lookup may" - + " not function properly from this point on...", e2); - } - } - } - } - } - -} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingContextDecorator.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingContextDecorator.java deleted file mode 100644 index 0697003..0000000 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingContextDecorator.java +++ /dev/null @@ -1,264 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2011 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.naming.context; - -import java.io.Serializable; -import java.util.Arrays; -import java.util.Hashtable; -import java.util.List; - -import javax.naming.Binding; -import javax.naming.Context; -import javax.naming.Name; -import javax.naming.NameClassPair; -import javax.naming.NameParser; -import javax.naming.NamingEnumeration; -import javax.naming.NamingException; - -import org.rhq.enterprise.server.AllowRhqServerInternalsAccessPermission; - -/** - * This is the "meat" of the RHQ's secured JNDI access. This {@link Context} decorator - * applied security checks in each method (lookups, (un)bindings, etc). - * <p> - * The security check consists of checking if the current callstack has the {@link AllowRhqServerInternalsAccessPermission}. - * <p> - * This decorator applies the security check on any JNDI name without a scheme and - * on any name that has a scheme listed in the {@link #checkedSchemes} list supplied - * in the constructor. - * - * @author Lukas Krejci - */ -public class AccessCheckingContextDecorator implements Context, ContextDecorator, Serializable { - - private static final long serialVersionUID = 1L; - - private static final AllowRhqServerInternalsAccessPermission PERM = new AllowRhqServerInternalsAccessPermission(); - private Context original; - private List<String> checkedSchemes; - - public AccessCheckingContextDecorator(String... checkedSchemes) { - this.checkedSchemes = Arrays.asList(checkedSchemes); - } - - public AccessCheckingContextDecorator(Context original, String... checkedSchemes) { - this.original = original; - this.checkedSchemes = Arrays.asList(checkedSchemes); - } - - public void init(Context ctx) { - this.original = ctx; - } - - protected Context getOriginal() { - return original; - } - - protected static void check() { - SecurityManager sm = System.getSecurityManager(); - if (sm != null) sm.checkPermission(PERM); - } - - private void checkScheme(String scheme) { - if (scheme == null || checkedSchemes.contains(scheme)) { - check(); - } - } - - protected void check(String name) { - checkScheme(getURLScheme(name)); - } - - protected void check(Name name) { - if (name.size() == 0) { - check(); - } else { - String first = name.get(0); - checkScheme(getURLScheme(first)); - } - } - - public Object lookup(Name name) throws NamingException { - check(name); - return original.lookup(name); - } - - public Object lookup(String name) throws NamingException { - check(name); - return original.lookup(name); - } - - public void bind(Name name, Object obj) throws NamingException { - check(name); - original.bind(name, obj); - } - - public void bind(String name, Object obj) throws NamingException { - check(name); - original.bind(name, obj); - } - - public void rebind(Name name, Object obj) throws NamingException { - check(name); - original.rebind(name, obj); - } - - public void rebind(String name, Object obj) throws NamingException { - check(name); - original.rebind(name, obj); - } - - public void unbind(Name name) throws NamingException { - check(name); - original.unbind(name); - } - - public void unbind(String name) throws NamingException { - check(name); - original.unbind(name); - } - - public void rename(Name oldName, Name newName) throws NamingException { - check(oldName); - check(newName); - original.rename(oldName, newName); - } - - public void rename(String oldName, String newName) throws NamingException { - check(oldName); - check(newName); - original.rename(oldName, newName); - } - - public NamingEnumeration<NameClassPair> list(Name name) throws NamingException { - check(name); - return original.list(name); - } - - public NamingEnumeration<NameClassPair> list(String name) throws NamingException { - check(name); - return original.list(name); - } - - public NamingEnumeration<Binding> listBindings(Name name) throws NamingException { - check(name); - return original.listBindings(name); - } - - public NamingEnumeration<Binding> listBindings(String name) throws NamingException { - check(name); - return original.listBindings(name); - } - - public void destroySubcontext(Name name) throws NamingException { - check(name); - original.destroySubcontext(name); - } - - public void destroySubcontext(String name) throws NamingException { - check(name); - original.destroySubcontext(name); - } - - public Context createSubcontext(Name name) throws NamingException { - check(name); - return original.createSubcontext(name); - } - - public Context createSubcontext(String name) throws NamingException { - check(name); - return original.createSubcontext(name); - } - - public Object lookupLink(Name name) throws NamingException { - check(name); - return original.lookupLink(name); - } - - public Object lookupLink(String name) throws NamingException { - check(name); - return original.lookupLink(name); - } - - public NameParser getNameParser(Name name) throws NamingException { - check(name); - return original.getNameParser(name); - } - - public NameParser getNameParser(String name) throws NamingException { - check(name); - return original.getNameParser(name); - } - - public Name composeName(Name name, Name prefix) throws NamingException { - check(name); - return original.composeName(name, prefix); - } - - public String composeName(String name, String prefix) throws NamingException { - check(name); - return original.composeName(name, prefix); - } - - public Object addToEnvironment(String propName, Object propVal) throws NamingException { - check(); - return original.addToEnvironment(propName, propVal); - } - - public Object removeFromEnvironment(String propName) throws NamingException { - check(); - return original.removeFromEnvironment(propName); - } - - public Hashtable<?, ?> getEnvironment() throws NamingException { - check(); - return original.getEnvironment(); - } - - public void close() throws NamingException { - check(); - original.close(); - } - - public String getNameInNamespace() throws NamingException { - check(); - return original.getNameInNamespace(); - } - - //copied from InitialContext - private static String getURLScheme(String str) { - int colon_posn = str.indexOf(':'); - int slash_posn = str.indexOf('/'); - - if (colon_posn > 0 && (slash_posn == -1 || colon_posn < slash_posn)) - return str.substring(0, colon_posn); - return null; - } - - @Override - public int hashCode() { - return getOriginal() == null ? super.hashCode() : getOriginal().hashCode(); - } - - @Override - public boolean equals(Object o) { - return getOriginal() == null ? super.equals(o) : getOriginal().equals(o); - } -} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingContextDecoratorSetContext.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingContextDecoratorSetContext.java deleted file mode 100644 index 2e0e790..0000000 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingContextDecoratorSetContext.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.naming.context; - -import java.lang.reflect.Constructor; -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; - -import javax.naming.Context; - -import org.rhq.enterprise.server.naming.util.DecoratorSetContext; - -/** - * - * - * @author Lukas Krejci - */ -public class AccessCheckingContextDecoratorSetContext implements DecoratorSetContext<Context, ContextDecorator> { - - private static final Set<Class<? extends ContextDecorator>> DECORATOR_CLASSES; - static { - HashSet<Class<? extends ContextDecorator>> tmp = new HashSet<Class<? extends ContextDecorator>>(); - tmp.add(AccessCheckingContextDecorator.class); - tmp.add(AccessCheckingDirContextDecorator.class); - tmp.add(AccessCheckingEventContextDecorator.class); - tmp.add(AccessCheckingEventDirContextDecorator.class); - tmp.add(AccessCheckingLdapContextDecorator.class); - - DECORATOR_CLASSES = Collections.unmodifiableSet(tmp); - } - - private Set<Class<? extends Context>> supportedInterfaces; - private String[] checkedSchemes; - - public AccessCheckingContextDecoratorSetContext(Set<Class<? extends Context>> supportedInterfaces, String... checkedSchemes) { - this.supportedInterfaces = supportedInterfaces; - this.checkedSchemes = checkedSchemes; - } - - public ContextDecorator instantiate(Class<? extends ContextDecorator> decoratorClass) throws Exception { - Constructor<? extends ContextDecorator> ctor = decoratorClass.getConstructor(String[].class); - - return ctor.newInstance((Object)checkedSchemes); - } - - public Set<Class<? extends Context>> getSupportedInterfaces() { - return supportedInterfaces; - } - - public Set<Class<? extends ContextDecorator>> getDecoratorClasses() { - return DECORATOR_CLASSES; - } - - public void init(ContextDecorator decorator, Context object) throws Exception { - decorator.init(object); - } -} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingDirContextDecorator.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingDirContextDecorator.java deleted file mode 100644 index 602cc02..0000000 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingDirContextDecorator.java +++ /dev/null @@ -1,187 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.naming.context; - -import javax.naming.Name; -import javax.naming.NamingEnumeration; -import javax.naming.NamingException; -import javax.naming.directory.Attributes; -import javax.naming.directory.DirContext; -import javax.naming.directory.ModificationItem; -import javax.naming.directory.SearchControls; -import javax.naming.directory.SearchResult; - -/** - * A decorator of {@link DirContext}. - * - * @author Lukas Krejci - */ -public class AccessCheckingDirContextDecorator extends AccessCheckingContextDecorator implements DirContext { - - private static final long serialVersionUID = 1L; - - public AccessCheckingDirContextDecorator(String... checkedSchemes) { - super(checkedSchemes); - } - - public AccessCheckingDirContextDecorator(DirContext original, String... checkedSchemes) { - super(original, checkedSchemes); - } - - @Override - protected DirContext getOriginal() { - return (DirContext) super.getOriginal(); - } - - public Attributes getAttributes(Name name) throws NamingException { - check(name); - return getOriginal().getAttributes(name); - } - - public Attributes getAttributes(String name) throws NamingException { - check(name); - return getOriginal().getAttributes(name); - } - - public Attributes getAttributes(Name name, String[] attrIds) throws NamingException { - check(name); - return getOriginal().getAttributes(name, attrIds); - } - - public Attributes getAttributes(String name, String[] attrIds) throws NamingException { - check(name); - return getOriginal().getAttributes(name, attrIds); - } - - public void modifyAttributes(Name name, int mod_op, Attributes attrs) throws NamingException { - check(name); - getOriginal().modifyAttributes(name, mod_op, attrs); - } - - public void modifyAttributes(String name, int mod_op, Attributes attrs) throws NamingException { - check(name); - getOriginal().modifyAttributes(name, mod_op, attrs); - } - - public void modifyAttributes(Name name, ModificationItem[] mods) throws NamingException { - check(name); - getOriginal().modifyAttributes(name, mods); - } - - public void modifyAttributes(String name, ModificationItem[] mods) throws NamingException { - check(name); - getOriginal().modifyAttributes(name, mods); - } - - public void bind(Name name, Object obj, Attributes attrs) throws NamingException { - check(name); - getOriginal().bind(name, obj, attrs); - } - - public void bind(String name, Object obj, Attributes attrs) throws NamingException { - check(name); - getOriginal().bind(name, obj, attrs); - } - - public void rebind(Name name, Object obj, Attributes attrs) throws NamingException { - check(name); - getOriginal().rebind(name, obj, attrs); - } - - public void rebind(String name, Object obj, Attributes attrs) throws NamingException { - check(name); - getOriginal().rebind(name, obj, attrs); - } - - public DirContext createSubcontext(Name name, Attributes attrs) throws NamingException { - check(name); - return getOriginal().createSubcontext(name, attrs); - } - - public DirContext createSubcontext(String name, Attributes attrs) throws NamingException { - check(name); - return getOriginal().createSubcontext(name, attrs); - } - - public DirContext getSchema(Name name) throws NamingException { - check(name); - return getOriginal().getSchema(name); - } - - public DirContext getSchema(String name) throws NamingException { - check(name); - return getOriginal().getSchema(name); - } - - public DirContext getSchemaClassDefinition(Name name) throws NamingException { - check(name); - return getOriginal().getSchemaClassDefinition(name); - } - - public DirContext getSchemaClassDefinition(String name) throws NamingException { - check(name); - return getOriginal().getSchema(name); - } - - public NamingEnumeration<SearchResult> - search(Name name, Attributes matchingAttributes, String[] attributesToReturn) throws NamingException { - check(name); - return getOriginal().search(name, matchingAttributes, attributesToReturn); - } - - public NamingEnumeration<SearchResult> search(String name, Attributes matchingAttributes, - String[] attributesToReturn) throws NamingException { - check(name); - return getOriginal().search(name, matchingAttributes, attributesToReturn); - } - - public NamingEnumeration<SearchResult> search(Name name, Attributes matchingAttributes) throws NamingException { - check(name); - return getOriginal().search(name, matchingAttributes); - } - - public NamingEnumeration<SearchResult> search(String name, Attributes matchingAttributes) throws NamingException { - check(name); - return getOriginal().search(name, matchingAttributes); - } - - public NamingEnumeration<SearchResult> search(Name name, String filter, SearchControls cons) throws NamingException { - check(name); - return getOriginal().search(name, filter, cons); - } - - public NamingEnumeration<SearchResult> search(String name, String filter, SearchControls cons) - throws NamingException { - check(name); - return getOriginal().search(name, filter, cons); - } - - public NamingEnumeration<SearchResult> - search(Name name, String filterExpr, Object[] filterArgs, SearchControls cons) throws NamingException { - check(name); - return getOriginal().search(name, filterExpr, filterArgs, cons); - } - - public NamingEnumeration<SearchResult> search(String name, String filterExpr, Object[] filterArgs, - SearchControls cons) throws NamingException { - check(name); - return getOriginal().search(name, filterExpr, filterArgs, cons); - } -} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingEventContextDecorator.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingEventContextDecorator.java deleted file mode 100644 index b6f314d..0000000 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingEventContextDecorator.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.naming.context; - -import javax.naming.Name; -import javax.naming.NamingException; -import javax.naming.event.EventContext; -import javax.naming.event.NamingListener; - -/** - * - * - * @author Lukas Krejci - */ -public class AccessCheckingEventContextDecorator extends AccessCheckingContextDecorator implements EventContext { - - private static final long serialVersionUID = 1L; - - public AccessCheckingEventContextDecorator(String... checkedSchemes) { - super(checkedSchemes); - } - - public AccessCheckingEventContextDecorator(EventContext original, String... checkedSchemes) { - super(original, checkedSchemes); - } - - @Override - protected EventContext getOriginal() { - return (EventContext) super.getOriginal(); - } - - public void addNamingListener(Name target, int scope, NamingListener l) throws NamingException { - check(target); - getOriginal().addNamingListener(target, scope, l); - } - - public void addNamingListener(String target, int scope, NamingListener l) throws NamingException { - check(target); - getOriginal().addNamingListener(target, scope, l); - } - - public void removeNamingListener(NamingListener l) throws NamingException { - check(); - getOriginal().removeNamingListener(l); - } - - public boolean targetMustExist() throws NamingException { - check(); - return getOriginal().targetMustExist(); - } - -} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingEventDirContextDecorator.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingEventDirContextDecorator.java deleted file mode 100644 index f28c29c..0000000 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingEventDirContextDecorator.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.naming.context; - -import javax.naming.Name; -import javax.naming.NamingException; -import javax.naming.directory.SearchControls; -import javax.naming.event.EventDirContext; -import javax.naming.event.NamingListener; - -/** - * - * - * @author Lukas Krejci - */ -public class AccessCheckingEventDirContextDecorator extends AccessCheckingDirContextDecorator implements - EventDirContext { - - private static final long serialVersionUID = 1L; - - public AccessCheckingEventDirContextDecorator(String... checkedSchemes) { - super(checkedSchemes); - } - - public AccessCheckingEventDirContextDecorator(EventDirContext original, String... checkedSchemes) { - super(original, checkedSchemes); - } - - @Override - protected EventDirContext getOriginal() { - return (EventDirContext) super.getOriginal(); - } - - public void addNamingListener(Name target, int scope, NamingListener l) throws NamingException { - check(target); - getOriginal().addNamingListener(target, scope, l); - } - - public void addNamingListener(String target, int scope, NamingListener l) throws NamingException { - check(target); - getOriginal().addNamingListener(target, scope, l); - } - - public void removeNamingListener(NamingListener l) throws NamingException { - check(); - getOriginal().removeNamingListener(l); - } - - public boolean targetMustExist() throws NamingException { - check(); - return getOriginal().targetMustExist(); - } - - public void addNamingListener(Name target, String filter, SearchControls ctls, NamingListener l) - throws NamingException { - check(target); - getOriginal().addNamingListener(target, filter, ctls, l); - } - - public void addNamingListener(String target, String filter, SearchControls ctls, NamingListener l) - throws NamingException { - check(target); - getOriginal().addNamingListener(target, filter, ctls, l); - } - - public void - addNamingListener(Name target, String filter, Object[] filterArgs, SearchControls ctls, NamingListener l) - throws NamingException { - check(target); - getOriginal().addNamingListener(target, filter, filterArgs, ctls, l); - } - - public void addNamingListener(String target, String filter, Object[] filterArgs, SearchControls ctls, - NamingListener l) throws NamingException { - check(target); - getOriginal().addNamingListener(target, filter, filterArgs, ctls, l); - } - -} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingLdapContextDecorator.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingLdapContextDecorator.java deleted file mode 100644 index 2c6036f..0000000 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingLdapContextDecorator.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.naming.context; - -import javax.naming.NamingException; -import javax.naming.ldap.Control; -import javax.naming.ldap.ExtendedRequest; -import javax.naming.ldap.ExtendedResponse; -import javax.naming.ldap.LdapContext; - -/** - * - * - * @author Lukas Krejci - */ -public class AccessCheckingLdapContextDecorator extends AccessCheckingDirContextDecorator implements LdapContext { - - private static final long serialVersionUID = 1L; - - public AccessCheckingLdapContextDecorator(String... checkedSchemes) { - super(checkedSchemes); - } - - public AccessCheckingLdapContextDecorator(LdapContext original, String... checkedSchemes) { - super(original, checkedSchemes); - } - - @Override - protected LdapContext getOriginal() { - return (LdapContext) super.getOriginal(); - } - - public ExtendedResponse extendedOperation(ExtendedRequest request) throws NamingException { - check(); - return getOriginal().extendedOperation(request); - } - - public LdapContext newInstance(Control[] requestControls) throws NamingException { - check(); - return getOriginal().newInstance(requestControls); - } - - public void reconnect(Control[] connCtls) throws NamingException { - check(); - getOriginal().reconnect(connCtls); - } - - public Control[] getConnectControls() throws NamingException { - check(); - return getOriginal().getConnectControls(); - } - - public void setRequestControls(Control[] requestControls) throws NamingException { - check(); - getOriginal().setRequestControls(requestControls); - } - - public Control[] getRequestControls() throws NamingException { - check(); - return getOriginal().getRequestControls(); - } - - public Control[] getResponseControls() throws NamingException { - check(); - return getOriginal().getResponseControls(); - } - -} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/ContextDecorator.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/ContextDecorator.java deleted file mode 100644 index 0781b9b..0000000 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/ContextDecorator.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.naming.context; - -import javax.naming.Context; -import javax.naming.NamingException; - -/** - * - * - * @author Lukas Krejci - */ -public interface ContextDecorator extends Context { - - void init(Context context) throws NamingException; -} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringContextDecorator.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringContextDecorator.java deleted file mode 100644 index 62fc86b..0000000 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringContextDecorator.java +++ /dev/null @@ -1,222 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2011 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.naming.context; - -import java.io.Serializable; -import java.util.Hashtable; - -import javax.naming.Binding; -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.Name; -import javax.naming.NameClassPair; -import javax.naming.NameParser; -import javax.naming.NamingEnumeration; -import javax.naming.NamingException; - -import org.rhq.enterprise.server.naming.AccessCheckingInitialContextFactoryBuilder; - -/** - * This is a wrapper class around another {@link Context} implementation that - * prefers to use an URL context for some operation if the JNDI name contains - * a scheme rather than the original. This is the behavior of {@link InitialContext} - * which we need to restore in the contexts created by the {@link AccessCheckingInitialContextFactoryBuilder} - * (which an {@link InitialContext} uses exclusively if the builder is set). - * <p> - * This is important because RHQ server has its own initial context factory - * builder that creates factories that in turn create contexts. If the default - * {@link InitialContext} implementation was used, we'd never be able to lookup - * scheme-based names because the default implementation of the {@link InitialContext} - * always uses the default context of the builder if one is installed no matter - * the scheme in the name. - * <p> - * The {@link AccessCheckingInitialContextFactoryBuilder} wraps the context returned - * by the factory in an instance of this class and thus is restoring the original - * intended behavior of the {@link InitialContext}. It looks at the name being looked - * up (bound or whatever) and prefers to use the URL context factories if the name - * contains the scheme (as does the {@link InitialContext} if no builder is installed). - * If the name doesn't contain a scheme, the provided default context factory is used to - * look up the name. - * - * @author Lukas Krejci - */ -public class URLPreferringContextDecorator implements Context, ContextDecorator, Serializable { - - private static final long serialVersionUID = 1L; - - private Context original; - - public URLPreferringContextDecorator() { - - } - - public URLPreferringContextDecorator(Context ctx) { - original = ctx; - } - - public void init(Context context) { - original = context; - } - - protected Context getOriginal() throws NamingException { - return original; - } - - protected Context getURLOrDefaultInitCtx(Name name) throws NamingException { - @SuppressWarnings("unchecked") - Context urlContext = URLPreferringContextDecoratorHelper.getURLContext(name, (Hashtable<Object, Object>) getEnvironment()); - return urlContext == null ? getOriginal() : urlContext; - } - - protected Context getURLOrDefaultInitCtx(String name) throws NamingException { - @SuppressWarnings("unchecked") - Context urlContext = URLPreferringContextDecoratorHelper.getURLContext(name, (Hashtable<Object, Object>) getEnvironment()); - return urlContext == null ? getOriginal() : urlContext; - } - - public Object lookup(Name name) throws NamingException { - return getURLOrDefaultInitCtx(name).lookup(name); - } - - public Object lookup(String name) throws NamingException { - return getURLOrDefaultInitCtx(name).lookup(name); - } - - public void bind(Name name, Object obj) throws NamingException { - getURLOrDefaultInitCtx(name).bind(name, obj); - } - - public void bind(String name, Object obj) throws NamingException { - getURLOrDefaultInitCtx(name).bind(name, obj); - } - - public void rebind(Name name, Object obj) throws NamingException { - getURLOrDefaultInitCtx(name).rebind(name, obj); - } - - public void rebind(String name, Object obj) throws NamingException { - getURLOrDefaultInitCtx(name).rebind(name, obj); - } - - public void unbind(Name name) throws NamingException { - getURLOrDefaultInitCtx(name).unbind(name); - } - - public void unbind(String name) throws NamingException { - getURLOrDefaultInitCtx(name).unbind(name); - } - - public void rename(Name oldName, Name newName) throws NamingException { - getURLOrDefaultInitCtx(oldName).rename(oldName, newName); - } - - public void rename(String oldName, String newName) throws NamingException { - getURLOrDefaultInitCtx(oldName).rename(oldName, newName); - } - - public NamingEnumeration<NameClassPair> list(Name name) throws NamingException { - return getURLOrDefaultInitCtx(name).list(name); - } - - public NamingEnumeration<NameClassPair> list(String name) throws NamingException { - return getURLOrDefaultInitCtx(name).list(name); - } - - public NamingEnumeration<Binding> listBindings(Name name) throws NamingException { - return getURLOrDefaultInitCtx(name).listBindings(name); - } - - public NamingEnumeration<Binding> listBindings(String name) throws NamingException { - return getURLOrDefaultInitCtx(name).listBindings(name); - } - - public void destroySubcontext(Name name) throws NamingException { - getURLOrDefaultInitCtx(name).destroySubcontext(name); - } - - public void destroySubcontext(String name) throws NamingException { - getURLOrDefaultInitCtx(name).destroySubcontext(name); - } - - public Context createSubcontext(Name name) throws NamingException { - return getURLOrDefaultInitCtx(name).createSubcontext(name); - } - - public Context createSubcontext(String name) throws NamingException { - return getURLOrDefaultInitCtx(name).createSubcontext(name); - } - - public Object lookupLink(Name name) throws NamingException { - return getURLOrDefaultInitCtx(name).lookupLink(name); - } - - public Object lookupLink(String name) throws NamingException { - return getURLOrDefaultInitCtx(name).lookupLink(name); - } - - public NameParser getNameParser(Name name) throws NamingException { - return getURLOrDefaultInitCtx(name).getNameParser(name); - } - - public NameParser getNameParser(String name) throws NamingException { - return getURLOrDefaultInitCtx(name).getNameParser(name); - } - - public Name composeName(Name name, Name prefix) throws NamingException { - return getOriginal().composeName(name, prefix); - } - - public String composeName(String name, String prefix) throws NamingException { - return getOriginal().composeName(name, prefix); - } - - public Object addToEnvironment(String propName, Object propVal) throws NamingException { - return getOriginal().addToEnvironment(propName, propVal); - } - - public Object removeFromEnvironment(String propName) throws NamingException { - return getOriginal().removeFromEnvironment(propName); - } - - public Hashtable<?, ?> getEnvironment() throws NamingException { - return getOriginal().getEnvironment(); - } - - public void close() throws NamingException { - if (getOriginal() != null) { - getOriginal().close(); - original = null; - } - } - - public String getNameInNamespace() throws NamingException { - return getOriginal().getNameInNamespace(); - } - - @Override - public int hashCode() { - return original == null ? super.hashCode() : original.hashCode(); - } - - @Override - public boolean equals(Object o) { - return original == null ? super.equals(o) : original.equals(o); - } -} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringContextDecoratorHelper.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringContextDecoratorHelper.java deleted file mode 100644 index 306446d..0000000 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringContextDecoratorHelper.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.naming.context; - -import java.util.Hashtable; - -import javax.naming.Context; -import javax.naming.Name; -import javax.naming.NamingException; -import javax.naming.spi.NamingManager; - -/** - * - * - * @author Lukas Krejci - */ -public class URLPreferringContextDecoratorHelper { - - private URLPreferringContextDecoratorHelper() { - - } - - public static Context getURLContext(String name, Hashtable<Object, Object> env) throws NamingException { - String scheme = getURLScheme(name); - if (scheme != null) { - Context ctx = NamingManager.getURLContext(scheme, env); - if (ctx != null) { - return ctx; - } - } - - return null; - } - - public static Context getURLContext(Name name, Hashtable<Object, Object> env) throws NamingException { - if (name.size() > 0) { - String first = name.get(0); - String scheme = getURLScheme(first); - if (scheme != null) { - Context ctx = NamingManager.getURLContext(scheme, env); - if (ctx != null) { - return ctx; - } - } - } - - return null; - } - - //copied from InitialContext - private static String getURLScheme(String str) { - int colon_posn = str.indexOf(':'); - int slash_posn = str.indexOf('/'); - - if (colon_posn > 0 && (slash_posn == -1 || colon_posn < slash_posn)) - return str.substring(0, colon_posn); - return null; - } -} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringContextDecoratorSetContext.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringContextDecoratorSetContext.java deleted file mode 100644 index ded552c..0000000 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringContextDecoratorSetContext.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.naming.context; - -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; - -import javax.naming.Context; - -import org.rhq.enterprise.server.naming.util.DecoratorSetContext; - -/** - * - * - * @author Lukas Krejci - */ -public class URLPreferringContextDecoratorSetContext implements DecoratorSetContext<Context, ContextDecorator> { - - private static final Set<Class<? extends ContextDecorator>> DECORATOR_CLASSES; - static { - HashSet<Class<? extends ContextDecorator>> tmp = new HashSet<Class<? extends ContextDecorator>>(); - tmp.add(URLPreferringContextDecorator.class); - tmp.add(URLPreferringDirContextDecorator.class); - tmp.add(URLPreferringEventContextDecorator.class); - tmp.add(URLPreferringEventDirContextDecorator.class); - tmp.add(URLPreferringLdapContextDecorator.class); - - DECORATOR_CLASSES = Collections.unmodifiableSet(tmp); - } - - private Set<Class<? extends Context>> supportedInterfaces; - - public URLPreferringContextDecoratorSetContext(Set<Class<? extends Context>> supportedInterfaces) { - this.supportedInterfaces = supportedInterfaces; - } - - public Set<Class<? extends Context>> getSupportedInterfaces() { - return supportedInterfaces; - } - - public Set<Class<? extends ContextDecorator>> getDecoratorClasses() { - return DECORATOR_CLASSES; - } - - public ContextDecorator instantiate(Class<? extends ContextDecorator> decoratorClass) throws Exception { - return decoratorClass.newInstance(); - } - - public void init(ContextDecorator decorator, Context object) throws Exception { - decorator.init(object); - } - -} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringDirContextDecorator.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringDirContextDecorator.java deleted file mode 100644 index 6c695f4..0000000 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringDirContextDecorator.java +++ /dev/null @@ -1,185 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.naming.context; - -import javax.naming.Context; -import javax.naming.Name; -import javax.naming.NamingEnumeration; -import javax.naming.NamingException; -import javax.naming.NoInitialContextException; -import javax.naming.NotContextException; -import javax.naming.directory.Attributes; -import javax.naming.directory.DirContext; -import javax.naming.directory.ModificationItem; -import javax.naming.directory.SearchControls; -import javax.naming.directory.SearchResult; - -/** - * Akin to {@link URLPreferringContextDecorator} this class implements the similar logic - * for {@link DirContext}s. - * - * @author Lukas Krejci - */ -public class URLPreferringDirContextDecorator extends URLPreferringContextDecorator implements DirContext { - - private static final long serialVersionUID = 1L; - - public URLPreferringDirContextDecorator() { - super(null); - } - - public URLPreferringDirContextDecorator(DirContext ctx) { - super(ctx); - } - - protected DirContext checkAndCast(Context ctx) throws NamingException { - if (!(ctx instanceof DirContext)) { - if (ctx == null) { - throw new NoInitialContextException(); - } else { - throw new NotContextException( - "Not an instance of DirContext"); - } - } - - return (DirContext) ctx; - } - - @Override - protected DirContext getURLOrDefaultInitCtx(Name name) throws NamingException { - Context ctx = super.getURLOrDefaultInitCtx(name); - return checkAndCast(ctx); - } - - @Override - protected DirContext getURLOrDefaultInitCtx(String name) throws NamingException { - Context ctx = super.getURLOrDefaultInitCtx(name); - return checkAndCast(ctx); - } - - public Attributes getAttributes(Name name) throws NamingException { - return getURLOrDefaultInitCtx(name).getAttributes(name); - } - - public Attributes getAttributes(String name) throws NamingException { - return getURLOrDefaultInitCtx(name).getAttributes(name); - } - - public Attributes getAttributes(Name name, String[] attrIds) throws NamingException { - return getURLOrDefaultInitCtx(name).getAttributes(name, attrIds); - } - - public Attributes getAttributes(String name, String[] attrIds) throws NamingException { - return getURLOrDefaultInitCtx(name).getAttributes(name, attrIds); - } - - public void modifyAttributes(Name name, int mod_op, Attributes attrs) throws NamingException { - getURLOrDefaultInitCtx(name).modifyAttributes(name, mod_op, attrs); - } - - public void modifyAttributes(String name, int mod_op, Attributes attrs) throws NamingException { - getURLOrDefaultInitCtx(name).modifyAttributes(name, mod_op, attrs); - } - - public void modifyAttributes(Name name, ModificationItem[] mods) throws NamingException { - getURLOrDefaultInitCtx(name).modifyAttributes(name, mods); - } - - public void modifyAttributes(String name, ModificationItem[] mods) throws NamingException { - getURLOrDefaultInitCtx(name).modifyAttributes(name, mods); - } - - public void bind(Name name, Object obj, Attributes attrs) throws NamingException { - getURLOrDefaultInitCtx(name).bind(name, obj, attrs); - } - - public void bind(String name, Object obj, Attributes attrs) throws NamingException { - getURLOrDefaultInitCtx(name).bind(name, obj, attrs); - } - - public void rebind(Name name, Object obj, Attributes attrs) throws NamingException { - getURLOrDefaultInitCtx(name).rebind(name, obj, attrs); - } - - public void rebind(String name, Object obj, Attributes attrs) throws NamingException { - getURLOrDefaultInitCtx(name).rebind(name, obj, attrs); - } - - public DirContext createSubcontext(Name name, Attributes attrs) throws NamingException { - return getURLOrDefaultInitCtx(name).createSubcontext(name, attrs); - } - - public DirContext createSubcontext(String name, Attributes attrs) throws NamingException { - return getURLOrDefaultInitCtx(name).createSubcontext(name, attrs); - } - - public DirContext getSchema(Name name) throws NamingException { - return getURLOrDefaultInitCtx(name).getSchema(name); - } - - public DirContext getSchema(String name) throws NamingException { - return getURLOrDefaultInitCtx(name).getSchema(name); - } - - public DirContext getSchemaClassDefinition(Name name) throws NamingException { - return getURLOrDefaultInitCtx(name).getSchemaClassDefinition(name); - } - - public DirContext getSchemaClassDefinition(String name) throws NamingException { - return getURLOrDefaultInitCtx(name).getSchemaClassDefinition(name); - } - - public NamingEnumeration<SearchResult> - search(Name name, Attributes matchingAttributes, String[] attributesToReturn) throws NamingException { - return getURLOrDefaultInitCtx(name).search(name, matchingAttributes, attributesToReturn); - } - - public NamingEnumeration<SearchResult> search(String name, Attributes matchingAttributes, - String[] attributesToReturn) throws NamingException { - return getURLOrDefaultInitCtx(name).search(name, matchingAttributes, attributesToReturn); - } - - public NamingEnumeration<SearchResult> search(Name name, Attributes matchingAttributes) throws NamingException { - return getURLOrDefaultInitCtx(name).search(name, matchingAttributes); - } - - public NamingEnumeration<SearchResult> search(String name, Attributes matchingAttributes) throws NamingException { - return getURLOrDefaultInitCtx(name).search(name, matchingAttributes); - } - - public NamingEnumeration<SearchResult> search(Name name, String filter, SearchControls cons) throws NamingException { - return getURLOrDefaultInitCtx(name).search(name, filter, cons); - } - - public NamingEnumeration<SearchResult> search(String name, String filter, SearchControls cons) - throws NamingException { - return getURLOrDefaultInitCtx(name).search(name, filter, cons); - } - - public NamingEnumeration<SearchResult> - search(Name name, String filterExpr, Object[] filterArgs, SearchControls cons) throws NamingException { - return getURLOrDefaultInitCtx(name).search(name, filterExpr, filterArgs, cons); - } - - public NamingEnumeration<SearchResult> search(String name, String filterExpr, Object[] filterArgs, - SearchControls cons) throws NamingException { - return getURLOrDefaultInitCtx(name).search(name, filterExpr, filterArgs, cons); - } -} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringEventContextDecorator.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringEventContextDecorator.java deleted file mode 100644 index 30e9ed2..0000000 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringEventContextDecorator.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.naming.context; - -import javax.naming.Context; -import javax.naming.Name; -import javax.naming.NamingException; -import javax.naming.NoInitialContextException; -import javax.naming.NotContextException; -import javax.naming.event.EventContext; -import javax.naming.event.NamingListener; - -/** - * - * - * @author Lukas Krejci - */ -public class URLPreferringEventContextDecorator extends URLPreferringContextDecorator implements EventContext { - - private static final long serialVersionUID = 1L; - - public URLPreferringEventContextDecorator() { - super(null); - } - - public URLPreferringEventContextDecorator(EventContext ctx) { - super(ctx); - } - - protected EventContext checkAndCast(Context ctx) throws NamingException { - if (!(ctx instanceof EventContext)) { - if (ctx == null) { - throw new NoInitialContextException(); - } else { - throw new NotContextException( - "Not an instance of EventContext"); - } - } - - return (EventContext) ctx; - } - - @Override - protected EventContext getOriginal() throws NamingException { - return checkAndCast(super.getOriginal()); - } - - public void addNamingListener(Name target, int scope, NamingListener l) throws NamingException { - getOriginal().addNamingListener(target, scope, l); - } - - public void addNamingListener(String target, int scope, NamingListener l) throws NamingException { - getOriginal().addNamingListener(target, scope, l); - } - - public void removeNamingListener(NamingListener l) throws NamingException { - getOriginal().removeNamingListener(l); - } - - public boolean targetMustExist() throws NamingException { - return getOriginal().targetMustExist(); - } - -} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringEventDirContextDecorator.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringEventDirContextDecorator.java deleted file mode 100644 index e9a3614..0000000 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringEventDirContextDecorator.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.naming.context; - -import javax.naming.Context; -import javax.naming.Name; -import javax.naming.NamingException; -import javax.naming.NoInitialContextException; -import javax.naming.NotContextException; -import javax.naming.directory.SearchControls; -import javax.naming.event.EventDirContext; -import javax.naming.event.NamingListener; - -/** - * - * - * @author Lukas Krejci - */ -public class URLPreferringEventDirContextDecorator extends URLPreferringDirContextDecorator implements EventDirContext { - - private static final long serialVersionUID = 1L; - - public URLPreferringEventDirContextDecorator() { - super(null); - } - - public URLPreferringEventDirContextDecorator(EventDirContext ctx) { - super(ctx); - } - - @Override - protected EventDirContext checkAndCast(Context ctx) throws NamingException { - if (!(ctx instanceof EventDirContext)) { - if (ctx == null) { - throw new NoInitialContextException(); - } else { - throw new NotContextException( - "Not an instance of EventDirContext"); - } - } - - return (EventDirContext) ctx; - } - - @Override - protected EventDirContext getOriginal() throws NamingException { - return checkAndCast(super.getOriginal()); - } - - public void addNamingListener(Name target, int scope, NamingListener l) throws NamingException { - getOriginal().addNamingListener(target, scope, l); - } - - public void addNamingListener(String target, int scope, NamingListener l) throws NamingException { - getOriginal().addNamingListener(target, scope, l); - } - - public void removeNamingListener(NamingListener l) throws NamingException { - getOriginal().removeNamingListener(l); - } - - public boolean targetMustExist() throws NamingException { - return getOriginal().targetMustExist(); - } - - public void addNamingListener(Name target, String filter, SearchControls ctls, NamingListener l) - throws NamingException { - getOriginal().addNamingListener(target, filter, ctls, l); - } - - public void addNamingListener(String target, String filter, SearchControls ctls, NamingListener l) - throws NamingException { - getOriginal().addNamingListener(target, filter, ctls, l); - } - - public void - addNamingListener(Name target, String filter, Object[] filterArgs, SearchControls ctls, NamingListener l) - throws NamingException { - getOriginal().addNamingListener(target, filter, filterArgs, ctls, l); - } - - public void addNamingListener(String target, String filter, Object[] filterArgs, SearchControls ctls, - NamingListener l) throws NamingException { - getOriginal().addNamingListener(target, filter, filterArgs, ctls, l); - } - -} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringLdapContextDecorator.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringLdapContextDecorator.java deleted file mode 100644 index 93965df..0000000 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringLdapContextDecorator.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.naming.context; - -import javax.naming.Context; -import javax.naming.NamingException; -import javax.naming.NoInitialContextException; -import javax.naming.NotContextException; -import javax.naming.ldap.Control; -import javax.naming.ldap.ExtendedRequest; -import javax.naming.ldap.ExtendedResponse; -import javax.naming.ldap.LdapContext; - -/** - * - * - * @author Lukas Krejci - */ -public class URLPreferringLdapContextDecorator extends URLPreferringDirContextDecorator implements LdapContext { - - private static final long serialVersionUID = 1L; - - public URLPreferringLdapContextDecorator() { - super(null); - } - - public URLPreferringLdapContextDecorator(LdapContext original) { - super(original); - } - - @Override - protected LdapContext checkAndCast(Context ctx) throws NamingException { - if (!(ctx instanceof LdapContext)) { - if (ctx == null) { - throw new NoInitialContextException(); - } else { - throw new NotContextException("Not an instance of LdapContext"); - } - } - - return (LdapContext) ctx; - } - - @Override - protected LdapContext getOriginal() throws NamingException { - return checkAndCast(super.getOriginal()); - } - - public ExtendedResponse extendedOperation(ExtendedRequest request) throws NamingException { - return getOriginal().extendedOperation(request); - } - - public LdapContext newInstance(Control[] requestControls) throws NamingException { - return new URLPreferringLdapContextDecorator(getOriginal().newInstance(requestControls)); - } - - public void reconnect(Control[] connCtls) throws NamingException { - getOriginal().reconnect(connCtls); - } - - public Control[] getConnectControls() throws NamingException { - return getOriginal().getConnectControls(); - } - - public void setRequestControls(Control[] requestControls) throws NamingException { - getOriginal().setRequestControls(requestControls); - } - - public Control[] getRequestControls() throws NamingException { - return getOriginal().getRequestControls(); - } - - public Control[] getResponseControls() throws NamingException { - return getOriginal().getResponseControls(); - } - -} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/interfaces/java/javaURLContextFactory.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/interfaces/java/javaURLContextFactory.java deleted file mode 100644 index fc4d02b..0000000 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/interfaces/java/javaURLContextFactory.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.rhq.enterprise.server.naming.interfaces.java; - -import java.util.Hashtable; - -import javax.naming.CompositeName; -import javax.naming.Context; -import javax.naming.Name; -import javax.naming.spi.ObjectFactory; - -import org.jboss.as.naming.NamingContext; - -import org.rhq.enterprise.server.AllowRhqServerInternalsAccessPermission; - -/** @deprecated this is not used after all */ -@Deprecated -public class javaURLContextFactory implements ObjectFactory { - - private static final AllowRhqServerInternalsAccessPermission PERM = new AllowRhqServerInternalsAccessPermission(); - - @Override - @SuppressWarnings("unchecked") - public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment) - throws Exception { - - SecurityManager sm = System.getSecurityManager(); - if (sm != null) { - sm.checkPermission(PERM); - } - - return new NamingContext(name != null ? name : new CompositeName(""), (Hashtable<String, Object>) environment); - } -} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/util/DecoratingInvocationHandler.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/util/DecoratingInvocationHandler.java deleted file mode 100644 index cda3a98..0000000 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/util/DecoratingInvocationHandler.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.naming.util; - -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.List; - -public class DecoratingInvocationHandler<Type, Decorator extends Type> implements InvocationHandler { - - private final List<DecoratorPicker<Type, Decorator>> pickers; - private Type object; - - public DecoratingInvocationHandler(List<DecoratorPicker<Type, Decorator>> pickers, Type object) { - this.pickers = pickers; - this.object = object; - } - - public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { - Type target = object; - Class<?> methodClass = method.getDeclaringClass(); - - for(DecoratorPicker<Type, Decorator> picker : pickers) { - target = picker.decorate(target, methodClass); - } - - try { - return method.invoke(target, args); - } catch (InvocationTargetException e) { - if (e.getCause() != null) { - throw e.getCause(); - } else { - throw e; - } - } - } -} \ No newline at end of file diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/util/DecoratorPicker.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/util/DecoratorPicker.java deleted file mode 100644 index 12add1c..0000000 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/util/DecoratorPicker.java +++ /dev/null @@ -1,195 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.naming.util; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -/** - * Given as set of decorators extending given type, this class can pick - * the most appropriate set of decorators for a class or a method call. - * <p> - * To configure the decorator, one has to provide a {@link DecoratorSetContext} that - * is then used to obtain the list of - * {@link DecoratorSetContext#getSupportedInterfaces() supported interfaces}, which are - * all the interfaces that should be used for decorator resolution (i.e. all other interfaces - * that a class might implement are ignored during decorator resolution), the list of - * {@link DecoratorSetContext#getDecoratorClasses() decorator classes}, which is a list - * of decorators the picker can choose from and is also used to instantiate and initialize - * the decorators. - * - * @author Lukas Krejci - */ -public class DecoratorPicker<Type, Decorator extends Type> { - - private DecoratorSetContext<Type, Decorator> context; - - public DecoratorSetContext<Type, Decorator> getContext() { - return context; - } - - public void setContext(DecoratorSetContext<Type, Decorator> decoratorSetContext) { - this.context = decoratorSetContext; - } - - /** - * Returns a set of decorators applicable for given method. The set is established based - * on the declaring class of the method. - * - * @param method the method to inspect - * @return the set of decorators that can be used to wrap a method call - * @throws Exception - */ - public Set<Decorator> getDecoratorsForMethod(Method method) throws Exception { - return getDecoratorsForClass_Private(method.getDeclaringClass()); - } - - /** - * Returns a set of decorators that can be used on instances of given class. - * @param cls the class to inspect - * @return - * @throws Exception - */ - public Set<Decorator> getDecoratorsForClass(Class<? extends Type> cls) throws Exception { - return getDecoratorsForClass_Private(cls); - } - - /** - * This method first establishes the set of decorators to use based on the class of the supplied - * object and then chains the decorators (in arbitrary order) with the supplied object at the - * "root" of the chain. - * <p> - * If a method is then called on the returned object, the methods of all the decorators are called - * in chain (each supposedly calling the next) and finally, at the end of the chain, the method on - * the original object (the one supplied to this method) is called. - * <p> - * Note that the above is only an intended behavior and actually depends on the implementation of - * the decorators that are resposinble for the chaining. Each decorator is initialized - * (@{link {@link DecoratorSetContext#init(Object, Object)} which should set it up for such chaining. - * - * @param object - * @return - * @throws Exception - */ - public Type decorate(Type object) throws Exception { - Set<Decorator> decs = getDecoratorsForClass_Private(object.getClass()); - Type ret = object; - for(Decorator d : decs) { - context.init(d, ret); - ret = d; - } - - return ret; - } - - /** - * Similar to {@link #decorate(Object)} but instead of the class of the object itself, - * uses the significantSuperClass as the basis for the decorator resolution. - * <p> - * This is important, because if the object implements two mutually incompatible sub-interfaces of <code>Type</code>, - * the chained decorators might fail to execute a method later on if the decorator depends on the upper part - * of the chain to implement certain sub-interface of <code>Type</code>. - * - * @param object the object to wrap in decorators - * @param significantSuperClass the class to base the decorator resolution on - * @return - * @throws Exception - */ - public Type decorate(Type object, Class<?> significantSuperClass) throws Exception { - Set<Decorator> decs = getDecoratorsForClass_Private(significantSuperClass); - Type ret = object; - for(Decorator d : decs) { - context.init(d, ret); - ret = d; - } - - return ret; - } - - private Set<Decorator> getDecoratorsForClass_Private(Class<?> cls) throws Exception { - Set<Class<? extends Type>> ifaces = getNearestApplicableInterfaces(cls); - - HashSet<Decorator> ret = new HashSet<Decorator>(); - - for (Class<? extends Type> iface : ifaces) { - for (Class<? extends Decorator> decClass : getMatch(iface)) { - ret.add(context.instantiate(decClass)); - } - } - - return ret; - } - - private Set<Class<? extends Type>> getNearestApplicableInterfaces(Class<?> cls) { - List<Class<? extends Type>> ifaces = new ArrayList<Class<? extends Type>>(getAllApplicableInterfaces(cls)); - - //now compact the set to only contain the most concrete interfaces - - Iterator<Class<? extends Type>> it = ifaces.iterator(); - while (it.hasNext()) { - Class<? extends Type> c = it.next(); - - for (int i = 0; i < ifaces.size(); ++i) { - Class<? extends Type> nextC = ifaces.get(i); - if (!c.equals(nextC) && c.isAssignableFrom(nextC)) { - it.remove(); - break; - } - } - } - - return new HashSet<Class<? extends Type>>(ifaces); - } - - private Set<Class<? extends Type>> getAllApplicableInterfaces(Class<?> cls) { - Set<Class<? extends Type>> ifaces = new HashSet<Class<? extends Type>>(); - - for (Class<? extends Type> iface : context.getSupportedInterfaces()) { - if (iface.isAssignableFrom(cls)) { - ifaces.add(iface); - } - } - - if (ifaces.isEmpty()) { - throw new IllegalArgumentException("Class " + cls - + " doesn't implement any of the applicable interfaces. Cannot find decorators for it."); - } - - return ifaces; - } - - private Set<Class<? extends Decorator>> getMatch(Class<?> targetIface) { - - Set<Class<? extends Decorator>> ret = new HashSet<Class<? extends Decorator>>(); - - for (Class<? extends Decorator> cls : context.getDecoratorClasses()) { - if (Arrays.asList(cls.getInterfaces()).contains(targetIface)) { - ret.add(cls); - } - } - - return ret; - } -} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/util/DecoratorSetContext.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/util/DecoratorSetContext.java deleted file mode 100644 index 4916a2d..0000000 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/util/DecoratorSetContext.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.naming.util; - -import java.util.Set; - -/** - * Implementations of this interface provide a context to the {@link DecoratorPicker}. - * - * @author Lukas Krejci - */ -public interface DecoratorSetContext<Type, Decorator> { - - /** - * @return the set of interfaces that the decorators are able support. - * Usually this should be just a union of all interfaces the decorators implement - * but can be trimmed down. - */ - Set<Class<? extends Type>> getSupportedInterfaces(); - - /** - * @return the set of all decorator classes in this set - */ - Set<Class<? extends Decorator>> getDecoratorClasses(); - - /** - * Instantiates a new decorator of given class. - * @param decoratorClass - * @return - * @throws Exception - */ - Decorator instantiate(Class<? extends Decorator> decoratorClass) throws Exception; - - /** - * Initializes the decorator to decorate given object. - * - * @param decorator - * @param object - * @throws Exception on error - */ - void init(Decorator decorator, Type object) throws Exception; -} diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/naming/DecoratingInvocationHandlerTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/naming/DecoratingInvocationHandlerTest.java deleted file mode 100644 index c92cc42..0000000 --- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/naming/DecoratingInvocationHandlerTest.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.naming; - -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.Properties; -import java.util.Set; - -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.Name; -import javax.naming.NamingException; -import javax.naming.directory.DirContext; -import javax.naming.event.EventContext; -import javax.naming.event.NamingListener; -import javax.naming.spi.InitialContextFactory; -import javax.naming.spi.NamingManager; - -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * - * - * @author Lukas Krejci - */ -@Test -public class DecoratingInvocationHandlerTest { - private static final Set<String> INVOKED_METHODS = new HashSet<String>(); - - private static final InvocationHandler NOTE_TAKING_HANDLER = new InvocationHandler() { - - public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { - INVOKED_METHODS.add(method.getName()); - - if ("hashCode".equals(method.getName())) { - return 0; - } else if ("equals".equals(method.getName())) { - return false; - } - - return null; - } - }; - - private static Class<?>[] CONTEXT_INTERFACES; - - public static class Factory implements InitialContextFactory { - public Context getInitialContext(Hashtable<?, ?> environment) - throws NamingException { - - return (Context) Proxy.newProxyInstance(DecoratingInvocationHandlerTest.class.getClassLoader(), CONTEXT_INTERFACES, NOTE_TAKING_HANDLER); - } - } - - private static class DummyInitialEventContext extends InitialContext implements EventContext { - - /** - * @param environment - * @throws NamingException - */ - public DummyInitialEventContext(Hashtable<?, ?> environment) throws NamingException { - super(environment); - } - - public void addNamingListener(Name target, int scope, NamingListener l) throws NamingException { - ((EventContext)getURLOrDefaultInitCtx(target)).addNamingListener(target, scope, l); - } - - public void addNamingListener(String target, int scope, NamingListener l) throws NamingException { - ((EventContext)getURLOrDefaultInitCtx(target)).addNamingListener(target, scope, l); - } - - public void removeNamingListener(NamingListener l) throws NamingException { - ((EventContext)getDefaultInitCtx()).removeNamingListener(l); - } - - public boolean targetMustExist() throws NamingException { - return ((EventContext)getDefaultInitCtx()).targetMustExist(); - } - - - } - - @BeforeClass - public void setBuilder() throws Exception { - NamingManager.setInitialContextFactoryBuilder(new AccessCheckingInitialContextFactoryBuilder( - new org.jboss.as.naming.InitialContextFactory())); - } - - public void testSimpleDispatch() throws Exception { - INVOKED_METHODS.clear(); - Properties env = new Properties(); - env.put(Context.INITIAL_CONTEXT_FACTORY, Factory.class.getName()); - - CONTEXT_INTERFACES = new Class<?>[] { Context.class }; - - InitialContext ctx = new InitialContext(env); - - ctx.lookup("asdf"); - - assert INVOKED_METHODS.contains("lookup") : "The lookup doesn't seem to have propagated to the actual context to be used."; - } - - public void testMultiInterfaceDispatch() throws Exception { - INVOKED_METHODS.clear(); - Properties env = new Properties(); - env.put(Context.INITIAL_CONTEXT_FACTORY, Factory.class.getName()); - - CONTEXT_INTERFACES = new Class<?>[] { EventContext.class, DirContext.class }; - - InitialContext ctx = new InitialContext(env); - - ctx.lookup("asdf"); - - DummyInitialEventContext ectx = new DummyInitialEventContext(env); - - ectx.addNamingListener("hodiny", 0, null); - - assert INVOKED_METHODS.contains("lookup") : "The lookup doesn't seem to have propagated to the actual context to be used."; - assert INVOKED_METHODS.contains("addNamingListener") : "The addNamingListener doesn't seem to have propagated to the actual context to be used."; - } -} diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/naming/DecoratorPickerTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/naming/DecoratorPickerTest.java deleted file mode 100644 index 6a0892f..0000000 --- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/naming/DecoratorPickerTest.java +++ /dev/null @@ -1,180 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.naming; - -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; - -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -import javax.naming.Context; -import javax.naming.directory.DirContext; -import javax.naming.event.EventContext; -import javax.naming.ldap.LdapContext; - -import org.testng.annotations.Test; - -import org.rhq.enterprise.server.naming.util.DecoratorPicker; -import org.rhq.enterprise.server.naming.util.DecoratorSetContext; - -/** - * @author Lukas Krejci - */ -@Test -public class DecoratorPickerTest { - - private static final InvocationHandler DUMMY_HANDLER = new InvocationHandler() { - - public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { - if ("hashCode".equals(method.getName())) { - return 0; - } else if ("equals".equals(method.getName())) { - return false; - } - - return null; - } - }; - - private static final Class<?> TEST_OBJECT_CLASS1 = createProxyClass(Context.class); - private static final Class<?> TEST_OBJECT_CLASS2 = createProxyClass(DirContext.class); - private static final Class<?> TEST_OBJECT_CLASS3 = createProxyClass(LdapContext.class); - private static final Class<?> TEST_OBJECT_CLASS4 = createProxyClass(LdapContext.class, EventContext.class); - private static final Class<?> DECORATOR_CLASS1 = createProxyClass(Context.class); - private static final Class<?> DECORATOR_CLASS2 = createProxyClass(EventContext.class); - private static final Class<?> DECORATOR_CLASS3 = createProxyClass(LdapContext.class); - private static final Class<?> DECORATOR_CLASS4 = createProxyClass(DirContext.class); - - public void testSimpleDecoratorIdentifiedByClass() throws Exception { - DecoratorPicker<Object, Object> picker = createTestPicker(); - - Set<Object> contextDecorators = picker.getDecoratorsForClass(TEST_OBJECT_CLASS1); - assertEquals(contextDecorators.size(), 1, "Expected exactly one decorator for Context class"); - assertEquals(contextDecorators.iterator().next().getClass().getInterfaces()[0], Context.class); - } - - public void testSuperClassDecoratorHasPrecedenceOverSubClassDecorator() throws Exception { - DecoratorPicker<Object, Object> picker = createTestPicker(); - - //this tests that the LdapContext isn't returned even though it subclasses the DirContext - Set<Object> contextDecorators = picker.getDecoratorsForClass(TEST_OBJECT_CLASS2); - assertEquals(contextDecorators.size(), 1, "Expected exactly one decorator for DirContext class"); - assertEquals(contextDecorators.iterator().next().getClass().getInterfaces()[0], DirContext.class); - } - - public void testSubClassDecoratorCorrectlyIdentified() throws Exception { - DecoratorPicker<Object, Object> picker = createTestPicker(); - - Set<Object> contextDecorators = picker.getDecoratorsForClass(TEST_OBJECT_CLASS3); - assertEquals(contextDecorators.size(), 1, "Expected exactly one decorator for LdapContext class"); - assertEquals(contextDecorators.iterator().next().getClass().getInterfaces()[0], LdapContext.class); - } - - public void testMultipleDecoratorsDetectable() throws Exception { - DecoratorPicker<Object, Object> picker = createTestPicker(); - - Set<Object> decorators = picker.getDecoratorsForClass(TEST_OBJECT_CLASS4); - assertEquals(decorators.size(), 2, - "Exactly 2 decorators should have been found for a class implementing 2 interfaces."); - - boolean ldapContextDecoratorFound = false; - boolean eventContextDecoratorFound = false; - - for (Object d : decorators) { - if (LdapContext.class.isAssignableFrom(d.getClass())) { - ldapContextDecoratorFound = true; - continue; //just to make sure that somehow the decorator doesn't implement both - } - if (EventContext.class.isAssignableFrom(d.getClass())) { - eventContextDecoratorFound = true; - } - } - - assertTrue(ldapContextDecoratorFound && eventContextDecoratorFound, - "The found decorators don't implement the desired interfaces."); - } - - public void testDecoratorsIdentifiedByMethod() throws Exception { - DecoratorPicker<Object, Object> picker = createTestPicker(); - - Set<Object> decorators = - picker.getDecoratorsForMethod(LdapContext.class.getMethod("getConnectControls", (Class<?>[]) null)); - assertEquals(decorators.size(), 1, - "Expected exactly one decorator for method 'getConnectControls()' from LdapContext class"); - assertEquals(decorators.iterator().next().getClass().getInterfaces()[0], LdapContext.class); - } - - public void testMethodFromSubclassMatchesSubclassDecorator() throws Exception { - DecoratorPicker<Object, Object> picker = createTestPicker(); - - //this is a method from the DirContext but we're asking for it from a class - //that implements also an LdapContext - //The LdapContext decorator also inherits from the DirContext decorator - //(by the virtue of LdapContext interface inheriting from the DirContext) - //The picker should therefore match the LdapContext decorator because its - //the "closest" one to the actual class. - Set<Object> decorators = - picker.getDecoratorsForMethod(TEST_OBJECT_CLASS3.getMethod("getSchemaClassDefinition", - new Class<?>[] { String.class })); - assertEquals(decorators.size(), 1, - "Expected exactly one decorator for method 'getSchemaClassDefinition(String)' from LdapContext class"); - assertEquals(decorators.iterator().next().getClass().getInterfaces()[0], LdapContext.class); - } - - private static Class<?> createProxyClass(Class<?>... ifaces) { - return Proxy.getProxyClass(DecoratorPickerTest.class.getClassLoader(), ifaces); - } - - private static DecoratorPicker<Object, Object> createTestPicker() { - DecoratorPicker<Object, Object> picker = new DecoratorPicker<Object, Object>(); - - DecoratorSetContext<Object, Object> decSet = new DecoratorSetContext<Object, Object>() { - - public Object instantiate(Class<? extends Object> decoratorClass) throws Exception { - Constructor<? extends Object> ctor = decoratorClass.getConstructor(InvocationHandler.class); - return ctor.newInstance(DUMMY_HANDLER); - } - - public void init(Object decorator, Object object) throws Exception { - } - - @SuppressWarnings("unchecked") - public Set<Class<? extends Object>> getSupportedInterfaces() { - return new HashSet<Class<? extends Object>>(Arrays.asList(Context.class, EventContext.class, - LdapContext.class, DirContext.class)); - } - - @SuppressWarnings("unchecked") - public Set<Class<? extends Object>> getDecoratorClasses() { - return new HashSet<Class<? extends Object>>(Arrays.asList(DECORATOR_CLASS1, DECORATOR_CLASS2, DECORATOR_CLASS3, DECORATOR_CLASS4)); - } - }; - - picker.setContext(decSet); - - return picker; - } -} diff --git a/modules/integration-tests/jndi-access/jndi-access-test/src/test/java/org/rhq/jndi/test/JndiAccessTest.java b/modules/integration-tests/jndi-access/jndi-access-test/src/test/java/org/rhq/jndi/test/JndiAccessTest.java index 46d211c..05c59b6 100644 --- a/modules/integration-tests/jndi-access/jndi-access-test/src/test/java/org/rhq/jndi/test/JndiAccessTest.java +++ b/modules/integration-tests/jndi-access/jndi-access-test/src/test/java/org/rhq/jndi/test/JndiAccessTest.java @@ -45,9 +45,9 @@ import org.rhq.bindings.StandardScriptPermissions; import org.rhq.bindings.util.PackageFinder; import org.rhq.core.domain.auth.Subject; import org.rhq.enterprise.client.LocalClient; -import org.rhq.enterprise.server.AllowRhqServerInternalsAccessPermission; import org.rhq.enterprise.server.test.AbstractEJB3Test; import org.rhq.enterprise.server.util.LookupUtil; +import org.rhq.jndi.AllowRhqServerInternalsAccessPermission; import org.rhq.test.PortScout;
/**
commit 7da0e10a95e08dcf71fcd578968a4f25e8ad0e7f Author: Jay Shaughnessy jshaughn@redhat.com Date: Wed Dec 5 11:49:22 2012 -0500
Disable the indi-access integration test. This test class relied on the legacy AbstractEJB3Test but used it only in a superfluous way. As opposed to migrating this to itests-2 to use the new AbstractEJB3test Lukas is working in a branch on a version that does not need it at all. We'll re-enable when that branch is merged in. The current version is causing some build issues due to obsolete pom refs.
diff --git a/modules/integration-tests/pom.xml b/modules/integration-tests/pom.xml index a0b0b13..4818c3a 100644 --- a/modules/integration-tests/pom.xml +++ b/modules/integration-tests/pom.xml @@ -59,7 +59,7 @@ </activation> <modules> <module>apache-plugin-test</module> - <module>jndi-access</module> + <!--<module>jndi-access</module> commented out until Lukas updates for AS7 --> <!--<module>mod_cluster-plugin-test</module>--> <!--<module>rest-api</module>--> </modules>
commit f50d03af0ee0f5942603ac225c4ebafdfb2d2a7e Author: John Mazzitelli mazz@redhat.com Date: Wed Dec 5 10:11:36 2012 -0500
trivial - use constants for exit codes
diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java index c15c5bb..50430de 100644 --- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java +++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java @@ -37,6 +37,11 @@ import org.rhq.enterprise.server.installer.InstallerService.AutoInstallDisabledE public class Installer { private static final Log LOG = LogFactory.getLog(Installer.class);
+ private static final int EXIT_CODE_ALREADY_INSTALLED = 0; + private static final int EXIT_CODE_INSTALLATION_DONE = 0; + private static final int EXIT_CODE_AUTOINSTALL_DISABLED = 1; + private static final int EXIT_CODE_INSTALLATION_ERROR = 2; + private InstallerConfiguration installerConfig;
public static void main(String[] args) { @@ -46,10 +51,10 @@ public class Installer { installer.doInstall(args); } catch (Exception e) { LOG.error("An error occurred", e); - System.exit(100); + System.exit(EXIT_CODE_INSTALLATION_ERROR); }
- System.exit(0); + System.exit(EXIT_CODE_INSTALLATION_DONE); }
public Installer() { @@ -72,10 +77,10 @@ public class Installer { new InstallerServiceImpl(installerConfig).test(); } catch (AutoInstallDisabledException e) { LOG.error(e.getMessage()); - System.exit(1); + System.exit(EXIT_CODE_AUTOINSTALL_DISABLED); } catch (AlreadyInstalledException e) { LOG.info(e.getMessage()); - System.exit(0); + System.exit(EXIT_CODE_ALREADY_INSTALLED); } return; } @@ -87,10 +92,10 @@ public class Installer { LOG.info("Installation is complete. The server should be ready shortly."); } catch (AutoInstallDisabledException e) { LOG.error(e.getMessage()); - System.exit(1); + System.exit(EXIT_CODE_AUTOINSTALL_DISABLED); } catch (AlreadyInstalledException e) { LOG.info(e.getMessage()); - System.exit(0); + System.exit(EXIT_CODE_ALREADY_INSTALLED); }
return;
commit 019fbf2c8a5930c54b3bbe32bbb7fdc07b01835d Author: Lukas Krejci lkrejci@redhat.com Date: Wed Dec 5 15:24:34 2012 +0100
[BZ 876479] - Hardcode the values of symbolic time constants in the measurement_utils.js rather than referencing the previous ones during the declaration. That just didn't work, giving all such props a value of NaN.
diff --git a/modules/enterprise/remoting/cli/src/main/samples/measurement_utils.js b/modules/enterprise/remoting/cli/src/main/samples/measurement_utils.js index a87f51a..80cc8a4 100644 --- a/modules/enterprise/remoting/cli/src/main/samples/measurement_utils.js +++ b/modules/enterprise/remoting/cli/src/main/samples/measurement_utils.js @@ -73,8 +73,8 @@ function MeasurementModule() { */ this.time = { seconds: 1000, - minutes: 60 * this.seconds, - hours: 60 * this.minutes + minutes: 60 * 1000, + hours: 60 * 60 * 1000 }
/**
commit 2de428af239ee6b4af0af2a439e7e27f65755acb Author: Lukas Krejci lkrejci@redhat.com Date: Wed Dec 5 14:58:23 2012 +0100
tmp
diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/StandardScriptPermissions.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/StandardScriptPermissions.java index 5822d44..3a7d046 100644 --- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/StandardScriptPermissions.java +++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/StandardScriptPermissions.java @@ -23,14 +23,19 @@ import java.io.FilePermission; import java.io.SerializablePermission; import java.lang.reflect.ReflectPermission; import java.net.SocketPermission; +import java.security.CodeSource; import java.security.Permission; import java.security.PermissionCollection; import java.security.Permissions; +import java.security.ProtectionDomain; +import java.security.cert.Certificate; import java.util.Enumeration; import java.util.PropertyPermission; +import java.util.logging.LoggingPermission;
import javax.management.MBeanPermission; import javax.management.ObjectName; +import javax.security.auth.PrivateCredentialPermission;
/** * @author Lukas Krejci @@ -58,13 +63,11 @@ public class StandardScriptPermissions extends PermissionCollection { //JVM defined runtime perms add(new RuntimePermission("createClassLoader")); add(new RuntimePermission("getClassLoader")); - add(new RuntimePermission("setContextClassLoader")); add(new RuntimePermission("getenv.*")); add(new RuntimePermission("getProtectionDomain")); add(new RuntimePermission("getFileSystemAttributes")); add(new RuntimePermission("readFileDescriptor")); add(new RuntimePermission("writeFileDescriptor")); - add(new RuntimePermission("loadLibrary.*")); add(new RuntimePermission("accessClassInPackage.*")); add(new RuntimePermission("defineClassInPackage.*")); add(new RuntimePermission("accessDeclaredMembers")); @@ -85,10 +88,18 @@ public class StandardScriptPermissions extends PermissionCollection {
add(new ReflectPermission("suppressAccessChecks"));
- //these 2 are required for server-side scripts to be able to + //these are required for server-side scripts to be able to //invoke remote EJBs. + add(new SerializablePermission("creator")); + add(new SerializablePermission("allowSerializationReflection")); add(new SerializablePermission("enableSubclassImplementation")); - add(new RuntimePermission("reflectionFactoryAccess")); + add(new RuntimePermission("reflectionFactoryAccess")); + + //by default allow the scripts access to any credentials of any user + //we don't consider the scripts malevolent. + add(new PrivateCredentialPermission("* * "*"", "read")); + + add(new LoggingPermission("control", null)); }
public void add(Permission permission) { diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientFactory.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientFactory.java index 74c0019..3b993a8 100644 --- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientFactory.java +++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientFactory.java @@ -9,11 +9,6 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Set;
-import javax.jws.WebParam; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - import javassist.CannotCompileException; import javassist.ClassPool; import javassist.CtClass; @@ -26,6 +21,11 @@ import javassist.bytecode.annotation.StringMemberValue; import javassist.util.proxy.MethodHandler; import javassist.util.proxy.ProxyFactory;
+import javax.jws.WebParam; + +import org.apache.commons.logging.Log; + +import org.rhq.bindings.security.SecurityActions; import org.rhq.bindings.util.ConfigurationClassBuilder; import org.rhq.bindings.util.ResourceTypeFingerprint; import org.rhq.core.domain.resource.ResourceCreationDataType; @@ -42,7 +42,7 @@ public class ResourceClientFactory { public Class<?> iface; }
- private static final Log LOG = LogFactory.getLog(ResourceClientFactory.class); + private static final Log LOG = SecurityActions.getLog(ResourceClientFactory.class);
//keys are resource type ids private static HashMap<Integer, CacheRecord> CUSTOM_CLASS_CACHE = new HashMap<Integer, CacheRecord>(); diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java index 7361fe8..1b71678 100644 --- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java +++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java @@ -32,8 +32,8 @@ import java.util.Set; import javassist.util.proxy.MethodHandler;
import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory;
+import org.rhq.bindings.security.SecurityActions; import org.rhq.bindings.util.ConfigurationClassBuilder; import org.rhq.bindings.util.LazyLoadScenario; import org.rhq.bindings.util.ResourceTypeFingerprint; @@ -84,7 +84,7 @@ import org.rhq.enterprise.server.resource.ResourceTypeNotFoundException; */ public class ResourceClientProxy {
- private static final Log LOG = LogFactory.getLog(ResourceClientProxy.class); + private static final Log LOG = SecurityActions.getLog(ResourceClientProxy.class);
private ResourceClientFactory proxyFactory; private RhqFacade remoteClient; diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java index 2a1f944..4d33fb2 100644 --- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java +++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java @@ -28,10 +28,10 @@ import java.nio.charset.Charset; import java.util.List;
import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory;
import org.rhq.bindings.StandardBindings; import org.rhq.bindings.client.RhqFacade; +import org.rhq.bindings.security.SecurityActions; import org.rhq.core.domain.content.Repo; import org.rhq.core.domain.content.composite.PackageAndLatestVersionComposite; import org.rhq.core.domain.criteria.PackageCriteria; @@ -53,7 +53,7 @@ import org.rhq.enterprise.server.content.RepoManagerRemote; public class RepoScriptSourceProvider extends BaseRhqSchemeScriptSourceProvider implements StandardBindings.RhqFacadeChangeListener {
- private static final Log LOG = LogFactory.getLog(RepoScriptSourceProvider.class); + private static final Log LOG = SecurityActions.getLog(RepoScriptSourceProvider.class);
private static final String AUTHORITY = "repositories";
diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/security/SecurityActions.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/security/SecurityActions.java new file mode 100644 index 0000000..cdde2ff --- /dev/null +++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/security/SecurityActions.java @@ -0,0 +1,56 @@ +/* + * RHQ Management Platform + * Copyright 2012, Red Hat Middleware LLC, and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +package org.rhq.bindings.security; + +import java.security.AccessController; +import java.security.PrivilegedAction; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * @author Lukas Krejci + * + */ +public class SecurityActions { + + private SecurityActions() { + + } + + public static Log getLog(final Class<?> cls) { + return AccessController.doPrivileged(new PrivilegedAction<Log>() { + @Override + public Log run() { + return LogFactory.getLog(cls); + }; + }); + } + + public static Log getLog(final String name) { + return AccessController.doPrivileged(new PrivilegedAction<Log>() { + @Override + public Log run() { + return LogFactory.getLog(name); + }; + }); + } +} diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/util/InterfaceSimplifier.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/util/InterfaceSimplifier.java index 8ce7bc6..d2724d1 100644 --- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/util/InterfaceSimplifier.java +++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/util/InterfaceSimplifier.java @@ -52,8 +52,8 @@ import javassist.bytecode.annotation.ShortMemberValue; import javassist.bytecode.annotation.StringMemberValue;
import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory;
+import org.rhq.bindings.security.SecurityActions; import org.rhq.core.domain.auth.Subject;
/** @@ -64,7 +64,7 @@ import org.rhq.core.domain.auth.Subject; * @author Lukas Krejci */ public class InterfaceSimplifier { - private static final Log LOG = LogFactory.getLog(InterfaceSimplifier.class); + private static final Log LOG = SecurityActions.getLog(InterfaceSimplifier.class);
private InterfaceSimplifier() {
diff --git a/modules/enterprise/server/container-lib/pom.xml b/modules/enterprise/server/container-lib/pom.xml index 05f8bd4..1b02461 100644 --- a/modules/enterprise/server/container-lib/pom.xml +++ b/modules/enterprise/server/container-lib/pom.xml @@ -9,7 +9,6 @@ <relativePath>../../../../pom.xml</relativePath> </parent>
- <groupId>org.rhq</groupId> <artifactId>rhq-container-lib</artifactId> <packaging>jar</packaging>
@@ -17,33 +16,10 @@ <description>A library of classes that will be deployed in the server container itself, above the main EAR</description>
<dependencies> - <dependency> - <groupId>org.jboss.jbossts</groupId> - <artifactId>jbossjts</artifactId> - <version>4.16.2.Final</version> - <scope>provided</scope> <!-- by JBossAS --> - </dependency> - - <dependency> - <groupId>org.jboss</groupId> - <artifactId>jboss-common-core</artifactId> - <scope>provided</scope> <!-- by JBossAS --> - </dependency> - - <dependency> - <groupId>jboss</groupId> - <artifactId>jbosssx</artifactId> - <version>4.2.3.GA</version> - <scope>provided</scope> <!-- by JBossAS --> - </dependency> - - <dependency> - <groupId>jboss</groupId> - <artifactId>jnpserver</artifactId> - <version>4.2.2.GA</version> - <scope>provided</scope> - </dependency> + <groupId>org.jboss.as</groupId> + <artifactId>jboss-as-naming</artifactId> + </dependency> </dependencies>
<profiles> diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/AccessCheckingInitialContextFactoryBuilder.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/AccessCheckingInitialContextFactoryBuilder.java deleted file mode 100644 index 1e35a4e..0000000 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/AccessCheckingInitialContextFactoryBuilder.java +++ /dev/null @@ -1,250 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2011 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.jndi; - -import java.net.InetAddress; -import java.net.NetworkInterface; -import java.net.SocketException; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.UnknownHostException; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Enumeration; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.Set; - -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.NamingException; -import javax.naming.directory.DirContext; -import javax.naming.event.EventContext; -import javax.naming.event.EventDirContext; -import javax.naming.ldap.LdapContext; -import javax.naming.spi.InitialContextFactory; -import javax.naming.spi.InitialContextFactoryBuilder; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import org.rhq.jndi.context.AccessCheckingContextDecorator; -import org.rhq.jndi.context.AccessCheckingContextDecoratorSetContext; -import org.rhq.jndi.context.ContextDecorator; -import org.rhq.jndi.context.URLPreferringContextDecoratorSetContext; -import org.rhq.jndi.util.DecoratorPicker; - -/** - * This initial context factory builder is installed early on during the RHQ server startup - * and is later on used for obtaining the {@link Context}s for all JNDI lookups in the - * RHQ server. - * <p> - * We use a custom initial context factory builder to prevent the potential malicious 3rd party - * code (like CLI alert scripts) from supplying custom environment variables to {@link InitialContext} - * that would modify the JNDI lookup to skip our security access checks. - * <p> - * By using a builder we effectively take control of the initial context creation process - * and are free to ignore whatever the script is trying to supply. - * <p> - * This builder makes sure to install the RHQ server's security access checks to whatever - * initial context that is configured by the standard environment variables - * ({@link Context#INITIAL_CONTEXT_FACTORY}, etc.) - * <p> - * This class is heavily inspired by the implementation of a similar builder in JBoss AS 7. - * - * @see AllowRhqServerInternalsAccessPermission - * - * @author Lukas Krejci - */ -public class AccessCheckingInitialContextFactoryBuilder implements InitialContextFactoryBuilder { - private static final Log LOG = LogFactory.getLog(AccessCheckingInitialContextFactoryBuilder.class); - - /** - * The list of JNDI name schemes that should be checked for security permissions - * (in addition to the names with no scheme). - * - * @see AccessCheckingContextDecorator - */ - private static final String[] CHECKED_SCHEMES = { "java" }; - - private static final Set<Class<? extends Context>> SUPPORTED_CONTEXT_INTERFACES; - - static { - SUPPORTED_CONTEXT_INTERFACES = new HashSet<Class<? extends Context>>(); - SUPPORTED_CONTEXT_INTERFACES.add(Context.class); - SUPPORTED_CONTEXT_INTERFACES.add(DirContext.class); - SUPPORTED_CONTEXT_INTERFACES.add(EventContext.class); - SUPPORTED_CONTEXT_INTERFACES.add(EventDirContext.class); - SUPPORTED_CONTEXT_INTERFACES.add(LdapContext.class); - } - - private static final Set<InetAddress> SERVER_BIND_IPS; - static { - SERVER_BIND_IPS = new HashSet<InetAddress>(); - - try { - String bindingAddressString = System.getProperty("jboss.bind.address"); - InetAddress bindingAddress = InetAddress.getByName(bindingAddressString); - - if (bindingAddress.isAnyLocalAddress()) { - Enumeration<NetworkInterface> ifaces = NetworkInterface.getNetworkInterfaces(); - while (ifaces.hasMoreElements()) { - NetworkInterface iface = ifaces.nextElement(); - SERVER_BIND_IPS.addAll(Collections.list(iface.getInetAddresses())); - } - } else { - SERVER_BIND_IPS.add(bindingAddress); - } - } catch (SocketException e) { - LOG.error("Could not obtain the list of local IPs", e); - } catch (UnknownHostException e) { - LOG.error("Failed to get the binding address of the RHQ server.", e); - } - } - - private static final int JNP_PORT = Integer.parseInt(System.getProperty("rhq.server.startup.namingservice.port", - "2099")); - - /** - * This is the default initial context factory that is returned when no other is - * configured using the environment variables. - * <p> - * It uses {@link NamingContextFactory} as the underlying mechanism - the same - * as the default configuration in JBoss 4. - */ - private static final InitialContextFactory DEFAULT_FACTORY = new InitialContextFactory() { - public Context getInitialContext(Hashtable<?, ?> environment) throws NamingException { - return null; // TODO: how to do this in AS7? createSecureWrapper(new NamingContextFactory(), environment).getInitialContext(environment); - } - }; - - /** - * Create a InitialContext factory. If the environment does not override the factory class it will use the - * default context factory. - * - * @param environment The environment - * @return An initial context factory - * @throws NamingException If an error occurs loading the factory class. - */ - public InitialContextFactory createInitialContextFactory(Hashtable<?, ?> environment) throws NamingException { - final String factoryClassName = (String) environment.get(Context.INITIAL_CONTEXT_FACTORY); - if (factoryClassName == null) { - if (LOG.isDebugEnabled()) { - LOG.debug("No " + Context.INITIAL_CONTEXT_FACTORY + " set. Using the default factory."); - } - return DEFAULT_FACTORY; - } - final ClassLoader classLoader = getContextClassLoader(); - try { - final Class<?> factoryClass = Class.forName(factoryClassName, true, classLoader); - InitialContextFactory configuredFactory = (InitialContextFactory) factoryClass.newInstance(); - return createSecureWrapper(configuredFactory, environment); - } catch (Exception e) { - throw new NamingException("Failed instantiate InitialContextFactory " + factoryClassName - + " from classloader " + classLoader); - } - } - - private ClassLoader getContextClassLoader() { - return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() { - public ClassLoader run() { - return Thread.currentThread().getContextClassLoader(); - } - }); - } - - private static InitialContextFactory - createSecureWrapper(InitialContextFactory factory, Hashtable<?, ?> environment) { - String providerUrl = (String) environment.get(Context.PROVIDER_URL); - - if (providerUrl == null) { - if (LOG.isTraceEnabled()) { - LOG.trace("Wrapping " + factory + " of class " + factory.getClass() + " in an access checking wrapper. No provider URL detected."); - } - return getAccessCheckingFactory(factory); - } else { - try { - URI uri = new URI(providerUrl); - InetAddress providerHost = InetAddress.getByName(uri.getHost()); - - //check if we are accessing the RHQ server through some remoting - //interface. - if (uri.getPort() == JNP_PORT && SERVER_BIND_IPS.contains(providerHost)) { - if (LOG.isTraceEnabled()) { - LOG.trace("Wrapping " + factory + " of class " + factory.getClass() + " in an access checking wrapper. The provider URL points to this server."); - } - return getAccessCheckingFactory(factory); - } else { - if (LOG.isTraceEnabled()) { - LOG.trace("Wrapping " + factory + " of class " + factory.getClass() + " in an URL preferring wrapper to enable remote connections."); - } - return getURLPreferringFactory(factory); - } - } catch (URISyntaxException e) { - if (LOG.isDebugEnabled()) { - LOG.debug("The " + Context.PROVIDER_URL - + " is not a valid URI. Falling back to using the access checking wrapper for the factory " - + factory + " of class " + factory.getClass() + ".", e); - } - return getAccessCheckingFactory(factory); - } catch (UnknownHostException e) { - //let the factory deal with the unknown host... - //this most probably shouldn't be secured because localhost addresses - //should be resolvable. - if (LOG.isDebugEnabled()) { - LOG.debug("The " + Context.PROVIDER_URL - + " is not resolvable. Falling back to using the URL preferring wrapper for the factory " - + factory + " of class " + factory.getClass() + ".", e); - } - return getURLPreferringFactory(factory); - } - } - } - - private static InitialContextFactory getAccessCheckingFactory(InitialContextFactory original) { - ArrayList<DecoratorPicker<Context, ContextDecorator>> pickers = new ArrayList<DecoratorPicker<Context,ContextDecorator>>(); - pickers.add(getURLPreferringDecoratorPicker()); - pickers.add(getAccessCheckingDecoratorPicker()); - - return new DecoratingInitialContextFactory(original, pickers); - } - - private static InitialContextFactory getURLPreferringFactory(InitialContextFactory original) { - ArrayList<DecoratorPicker<Context, ContextDecorator>> pickers = new ArrayList<DecoratorPicker<Context,ContextDecorator>>(); - pickers.add(getURLPreferringDecoratorPicker()); - - return new DecoratingInitialContextFactory(original, pickers); - } - - private static DecoratorPicker<Context, ContextDecorator> getAccessCheckingDecoratorPicker() { - DecoratorPicker<Context, ContextDecorator> ret = new DecoratorPicker<Context, ContextDecorator>(); - ret.setContext(new AccessCheckingContextDecoratorSetContext(SUPPORTED_CONTEXT_INTERFACES, CHECKED_SCHEMES)); - - return ret; - } - - private static DecoratorPicker<Context, ContextDecorator> getURLPreferringDecoratorPicker() { - DecoratorPicker<Context, ContextDecorator> ret = new DecoratorPicker<Context, ContextDecorator>(); - ret.setContext(new URLPreferringContextDecoratorSetContext(SUPPORTED_CONTEXT_INTERFACES)); - - return ret; - } -} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/AllowRhqServerInternalsAccessPermission.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/AllowRhqServerInternalsAccessPermission.java deleted file mode 100644 index aa807d6..0000000 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/AllowRhqServerInternalsAccessPermission.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2011 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.jndi; - -import java.security.BasicPermission; - -/** - * - * - * @author Lukas Krejci - */ -public class AllowRhqServerInternalsAccessPermission extends BasicPermission { - - private static final long serialVersionUID = 1L; - - public AllowRhqServerInternalsAccessPermission() { - super("org.rhq.allow.server.internals.access"); - } -} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/DecoratingInitialContextFactory.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/DecoratingInitialContextFactory.java deleted file mode 100644 index e0f1d84..0000000 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/DecoratingInitialContextFactory.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.jndi; - -import java.lang.reflect.Proxy; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.List; -import java.util.Set; - -import javax.naming.Context; -import javax.naming.NamingException; -import javax.naming.spi.InitialContextFactory; - -import org.rhq.jndi.context.ContextDecorator; -import org.rhq.jndi.util.DecoratorPicker; -import org.rhq.jndi.util.DecoratingInvocationHandler; - -/** - * This class implements an initial context factory that decorates the contexts - * returned from a "wrapped" initial factory passed to this class in the constructor. - * <p> - * The contexts returned from the wrapped initial factory are hidden behind a proxy - * that implements the intersection of interfaces from the <code>supportedContextInterfaces</code> - * constructor parameter and the actual interfaces the wrapped context implements. - * <p> - * The proxy method calls are handled using the {@link DecoratingInvocationHandler} which is initialized - * with the list of {@link DecoratorPicker pickers} that are used to intercept the method - * calls on the wrapped context. - * - * @see DecoratorPicker - * @see DecoratingInvocationHandler - * - * @author Lukas Krejci - */ -public class DecoratingInitialContextFactory implements InitialContextFactory { - - List<DecoratorPicker<Context, ContextDecorator>> pickers; - private InitialContextFactory factory; - private Set<Class<? extends Context>> supportedContextInterfaces; - - public DecoratingInitialContextFactory(InitialContextFactory factory, List<DecoratorPicker<Context, ContextDecorator>> decoratorPickers) { - this.factory = factory; - this.pickers = decoratorPickers; - this.supportedContextInterfaces = new HashSet<Class<? extends Context>>(); - for(DecoratorPicker<Context, ContextDecorator> picker : pickers) { - supportedContextInterfaces.addAll(picker.getContext().getSupportedInterfaces()); - } - } - - public Context getInitialContext(Hashtable<?, ?> environment) throws NamingException { - Context ctx = factory.getInitialContext(environment); - - Set<Class<?>> implementedIfaces = getAllImplementedInterfaces(ctx.getClass()); - Class<?>[] ii = new Class<?>[implementedIfaces.size()]; - implementedIfaces.toArray(ii); - - return (Context) Proxy.newProxyInstance(ctx.getClass().getClassLoader(), ii, new DecoratingInvocationHandler<Context, ContextDecorator>(pickers, ctx)); - } - - private Set<Class<?>> getAllImplementedInterfaces(Class<?> cls) { - HashSet<Class<?>> ret = new HashSet<Class<?>>(); - getAllImplementedInterfaces(cls, ret); - - ret.retainAll(supportedContextInterfaces); - - return ret; - } - - private static void getAllImplementedInterfaces(Class<?> cls, Set<Class<?>> output) { - Class<?>[] ifaces = cls.getInterfaces(); - - for (Class<?> iface : Arrays.asList(ifaces)) { - output.add(iface); - getAllImplementedInterfaces(iface, output); - } - - if (cls.getSuperclass() != null) { - getAllImplementedInterfaces(cls.getSuperclass(), output); - } - } - - @Override - public int hashCode() { - return factory.hashCode(); - } - - @Override - public boolean equals(Object o) { - return factory.equals(o); - } -} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingContextDecorator.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingContextDecorator.java deleted file mode 100644 index 8970b0a..0000000 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingContextDecorator.java +++ /dev/null @@ -1,264 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2011 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.jndi.context; - -import java.io.Serializable; -import java.util.Arrays; -import java.util.Hashtable; -import java.util.List; - -import javax.naming.Binding; -import javax.naming.Context; -import javax.naming.Name; -import javax.naming.NameClassPair; -import javax.naming.NameParser; -import javax.naming.NamingEnumeration; -import javax.naming.NamingException; - -import org.rhq.jndi.AllowRhqServerInternalsAccessPermission; - -/** - * This is the "meat" of the RHQ's secured JNDI access. This {@link Context} decorator - * applied security checks in each method (lookups, (un)bindings, etc). - * <p> - * The security check consists of checking if the current callstack has the {@link AllowRhqServerInternalsAccessPermission}. - * <p> - * This decorator applies the security check on any JNDI name without a scheme and - * on any name that has a scheme listed in the {@link #checkedSchemes} list supplied - * in the constructor. - * - * @author Lukas Krejci - */ -public class AccessCheckingContextDecorator implements Context, ContextDecorator, Serializable { - - private static final long serialVersionUID = 1L; - - private static final AllowRhqServerInternalsAccessPermission PERM = new AllowRhqServerInternalsAccessPermission(); - private Context original; - private List<String> checkedSchemes; - - public AccessCheckingContextDecorator(String... checkedSchemes) { - this.checkedSchemes = Arrays.asList(checkedSchemes); - } - - public AccessCheckingContextDecorator(Context original, String... checkedSchemes) { - this.original = original; - this.checkedSchemes = Arrays.asList(checkedSchemes); - } - - public void init(Context ctx) { - this.original = ctx; - } - - protected Context getOriginal() { - return original; - } - - protected static void check() { - SecurityManager sm = System.getSecurityManager(); - if (sm != null) sm.checkPermission(PERM); - } - - private void checkScheme(String scheme) { - if (scheme == null || checkedSchemes.contains(scheme)) { - check(); - } - } - - protected void check(String name) { - checkScheme(getURLScheme(name)); - } - - protected void check(Name name) { - if (name.size() == 0) { - check(); - } else { - String first = name.get(0); - checkScheme(getURLScheme(first)); - } - } - - public Object lookup(Name name) throws NamingException { - check(name); - return original.lookup(name); - } - - public Object lookup(String name) throws NamingException { - check(name); - return original.lookup(name); - } - - public void bind(Name name, Object obj) throws NamingException { - check(name); - original.bind(name, obj); - } - - public void bind(String name, Object obj) throws NamingException { - check(name); - original.bind(name, obj); - } - - public void rebind(Name name, Object obj) throws NamingException { - check(name); - original.rebind(name, obj); - } - - public void rebind(String name, Object obj) throws NamingException { - check(name); - original.rebind(name, obj); - } - - public void unbind(Name name) throws NamingException { - check(name); - original.unbind(name); - } - - public void unbind(String name) throws NamingException { - check(name); - original.unbind(name); - } - - public void rename(Name oldName, Name newName) throws NamingException { - check(oldName); - check(newName); - original.rename(oldName, newName); - } - - public void rename(String oldName, String newName) throws NamingException { - check(oldName); - check(newName); - original.rename(oldName, newName); - } - - public NamingEnumeration<NameClassPair> list(Name name) throws NamingException { - check(name); - return original.list(name); - } - - public NamingEnumeration<NameClassPair> list(String name) throws NamingException { - check(name); - return original.list(name); - } - - public NamingEnumeration<Binding> listBindings(Name name) throws NamingException { - check(name); - return original.listBindings(name); - } - - public NamingEnumeration<Binding> listBindings(String name) throws NamingException { - check(name); - return original.listBindings(name); - } - - public void destroySubcontext(Name name) throws NamingException { - check(name); - original.destroySubcontext(name); - } - - public void destroySubcontext(String name) throws NamingException { - check(name); - original.destroySubcontext(name); - } - - public Context createSubcontext(Name name) throws NamingException { - check(name); - return original.createSubcontext(name); - } - - public Context createSubcontext(String name) throws NamingException { - check(name); - return original.createSubcontext(name); - } - - public Object lookupLink(Name name) throws NamingException { - check(name); - return original.lookupLink(name); - } - - public Object lookupLink(String name) throws NamingException { - check(name); - return original.lookupLink(name); - } - - public NameParser getNameParser(Name name) throws NamingException { - check(name); - return original.getNameParser(name); - } - - public NameParser getNameParser(String name) throws NamingException { - check(name); - return original.getNameParser(name); - } - - public Name composeName(Name name, Name prefix) throws NamingException { - check(name); - return original.composeName(name, prefix); - } - - public String composeName(String name, String prefix) throws NamingException { - check(name); - return original.composeName(name, prefix); - } - - public Object addToEnvironment(String propName, Object propVal) throws NamingException { - check(); - return original.addToEnvironment(propName, propVal); - } - - public Object removeFromEnvironment(String propName) throws NamingException { - check(); - return original.removeFromEnvironment(propName); - } - - public Hashtable<?, ?> getEnvironment() throws NamingException { - check(); - return original.getEnvironment(); - } - - public void close() throws NamingException { - check(); - original.close(); - } - - public String getNameInNamespace() throws NamingException { - check(); - return original.getNameInNamespace(); - } - - //copied from InitialContext - private static String getURLScheme(String str) { - int colon_posn = str.indexOf(':'); - int slash_posn = str.indexOf('/'); - - if (colon_posn > 0 && (slash_posn == -1 || colon_posn < slash_posn)) - return str.substring(0, colon_posn); - return null; - } - - @Override - public int hashCode() { - return getOriginal() == null ? super.hashCode() : getOriginal().hashCode(); - } - - @Override - public boolean equals(Object o) { - return getOriginal() == null ? super.equals(o) : getOriginal().equals(o); - } -} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingContextDecoratorSetContext.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingContextDecoratorSetContext.java deleted file mode 100644 index 284fd0c..0000000 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingContextDecoratorSetContext.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.jndi.context; - -import java.lang.reflect.Constructor; -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; - -import javax.naming.Context; - -import org.rhq.jndi.util.DecoratorSetContext; - -/** - * - * - * @author Lukas Krejci - */ -public class AccessCheckingContextDecoratorSetContext implements DecoratorSetContext<Context, ContextDecorator> { - - private static final Set<Class<? extends ContextDecorator>> DECORATOR_CLASSES; - static { - HashSet<Class<? extends ContextDecorator>> tmp = new HashSet<Class<? extends ContextDecorator>>(); - tmp.add(AccessCheckingContextDecorator.class); - tmp.add(AccessCheckingDirContextDecorator.class); - tmp.add(AccessCheckingEventContextDecorator.class); - tmp.add(AccessCheckingEventDirContextDecorator.class); - tmp.add(AccessCheckingLdapContextDecorator.class); - - DECORATOR_CLASSES = Collections.unmodifiableSet(tmp); - } - - private Set<Class<? extends Context>> supportedInterfaces; - private String[] checkedSchemes; - - public AccessCheckingContextDecoratorSetContext(Set<Class<? extends Context>> supportedInterfaces, String... checkedSchemes) { - this.supportedInterfaces = supportedInterfaces; - this.checkedSchemes = checkedSchemes; - } - - public ContextDecorator instantiate(Class<? extends ContextDecorator> decoratorClass) throws Exception { - Constructor<? extends ContextDecorator> ctor = decoratorClass.getConstructor(String[].class); - - return ctor.newInstance((Object)checkedSchemes); - } - - public Set<Class<? extends Context>> getSupportedInterfaces() { - return supportedInterfaces; - } - - public Set<Class<? extends ContextDecorator>> getDecoratorClasses() { - return DECORATOR_CLASSES; - } - - public void init(ContextDecorator decorator, Context object) throws Exception { - decorator.init(object); - } -} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingDirContextDecorator.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingDirContextDecorator.java deleted file mode 100644 index 1614180..0000000 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingDirContextDecorator.java +++ /dev/null @@ -1,187 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.jndi.context; - -import javax.naming.Name; -import javax.naming.NamingEnumeration; -import javax.naming.NamingException; -import javax.naming.directory.Attributes; -import javax.naming.directory.DirContext; -import javax.naming.directory.ModificationItem; -import javax.naming.directory.SearchControls; -import javax.naming.directory.SearchResult; - -/** - * A decorator of {@link DirContext}. - * - * @author Lukas Krejci - */ -public class AccessCheckingDirContextDecorator extends AccessCheckingContextDecorator implements DirContext { - - private static final long serialVersionUID = 1L; - - public AccessCheckingDirContextDecorator(String... checkedSchemes) { - super(checkedSchemes); - } - - public AccessCheckingDirContextDecorator(DirContext original, String... checkedSchemes) { - super(original, checkedSchemes); - } - - @Override - protected DirContext getOriginal() { - return (DirContext) super.getOriginal(); - } - - public Attributes getAttributes(Name name) throws NamingException { - check(name); - return getOriginal().getAttributes(name); - } - - public Attributes getAttributes(String name) throws NamingException { - check(name); - return getOriginal().getAttributes(name); - } - - public Attributes getAttributes(Name name, String[] attrIds) throws NamingException { - check(name); - return getOriginal().getAttributes(name, attrIds); - } - - public Attributes getAttributes(String name, String[] attrIds) throws NamingException { - check(name); - return getOriginal().getAttributes(name, attrIds); - } - - public void modifyAttributes(Name name, int mod_op, Attributes attrs) throws NamingException { - check(name); - getOriginal().modifyAttributes(name, mod_op, attrs); - } - - public void modifyAttributes(String name, int mod_op, Attributes attrs) throws NamingException { - check(name); - getOriginal().modifyAttributes(name, mod_op, attrs); - } - - public void modifyAttributes(Name name, ModificationItem[] mods) throws NamingException { - check(name); - getOriginal().modifyAttributes(name, mods); - } - - public void modifyAttributes(String name, ModificationItem[] mods) throws NamingException { - check(name); - getOriginal().modifyAttributes(name, mods); - } - - public void bind(Name name, Object obj, Attributes attrs) throws NamingException { - check(name); - getOriginal().bind(name, obj, attrs); - } - - public void bind(String name, Object obj, Attributes attrs) throws NamingException { - check(name); - getOriginal().bind(name, obj, attrs); - } - - public void rebind(Name name, Object obj, Attributes attrs) throws NamingException { - check(name); - getOriginal().rebind(name, obj, attrs); - } - - public void rebind(String name, Object obj, Attributes attrs) throws NamingException { - check(name); - getOriginal().rebind(name, obj, attrs); - } - - public DirContext createSubcontext(Name name, Attributes attrs) throws NamingException { - check(name); - return getOriginal().createSubcontext(name, attrs); - } - - public DirContext createSubcontext(String name, Attributes attrs) throws NamingException { - check(name); - return getOriginal().createSubcontext(name, attrs); - } - - public DirContext getSchema(Name name) throws NamingException { - check(name); - return getOriginal().getSchema(name); - } - - public DirContext getSchema(String name) throws NamingException { - check(name); - return getOriginal().getSchema(name); - } - - public DirContext getSchemaClassDefinition(Name name) throws NamingException { - check(name); - return getOriginal().getSchemaClassDefinition(name); - } - - public DirContext getSchemaClassDefinition(String name) throws NamingException { - check(name); - return getOriginal().getSchema(name); - } - - public NamingEnumeration<SearchResult> - search(Name name, Attributes matchingAttributes, String[] attributesToReturn) throws NamingException { - check(name); - return getOriginal().search(name, matchingAttributes, attributesToReturn); - } - - public NamingEnumeration<SearchResult> search(String name, Attributes matchingAttributes, - String[] attributesToReturn) throws NamingException { - check(name); - return getOriginal().search(name, matchingAttributes, attributesToReturn); - } - - public NamingEnumeration<SearchResult> search(Name name, Attributes matchingAttributes) throws NamingException { - check(name); - return getOriginal().search(name, matchingAttributes); - } - - public NamingEnumeration<SearchResult> search(String name, Attributes matchingAttributes) throws NamingException { - check(name); - return getOriginal().search(name, matchingAttributes); - } - - public NamingEnumeration<SearchResult> search(Name name, String filter, SearchControls cons) throws NamingException { - check(name); - return getOriginal().search(name, filter, cons); - } - - public NamingEnumeration<SearchResult> search(String name, String filter, SearchControls cons) - throws NamingException { - check(name); - return getOriginal().search(name, filter, cons); - } - - public NamingEnumeration<SearchResult> - search(Name name, String filterExpr, Object[] filterArgs, SearchControls cons) throws NamingException { - check(name); - return getOriginal().search(name, filterExpr, filterArgs, cons); - } - - public NamingEnumeration<SearchResult> search(String name, String filterExpr, Object[] filterArgs, - SearchControls cons) throws NamingException { - check(name); - return getOriginal().search(name, filterExpr, filterArgs, cons); - } -} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingEventContextDecorator.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingEventContextDecorator.java deleted file mode 100644 index 67a9527..0000000 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingEventContextDecorator.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.jndi.context; - -import javax.naming.Name; -import javax.naming.NamingException; -import javax.naming.event.EventContext; -import javax.naming.event.NamingListener; - -/** - * - * - * @author Lukas Krejci - */ -public class AccessCheckingEventContextDecorator extends AccessCheckingContextDecorator implements EventContext { - - private static final long serialVersionUID = 1L; - - public AccessCheckingEventContextDecorator(String... checkedSchemes) { - super(checkedSchemes); - } - - public AccessCheckingEventContextDecorator(EventContext original, String... checkedSchemes) { - super(original, checkedSchemes); - } - - @Override - protected EventContext getOriginal() { - return (EventContext) super.getOriginal(); - } - - public void addNamingListener(Name target, int scope, NamingListener l) throws NamingException { - check(target); - getOriginal().addNamingListener(target, scope, l); - } - - public void addNamingListener(String target, int scope, NamingListener l) throws NamingException { - check(target); - getOriginal().addNamingListener(target, scope, l); - } - - public void removeNamingListener(NamingListener l) throws NamingException { - check(); - getOriginal().removeNamingListener(l); - } - - public boolean targetMustExist() throws NamingException { - check(); - return getOriginal().targetMustExist(); - } - -} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingEventDirContextDecorator.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingEventDirContextDecorator.java deleted file mode 100644 index ed7a848..0000000 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingEventDirContextDecorator.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.jndi.context; - -import javax.naming.Name; -import javax.naming.NamingException; -import javax.naming.directory.SearchControls; -import javax.naming.event.EventDirContext; -import javax.naming.event.NamingListener; - -/** - * - * - * @author Lukas Krejci - */ -public class AccessCheckingEventDirContextDecorator extends AccessCheckingDirContextDecorator implements - EventDirContext { - - private static final long serialVersionUID = 1L; - - public AccessCheckingEventDirContextDecorator(String... checkedSchemes) { - super(checkedSchemes); - } - - public AccessCheckingEventDirContextDecorator(EventDirContext original, String... checkedSchemes) { - super(original, checkedSchemes); - } - - @Override - protected EventDirContext getOriginal() { - return (EventDirContext) super.getOriginal(); - } - - public void addNamingListener(Name target, int scope, NamingListener l) throws NamingException { - check(target); - getOriginal().addNamingListener(target, scope, l); - } - - public void addNamingListener(String target, int scope, NamingListener l) throws NamingException { - check(target); - getOriginal().addNamingListener(target, scope, l); - } - - public void removeNamingListener(NamingListener l) throws NamingException { - check(); - getOriginal().removeNamingListener(l); - } - - public boolean targetMustExist() throws NamingException { - check(); - return getOriginal().targetMustExist(); - } - - public void addNamingListener(Name target, String filter, SearchControls ctls, NamingListener l) - throws NamingException { - check(target); - getOriginal().addNamingListener(target, filter, ctls, l); - } - - public void addNamingListener(String target, String filter, SearchControls ctls, NamingListener l) - throws NamingException { - check(target); - getOriginal().addNamingListener(target, filter, ctls, l); - } - - public void - addNamingListener(Name target, String filter, Object[] filterArgs, SearchControls ctls, NamingListener l) - throws NamingException { - check(target); - getOriginal().addNamingListener(target, filter, filterArgs, ctls, l); - } - - public void addNamingListener(String target, String filter, Object[] filterArgs, SearchControls ctls, - NamingListener l) throws NamingException { - check(target); - getOriginal().addNamingListener(target, filter, filterArgs, ctls, l); - } - -} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingLdapContextDecorator.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingLdapContextDecorator.java deleted file mode 100644 index e361db8..0000000 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/AccessCheckingLdapContextDecorator.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.jndi.context; - -import javax.naming.NamingException; -import javax.naming.ldap.Control; -import javax.naming.ldap.ExtendedRequest; -import javax.naming.ldap.ExtendedResponse; -import javax.naming.ldap.LdapContext; - -/** - * - * - * @author Lukas Krejci - */ -public class AccessCheckingLdapContextDecorator extends AccessCheckingDirContextDecorator implements LdapContext { - - private static final long serialVersionUID = 1L; - - public AccessCheckingLdapContextDecorator(String... checkedSchemes) { - super(checkedSchemes); - } - - public AccessCheckingLdapContextDecorator(LdapContext original, String... checkedSchemes) { - super(original, checkedSchemes); - } - - @Override - protected LdapContext getOriginal() { - return (LdapContext) super.getOriginal(); - } - - public ExtendedResponse extendedOperation(ExtendedRequest request) throws NamingException { - check(); - return getOriginal().extendedOperation(request); - } - - public LdapContext newInstance(Control[] requestControls) throws NamingException { - check(); - return getOriginal().newInstance(requestControls); - } - - public void reconnect(Control[] connCtls) throws NamingException { - check(); - getOriginal().reconnect(connCtls); - } - - public Control[] getConnectControls() throws NamingException { - check(); - return getOriginal().getConnectControls(); - } - - public void setRequestControls(Control[] requestControls) throws NamingException { - check(); - getOriginal().setRequestControls(requestControls); - } - - public Control[] getRequestControls() throws NamingException { - check(); - return getOriginal().getRequestControls(); - } - - public Control[] getResponseControls() throws NamingException { - check(); - return getOriginal().getResponseControls(); - } - -} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/ContextDecorator.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/ContextDecorator.java deleted file mode 100644 index 5755ebd..0000000 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/ContextDecorator.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.jndi.context; - -import javax.naming.Context; -import javax.naming.NamingException; - -/** - * - * - * @author Lukas Krejci - */ -public interface ContextDecorator extends Context { - - void init(Context context) throws NamingException; -} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringContextDecorator.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringContextDecorator.java deleted file mode 100644 index 3f3a95d..0000000 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringContextDecorator.java +++ /dev/null @@ -1,222 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2011 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.jndi.context; - -import java.io.Serializable; -import java.util.Hashtable; - -import javax.naming.Binding; -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.Name; -import javax.naming.NameClassPair; -import javax.naming.NameParser; -import javax.naming.NamingEnumeration; -import javax.naming.NamingException; - -import org.rhq.jndi.AccessCheckingInitialContextFactoryBuilder; - -/** - * This is a wrapper class around another {@link Context} implementation that - * prefers to use an URL context for some operation if the JNDI name contains - * a scheme rather than the original. This is the behavior of {@link InitialContext} - * which we need to restore in the contexts created by the {@link AccessCheckingInitialContextFactoryBuilder} - * (which an {@link InitialContext} uses exclusively if the builder is set). - * <p> - * This is important because RHQ server has its own initial context factory - * builder that creates factories that in turn create contexts. If the default - * {@link InitialContext} implementation was used, we'd never be able to lookup - * scheme-based names because the default implementation of the {@link InitialContext} - * always uses the default context of the builder if one is installed no matter - * the scheme in the name. - * <p> - * The {@link AccessCheckingInitialContextFactoryBuilder} wraps the context returned - * by the factory in an instance of this class and thus is restoring the original - * intended behavior of the {@link InitialContext}. It looks at the name being looked - * up (bound or whatever) and prefers to use the URL context factories if the name - * contains the scheme (as does the {@link InitialContext} if no builder is installed). - * If the name doesn't contain a scheme, the provided default context factory is used to - * look up the name. - * - * @author Lukas Krejci - */ -public class URLPreferringContextDecorator implements Context, ContextDecorator, Serializable { - - private static final long serialVersionUID = 1L; - - private Context original; - - public URLPreferringContextDecorator() { - - } - - public URLPreferringContextDecorator(Context ctx) { - original = ctx; - } - - public void init(Context context) { - original = context; - } - - protected Context getOriginal() throws NamingException { - return original; - } - - protected Context getURLOrDefaultInitCtx(Name name) throws NamingException { - @SuppressWarnings("unchecked") - Context urlContext = URLPreferringContextDecoratorHelper.getURLContext(name, (Hashtable<Object, Object>) getEnvironment()); - return urlContext == null ? getOriginal() : urlContext; - } - - protected Context getURLOrDefaultInitCtx(String name) throws NamingException { - @SuppressWarnings("unchecked") - Context urlContext = URLPreferringContextDecoratorHelper.getURLContext(name, (Hashtable<Object, Object>) getEnvironment()); - return urlContext == null ? getOriginal() : urlContext; - } - - public Object lookup(Name name) throws NamingException { - return getURLOrDefaultInitCtx(name).lookup(name); - } - - public Object lookup(String name) throws NamingException { - return getURLOrDefaultInitCtx(name).lookup(name); - } - - public void bind(Name name, Object obj) throws NamingException { - getURLOrDefaultInitCtx(name).bind(name, obj); - } - - public void bind(String name, Object obj) throws NamingException { - getURLOrDefaultInitCtx(name).bind(name, obj); - } - - public void rebind(Name name, Object obj) throws NamingException { - getURLOrDefaultInitCtx(name).rebind(name, obj); - } - - public void rebind(String name, Object obj) throws NamingException { - getURLOrDefaultInitCtx(name).rebind(name, obj); - } - - public void unbind(Name name) throws NamingException { - getURLOrDefaultInitCtx(name).unbind(name); - } - - public void unbind(String name) throws NamingException { - getURLOrDefaultInitCtx(name).unbind(name); - } - - public void rename(Name oldName, Name newName) throws NamingException { - getURLOrDefaultInitCtx(oldName).rename(oldName, newName); - } - - public void rename(String oldName, String newName) throws NamingException { - getURLOrDefaultInitCtx(oldName).rename(oldName, newName); - } - - public NamingEnumeration<NameClassPair> list(Name name) throws NamingException { - return getURLOrDefaultInitCtx(name).list(name); - } - - public NamingEnumeration<NameClassPair> list(String name) throws NamingException { - return getURLOrDefaultInitCtx(name).list(name); - } - - public NamingEnumeration<Binding> listBindings(Name name) throws NamingException { - return getURLOrDefaultInitCtx(name).listBindings(name); - } - - public NamingEnumeration<Binding> listBindings(String name) throws NamingException { - return getURLOrDefaultInitCtx(name).listBindings(name); - } - - public void destroySubcontext(Name name) throws NamingException { - getURLOrDefaultInitCtx(name).destroySubcontext(name); - } - - public void destroySubcontext(String name) throws NamingException { - getURLOrDefaultInitCtx(name).destroySubcontext(name); - } - - public Context createSubcontext(Name name) throws NamingException { - return getURLOrDefaultInitCtx(name).createSubcontext(name); - } - - public Context createSubcontext(String name) throws NamingException { - return getURLOrDefaultInitCtx(name).createSubcontext(name); - } - - public Object lookupLink(Name name) throws NamingException { - return getURLOrDefaultInitCtx(name).lookupLink(name); - } - - public Object lookupLink(String name) throws NamingException { - return getURLOrDefaultInitCtx(name).lookupLink(name); - } - - public NameParser getNameParser(Name name) throws NamingException { - return getURLOrDefaultInitCtx(name).getNameParser(name); - } - - public NameParser getNameParser(String name) throws NamingException { - return getURLOrDefaultInitCtx(name).getNameParser(name); - } - - public Name composeName(Name name, Name prefix) throws NamingException { - return getOriginal().composeName(name, prefix); - } - - public String composeName(String name, String prefix) throws NamingException { - return getOriginal().composeName(name, prefix); - } - - public Object addToEnvironment(String propName, Object propVal) throws NamingException { - return getOriginal().addToEnvironment(propName, propVal); - } - - public Object removeFromEnvironment(String propName) throws NamingException { - return getOriginal().removeFromEnvironment(propName); - } - - public Hashtable<?, ?> getEnvironment() throws NamingException { - return getOriginal().getEnvironment(); - } - - public void close() throws NamingException { - if (getOriginal() != null) { - getOriginal().close(); - original = null; - } - } - - public String getNameInNamespace() throws NamingException { - return getOriginal().getNameInNamespace(); - } - - @Override - public int hashCode() { - return original == null ? super.hashCode() : original.hashCode(); - } - - @Override - public boolean equals(Object o) { - return original == null ? super.equals(o) : original.equals(o); - } -} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringContextDecoratorHelper.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringContextDecoratorHelper.java deleted file mode 100644 index 6e7debc..0000000 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringContextDecoratorHelper.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.jndi.context; - -import java.util.Hashtable; - -import javax.naming.Context; -import javax.naming.Name; -import javax.naming.NamingException; -import javax.naming.spi.NamingManager; - -/** - * - * - * @author Lukas Krejci - */ -public class URLPreferringContextDecoratorHelper { - - private URLPreferringContextDecoratorHelper() { - - } - - public static Context getURLContext(String name, Hashtable<Object, Object> env) throws NamingException { - String scheme = getURLScheme(name); - if (scheme != null) { - Context ctx = NamingManager.getURLContext(scheme, env); - if (ctx != null) { - return ctx; - } - } - - return null; - } - - public static Context getURLContext(Name name, Hashtable<Object, Object> env) throws NamingException { - if (name.size() > 0) { - String first = name.get(0); - String scheme = getURLScheme(first); - if (scheme != null) { - Context ctx = NamingManager.getURLContext(scheme, env); - if (ctx != null) { - return ctx; - } - } - } - - return null; - } - - //copied from InitialContext - private static String getURLScheme(String str) { - int colon_posn = str.indexOf(':'); - int slash_posn = str.indexOf('/'); - - if (colon_posn > 0 && (slash_posn == -1 || colon_posn < slash_posn)) - return str.substring(0, colon_posn); - return null; - } -} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringContextDecoratorSetContext.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringContextDecoratorSetContext.java deleted file mode 100644 index 828cd74..0000000 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringContextDecoratorSetContext.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.jndi.context; - -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; - -import javax.naming.Context; - -import org.rhq.jndi.util.DecoratorSetContext; - -/** - * - * - * @author Lukas Krejci - */ -public class URLPreferringContextDecoratorSetContext implements DecoratorSetContext<Context, ContextDecorator> { - - private static final Set<Class<? extends ContextDecorator>> DECORATOR_CLASSES; - static { - HashSet<Class<? extends ContextDecorator>> tmp = new HashSet<Class<? extends ContextDecorator>>(); - tmp.add(URLPreferringContextDecorator.class); - tmp.add(URLPreferringDirContextDecorator.class); - tmp.add(URLPreferringEventContextDecorator.class); - tmp.add(URLPreferringEventDirContextDecorator.class); - tmp.add(URLPreferringLdapContextDecorator.class); - - DECORATOR_CLASSES = Collections.unmodifiableSet(tmp); - } - - private Set<Class<? extends Context>> supportedInterfaces; - - public URLPreferringContextDecoratorSetContext(Set<Class<? extends Context>> supportedInterfaces) { - this.supportedInterfaces = supportedInterfaces; - } - - public Set<Class<? extends Context>> getSupportedInterfaces() { - return supportedInterfaces; - } - - public Set<Class<? extends ContextDecorator>> getDecoratorClasses() { - return DECORATOR_CLASSES; - } - - public ContextDecorator instantiate(Class<? extends ContextDecorator> decoratorClass) throws Exception { - return decoratorClass.newInstance(); - } - - public void init(ContextDecorator decorator, Context object) throws Exception { - decorator.init(object); - } - -} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringDirContextDecorator.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringDirContextDecorator.java deleted file mode 100644 index 6a49942..0000000 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringDirContextDecorator.java +++ /dev/null @@ -1,185 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.jndi.context; - -import javax.naming.Context; -import javax.naming.Name; -import javax.naming.NamingEnumeration; -import javax.naming.NamingException; -import javax.naming.NoInitialContextException; -import javax.naming.NotContextException; -import javax.naming.directory.Attributes; -import javax.naming.directory.DirContext; -import javax.naming.directory.ModificationItem; -import javax.naming.directory.SearchControls; -import javax.naming.directory.SearchResult; - -/** - * Akin to {@link URLPreferringContextDecorator} this class implements the similar logic - * for {@link DirContext}s. - * - * @author Lukas Krejci - */ -public class URLPreferringDirContextDecorator extends URLPreferringContextDecorator implements DirContext { - - private static final long serialVersionUID = 1L; - - public URLPreferringDirContextDecorator() { - super(null); - } - - public URLPreferringDirContextDecorator(DirContext ctx) { - super(ctx); - } - - protected DirContext checkAndCast(Context ctx) throws NamingException { - if (!(ctx instanceof DirContext)) { - if (ctx == null) { - throw new NoInitialContextException(); - } else { - throw new NotContextException( - "Not an instance of DirContext"); - } - } - - return (DirContext) ctx; - } - - @Override - protected DirContext getURLOrDefaultInitCtx(Name name) throws NamingException { - Context ctx = super.getURLOrDefaultInitCtx(name); - return checkAndCast(ctx); - } - - @Override - protected DirContext getURLOrDefaultInitCtx(String name) throws NamingException { - Context ctx = super.getURLOrDefaultInitCtx(name); - return checkAndCast(ctx); - } - - public Attributes getAttributes(Name name) throws NamingException { - return getURLOrDefaultInitCtx(name).getAttributes(name); - } - - public Attributes getAttributes(String name) throws NamingException { - return getURLOrDefaultInitCtx(name).getAttributes(name); - } - - public Attributes getAttributes(Name name, String[] attrIds) throws NamingException { - return getURLOrDefaultInitCtx(name).getAttributes(name, attrIds); - } - - public Attributes getAttributes(String name, String[] attrIds) throws NamingException { - return getURLOrDefaultInitCtx(name).getAttributes(name, attrIds); - } - - public void modifyAttributes(Name name, int mod_op, Attributes attrs) throws NamingException { - getURLOrDefaultInitCtx(name).modifyAttributes(name, mod_op, attrs); - } - - public void modifyAttributes(String name, int mod_op, Attributes attrs) throws NamingException { - getURLOrDefaultInitCtx(name).modifyAttributes(name, mod_op, attrs); - } - - public void modifyAttributes(Name name, ModificationItem[] mods) throws NamingException { - getURLOrDefaultInitCtx(name).modifyAttributes(name, mods); - } - - public void modifyAttributes(String name, ModificationItem[] mods) throws NamingException { - getURLOrDefaultInitCtx(name).modifyAttributes(name, mods); - } - - public void bind(Name name, Object obj, Attributes attrs) throws NamingException { - getURLOrDefaultInitCtx(name).bind(name, obj, attrs); - } - - public void bind(String name, Object obj, Attributes attrs) throws NamingException { - getURLOrDefaultInitCtx(name).bind(name, obj, attrs); - } - - public void rebind(Name name, Object obj, Attributes attrs) throws NamingException { - getURLOrDefaultInitCtx(name).rebind(name, obj, attrs); - } - - public void rebind(String name, Object obj, Attributes attrs) throws NamingException { - getURLOrDefaultInitCtx(name).rebind(name, obj, attrs); - } - - public DirContext createSubcontext(Name name, Attributes attrs) throws NamingException { - return getURLOrDefaultInitCtx(name).createSubcontext(name, attrs); - } - - public DirContext createSubcontext(String name, Attributes attrs) throws NamingException { - return getURLOrDefaultInitCtx(name).createSubcontext(name, attrs); - } - - public DirContext getSchema(Name name) throws NamingException { - return getURLOrDefaultInitCtx(name).getSchema(name); - } - - public DirContext getSchema(String name) throws NamingException { - return getURLOrDefaultInitCtx(name).getSchema(name); - } - - public DirContext getSchemaClassDefinition(Name name) throws NamingException { - return getURLOrDefaultInitCtx(name).getSchemaClassDefinition(name); - } - - public DirContext getSchemaClassDefinition(String name) throws NamingException { - return getURLOrDefaultInitCtx(name).getSchemaClassDefinition(name); - } - - public NamingEnumeration<SearchResult> - search(Name name, Attributes matchingAttributes, String[] attributesToReturn) throws NamingException { - return getURLOrDefaultInitCtx(name).search(name, matchingAttributes, attributesToReturn); - } - - public NamingEnumeration<SearchResult> search(String name, Attributes matchingAttributes, - String[] attributesToReturn) throws NamingException { - return getURLOrDefaultInitCtx(name).search(name, matchingAttributes, attributesToReturn); - } - - public NamingEnumeration<SearchResult> search(Name name, Attributes matchingAttributes) throws NamingException { - return getURLOrDefaultInitCtx(name).search(name, matchingAttributes); - } - - public NamingEnumeration<SearchResult> search(String name, Attributes matchingAttributes) throws NamingException { - return getURLOrDefaultInitCtx(name).search(name, matchingAttributes); - } - - public NamingEnumeration<SearchResult> search(Name name, String filter, SearchControls cons) throws NamingException { - return getURLOrDefaultInitCtx(name).search(name, filter, cons); - } - - public NamingEnumeration<SearchResult> search(String name, String filter, SearchControls cons) - throws NamingException { - return getURLOrDefaultInitCtx(name).search(name, filter, cons); - } - - public NamingEnumeration<SearchResult> - search(Name name, String filterExpr, Object[] filterArgs, SearchControls cons) throws NamingException { - return getURLOrDefaultInitCtx(name).search(name, filterExpr, filterArgs, cons); - } - - public NamingEnumeration<SearchResult> search(String name, String filterExpr, Object[] filterArgs, - SearchControls cons) throws NamingException { - return getURLOrDefaultInitCtx(name).search(name, filterExpr, filterArgs, cons); - } -} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringEventContextDecorator.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringEventContextDecorator.java deleted file mode 100644 index e3298a0..0000000 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringEventContextDecorator.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.jndi.context; - -import javax.naming.Context; -import javax.naming.Name; -import javax.naming.NamingException; -import javax.naming.NoInitialContextException; -import javax.naming.NotContextException; -import javax.naming.event.EventContext; -import javax.naming.event.NamingListener; - -/** - * - * - * @author Lukas Krejci - */ -public class URLPreferringEventContextDecorator extends URLPreferringContextDecorator implements EventContext { - - private static final long serialVersionUID = 1L; - - public URLPreferringEventContextDecorator() { - super(null); - } - - public URLPreferringEventContextDecorator(EventContext ctx) { - super(ctx); - } - - protected EventContext checkAndCast(Context ctx) throws NamingException { - if (!(ctx instanceof EventContext)) { - if (ctx == null) { - throw new NoInitialContextException(); - } else { - throw new NotContextException( - "Not an instance of EventContext"); - } - } - - return (EventContext) ctx; - } - - @Override - protected EventContext getOriginal() throws NamingException { - return checkAndCast(super.getOriginal()); - } - - public void addNamingListener(Name target, int scope, NamingListener l) throws NamingException { - getOriginal().addNamingListener(target, scope, l); - } - - public void addNamingListener(String target, int scope, NamingListener l) throws NamingException { - getOriginal().addNamingListener(target, scope, l); - } - - public void removeNamingListener(NamingListener l) throws NamingException { - getOriginal().removeNamingListener(l); - } - - public boolean targetMustExist() throws NamingException { - return getOriginal().targetMustExist(); - } - -} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringEventDirContextDecorator.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringEventDirContextDecorator.java deleted file mode 100644 index 4925297..0000000 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringEventDirContextDecorator.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.jndi.context; - -import javax.naming.Context; -import javax.naming.Name; -import javax.naming.NamingException; -import javax.naming.NoInitialContextException; -import javax.naming.NotContextException; -import javax.naming.directory.SearchControls; -import javax.naming.event.EventDirContext; -import javax.naming.event.NamingListener; - -/** - * - * - * @author Lukas Krejci - */ -public class URLPreferringEventDirContextDecorator extends URLPreferringDirContextDecorator implements EventDirContext { - - private static final long serialVersionUID = 1L; - - public URLPreferringEventDirContextDecorator() { - super(null); - } - - public URLPreferringEventDirContextDecorator(EventDirContext ctx) { - super(ctx); - } - - @Override - protected EventDirContext checkAndCast(Context ctx) throws NamingException { - if (!(ctx instanceof EventDirContext)) { - if (ctx == null) { - throw new NoInitialContextException(); - } else { - throw new NotContextException( - "Not an instance of EventDirContext"); - } - } - - return (EventDirContext) ctx; - } - - @Override - protected EventDirContext getOriginal() throws NamingException { - return checkAndCast(super.getOriginal()); - } - - public void addNamingListener(Name target, int scope, NamingListener l) throws NamingException { - getOriginal().addNamingListener(target, scope, l); - } - - public void addNamingListener(String target, int scope, NamingListener l) throws NamingException { - getOriginal().addNamingListener(target, scope, l); - } - - public void removeNamingListener(NamingListener l) throws NamingException { - getOriginal().removeNamingListener(l); - } - - public boolean targetMustExist() throws NamingException { - return getOriginal().targetMustExist(); - } - - public void addNamingListener(Name target, String filter, SearchControls ctls, NamingListener l) - throws NamingException { - getOriginal().addNamingListener(target, filter, ctls, l); - } - - public void addNamingListener(String target, String filter, SearchControls ctls, NamingListener l) - throws NamingException { - getOriginal().addNamingListener(target, filter, ctls, l); - } - - public void - addNamingListener(Name target, String filter, Object[] filterArgs, SearchControls ctls, NamingListener l) - throws NamingException { - getOriginal().addNamingListener(target, filter, filterArgs, ctls, l); - } - - public void addNamingListener(String target, String filter, Object[] filterArgs, SearchControls ctls, - NamingListener l) throws NamingException { - getOriginal().addNamingListener(target, filter, filterArgs, ctls, l); - } - -} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringLdapContextDecorator.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringLdapContextDecorator.java deleted file mode 100644 index c74df39..0000000 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/context/URLPreferringLdapContextDecorator.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.jndi.context; - -import javax.naming.Context; -import javax.naming.NamingException; -import javax.naming.NoInitialContextException; -import javax.naming.NotContextException; -import javax.naming.ldap.Control; -import javax.naming.ldap.ExtendedRequest; -import javax.naming.ldap.ExtendedResponse; -import javax.naming.ldap.LdapContext; - -/** - * - * - * @author Lukas Krejci - */ -public class URLPreferringLdapContextDecorator extends URLPreferringDirContextDecorator implements LdapContext { - - private static final long serialVersionUID = 1L; - - public URLPreferringLdapContextDecorator() { - super(null); - } - - public URLPreferringLdapContextDecorator(LdapContext original) { - super(original); - } - - @Override - protected LdapContext checkAndCast(Context ctx) throws NamingException { - if (!(ctx instanceof LdapContext)) { - if (ctx == null) { - throw new NoInitialContextException(); - } else { - throw new NotContextException("Not an instance of LdapContext"); - } - } - - return (LdapContext) ctx; - } - - @Override - protected LdapContext getOriginal() throws NamingException { - return checkAndCast(super.getOriginal()); - } - - public ExtendedResponse extendedOperation(ExtendedRequest request) throws NamingException { - return getOriginal().extendedOperation(request); - } - - public LdapContext newInstance(Control[] requestControls) throws NamingException { - return new URLPreferringLdapContextDecorator(getOriginal().newInstance(requestControls)); - } - - public void reconnect(Control[] connCtls) throws NamingException { - getOriginal().reconnect(connCtls); - } - - public Control[] getConnectControls() throws NamingException { - return getOriginal().getConnectControls(); - } - - public void setRequestControls(Control[] requestControls) throws NamingException { - getOriginal().setRequestControls(requestControls); - } - - public Control[] getRequestControls() throws NamingException { - return getOriginal().getRequestControls(); - } - - public Control[] getResponseControls() throws NamingException { - return getOriginal().getResponseControls(); - } - -} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/mbean/AccessCheckingInitialContextFactoryBuilderInstaller.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/mbean/AccessCheckingInitialContextFactoryBuilderInstaller.java index a1ccb4f..69571da 100644 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/mbean/AccessCheckingInitialContextFactoryBuilderInstaller.java +++ b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/mbean/AccessCheckingInitialContextFactoryBuilderInstaller.java @@ -24,7 +24,7 @@ import javax.naming.spi.NamingManager; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory;
-import org.rhq.jndi.AccessCheckingInitialContextFactoryBuilder; +import org.rhq.enterprise.server.naming.AccessCheckingInitialContextFactoryBuilder;
/** * diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/util/DecoratingInvocationHandler.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/util/DecoratingInvocationHandler.java deleted file mode 100644 index 1bfa7ac..0000000 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/util/DecoratingInvocationHandler.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.jndi.util; - -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.List; - -public class DecoratingInvocationHandler<Type, Decorator extends Type> implements InvocationHandler { - - private final List<DecoratorPicker<Type, Decorator>> pickers; - private Type object; - - public DecoratingInvocationHandler(List<DecoratorPicker<Type, Decorator>> pickers, Type object) { - this.pickers = pickers; - this.object = object; - } - - public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { - Type target = object; - Class<?> methodClass = method.getDeclaringClass(); - - for(DecoratorPicker<Type, Decorator> picker : pickers) { - target = picker.decorate(target, methodClass); - } - - try { - return method.invoke(target, args); - } catch (InvocationTargetException e) { - if (e.getCause() != null) { - throw e.getCause(); - } else { - throw e; - } - } - } -} \ No newline at end of file diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/util/DecoratorPicker.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/util/DecoratorPicker.java deleted file mode 100644 index 017d29f..0000000 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/util/DecoratorPicker.java +++ /dev/null @@ -1,195 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.jndi.util; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -/** - * Given as set of decorators extending given type, this class can pick - * the most appropriate set of decorators for a class or a method call. - * <p> - * To configure the decorator, one has to provide a {@link DecoratorSetContext} that - * is then used to obtain the list of - * {@link DecoratorSetContext#getSupportedInterfaces() supported interfaces}, which are - * all the interfaces that should be used for decorator resolution (i.e. all other interfaces - * that a class might implement are ignored during decorator resolution), the list of - * {@link DecoratorSetContext#getDecoratorClasses() decorator classes}, which is a list - * of decorators the picker can choose from and is also used to instantiate and initialize - * the decorators. - * - * @author Lukas Krejci - */ -public class DecoratorPicker<Type, Decorator extends Type> { - - private DecoratorSetContext<Type, Decorator> context; - - public DecoratorSetContext<Type, Decorator> getContext() { - return context; - } - - public void setContext(DecoratorSetContext<Type, Decorator> decoratorSetContext) { - this.context = decoratorSetContext; - } - - /** - * Returns a set of decorators applicable for given method. The set is established based - * on the declaring class of the method. - * - * @param method the method to inspect - * @return the set of decorators that can be used to wrap a method call - * @throws Exception - */ - public Set<Decorator> getDecoratorsForMethod(Method method) throws Exception { - return getDecoratorsForClass_Private(method.getDeclaringClass()); - } - - /** - * Returns a set of decorators that can be used on instances of given class. - * @param cls the class to inspect - * @return - * @throws Exception - */ - public Set<Decorator> getDecoratorsForClass(Class<? extends Type> cls) throws Exception { - return getDecoratorsForClass_Private(cls); - } - - /** - * This method first establishes the set of decorators to use based on the class of the supplied - * object and then chains the decorators (in arbitrary order) with the supplied object at the - * "root" of the chain. - * <p> - * If a method is then called on the returned object, the methods of all the decorators are called - * in chain (each supposedly calling the next) and finally, at the end of the chain, the method on - * the original object (the one supplied to this method) is called. - * <p> - * Note that the above is only an intended behavior and actually depends on the implementation of - * the decorators that are resposinble for the chaining. Each decorator is initialized - * (@{link {@link DecoratorSetContext#init(Object, Object)} which should set it up for such chaining. - * - * @param object - * @return - * @throws Exception - */ - public Type decorate(Type object) throws Exception { - Set<Decorator> decs = getDecoratorsForClass_Private(object.getClass()); - Type ret = object; - for(Decorator d : decs) { - context.init(d, ret); - ret = d; - } - - return ret; - } - - /** - * Similar to {@link #decorate(Object)} but instead of the class of the object itself, - * uses the significantSuperClass as the basis for the decorator resolution. - * <p> - * This is important, because if the object implements two mutually incompatible sub-interfaces of <code>Type</code>, - * the chained decorators might fail to execute a method later on if the decorator depends on the upper part - * of the chain to implement certain sub-interface of <code>Type</code>. - * - * @param object the object to wrap in decorators - * @param significantSuperClass the class to base the decorator resolution on - * @return - * @throws Exception - */ - public Type decorate(Type object, Class<?> significantSuperClass) throws Exception { - Set<Decorator> decs = getDecoratorsForClass_Private(significantSuperClass); - Type ret = object; - for(Decorator d : decs) { - context.init(d, ret); - ret = d; - } - - return ret; - } - - private Set<Decorator> getDecoratorsForClass_Private(Class<?> cls) throws Exception { - Set<Class<? extends Type>> ifaces = getNearestApplicableInterfaces(cls); - - HashSet<Decorator> ret = new HashSet<Decorator>(); - - for (Class<? extends Type> iface : ifaces) { - for (Class<? extends Decorator> decClass : getMatch(iface)) { - ret.add(context.instantiate(decClass)); - } - } - - return ret; - } - - private Set<Class<? extends Type>> getNearestApplicableInterfaces(Class<?> cls) { - List<Class<? extends Type>> ifaces = new ArrayList<Class<? extends Type>>(getAllApplicableInterfaces(cls)); - - //now compact the set to only contain the most concrete interfaces - - Iterator<Class<? extends Type>> it = ifaces.iterator(); - while (it.hasNext()) { - Class<? extends Type> c = it.next(); - - for (int i = 0; i < ifaces.size(); ++i) { - Class<? extends Type> nextC = ifaces.get(i); - if (!c.equals(nextC) && c.isAssignableFrom(nextC)) { - it.remove(); - break; - } - } - } - - return new HashSet<Class<? extends Type>>(ifaces); - } - - private Set<Class<? extends Type>> getAllApplicableInterfaces(Class<?> cls) { - Set<Class<? extends Type>> ifaces = new HashSet<Class<? extends Type>>(); - - for (Class<? extends Type> iface : context.getSupportedInterfaces()) { - if (iface.isAssignableFrom(cls)) { - ifaces.add(iface); - } - } - - if (ifaces.isEmpty()) { - throw new IllegalArgumentException("Class " + cls - + " doesn't implement any of the applicable interfaces. Cannot find decorators for it."); - } - - return ifaces; - } - - private Set<Class<? extends Decorator>> getMatch(Class<?> targetIface) { - - Set<Class<? extends Decorator>> ret = new HashSet<Class<? extends Decorator>>(); - - for (Class<? extends Decorator> cls : context.getDecoratorClasses()) { - if (Arrays.asList(cls.getInterfaces()).contains(targetIface)) { - ret.add(cls); - } - } - - return ret; - } -} diff --git a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/util/DecoratorSetContext.java b/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/util/DecoratorSetContext.java deleted file mode 100644 index d7b1676..0000000 --- a/modules/enterprise/server/container-lib/src/main/java/org/rhq/jndi/util/DecoratorSetContext.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.jndi.util; - -import java.util.Set; - -/** - * Implementations of this interface provide a context to the {@link DecoratorPicker}. - * - * @author Lukas Krejci - */ -public interface DecoratorSetContext<Type, Decorator> { - - /** - * @return the set of interfaces that the decorators are able support. - * Usually this should be just a union of all interfaces the decorators implement - * but can be trimmed down. - */ - Set<Class<? extends Type>> getSupportedInterfaces(); - - /** - * @return the set of all decorator classes in this set - */ - Set<Class<? extends Decorator>> getDecoratorClasses(); - - /** - * Instantiates a new decorator of given class. - * @param decoratorClass - * @return - * @throws Exception - */ - Decorator instantiate(Class<? extends Decorator> decoratorClass) throws Exception; - - /** - * Initializes the decorator to decorate given object. - * - * @param decorator - * @param object - * @throws Exception on error - */ - void init(Decorator decorator, Type object) throws Exception; -} diff --git a/modules/enterprise/server/container-lib/src/test/java/org/rhq/jndi/context/DecoratingInvocationHandlerTest.java b/modules/enterprise/server/container-lib/src/test/java/org/rhq/jndi/context/DecoratingInvocationHandlerTest.java deleted file mode 100644 index 45ba114..0000000 --- a/modules/enterprise/server/container-lib/src/test/java/org/rhq/jndi/context/DecoratingInvocationHandlerTest.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.jndi.context; - -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.Properties; -import java.util.Set; - -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.Name; -import javax.naming.NamingException; -import javax.naming.directory.DirContext; -import javax.naming.event.EventContext; -import javax.naming.event.NamingListener; -import javax.naming.spi.InitialContextFactory; -import javax.naming.spi.NamingManager; - -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import org.rhq.jndi.AccessCheckingInitialContextFactoryBuilder; - -/** - * - * - * @author Lukas Krejci - */ -@Test -public class DecoratingInvocationHandlerTest { - private static final Set<String> INVOKED_METHODS = new HashSet<String>(); - - private static final InvocationHandler NOTE_TAKING_HANDLER = new InvocationHandler() { - - public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { - INVOKED_METHODS.add(method.getName()); - - if ("hashCode".equals(method.getName())) { - return 0; - } else if ("equals".equals(method.getName())) { - return false; - } - - return null; - } - }; - - private static Class<?>[] CONTEXT_INTERFACES; - - public static class Factory implements InitialContextFactory { - public Context getInitialContext(Hashtable<?, ?> environment) - throws NamingException { - - return (Context) Proxy.newProxyInstance(DecoratingInvocationHandlerTest.class.getClassLoader(), CONTEXT_INTERFACES, NOTE_TAKING_HANDLER); - } - } - - private static class DummyInitialEventContext extends InitialContext implements EventContext { - - /** - * @param environment - * @throws NamingException - */ - public DummyInitialEventContext(Hashtable<?, ?> environment) throws NamingException { - super(environment); - } - - public void addNamingListener(Name target, int scope, NamingListener l) throws NamingException { - ((EventContext)getURLOrDefaultInitCtx(target)).addNamingListener(target, scope, l); - } - - public void addNamingListener(String target, int scope, NamingListener l) throws NamingException { - ((EventContext)getURLOrDefaultInitCtx(target)).addNamingListener(target, scope, l); - } - - public void removeNamingListener(NamingListener l) throws NamingException { - ((EventContext)getDefaultInitCtx()).removeNamingListener(l); - } - - public boolean targetMustExist() throws NamingException { - return ((EventContext)getDefaultInitCtx()).targetMustExist(); - } - - - } - - @BeforeClass - public void setBuilder() throws Exception { - NamingManager.setInitialContextFactoryBuilder(new AccessCheckingInitialContextFactoryBuilder()); - } - - public void testSimpleDispatch() throws Exception { - INVOKED_METHODS.clear(); - Properties env = new Properties(); - env.put(Context.INITIAL_CONTEXT_FACTORY, Factory.class.getName()); - - CONTEXT_INTERFACES = new Class<?>[] { Context.class }; - - InitialContext ctx = new InitialContext(env); - - ctx.lookup("asdf"); - - assert INVOKED_METHODS.contains("lookup") : "The lookup doesn't seem to have propagated to the actual context to be used."; - } - - public void testMultiInterfaceDispatch() throws Exception { - INVOKED_METHODS.clear(); - Properties env = new Properties(); - env.put(Context.INITIAL_CONTEXT_FACTORY, Factory.class.getName()); - - CONTEXT_INTERFACES = new Class<?>[] { EventContext.class, DirContext.class }; - - InitialContext ctx = new InitialContext(env); - - ctx.lookup("asdf"); - - DummyInitialEventContext ectx = new DummyInitialEventContext(env); - - ectx.addNamingListener("hodiny", 0, null); - - assert INVOKED_METHODS.contains("lookup") : "The lookup doesn't seem to have propagated to the actual context to be used."; - assert INVOKED_METHODS.contains("addNamingListener") : "The addNamingListener doesn't seem to have propagated to the actual context to be used."; - } -} diff --git a/modules/enterprise/server/container-lib/src/test/java/org/rhq/jndi/context/DecoratorPickerTest.java b/modules/enterprise/server/container-lib/src/test/java/org/rhq/jndi/context/DecoratorPickerTest.java deleted file mode 100644 index e2d7429..0000000 --- a/modules/enterprise/server/container-lib/src/test/java/org/rhq/jndi/context/DecoratorPickerTest.java +++ /dev/null @@ -1,180 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.jndi.context; - -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; - -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -import javax.naming.Context; -import javax.naming.directory.DirContext; -import javax.naming.event.EventContext; -import javax.naming.ldap.LdapContext; - -import org.testng.annotations.Test; - -import org.rhq.jndi.util.DecoratorPicker; -import org.rhq.jndi.util.DecoratorSetContext; - -/** - * @author Lukas Krejci - */ -@Test -public class DecoratorPickerTest { - - private static final InvocationHandler DUMMY_HANDLER = new InvocationHandler() { - - public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { - if ("hashCode".equals(method.getName())) { - return 0; - } else if ("equals".equals(method.getName())) { - return false; - } - - return null; - } - }; - - private static final Class<?> TEST_OBJECT_CLASS1 = createProxyClass(Context.class); - private static final Class<?> TEST_OBJECT_CLASS2 = createProxyClass(DirContext.class); - private static final Class<?> TEST_OBJECT_CLASS3 = createProxyClass(LdapContext.class); - private static final Class<?> TEST_OBJECT_CLASS4 = createProxyClass(LdapContext.class, EventContext.class); - private static final Class<?> DECORATOR_CLASS1 = createProxyClass(Context.class); - private static final Class<?> DECORATOR_CLASS2 = createProxyClass(EventContext.class); - private static final Class<?> DECORATOR_CLASS3 = createProxyClass(LdapContext.class); - private static final Class<?> DECORATOR_CLASS4 = createProxyClass(DirContext.class); - - public void testSimpleDecoratorIdentifiedByClass() throws Exception { - DecoratorPicker<Object, Object> picker = createTestPicker(); - - Set<Object> contextDecorators = picker.getDecoratorsForClass(TEST_OBJECT_CLASS1); - assertEquals(contextDecorators.size(), 1, "Expected exactly one decorator for Context class"); - assertEquals(contextDecorators.iterator().next().getClass().getInterfaces()[0], Context.class); - } - - public void testSuperClassDecoratorHasPrecedenceOverSubClassDecorator() throws Exception { - DecoratorPicker<Object, Object> picker = createTestPicker(); - - //this tests that the LdapContext isn't returned even though it subclasses the DirContext - Set<Object> contextDecorators = picker.getDecoratorsForClass(TEST_OBJECT_CLASS2); - assertEquals(contextDecorators.size(), 1, "Expected exactly one decorator for DirContext class"); - assertEquals(contextDecorators.iterator().next().getClass().getInterfaces()[0], DirContext.class); - } - - public void testSubClassDecoratorCorrectlyIdentified() throws Exception { - DecoratorPicker<Object, Object> picker = createTestPicker(); - - Set<Object> contextDecorators = picker.getDecoratorsForClass(TEST_OBJECT_CLASS3); - assertEquals(contextDecorators.size(), 1, "Expected exactly one decorator for LdapContext class"); - assertEquals(contextDecorators.iterator().next().getClass().getInterfaces()[0], LdapContext.class); - } - - public void testMultipleDecoratorsDetectable() throws Exception { - DecoratorPicker<Object, Object> picker = createTestPicker(); - - Set<Object> decorators = picker.getDecoratorsForClass(TEST_OBJECT_CLASS4); - assertEquals(decorators.size(), 2, - "Exactly 2 decorators should have been found for a class implementing 2 interfaces."); - - boolean ldapContextDecoratorFound = false; - boolean eventContextDecoratorFound = false; - - for (Object d : decorators) { - if (LdapContext.class.isAssignableFrom(d.getClass())) { - ldapContextDecoratorFound = true; - continue; //just to make sure that somehow the decorator doesn't implement both - } - if (EventContext.class.isAssignableFrom(d.getClass())) { - eventContextDecoratorFound = true; - } - } - - assertTrue(ldapContextDecoratorFound && eventContextDecoratorFound, - "The found decorators don't implement the desired interfaces."); - } - - public void testDecoratorsIdentifiedByMethod() throws Exception { - DecoratorPicker<Object, Object> picker = createTestPicker(); - - Set<Object> decorators = - picker.getDecoratorsForMethod(LdapContext.class.getMethod("getConnectControls", (Class<?>[]) null)); - assertEquals(decorators.size(), 1, - "Expected exactly one decorator for method 'getConnectControls()' from LdapContext class"); - assertEquals(decorators.iterator().next().getClass().getInterfaces()[0], LdapContext.class); - } - - public void testMethodFromSubclassMatchesSubclassDecorator() throws Exception { - DecoratorPicker<Object, Object> picker = createTestPicker(); - - //this is a method from the DirContext but we're asking for it from a class - //that implements also an LdapContext - //The LdapContext decorator also inherits from the DirContext decorator - //(by the virtue of LdapContext interface inheriting from the DirContext) - //The picker should therefore match the LdapContext decorator because its - //the "closest" one to the actual class. - Set<Object> decorators = - picker.getDecoratorsForMethod(TEST_OBJECT_CLASS3.getMethod("getSchemaClassDefinition", - new Class<?>[] { String.class })); - assertEquals(decorators.size(), 1, - "Expected exactly one decorator for method 'getSchemaClassDefinition(String)' from LdapContext class"); - assertEquals(decorators.iterator().next().getClass().getInterfaces()[0], LdapContext.class); - } - - private static Class<?> createProxyClass(Class<?>... ifaces) { - return Proxy.getProxyClass(DecoratorPickerTest.class.getClassLoader(), ifaces); - } - - private static DecoratorPicker<Object, Object> createTestPicker() { - DecoratorPicker<Object, Object> picker = new DecoratorPicker<Object, Object>(); - - DecoratorSetContext<Object, Object> decSet = new DecoratorSetContext<Object, Object>() { - - public Object instantiate(Class<? extends Object> decoratorClass) throws Exception { - Constructor<? extends Object> ctor = decoratorClass.getConstructor(InvocationHandler.class); - return ctor.newInstance(DUMMY_HANDLER); - } - - public void init(Object decorator, Object object) throws Exception { - } - - @SuppressWarnings("unchecked") - public Set<Class<? extends Object>> getSupportedInterfaces() { - return new HashSet<Class<? extends Object>>(Arrays.asList(Context.class, EventContext.class, - LdapContext.class, DirContext.class)); - } - - @SuppressWarnings("unchecked") - public Set<Class<? extends Object>> getDecoratorClasses() { - return new HashSet<Class<? extends Object>>(Arrays.asList(DECORATOR_CLASS1, DECORATOR_CLASS2, DECORATOR_CLASS3, DECORATOR_CLASS4)); - } - }; - - picker.setContext(decSet); - - return picker; - } -} diff --git a/modules/enterprise/server/ear/src/main/application/META-INF/jboss-deployment-structure.xml b/modules/enterprise/server/ear/src/main/application/META-INF/jboss-deployment-structure.xml index 8c4ad54..f3d48d1 100644 --- a/modules/enterprise/server/ear/src/main/application/META-INF/jboss-deployment-structure.xml +++ b/modules/enterprise/server/ear/src/main/application/META-INF/jboss-deployment-structure.xml @@ -16,6 +16,7 @@ <module name="org.dom4j" export="true" /> <!-- rhq ejb jar module declares this with runtime/provided scope --> <module name="javax.mail.api" export="true" /> <!-- for sending email notifications --> <module name="org.picketbox" export="true" /> <!-- for obfuscating passwords --> + <module name="org.jboss.as.naming" export="true" /> </dependencies> </deployment>
@@ -37,6 +38,8 @@ <module name="org.jboss.msc" export="true" /> <module name="org.jboss.as.controller" export="true" /> <module name="org.jboss.as.server" export="true" /> + <module name="org.jboss.modules" export="true" /> + <module name="org.jboss.as.naming" export="true" /> </dependencies> </sub-deployment>
diff --git a/modules/enterprise/server/itests-2/pom.xml b/modules/enterprise/server/itests-2/pom.xml index 1b50266..30ccbe5 100644 --- a/modules/enterprise/server/itests-2/pom.xml +++ b/modules/enterprise/server/itests-2/pom.xml @@ -23,7 +23,7 @@ <properties> <jboss.zip>${settings.localRepository}/org/jboss/as/jboss-as-dist/${jboss.version}/jboss-as-dist-${jboss.version}.zip</jboss.zip> <jboss.unzip.location>${basedir}/target/jboss-as-${jboss.version}</jboss.unzip.location> - <jboss.vm.args>-Xmx700m -XX:MaxPermSize=200m</jboss.vm.args> + <jboss.vm.args>-Xmx700m -XX:MaxPermSize=200m -Djava.security.manager -Djava.security.policy==${jboss.unzip.location}/security.policy</jboss.vm.args> <jboss.vm.args.debug></jboss.vm.args.debug> <!-- -Ditest.debug can override this, see below --> </properties>
@@ -223,7 +223,13 @@ <echo>Unzipping JBossAS ${jboss.version} found at ${jboss.zip}</echo> <unzip src="${jboss.zip}" dest="${jboss.unzip.location}/.." /> <echo>JBossAS ${jboss.version} should now be at: ${jboss.unzip.location}</echo> - <property name="jboss.conf" location="${jboss.unzip.location}/standalone/configuration/standalone.xml" /> + + <echo>Copying security policy to JBossAS</echo> + <copy file="${project.build.directory}/test-classes/security.policy" tofile="${jboss.unzip.location}/security.policy"/> + + <property + name="jboss.conf" + location="${jboss.unzip.location}/standalone/configuration/standalone.xml" /> <echo>Will now add test configuration to JBossAS config file: ${jboss.conf}</echo> <replace file="${jboss.conf}">
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/security/test/JndiAccessTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/security/test/JndiAccessTest.java index 274e94f..fabe6ae 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/security/test/JndiAccessTest.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/security/test/JndiAccessTest.java @@ -24,6 +24,7 @@ import java.io.PrintWriter; import java.security.PermissionCollection; import java.util.Collections;
+import javax.naming.Context; import javax.script.ScriptEngine; import javax.script.ScriptException;
@@ -37,10 +38,9 @@ import org.rhq.bindings.util.PackageFinder; import org.rhq.core.domain.auth.Subject; import org.rhq.enterprise.client.LocalClient; import org.rhq.enterprise.server.RHQConstants; -import org.rhq.enterprise.server.auth.SubjectManagerBean; +import org.rhq.enterprise.server.system.SystemManagerBean; import org.rhq.enterprise.server.test.AbstractEJB3Test; import org.rhq.enterprise.server.util.LookupUtil; -import org.rhq.jndi.AllowRhqServerInternalsAccessPermission;
/** * @@ -50,6 +50,21 @@ import org.rhq.jndi.AllowRhqServerInternalsAccessPermission; @Test public class JndiAccessTest extends AbstractEJB3Test {
+ public void testScriptCantOverrideSystemProperties() throws Exception { + Subject overlord = LookupUtil.getSubjectManager().getOverlord(); + + ScriptEngine engine = getEngine(overlord); + + try { + engine.eval("java.lang.System.setProperty('java.naming.factory.url.pkgs', 'counterfeit');"); + } catch (ScriptException e) { + Assert.assertTrue( + e.getMessage().contains( + "access denied ("java.util.PropertyPermission" "java.naming.factory.url.pkgs" "write")"), + "The script shouldn't have write access to the system properties."); + } + } + public void testEjbsAccessibleThroughPrivilegedCode() { LookupUtil.getSubjectManager().getOverlord(); } @@ -67,14 +82,18 @@ public class JndiAccessTest extends AbstractEJB3Test {
ScriptEngine engine = getEngine(overlord);
- String jndiName = "java:global/rhq/rhq-enterprise-server-ejb3/" + SubjectManagerBean.class.getSimpleName() - + "!" + SubjectManagerBean.class.getName().replace("Bean", "Local"); + String jndiName = "java:global/rhq/rhq-enterprise-server-ejb3/" + + SystemManagerBean.class.getSimpleName() + + "!" + + SystemManagerBean.class.getName().replace("Bean", "Local");
try { engine.eval("" + "var ctx = new javax.naming.InitialContext();\n" - + "var subjectManager = ctx.lookup('" + jndiName + "');\n" - + "subjectManager.getOverlord();"); + + "var systemManager = ctx.lookup('" + + jndiName + + "');\n" + + "systemManager.isDebugModeEnabled();");
Assert.fail("The script shouldn't have been able to call local SLSB method."); } catch (ScriptException e) { @@ -82,19 +101,51 @@ public class JndiAccessTest extends AbstractEJB3Test { } }
+ public void testLocalEjbsInaccessibleThroughJndiLookupWithCustomUrlPackages() throws ScriptException, IOException { + Subject overlord = LookupUtil.getSubjectManager().getOverlord(); + + ScriptEngine engine = getEngine(overlord); + + String jndiName = "java:global/rhq/rhq-enterprise-server-ejb3/" + + SystemManagerBean.class.getSimpleName() + + "!" + + SystemManagerBean.class.getName().replace("Bean", "Local"); + + try { + engine.eval("" + + "var env = new java.util.Hashtable();\n" + + "env.put('" + + Context.URL_PKG_PREFIXES + + "', 'org.jboss.as.naming.interfaces');\n" + + "var ctx = new javax.naming.InitialContext(env);\n" + + "var systemManager = ctx.lookup('" + + jndiName + + "');\n" + + "systemManager.isDebugModeEnabled();"); + + Assert.fail("The script shouldn't have been able to call local SLSB method."); + } catch (ScriptException e) { + checkIsDesiredSecurityException(e); + } + } + public void testRemoteEjbsInaccessibleThroughJndiLookup() throws ScriptException, IOException { Subject overlord = LookupUtil.getSubjectManager().getOverlord();
ScriptEngine engine = getEngine(overlord);
- String jndiName = "java:global/rhq/rhq-enterprise-server-ejb3/" + SubjectManagerBean.class.getSimpleName() - + "!" + SubjectManagerBean.class.getName().replace("Bean", "Remote"); + String jndiName = "java:global/rhq/rhq-enterprise-server-ejb3/" + + SystemManagerBean.class.getSimpleName() + + "!" + + SystemManagerBean.class.getName().replace("Bean", "Remote");
try { engine.eval("" + "var ctx = new javax.naming.InitialContext();\n" - + "var subjectManager = ctx.lookup('" + jndiName + "');\n" - + "subjectManager.getSubjectByName('rhqadmin');"); + + "var systemManager = ctx.lookup('" + + jndiName + + "');\n" + + "systemManager.getSystemSettings(subject);");
Assert.fail("The script shouldn't have been able to call remote SLSB method directly."); } catch (ScriptException e) { @@ -198,7 +249,29 @@ public class JndiAccessTest extends AbstractEJB3Test { checkIsNotASecurityException(e); } } - + + //THIS IS A NEW REQUIREMENT THAT DOESN'T CURRENTLY WORK... + // public void testInitialContextFactoryBuilderNotReplaceableUsingScripts() throws Exception { + // Subject overlord = LookupUtil.getSubjectManager().getOverlord(); + // + // ScriptEngine engine = getEngine(overlord); + // + // try { + // engine.eval("" + // + "var mgrCls = java.lang.Class.forName('javax.naming.spi.NamingManager');\n" + // + "var fld = mgrCls.getDeclaredField('initctx_factory_builder');\n" + // + "fld.setAccessible(true);\n" + // + "fld.set(null, null);\n"); + // + // Assert.fail("It should not be possible to use reflection to reset the initial context factory builder."); + // } catch (ScriptException e) { + // checkIsDesiredSecurityException(e); + // } finally { + // //restore the default behavior + // NamingHack.bruteForceInitialContextFactoryBuilder(); + // } + // } + private ScriptEngine getEngine(Subject subject) throws ScriptException, IOException { StandardBindings bindings = new StandardBindings(new PrintWriter(System.out), new LocalClient(subject));
@@ -210,15 +283,25 @@ public class JndiAccessTest extends AbstractEJB3Test {
private static void checkIsDesiredSecurityException(ScriptException e) { String message = e.getMessage(); - String permissionTrace = AllowRhqServerInternalsAccessPermission.class.getName(); + String permissionTrace = "org.rhq.allow.server.internals.access";
- Assert.assertTrue(message.contains(permissionTrace), "The script exception doesn't seem to be caused by the AllowRhqServerInternalsAccessPermission security exception. " + message); + if (!message.contains(permissionTrace)) { + Assert + .fail( + "The script exception doesn't seem to be caused by the AllowRhqServerInternalsAccessPermission security exception. ", + e); + } }
private static void checkIsNotASecurityException(ScriptException e) { String message = e.getMessage(); - String permissionTrace = AllowRhqServerInternalsAccessPermission.class.getName(); + String permissionTrace = "org.rhq.allow.server.internals.access";
- Assert.assertFalse(message.contains(permissionTrace), "The script exception does seem to be caused by the AllowRhqServerInternalsAccessPermission security exception although it shouldn't. " + message); + if (message.contains(permissionTrace)) { + Assert + .fail( + "The script exception does seem to be caused by the AllowRhqServerInternalsAccessPermission security exception although it shouldn't. ", + e); + } } } diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java index f1ba91f..f27a5ba 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java @@ -39,6 +39,7 @@ import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ArchivePaths; import org.jboss.shrinkwrap.api.Filters; import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.asset.ClassAsset; import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.exporter.ZipExporter; import org.jboss.shrinkwrap.api.spec.EnterpriseArchive; @@ -308,6 +309,13 @@ public abstract class AbstractEJB3Test extends Arquillian { testEar.delete(ArchivePaths .create("/rhq-enterprise-server-ejb3.jar/org/rhq/enterprise/server/core/ShutdownListener.class"));
+ //replace the above startup beans with stripped down versions + testEar.add(new ClassAsset(StrippedDownStartupBean.class), ArchivePaths + .create("/rhq-enterprise-server-ejb3.jar/org/rhq/enterprise/server/test/StrippedDownStartupBean.class")); + testEar.add(new ClassAsset(StrippedDownStartupBeanPreparation.class), ArchivePaths + .create("/rhq-enterprise-server-ejb3.jar/org/rhq/enterprise/server/test/" + + "StrippedDownStartupBeanPreparation.class")); + // add the test classes to the deployment testEar.addAsLibrary(testClassesJar);
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/StrippedDownStartupBean.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/StrippedDownStartupBean.java new file mode 100644 index 0000000..bfe9f32 --- /dev/null +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/StrippedDownStartupBean.java @@ -0,0 +1,45 @@ +/* + * RHQ Management Platform + * Copyright 2012, Red Hat Middleware LLC, and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +package org.rhq.enterprise.server.test; + +import javax.ejb.Singleton; +import javax.ejb.TransactionAttribute; +import javax.ejb.TransactionAttributeType; + +import org.rhq.enterprise.server.core.StartupBean; +import org.rhq.enterprise.server.naming.NamingHack; + +/** + * This is a replacement for the fullblown {@link StartupBean} of the actual RHQ server. + * @author Lukas Krejci + */ +@Singleton +public class StrippedDownStartupBean { + + @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) + public void secureNaming() { + NamingHack.bruteForceInitialContextFactoryBuilder(); + } + + public void init() { + secureNaming(); + } +} diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/StrippedDownStartupBeanPreparation.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/StrippedDownStartupBeanPreparation.java new file mode 100644 index 0000000..e32d8a4 --- /dev/null +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/StrippedDownStartupBeanPreparation.java @@ -0,0 +1,75 @@ +/* + * RHQ Management Platform + * Copyright 2012, Red Hat Middleware LLC, and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +package org.rhq.enterprise.server.test; + +import javax.annotation.PostConstruct; +import javax.annotation.Resource; +import javax.ejb.EJB; +import javax.ejb.Singleton; +import javax.ejb.Startup; +import javax.ejb.Timeout; +import javax.ejb.TimerConfig; +import javax.ejb.TimerService; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * This startup singleton EJB is here to work around bug AS7-5530 and to + * schedule the real StartupBean's work in a delayed fashion (this is to allow + * AS7 to complete its deployment work before we do our work). + * + * See https://issues.jboss.org/browse/AS7-5530 + * + * This version is a replacement for the original code (identical) code that uses the StrippedDownStartupBean instead + * of the fullblown original. + */ +@Singleton +@Startup +public class StrippedDownStartupBeanPreparation { + private Log log = LogFactory.getLog(this.getClass()); + + @EJB + private StrippedDownStartupBean startupBean; + + @Resource + private TimerService timerService; // needed to schedule our startup bean init call + + @PostConstruct + public void initWithTransactionBecauseAS75530() throws RuntimeException { + log.info("Scheduling the initialization of the testing RHQ deployment"); + timerService.createSingleActionTimer(1, new TimerConfig(null, false)); // call StartupBean in 1ms + } + + @Timeout + public void initializeServer() throws RuntimeException { + try { + log.info("Initializing the testing RHQ deployment"); + this.startupBean.init(); + } catch (Throwable t) { + // do NOT allow exceptions to bubble out of our method because then + // the EJB container would simply re-trigger the timer and call us again + // and we don't want to keep failing over and over filling the logs + // in an infinite loop. + log.fatal("The server failed to start up properly", t); + } + } +} diff --git a/modules/enterprise/server/itests-2/src/test/resources/security.policy b/modules/enterprise/server/itests-2/src/test/resources/security.policy new file mode 100644 index 0000000..8860b47 --- /dev/null +++ b/modules/enterprise/server/itests-2/src/test/resources/security.policy @@ -0,0 +1,10 @@ +// We need the SecurityManager installed to enable sandboxing of CLI scripts +// but we don't define any other security measures on the RHQ server itself. +// +// Granting all permissions allows us to run the RHQ server as if no security +// manager was in place (which is assumed by default by JBoss AS) but be able +// to use it when we need it for our own purposes. + +grant { + permission java.security.AllPermission; +}; diff --git a/modules/enterprise/server/jar/pom.xml b/modules/enterprise/server/jar/pom.xml index dae3778..760b68c 100644 --- a/modules/enterprise/server/jar/pom.xml +++ b/modules/enterprise/server/jar/pom.xml @@ -112,10 +112,14 @@ <dependency> <groupId>org.jboss.as</groupId> <artifactId>jboss-as-server</artifactId> - <version>${jboss.version}</version> <scope>provided</scope> <!-- provided by AS7 --> </dependency>
+ <dependency> + <groupId>org.jboss.as</groupId> + <artifactId>jboss-as-naming</artifactId> + <scope>provided</scope> <!-- provided by AS7 --> + </dependency>
<!--================ Test Deps ================-->
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/AllowRhqServerInternalsAccessPermission.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/AllowRhqServerInternalsAccessPermission.java new file mode 100644 index 0000000..d448049 --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/AllowRhqServerInternalsAccessPermission.java @@ -0,0 +1,36 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2011 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; + +import java.security.BasicPermission; + +/** + * + * + * @author Lukas Krejci + */ +public class AllowRhqServerInternalsAccessPermission extends BasicPermission { + + private static final long serialVersionUID = 1L; + + public AllowRhqServerInternalsAccessPermission() { + super("org.rhq.allow.server.internals.access"); + } +} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SessionManager.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SessionManager.java index ecf2f6f..8819cab 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SessionManager.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SessionManager.java @@ -25,8 +25,8 @@ import java.util.Map; import java.util.Random;
import org.rhq.core.domain.auth.Subject; +import org.rhq.enterprise.server.AllowRhqServerInternalsAccessPermission; import org.rhq.enterprise.server.util.LookupUtil; -import org.rhq.jndi.AllowRhqServerInternalsAccessPermission;
/** * This is the JON Server's own session ID generator. It is outside any container-provided session mechanism. Its sole diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java index 9e92a69..cb46440 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java @@ -65,6 +65,7 @@ import org.rhq.enterprise.server.cloud.instance.ServerManagerLocal; import org.rhq.enterprise.server.cloud.instance.SyncEndpointAddressException; import org.rhq.enterprise.server.core.comm.ServerCommunicationsServiceUtil; import org.rhq.enterprise.server.core.plugin.PluginDeploymentScannerMBean; +import org.rhq.enterprise.server.naming.NamingHack; import org.rhq.enterprise.server.plugin.pc.MasterServerPluginContainer; import org.rhq.enterprise.server.plugin.pc.ServerPluginServiceMBean; import org.rhq.enterprise.server.resource.ResourceTypeManagerLocal; @@ -131,6 +132,16 @@ public class StartupBean { private DataSource dataSource;
/** + * Modifies the naming subsystem to be able to check for Java security permissions on JNDI lookup. + * <p> + * Made public so that this can be reused in tests. + */ + @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) + public void secureNaming() { + NamingHack.bruteForceInitialContextFactoryBuilder(); + } + + /** * Performs the final RHQ Server initialization work that needs to talk place. EJBs are available in this method. * * @throws RuntimeException @@ -138,6 +149,8 @@ public class StartupBean { //@PostConstruct // when AS7-5530 is fixed, uncomment this and remove class StartupBeanToWorkaroundAS7_5530 @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) public void init() throws RuntimeException { + secureNaming(); + initialized = false;
log.info("All business tier deployments are complete - finishing the startup..."); @@ -781,5 +794,4 @@ public class StartupBean { + ") Server started."); log.info("--------------------------------------------------"); // 50 dashes } - } diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/AccessCheckingInitialContextFactoryBuilder.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/AccessCheckingInitialContextFactoryBuilder.java new file mode 100644 index 0000000..9681014 --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/AccessCheckingInitialContextFactoryBuilder.java @@ -0,0 +1,295 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2011 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.naming; + +import java.net.InetAddress; +import java.net.NetworkInterface; +import java.net.SocketException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.UnknownHostException; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.util.ArrayList; +import java.util.Collections; +import java.util.EnumMap; +import java.util.Enumeration; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.Set; + +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NamingException; +import javax.naming.directory.DirContext; +import javax.naming.event.EventContext; +import javax.naming.event.EventDirContext; +import javax.naming.ldap.LdapContext; +import javax.naming.spi.InitialContextFactory; +import javax.naming.spi.InitialContextFactoryBuilder; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import org.rhq.enterprise.server.AllowRhqServerInternalsAccessPermission; +import org.rhq.enterprise.server.naming.context.AccessCheckingContextDecorator; +import org.rhq.enterprise.server.naming.context.AccessCheckingContextDecoratorSetContext; +import org.rhq.enterprise.server.naming.context.ContextDecorator; +import org.rhq.enterprise.server.naming.context.URLPreferringContextDecoratorSetContext; +import org.rhq.enterprise.server.naming.util.DecoratorPicker; + +/** + * This initial context factory builder is installed early on during the RHQ server startup + * and is later on used for obtaining the {@link Context}s for all JNDI lookups in the + * RHQ server. + * <p> + * We use a custom initial context factory builder to prevent the potential malicious 3rd party + * code (like CLI alert scripts) from supplying custom environment variables to {@link InitialContext} + * that would modify the JNDI lookup to skip our security access checks. + * <p> + * By using a builder we effectively take control of the initial context creation process + * and are free to ignore whatever the script is trying to supply. + * <p> + * This builder makes sure to install the RHQ server's security access checks to whatever + * initial context that is configured by the standard environment variables + * ({@link Context#INITIAL_CONTEXT_FACTORY}, etc.) + * + * @see AllowRhqServerInternalsAccessPermission + * + * @author Lukas Krejci + */ +public class AccessCheckingInitialContextFactoryBuilder implements InitialContextFactoryBuilder { + private static final Log LOG = LogFactory.getLog(AccessCheckingInitialContextFactoryBuilder.class); + + /** + * The list of JNDI name schemes that should be checked for security permissions + * (in addition to the names with no scheme). + * + * @see AccessCheckingContextDecorator + */ + private static final String[] CHECKED_SCHEMES = { "java" }; + + private static final Set<Class<? extends Context>> SUPPORTED_CONTEXT_INTERFACES; + + static { + SUPPORTED_CONTEXT_INTERFACES = new HashSet<Class<? extends Context>>(); + SUPPORTED_CONTEXT_INTERFACES.add(Context.class); + SUPPORTED_CONTEXT_INTERFACES.add(DirContext.class); + SUPPORTED_CONTEXT_INTERFACES.add(EventContext.class); + SUPPORTED_CONTEXT_INTERFACES.add(EventDirContext.class); + SUPPORTED_CONTEXT_INTERFACES.add(LdapContext.class); + } + + private static final Set<InetAddress> SERVER_BIND_IPS; + static { + SERVER_BIND_IPS = new HashSet<InetAddress>(); + + try { + String bindingAddressString = System.getProperty("jboss.bind.address"); + InetAddress bindingAddress = InetAddress.getByName(bindingAddressString); + + if (bindingAddress.isAnyLocalAddress()) { + Enumeration<NetworkInterface> ifaces = NetworkInterface.getNetworkInterfaces(); + while (ifaces.hasMoreElements()) { + NetworkInterface iface = ifaces.nextElement(); + SERVER_BIND_IPS.addAll(Collections.list(iface.getInetAddresses())); + } + } else { + SERVER_BIND_IPS.add(bindingAddress); + } + } catch (SocketException e) { + LOG.error("Could not obtain the list of local IPs", e); + } catch (UnknownHostException e) { + LOG.error("Failed to get the binding address of the RHQ server.", e); + } + } + + //TODO this most probably no longer applies because AS7 doesn't use JNP for JNDI + private static final int JNP_PORT = Integer.parseInt(System.getProperty("rhq.server.startup.namingservice.port", + "2099")); + + private static InitialContextFactory getJbossDefaultInitialContextFactory() throws NamingException { + try { + Class<?> cls = Class.forName("org.jboss.as.naming.InitialContextFactory"); + return (InitialContextFactory) cls.newInstance(); + } catch (Exception e) { + NamingException ne = new NamingException( + "Failed to obtain the default initial context factory from JBoss AS."); + ne.initCause(e); + + throw ne; + } + } + + private enum FactoryType { + ACCESS_CHECKING { + + @Override + public InitialContextFactory wrap(InitialContextFactory factory) { + ArrayList<DecoratorPicker<Context, ContextDecorator>> pickers = new ArrayList<DecoratorPicker<Context, ContextDecorator>>(); + pickers.add(getURLPreferringDecoratorPicker()); + pickers.add(getAccessCheckingDecoratorPicker()); + + return new DecoratingInitialContextFactory(factory, pickers); + } + }, + URL_PREFERRING { + + @Override + public InitialContextFactory wrap(InitialContextFactory factory) { + ArrayList<DecoratorPicker<Context, ContextDecorator>> pickers = new ArrayList<DecoratorPicker<Context, ContextDecorator>>(); + pickers.add(getURLPreferringDecoratorPicker()); + + return new DecoratingInitialContextFactory(factory, pickers); + } + }; + + public abstract InitialContextFactory wrap(InitialContextFactory factory); + + public static FactoryType detect(Hashtable<?, ?> environment) { + String providerUrl = (String) environment.get(Context.PROVIDER_URL); + + if (providerUrl == null) { + return ACCESS_CHECKING; + } else { + try { + URI uri = new URI(providerUrl); + InetAddress providerHost = InetAddress.getByName(uri.getHost()); + + //check if we are accessing the RHQ server through some remoting + //interface. + if (uri.getPort() == JNP_PORT && SERVER_BIND_IPS.contains(providerHost)) { + return ACCESS_CHECKING; + } else { + return URL_PREFERRING; + } + } catch (URISyntaxException e) { + if (LOG.isDebugEnabled()) { + LOG.debug("The " + + Context.PROVIDER_URL + + " is not a valid URI. Falling back to using the access checking wrapper.", e); + } + return ACCESS_CHECKING; + } catch (UnknownHostException e) { + //let the factory deal with the unknown host... + //this most probably shouldn't be secured because localhost addresses + //should be resolvable. + if (LOG.isDebugEnabled()) { + LOG.debug("The " + + Context.PROVIDER_URL + + " is not resolvable. Falling back to using the URL preferring wrapper.", e); + } + return URL_PREFERRING; + } + } + } + + private static DecoratorPicker<Context, ContextDecorator> getAccessCheckingDecoratorPicker() { + DecoratorPicker<Context, ContextDecorator> ret = new DecoratorPicker<Context, ContextDecorator>(); + ret.setContext(new AccessCheckingContextDecoratorSetContext(SUPPORTED_CONTEXT_INTERFACES, CHECKED_SCHEMES)); + + return ret; + } + + private static DecoratorPicker<Context, ContextDecorator> getURLPreferringDecoratorPicker() { + DecoratorPicker<Context, ContextDecorator> ret = new DecoratorPicker<Context, ContextDecorator>(); + ret.setContext(new URLPreferringContextDecoratorSetContext(SUPPORTED_CONTEXT_INTERFACES)); + + return ret; + } + } + + private final EnumMap<FactoryType, InitialContextFactory> typeDefaults = new EnumMap<FactoryType, InitialContextFactory>( + FactoryType.class); + + private final String defaultFactoryClassName; + + /** + * @param defaultFactory the default factory to use if none can be deduced from the environment. If null, an attempt + * is made to obtain the default InitialContextFactory of JBoss AS (which may fail depending on the classloading + * "situation"). + * + * @throws NamingException + */ + public AccessCheckingInitialContextFactoryBuilder(InitialContextFactory defaultFactory) throws NamingException { + if (defaultFactory == null) { + defaultFactory = getJbossDefaultInitialContextFactory(); + } + + defaultFactoryClassName = defaultFactory.getClass().getName(); + + for (FactoryType ft : FactoryType.values()) { + typeDefaults.put(ft, ft.wrap(defaultFactory)); + } + } + + /** + * This is the default initial context factory that is returned when no other is + * configured using the environment variables. + * <p> + * It uses {@link NamingContextFactory} as the underlying mechanism - the same + * as the default configuration in JBoss 4. + */ + private final InitialContextFactory defaultFactory = new InitialContextFactory() { + public Context getInitialContext(Hashtable<?, ?> environment) throws NamingException { + return typeDefaults.get(FactoryType.detect(environment)).getInitialContext( + environment); + } + }; + + /** + * Create a InitialContext factory. If the environment does not override the factory class it will use the + * default context factory. + * + * @param environment The environment + * @return An initial context factory + * @throws NamingException If an error occurs loading the factory class. + */ + public InitialContextFactory createInitialContextFactory(Hashtable<?, ?> environment) throws NamingException { + final String factoryClassName = (String) environment.get(Context.INITIAL_CONTEXT_FACTORY); + if (factoryClassName == null || factoryClassName.equals(defaultFactoryClassName)) { + if (LOG.isDebugEnabled()) { + LOG.debug("No " + Context.INITIAL_CONTEXT_FACTORY + " set. Using the default factory."); + } + return defaultFactory; + } + final ClassLoader classLoader = getContextClassLoader(); + try { + final Class<?> factoryClass = Class.forName(factoryClassName, true, classLoader); + InitialContextFactory configuredFactory = (InitialContextFactory) factoryClass.newInstance(); + return FactoryType.detect(environment).wrap(configuredFactory); + } catch (Exception e) { + NamingException ne = new NamingException("Failed instantiate InitialContextFactory " + + factoryClassName + + " from classloader " + + classLoader); + ne.initCause(e); + + throw ne; + } + } + + private ClassLoader getContextClassLoader() { + return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() { + public ClassLoader run() { + return Thread.currentThread().getContextClassLoader(); + } + }); + } +} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/DecoratingInitialContextFactory.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/DecoratingInitialContextFactory.java new file mode 100644 index 0000000..602a68c --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/DecoratingInitialContextFactory.java @@ -0,0 +1,110 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.naming; + +import java.lang.reflect.Proxy; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.List; +import java.util.Set; + +import javax.naming.Context; +import javax.naming.NamingException; +import javax.naming.spi.InitialContextFactory; + +import org.rhq.enterprise.server.naming.context.ContextDecorator; +import org.rhq.enterprise.server.naming.util.DecoratingInvocationHandler; +import org.rhq.enterprise.server.naming.util.DecoratorPicker; + +/** + * This class implements an initial context factory that decorates the contexts + * returned from a "wrapped" initial factory passed to this class in the constructor. + * <p> + * The contexts returned from the wrapped initial factory are hidden behind a proxy + * that implements the intersection of interfaces from the <code>supportedContextInterfaces</code> + * constructor parameter and the actual interfaces the wrapped context implements. + * <p> + * The proxy method calls are handled using the {@link DecoratingInvocationHandler} which is initialized + * with the list of {@link DecoratorPicker pickers} that are used to intercept the method + * calls on the wrapped context. + * + * @see DecoratorPicker + * @see DecoratingInvocationHandler + * + * @author Lukas Krejci + */ +public class DecoratingInitialContextFactory implements InitialContextFactory { + + List<DecoratorPicker<Context, ContextDecorator>> pickers; + private InitialContextFactory factory; + private Set<Class<? extends Context>> supportedContextInterfaces; + + public DecoratingInitialContextFactory(InitialContextFactory factory, List<DecoratorPicker<Context, ContextDecorator>> decoratorPickers) { + this.factory = factory; + this.pickers = decoratorPickers; + this.supportedContextInterfaces = new HashSet<Class<? extends Context>>(); + for(DecoratorPicker<Context, ContextDecorator> picker : pickers) { + supportedContextInterfaces.addAll(picker.getContext().getSupportedInterfaces()); + } + } + + public Context getInitialContext(Hashtable<?, ?> environment) throws NamingException { + Context ctx = factory.getInitialContext(environment); + + Set<Class<?>> implementedIfaces = getAllImplementedInterfaces(ctx.getClass()); + Class<?>[] ii = new Class<?>[implementedIfaces.size()]; + implementedIfaces.toArray(ii); + + return (Context) Proxy.newProxyInstance(ctx.getClass().getClassLoader(), ii, new DecoratingInvocationHandler<Context, ContextDecorator>(pickers, ctx)); + } + + private Set<Class<?>> getAllImplementedInterfaces(Class<?> cls) { + HashSet<Class<?>> ret = new HashSet<Class<?>>(); + getAllImplementedInterfaces(cls, ret); + + ret.retainAll(supportedContextInterfaces); + + return ret; + } + + private static void getAllImplementedInterfaces(Class<?> cls, Set<Class<?>> output) { + Class<?>[] ifaces = cls.getInterfaces(); + + for (Class<?> iface : Arrays.asList(ifaces)) { + output.add(iface); + getAllImplementedInterfaces(iface, output); + } + + if (cls.getSuperclass() != null) { + getAllImplementedInterfaces(cls.getSuperclass(), output); + } + } + + @Override + public int hashCode() { + return factory.hashCode(); + } + + @Override + public boolean equals(Object o) { + return factory.equals(o); + } +} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/NamingHack.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/NamingHack.java new file mode 100644 index 0000000..b9ff8a9 --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/NamingHack.java @@ -0,0 +1,103 @@ +/* + * RHQ Management Platform + * Copyright 2012, Red Hat Middleware LLC, and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +package org.rhq.enterprise.server.naming; + +import java.lang.reflect.Field; +import java.util.Hashtable; + +import javax.naming.spi.InitialContextFactory; +import javax.naming.spi.InitialContextFactoryBuilder; +import javax.naming.spi.NamingManager; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * @author Lukas Krejci + */ +public class NamingHack { + + private static final Log LOG = LogFactory.getLog(NamingHack.class); + + //in case this method is called multiple times, which can happen during the tests, + //remember the builder encountered the first time... + private static InitialContextFactoryBuilder originalBuilder; + + public static void bruteForceInitialContextFactoryBuilder() { + LOG.info("Hacking the naming subsystem to enable secure execution of scripts inside the server..."); + + //it is important to synchronize on the NamingManager class because the get/setInitialContextFactoryBuilder + //methods in that class are static synchronized. By holding the lock on the NamingManager class we prevent + //any other thread to check for the initial context factory builder (and therefore de-facto do any JNDI lookup). + synchronized (NamingManager.class) { + + if (NamingManager.hasInitialContextFactoryBuilder()) { + //if anyone ever changes the implementation of the NamingManager, we will break here... + //but as of now, we have no other option but to do this and wait for JBAS-XXX to be resolved and + //incorporated into our underlying container + + try { + Field f = NamingManager.class.getDeclaredField("initctx_factory_builder"); + f.setAccessible(true); + + if (originalBuilder == null) { + originalBuilder = (InitialContextFactoryBuilder) f.get(null); + } + + f.set(null, null); + } catch (Exception e) { + LOG.error( + "Failed to install a custom initial context factory builder. RHQ installation is unsecure!", e); + + return; + } + } + + try { + InitialContextFactory defaultFactory = null; + if (originalBuilder != null) { + defaultFactory = originalBuilder + .createInitialContextFactory(new Hashtable<String, String>()); + } + + NamingManager.setInitialContextFactoryBuilder(new AccessCheckingInitialContextFactoryBuilder( + defaultFactory)); + } catch (Exception e) { + LOG.error("Failed to install a custom initial context factory builder. RHQ installation is unsecure!", + e); + + if (originalBuilder != null) { + if (LOG.isDebugEnabled()) { + LOG.debug("Trying to restore the original initial context factory builder: " + originalBuilder); + } + + try { + NamingManager.setInitialContextFactoryBuilder(originalBuilder); + } catch (Exception e2) { + LOG.error("Failed to restore the original initial context factory builder. The JNDI lookup may" + + " not function properly from this point on...", e2); + } + } + } + } + } + +} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingContextDecorator.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingContextDecorator.java new file mode 100644 index 0000000..0697003 --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingContextDecorator.java @@ -0,0 +1,264 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2011 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.naming.context; + +import java.io.Serializable; +import java.util.Arrays; +import java.util.Hashtable; +import java.util.List; + +import javax.naming.Binding; +import javax.naming.Context; +import javax.naming.Name; +import javax.naming.NameClassPair; +import javax.naming.NameParser; +import javax.naming.NamingEnumeration; +import javax.naming.NamingException; + +import org.rhq.enterprise.server.AllowRhqServerInternalsAccessPermission; + +/** + * This is the "meat" of the RHQ's secured JNDI access. This {@link Context} decorator + * applied security checks in each method (lookups, (un)bindings, etc). + * <p> + * The security check consists of checking if the current callstack has the {@link AllowRhqServerInternalsAccessPermission}. + * <p> + * This decorator applies the security check on any JNDI name without a scheme and + * on any name that has a scheme listed in the {@link #checkedSchemes} list supplied + * in the constructor. + * + * @author Lukas Krejci + */ +public class AccessCheckingContextDecorator implements Context, ContextDecorator, Serializable { + + private static final long serialVersionUID = 1L; + + private static final AllowRhqServerInternalsAccessPermission PERM = new AllowRhqServerInternalsAccessPermission(); + private Context original; + private List<String> checkedSchemes; + + public AccessCheckingContextDecorator(String... checkedSchemes) { + this.checkedSchemes = Arrays.asList(checkedSchemes); + } + + public AccessCheckingContextDecorator(Context original, String... checkedSchemes) { + this.original = original; + this.checkedSchemes = Arrays.asList(checkedSchemes); + } + + public void init(Context ctx) { + this.original = ctx; + } + + protected Context getOriginal() { + return original; + } + + protected static void check() { + SecurityManager sm = System.getSecurityManager(); + if (sm != null) sm.checkPermission(PERM); + } + + private void checkScheme(String scheme) { + if (scheme == null || checkedSchemes.contains(scheme)) { + check(); + } + } + + protected void check(String name) { + checkScheme(getURLScheme(name)); + } + + protected void check(Name name) { + if (name.size() == 0) { + check(); + } else { + String first = name.get(0); + checkScheme(getURLScheme(first)); + } + } + + public Object lookup(Name name) throws NamingException { + check(name); + return original.lookup(name); + } + + public Object lookup(String name) throws NamingException { + check(name); + return original.lookup(name); + } + + public void bind(Name name, Object obj) throws NamingException { + check(name); + original.bind(name, obj); + } + + public void bind(String name, Object obj) throws NamingException { + check(name); + original.bind(name, obj); + } + + public void rebind(Name name, Object obj) throws NamingException { + check(name); + original.rebind(name, obj); + } + + public void rebind(String name, Object obj) throws NamingException { + check(name); + original.rebind(name, obj); + } + + public void unbind(Name name) throws NamingException { + check(name); + original.unbind(name); + } + + public void unbind(String name) throws NamingException { + check(name); + original.unbind(name); + } + + public void rename(Name oldName, Name newName) throws NamingException { + check(oldName); + check(newName); + original.rename(oldName, newName); + } + + public void rename(String oldName, String newName) throws NamingException { + check(oldName); + check(newName); + original.rename(oldName, newName); + } + + public NamingEnumeration<NameClassPair> list(Name name) throws NamingException { + check(name); + return original.list(name); + } + + public NamingEnumeration<NameClassPair> list(String name) throws NamingException { + check(name); + return original.list(name); + } + + public NamingEnumeration<Binding> listBindings(Name name) throws NamingException { + check(name); + return original.listBindings(name); + } + + public NamingEnumeration<Binding> listBindings(String name) throws NamingException { + check(name); + return original.listBindings(name); + } + + public void destroySubcontext(Name name) throws NamingException { + check(name); + original.destroySubcontext(name); + } + + public void destroySubcontext(String name) throws NamingException { + check(name); + original.destroySubcontext(name); + } + + public Context createSubcontext(Name name) throws NamingException { + check(name); + return original.createSubcontext(name); + } + + public Context createSubcontext(String name) throws NamingException { + check(name); + return original.createSubcontext(name); + } + + public Object lookupLink(Name name) throws NamingException { + check(name); + return original.lookupLink(name); + } + + public Object lookupLink(String name) throws NamingException { + check(name); + return original.lookupLink(name); + } + + public NameParser getNameParser(Name name) throws NamingException { + check(name); + return original.getNameParser(name); + } + + public NameParser getNameParser(String name) throws NamingException { + check(name); + return original.getNameParser(name); + } + + public Name composeName(Name name, Name prefix) throws NamingException { + check(name); + return original.composeName(name, prefix); + } + + public String composeName(String name, String prefix) throws NamingException { + check(name); + return original.composeName(name, prefix); + } + + public Object addToEnvironment(String propName, Object propVal) throws NamingException { + check(); + return original.addToEnvironment(propName, propVal); + } + + public Object removeFromEnvironment(String propName) throws NamingException { + check(); + return original.removeFromEnvironment(propName); + } + + public Hashtable<?, ?> getEnvironment() throws NamingException { + check(); + return original.getEnvironment(); + } + + public void close() throws NamingException { + check(); + original.close(); + } + + public String getNameInNamespace() throws NamingException { + check(); + return original.getNameInNamespace(); + } + + //copied from InitialContext + private static String getURLScheme(String str) { + int colon_posn = str.indexOf(':'); + int slash_posn = str.indexOf('/'); + + if (colon_posn > 0 && (slash_posn == -1 || colon_posn < slash_posn)) + return str.substring(0, colon_posn); + return null; + } + + @Override + public int hashCode() { + return getOriginal() == null ? super.hashCode() : getOriginal().hashCode(); + } + + @Override + public boolean equals(Object o) { + return getOriginal() == null ? super.equals(o) : getOriginal().equals(o); + } +} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingContextDecoratorSetContext.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingContextDecoratorSetContext.java new file mode 100644 index 0000000..2e0e790 --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingContextDecoratorSetContext.java @@ -0,0 +1,75 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.naming.context; + +import java.lang.reflect.Constructor; +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + +import javax.naming.Context; + +import org.rhq.enterprise.server.naming.util.DecoratorSetContext; + +/** + * + * + * @author Lukas Krejci + */ +public class AccessCheckingContextDecoratorSetContext implements DecoratorSetContext<Context, ContextDecorator> { + + private static final Set<Class<? extends ContextDecorator>> DECORATOR_CLASSES; + static { + HashSet<Class<? extends ContextDecorator>> tmp = new HashSet<Class<? extends ContextDecorator>>(); + tmp.add(AccessCheckingContextDecorator.class); + tmp.add(AccessCheckingDirContextDecorator.class); + tmp.add(AccessCheckingEventContextDecorator.class); + tmp.add(AccessCheckingEventDirContextDecorator.class); + tmp.add(AccessCheckingLdapContextDecorator.class); + + DECORATOR_CLASSES = Collections.unmodifiableSet(tmp); + } + + private Set<Class<? extends Context>> supportedInterfaces; + private String[] checkedSchemes; + + public AccessCheckingContextDecoratorSetContext(Set<Class<? extends Context>> supportedInterfaces, String... checkedSchemes) { + this.supportedInterfaces = supportedInterfaces; + this.checkedSchemes = checkedSchemes; + } + + public ContextDecorator instantiate(Class<? extends ContextDecorator> decoratorClass) throws Exception { + Constructor<? extends ContextDecorator> ctor = decoratorClass.getConstructor(String[].class); + + return ctor.newInstance((Object)checkedSchemes); + } + + public Set<Class<? extends Context>> getSupportedInterfaces() { + return supportedInterfaces; + } + + public Set<Class<? extends ContextDecorator>> getDecoratorClasses() { + return DECORATOR_CLASSES; + } + + public void init(ContextDecorator decorator, Context object) throws Exception { + decorator.init(object); + } +} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingDirContextDecorator.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingDirContextDecorator.java new file mode 100644 index 0000000..602cc02 --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingDirContextDecorator.java @@ -0,0 +1,187 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.naming.context; + +import javax.naming.Name; +import javax.naming.NamingEnumeration; +import javax.naming.NamingException; +import javax.naming.directory.Attributes; +import javax.naming.directory.DirContext; +import javax.naming.directory.ModificationItem; +import javax.naming.directory.SearchControls; +import javax.naming.directory.SearchResult; + +/** + * A decorator of {@link DirContext}. + * + * @author Lukas Krejci + */ +public class AccessCheckingDirContextDecorator extends AccessCheckingContextDecorator implements DirContext { + + private static final long serialVersionUID = 1L; + + public AccessCheckingDirContextDecorator(String... checkedSchemes) { + super(checkedSchemes); + } + + public AccessCheckingDirContextDecorator(DirContext original, String... checkedSchemes) { + super(original, checkedSchemes); + } + + @Override + protected DirContext getOriginal() { + return (DirContext) super.getOriginal(); + } + + public Attributes getAttributes(Name name) throws NamingException { + check(name); + return getOriginal().getAttributes(name); + } + + public Attributes getAttributes(String name) throws NamingException { + check(name); + return getOriginal().getAttributes(name); + } + + public Attributes getAttributes(Name name, String[] attrIds) throws NamingException { + check(name); + return getOriginal().getAttributes(name, attrIds); + } + + public Attributes getAttributes(String name, String[] attrIds) throws NamingException { + check(name); + return getOriginal().getAttributes(name, attrIds); + } + + public void modifyAttributes(Name name, int mod_op, Attributes attrs) throws NamingException { + check(name); + getOriginal().modifyAttributes(name, mod_op, attrs); + } + + public void modifyAttributes(String name, int mod_op, Attributes attrs) throws NamingException { + check(name); + getOriginal().modifyAttributes(name, mod_op, attrs); + } + + public void modifyAttributes(Name name, ModificationItem[] mods) throws NamingException { + check(name); + getOriginal().modifyAttributes(name, mods); + } + + public void modifyAttributes(String name, ModificationItem[] mods) throws NamingException { + check(name); + getOriginal().modifyAttributes(name, mods); + } + + public void bind(Name name, Object obj, Attributes attrs) throws NamingException { + check(name); + getOriginal().bind(name, obj, attrs); + } + + public void bind(String name, Object obj, Attributes attrs) throws NamingException { + check(name); + getOriginal().bind(name, obj, attrs); + } + + public void rebind(Name name, Object obj, Attributes attrs) throws NamingException { + check(name); + getOriginal().rebind(name, obj, attrs); + } + + public void rebind(String name, Object obj, Attributes attrs) throws NamingException { + check(name); + getOriginal().rebind(name, obj, attrs); + } + + public DirContext createSubcontext(Name name, Attributes attrs) throws NamingException { + check(name); + return getOriginal().createSubcontext(name, attrs); + } + + public DirContext createSubcontext(String name, Attributes attrs) throws NamingException { + check(name); + return getOriginal().createSubcontext(name, attrs); + } + + public DirContext getSchema(Name name) throws NamingException { + check(name); + return getOriginal().getSchema(name); + } + + public DirContext getSchema(String name) throws NamingException { + check(name); + return getOriginal().getSchema(name); + } + + public DirContext getSchemaClassDefinition(Name name) throws NamingException { + check(name); + return getOriginal().getSchemaClassDefinition(name); + } + + public DirContext getSchemaClassDefinition(String name) throws NamingException { + check(name); + return getOriginal().getSchema(name); + } + + public NamingEnumeration<SearchResult> + search(Name name, Attributes matchingAttributes, String[] attributesToReturn) throws NamingException { + check(name); + return getOriginal().search(name, matchingAttributes, attributesToReturn); + } + + public NamingEnumeration<SearchResult> search(String name, Attributes matchingAttributes, + String[] attributesToReturn) throws NamingException { + check(name); + return getOriginal().search(name, matchingAttributes, attributesToReturn); + } + + public NamingEnumeration<SearchResult> search(Name name, Attributes matchingAttributes) throws NamingException { + check(name); + return getOriginal().search(name, matchingAttributes); + } + + public NamingEnumeration<SearchResult> search(String name, Attributes matchingAttributes) throws NamingException { + check(name); + return getOriginal().search(name, matchingAttributes); + } + + public NamingEnumeration<SearchResult> search(Name name, String filter, SearchControls cons) throws NamingException { + check(name); + return getOriginal().search(name, filter, cons); + } + + public NamingEnumeration<SearchResult> search(String name, String filter, SearchControls cons) + throws NamingException { + check(name); + return getOriginal().search(name, filter, cons); + } + + public NamingEnumeration<SearchResult> + search(Name name, String filterExpr, Object[] filterArgs, SearchControls cons) throws NamingException { + check(name); + return getOriginal().search(name, filterExpr, filterArgs, cons); + } + + public NamingEnumeration<SearchResult> search(String name, String filterExpr, Object[] filterArgs, + SearchControls cons) throws NamingException { + check(name); + return getOriginal().search(name, filterExpr, filterArgs, cons); + } +} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingEventContextDecorator.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingEventContextDecorator.java new file mode 100644 index 0000000..b6f314d --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingEventContextDecorator.java @@ -0,0 +1,69 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.naming.context; + +import javax.naming.Name; +import javax.naming.NamingException; +import javax.naming.event.EventContext; +import javax.naming.event.NamingListener; + +/** + * + * + * @author Lukas Krejci + */ +public class AccessCheckingEventContextDecorator extends AccessCheckingContextDecorator implements EventContext { + + private static final long serialVersionUID = 1L; + + public AccessCheckingEventContextDecorator(String... checkedSchemes) { + super(checkedSchemes); + } + + public AccessCheckingEventContextDecorator(EventContext original, String... checkedSchemes) { + super(original, checkedSchemes); + } + + @Override + protected EventContext getOriginal() { + return (EventContext) super.getOriginal(); + } + + public void addNamingListener(Name target, int scope, NamingListener l) throws NamingException { + check(target); + getOriginal().addNamingListener(target, scope, l); + } + + public void addNamingListener(String target, int scope, NamingListener l) throws NamingException { + check(target); + getOriginal().addNamingListener(target, scope, l); + } + + public void removeNamingListener(NamingListener l) throws NamingException { + check(); + getOriginal().removeNamingListener(l); + } + + public boolean targetMustExist() throws NamingException { + check(); + return getOriginal().targetMustExist(); + } + +} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingEventDirContextDecorator.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingEventDirContextDecorator.java new file mode 100644 index 0000000..f28c29c --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingEventDirContextDecorator.java @@ -0,0 +1,96 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.naming.context; + +import javax.naming.Name; +import javax.naming.NamingException; +import javax.naming.directory.SearchControls; +import javax.naming.event.EventDirContext; +import javax.naming.event.NamingListener; + +/** + * + * + * @author Lukas Krejci + */ +public class AccessCheckingEventDirContextDecorator extends AccessCheckingDirContextDecorator implements + EventDirContext { + + private static final long serialVersionUID = 1L; + + public AccessCheckingEventDirContextDecorator(String... checkedSchemes) { + super(checkedSchemes); + } + + public AccessCheckingEventDirContextDecorator(EventDirContext original, String... checkedSchemes) { + super(original, checkedSchemes); + } + + @Override + protected EventDirContext getOriginal() { + return (EventDirContext) super.getOriginal(); + } + + public void addNamingListener(Name target, int scope, NamingListener l) throws NamingException { + check(target); + getOriginal().addNamingListener(target, scope, l); + } + + public void addNamingListener(String target, int scope, NamingListener l) throws NamingException { + check(target); + getOriginal().addNamingListener(target, scope, l); + } + + public void removeNamingListener(NamingListener l) throws NamingException { + check(); + getOriginal().removeNamingListener(l); + } + + public boolean targetMustExist() throws NamingException { + check(); + return getOriginal().targetMustExist(); + } + + public void addNamingListener(Name target, String filter, SearchControls ctls, NamingListener l) + throws NamingException { + check(target); + getOriginal().addNamingListener(target, filter, ctls, l); + } + + public void addNamingListener(String target, String filter, SearchControls ctls, NamingListener l) + throws NamingException { + check(target); + getOriginal().addNamingListener(target, filter, ctls, l); + } + + public void + addNamingListener(Name target, String filter, Object[] filterArgs, SearchControls ctls, NamingListener l) + throws NamingException { + check(target); + getOriginal().addNamingListener(target, filter, filterArgs, ctls, l); + } + + public void addNamingListener(String target, String filter, Object[] filterArgs, SearchControls ctls, + NamingListener l) throws NamingException { + check(target); + getOriginal().addNamingListener(target, filter, filterArgs, ctls, l); + } + +} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingLdapContextDecorator.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingLdapContextDecorator.java new file mode 100644 index 0000000..2c6036f --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/AccessCheckingLdapContextDecorator.java @@ -0,0 +1,85 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.naming.context; + +import javax.naming.NamingException; +import javax.naming.ldap.Control; +import javax.naming.ldap.ExtendedRequest; +import javax.naming.ldap.ExtendedResponse; +import javax.naming.ldap.LdapContext; + +/** + * + * + * @author Lukas Krejci + */ +public class AccessCheckingLdapContextDecorator extends AccessCheckingDirContextDecorator implements LdapContext { + + private static final long serialVersionUID = 1L; + + public AccessCheckingLdapContextDecorator(String... checkedSchemes) { + super(checkedSchemes); + } + + public AccessCheckingLdapContextDecorator(LdapContext original, String... checkedSchemes) { + super(original, checkedSchemes); + } + + @Override + protected LdapContext getOriginal() { + return (LdapContext) super.getOriginal(); + } + + public ExtendedResponse extendedOperation(ExtendedRequest request) throws NamingException { + check(); + return getOriginal().extendedOperation(request); + } + + public LdapContext newInstance(Control[] requestControls) throws NamingException { + check(); + return getOriginal().newInstance(requestControls); + } + + public void reconnect(Control[] connCtls) throws NamingException { + check(); + getOriginal().reconnect(connCtls); + } + + public Control[] getConnectControls() throws NamingException { + check(); + return getOriginal().getConnectControls(); + } + + public void setRequestControls(Control[] requestControls) throws NamingException { + check(); + getOriginal().setRequestControls(requestControls); + } + + public Control[] getRequestControls() throws NamingException { + check(); + return getOriginal().getRequestControls(); + } + + public Control[] getResponseControls() throws NamingException { + check(); + return getOriginal().getResponseControls(); + } + +} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/ContextDecorator.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/ContextDecorator.java new file mode 100644 index 0000000..0781b9b --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/ContextDecorator.java @@ -0,0 +1,33 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.naming.context; + +import javax.naming.Context; +import javax.naming.NamingException; + +/** + * + * + * @author Lukas Krejci + */ +public interface ContextDecorator extends Context { + + void init(Context context) throws NamingException; +} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringContextDecorator.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringContextDecorator.java new file mode 100644 index 0000000..62fc86b --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringContextDecorator.java @@ -0,0 +1,222 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2011 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.naming.context; + +import java.io.Serializable; +import java.util.Hashtable; + +import javax.naming.Binding; +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.Name; +import javax.naming.NameClassPair; +import javax.naming.NameParser; +import javax.naming.NamingEnumeration; +import javax.naming.NamingException; + +import org.rhq.enterprise.server.naming.AccessCheckingInitialContextFactoryBuilder; + +/** + * This is a wrapper class around another {@link Context} implementation that + * prefers to use an URL context for some operation if the JNDI name contains + * a scheme rather than the original. This is the behavior of {@link InitialContext} + * which we need to restore in the contexts created by the {@link AccessCheckingInitialContextFactoryBuilder} + * (which an {@link InitialContext} uses exclusively if the builder is set). + * <p> + * This is important because RHQ server has its own initial context factory + * builder that creates factories that in turn create contexts. If the default + * {@link InitialContext} implementation was used, we'd never be able to lookup + * scheme-based names because the default implementation of the {@link InitialContext} + * always uses the default context of the builder if one is installed no matter + * the scheme in the name. + * <p> + * The {@link AccessCheckingInitialContextFactoryBuilder} wraps the context returned + * by the factory in an instance of this class and thus is restoring the original + * intended behavior of the {@link InitialContext}. It looks at the name being looked + * up (bound or whatever) and prefers to use the URL context factories if the name + * contains the scheme (as does the {@link InitialContext} if no builder is installed). + * If the name doesn't contain a scheme, the provided default context factory is used to + * look up the name. + * + * @author Lukas Krejci + */ +public class URLPreferringContextDecorator implements Context, ContextDecorator, Serializable { + + private static final long serialVersionUID = 1L; + + private Context original; + + public URLPreferringContextDecorator() { + + } + + public URLPreferringContextDecorator(Context ctx) { + original = ctx; + } + + public void init(Context context) { + original = context; + } + + protected Context getOriginal() throws NamingException { + return original; + } + + protected Context getURLOrDefaultInitCtx(Name name) throws NamingException { + @SuppressWarnings("unchecked") + Context urlContext = URLPreferringContextDecoratorHelper.getURLContext(name, (Hashtable<Object, Object>) getEnvironment()); + return urlContext == null ? getOriginal() : urlContext; + } + + protected Context getURLOrDefaultInitCtx(String name) throws NamingException { + @SuppressWarnings("unchecked") + Context urlContext = URLPreferringContextDecoratorHelper.getURLContext(name, (Hashtable<Object, Object>) getEnvironment()); + return urlContext == null ? getOriginal() : urlContext; + } + + public Object lookup(Name name) throws NamingException { + return getURLOrDefaultInitCtx(name).lookup(name); + } + + public Object lookup(String name) throws NamingException { + return getURLOrDefaultInitCtx(name).lookup(name); + } + + public void bind(Name name, Object obj) throws NamingException { + getURLOrDefaultInitCtx(name).bind(name, obj); + } + + public void bind(String name, Object obj) throws NamingException { + getURLOrDefaultInitCtx(name).bind(name, obj); + } + + public void rebind(Name name, Object obj) throws NamingException { + getURLOrDefaultInitCtx(name).rebind(name, obj); + } + + public void rebind(String name, Object obj) throws NamingException { + getURLOrDefaultInitCtx(name).rebind(name, obj); + } + + public void unbind(Name name) throws NamingException { + getURLOrDefaultInitCtx(name).unbind(name); + } + + public void unbind(String name) throws NamingException { + getURLOrDefaultInitCtx(name).unbind(name); + } + + public void rename(Name oldName, Name newName) throws NamingException { + getURLOrDefaultInitCtx(oldName).rename(oldName, newName); + } + + public void rename(String oldName, String newName) throws NamingException { + getURLOrDefaultInitCtx(oldName).rename(oldName, newName); + } + + public NamingEnumeration<NameClassPair> list(Name name) throws NamingException { + return getURLOrDefaultInitCtx(name).list(name); + } + + public NamingEnumeration<NameClassPair> list(String name) throws NamingException { + return getURLOrDefaultInitCtx(name).list(name); + } + + public NamingEnumeration<Binding> listBindings(Name name) throws NamingException { + return getURLOrDefaultInitCtx(name).listBindings(name); + } + + public NamingEnumeration<Binding> listBindings(String name) throws NamingException { + return getURLOrDefaultInitCtx(name).listBindings(name); + } + + public void destroySubcontext(Name name) throws NamingException { + getURLOrDefaultInitCtx(name).destroySubcontext(name); + } + + public void destroySubcontext(String name) throws NamingException { + getURLOrDefaultInitCtx(name).destroySubcontext(name); + } + + public Context createSubcontext(Name name) throws NamingException { + return getURLOrDefaultInitCtx(name).createSubcontext(name); + } + + public Context createSubcontext(String name) throws NamingException { + return getURLOrDefaultInitCtx(name).createSubcontext(name); + } + + public Object lookupLink(Name name) throws NamingException { + return getURLOrDefaultInitCtx(name).lookupLink(name); + } + + public Object lookupLink(String name) throws NamingException { + return getURLOrDefaultInitCtx(name).lookupLink(name); + } + + public NameParser getNameParser(Name name) throws NamingException { + return getURLOrDefaultInitCtx(name).getNameParser(name); + } + + public NameParser getNameParser(String name) throws NamingException { + return getURLOrDefaultInitCtx(name).getNameParser(name); + } + + public Name composeName(Name name, Name prefix) throws NamingException { + return getOriginal().composeName(name, prefix); + } + + public String composeName(String name, String prefix) throws NamingException { + return getOriginal().composeName(name, prefix); + } + + public Object addToEnvironment(String propName, Object propVal) throws NamingException { + return getOriginal().addToEnvironment(propName, propVal); + } + + public Object removeFromEnvironment(String propName) throws NamingException { + return getOriginal().removeFromEnvironment(propName); + } + + public Hashtable<?, ?> getEnvironment() throws NamingException { + return getOriginal().getEnvironment(); + } + + public void close() throws NamingException { + if (getOriginal() != null) { + getOriginal().close(); + original = null; + } + } + + public String getNameInNamespace() throws NamingException { + return getOriginal().getNameInNamespace(); + } + + @Override + public int hashCode() { + return original == null ? super.hashCode() : original.hashCode(); + } + + @Override + public boolean equals(Object o) { + return original == null ? super.equals(o) : original.equals(o); + } +} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringContextDecoratorHelper.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringContextDecoratorHelper.java new file mode 100644 index 0000000..306446d --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringContextDecoratorHelper.java @@ -0,0 +1,76 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.naming.context; + +import java.util.Hashtable; + +import javax.naming.Context; +import javax.naming.Name; +import javax.naming.NamingException; +import javax.naming.spi.NamingManager; + +/** + * + * + * @author Lukas Krejci + */ +public class URLPreferringContextDecoratorHelper { + + private URLPreferringContextDecoratorHelper() { + + } + + public static Context getURLContext(String name, Hashtable<Object, Object> env) throws NamingException { + String scheme = getURLScheme(name); + if (scheme != null) { + Context ctx = NamingManager.getURLContext(scheme, env); + if (ctx != null) { + return ctx; + } + } + + return null; + } + + public static Context getURLContext(Name name, Hashtable<Object, Object> env) throws NamingException { + if (name.size() > 0) { + String first = name.get(0); + String scheme = getURLScheme(first); + if (scheme != null) { + Context ctx = NamingManager.getURLContext(scheme, env); + if (ctx != null) { + return ctx; + } + } + } + + return null; + } + + //copied from InitialContext + private static String getURLScheme(String str) { + int colon_posn = str.indexOf(':'); + int slash_posn = str.indexOf('/'); + + if (colon_posn > 0 && (slash_posn == -1 || colon_posn < slash_posn)) + return str.substring(0, colon_posn); + return null; + } +} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringContextDecoratorSetContext.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringContextDecoratorSetContext.java new file mode 100644 index 0000000..ded552c --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringContextDecoratorSetContext.java @@ -0,0 +1,71 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.naming.context; + +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + +import javax.naming.Context; + +import org.rhq.enterprise.server.naming.util.DecoratorSetContext; + +/** + * + * + * @author Lukas Krejci + */ +public class URLPreferringContextDecoratorSetContext implements DecoratorSetContext<Context, ContextDecorator> { + + private static final Set<Class<? extends ContextDecorator>> DECORATOR_CLASSES; + static { + HashSet<Class<? extends ContextDecorator>> tmp = new HashSet<Class<? extends ContextDecorator>>(); + tmp.add(URLPreferringContextDecorator.class); + tmp.add(URLPreferringDirContextDecorator.class); + tmp.add(URLPreferringEventContextDecorator.class); + tmp.add(URLPreferringEventDirContextDecorator.class); + tmp.add(URLPreferringLdapContextDecorator.class); + + DECORATOR_CLASSES = Collections.unmodifiableSet(tmp); + } + + private Set<Class<? extends Context>> supportedInterfaces; + + public URLPreferringContextDecoratorSetContext(Set<Class<? extends Context>> supportedInterfaces) { + this.supportedInterfaces = supportedInterfaces; + } + + public Set<Class<? extends Context>> getSupportedInterfaces() { + return supportedInterfaces; + } + + public Set<Class<? extends ContextDecorator>> getDecoratorClasses() { + return DECORATOR_CLASSES; + } + + public ContextDecorator instantiate(Class<? extends ContextDecorator> decoratorClass) throws Exception { + return decoratorClass.newInstance(); + } + + public void init(ContextDecorator decorator, Context object) throws Exception { + decorator.init(object); + } + +} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringDirContextDecorator.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringDirContextDecorator.java new file mode 100644 index 0000000..6c695f4 --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringDirContextDecorator.java @@ -0,0 +1,185 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.naming.context; + +import javax.naming.Context; +import javax.naming.Name; +import javax.naming.NamingEnumeration; +import javax.naming.NamingException; +import javax.naming.NoInitialContextException; +import javax.naming.NotContextException; +import javax.naming.directory.Attributes; +import javax.naming.directory.DirContext; +import javax.naming.directory.ModificationItem; +import javax.naming.directory.SearchControls; +import javax.naming.directory.SearchResult; + +/** + * Akin to {@link URLPreferringContextDecorator} this class implements the similar logic + * for {@link DirContext}s. + * + * @author Lukas Krejci + */ +public class URLPreferringDirContextDecorator extends URLPreferringContextDecorator implements DirContext { + + private static final long serialVersionUID = 1L; + + public URLPreferringDirContextDecorator() { + super(null); + } + + public URLPreferringDirContextDecorator(DirContext ctx) { + super(ctx); + } + + protected DirContext checkAndCast(Context ctx) throws NamingException { + if (!(ctx instanceof DirContext)) { + if (ctx == null) { + throw new NoInitialContextException(); + } else { + throw new NotContextException( + "Not an instance of DirContext"); + } + } + + return (DirContext) ctx; + } + + @Override + protected DirContext getURLOrDefaultInitCtx(Name name) throws NamingException { + Context ctx = super.getURLOrDefaultInitCtx(name); + return checkAndCast(ctx); + } + + @Override + protected DirContext getURLOrDefaultInitCtx(String name) throws NamingException { + Context ctx = super.getURLOrDefaultInitCtx(name); + return checkAndCast(ctx); + } + + public Attributes getAttributes(Name name) throws NamingException { + return getURLOrDefaultInitCtx(name).getAttributes(name); + } + + public Attributes getAttributes(String name) throws NamingException { + return getURLOrDefaultInitCtx(name).getAttributes(name); + } + + public Attributes getAttributes(Name name, String[] attrIds) throws NamingException { + return getURLOrDefaultInitCtx(name).getAttributes(name, attrIds); + } + + public Attributes getAttributes(String name, String[] attrIds) throws NamingException { + return getURLOrDefaultInitCtx(name).getAttributes(name, attrIds); + } + + public void modifyAttributes(Name name, int mod_op, Attributes attrs) throws NamingException { + getURLOrDefaultInitCtx(name).modifyAttributes(name, mod_op, attrs); + } + + public void modifyAttributes(String name, int mod_op, Attributes attrs) throws NamingException { + getURLOrDefaultInitCtx(name).modifyAttributes(name, mod_op, attrs); + } + + public void modifyAttributes(Name name, ModificationItem[] mods) throws NamingException { + getURLOrDefaultInitCtx(name).modifyAttributes(name, mods); + } + + public void modifyAttributes(String name, ModificationItem[] mods) throws NamingException { + getURLOrDefaultInitCtx(name).modifyAttributes(name, mods); + } + + public void bind(Name name, Object obj, Attributes attrs) throws NamingException { + getURLOrDefaultInitCtx(name).bind(name, obj, attrs); + } + + public void bind(String name, Object obj, Attributes attrs) throws NamingException { + getURLOrDefaultInitCtx(name).bind(name, obj, attrs); + } + + public void rebind(Name name, Object obj, Attributes attrs) throws NamingException { + getURLOrDefaultInitCtx(name).rebind(name, obj, attrs); + } + + public void rebind(String name, Object obj, Attributes attrs) throws NamingException { + getURLOrDefaultInitCtx(name).rebind(name, obj, attrs); + } + + public DirContext createSubcontext(Name name, Attributes attrs) throws NamingException { + return getURLOrDefaultInitCtx(name).createSubcontext(name, attrs); + } + + public DirContext createSubcontext(String name, Attributes attrs) throws NamingException { + return getURLOrDefaultInitCtx(name).createSubcontext(name, attrs); + } + + public DirContext getSchema(Name name) throws NamingException { + return getURLOrDefaultInitCtx(name).getSchema(name); + } + + public DirContext getSchema(String name) throws NamingException { + return getURLOrDefaultInitCtx(name).getSchema(name); + } + + public DirContext getSchemaClassDefinition(Name name) throws NamingException { + return getURLOrDefaultInitCtx(name).getSchemaClassDefinition(name); + } + + public DirContext getSchemaClassDefinition(String name) throws NamingException { + return getURLOrDefaultInitCtx(name).getSchemaClassDefinition(name); + } + + public NamingEnumeration<SearchResult> + search(Name name, Attributes matchingAttributes, String[] attributesToReturn) throws NamingException { + return getURLOrDefaultInitCtx(name).search(name, matchingAttributes, attributesToReturn); + } + + public NamingEnumeration<SearchResult> search(String name, Attributes matchingAttributes, + String[] attributesToReturn) throws NamingException { + return getURLOrDefaultInitCtx(name).search(name, matchingAttributes, attributesToReturn); + } + + public NamingEnumeration<SearchResult> search(Name name, Attributes matchingAttributes) throws NamingException { + return getURLOrDefaultInitCtx(name).search(name, matchingAttributes); + } + + public NamingEnumeration<SearchResult> search(String name, Attributes matchingAttributes) throws NamingException { + return getURLOrDefaultInitCtx(name).search(name, matchingAttributes); + } + + public NamingEnumeration<SearchResult> search(Name name, String filter, SearchControls cons) throws NamingException { + return getURLOrDefaultInitCtx(name).search(name, filter, cons); + } + + public NamingEnumeration<SearchResult> search(String name, String filter, SearchControls cons) + throws NamingException { + return getURLOrDefaultInitCtx(name).search(name, filter, cons); + } + + public NamingEnumeration<SearchResult> + search(Name name, String filterExpr, Object[] filterArgs, SearchControls cons) throws NamingException { + return getURLOrDefaultInitCtx(name).search(name, filterExpr, filterArgs, cons); + } + + public NamingEnumeration<SearchResult> search(String name, String filterExpr, Object[] filterArgs, + SearchControls cons) throws NamingException { + return getURLOrDefaultInitCtx(name).search(name, filterExpr, filterArgs, cons); + } +} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringEventContextDecorator.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringEventContextDecorator.java new file mode 100644 index 0000000..30e9ed2 --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringEventContextDecorator.java @@ -0,0 +1,81 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.naming.context; + +import javax.naming.Context; +import javax.naming.Name; +import javax.naming.NamingException; +import javax.naming.NoInitialContextException; +import javax.naming.NotContextException; +import javax.naming.event.EventContext; +import javax.naming.event.NamingListener; + +/** + * + * + * @author Lukas Krejci + */ +public class URLPreferringEventContextDecorator extends URLPreferringContextDecorator implements EventContext { + + private static final long serialVersionUID = 1L; + + public URLPreferringEventContextDecorator() { + super(null); + } + + public URLPreferringEventContextDecorator(EventContext ctx) { + super(ctx); + } + + protected EventContext checkAndCast(Context ctx) throws NamingException { + if (!(ctx instanceof EventContext)) { + if (ctx == null) { + throw new NoInitialContextException(); + } else { + throw new NotContextException( + "Not an instance of EventContext"); + } + } + + return (EventContext) ctx; + } + + @Override + protected EventContext getOriginal() throws NamingException { + return checkAndCast(super.getOriginal()); + } + + public void addNamingListener(Name target, int scope, NamingListener l) throws NamingException { + getOriginal().addNamingListener(target, scope, l); + } + + public void addNamingListener(String target, int scope, NamingListener l) throws NamingException { + getOriginal().addNamingListener(target, scope, l); + } + + public void removeNamingListener(NamingListener l) throws NamingException { + getOriginal().removeNamingListener(l); + } + + public boolean targetMustExist() throws NamingException { + return getOriginal().targetMustExist(); + } + +} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringEventDirContextDecorator.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringEventDirContextDecorator.java new file mode 100644 index 0000000..e9a3614 --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringEventDirContextDecorator.java @@ -0,0 +1,104 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.naming.context; + +import javax.naming.Context; +import javax.naming.Name; +import javax.naming.NamingException; +import javax.naming.NoInitialContextException; +import javax.naming.NotContextException; +import javax.naming.directory.SearchControls; +import javax.naming.event.EventDirContext; +import javax.naming.event.NamingListener; + +/** + * + * + * @author Lukas Krejci + */ +public class URLPreferringEventDirContextDecorator extends URLPreferringDirContextDecorator implements EventDirContext { + + private static final long serialVersionUID = 1L; + + public URLPreferringEventDirContextDecorator() { + super(null); + } + + public URLPreferringEventDirContextDecorator(EventDirContext ctx) { + super(ctx); + } + + @Override + protected EventDirContext checkAndCast(Context ctx) throws NamingException { + if (!(ctx instanceof EventDirContext)) { + if (ctx == null) { + throw new NoInitialContextException(); + } else { + throw new NotContextException( + "Not an instance of EventDirContext"); + } + } + + return (EventDirContext) ctx; + } + + @Override + protected EventDirContext getOriginal() throws NamingException { + return checkAndCast(super.getOriginal()); + } + + public void addNamingListener(Name target, int scope, NamingListener l) throws NamingException { + getOriginal().addNamingListener(target, scope, l); + } + + public void addNamingListener(String target, int scope, NamingListener l) throws NamingException { + getOriginal().addNamingListener(target, scope, l); + } + + public void removeNamingListener(NamingListener l) throws NamingException { + getOriginal().removeNamingListener(l); + } + + public boolean targetMustExist() throws NamingException { + return getOriginal().targetMustExist(); + } + + public void addNamingListener(Name target, String filter, SearchControls ctls, NamingListener l) + throws NamingException { + getOriginal().addNamingListener(target, filter, ctls, l); + } + + public void addNamingListener(String target, String filter, SearchControls ctls, NamingListener l) + throws NamingException { + getOriginal().addNamingListener(target, filter, ctls, l); + } + + public void + addNamingListener(Name target, String filter, Object[] filterArgs, SearchControls ctls, NamingListener l) + throws NamingException { + getOriginal().addNamingListener(target, filter, filterArgs, ctls, l); + } + + public void addNamingListener(String target, String filter, Object[] filterArgs, SearchControls ctls, + NamingListener l) throws NamingException { + getOriginal().addNamingListener(target, filter, filterArgs, ctls, l); + } + +} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringLdapContextDecorator.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringLdapContextDecorator.java new file mode 100644 index 0000000..93965df --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/context/URLPreferringLdapContextDecorator.java @@ -0,0 +1,94 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.naming.context; + +import javax.naming.Context; +import javax.naming.NamingException; +import javax.naming.NoInitialContextException; +import javax.naming.NotContextException; +import javax.naming.ldap.Control; +import javax.naming.ldap.ExtendedRequest; +import javax.naming.ldap.ExtendedResponse; +import javax.naming.ldap.LdapContext; + +/** + * + * + * @author Lukas Krejci + */ +public class URLPreferringLdapContextDecorator extends URLPreferringDirContextDecorator implements LdapContext { + + private static final long serialVersionUID = 1L; + + public URLPreferringLdapContextDecorator() { + super(null); + } + + public URLPreferringLdapContextDecorator(LdapContext original) { + super(original); + } + + @Override + protected LdapContext checkAndCast(Context ctx) throws NamingException { + if (!(ctx instanceof LdapContext)) { + if (ctx == null) { + throw new NoInitialContextException(); + } else { + throw new NotContextException("Not an instance of LdapContext"); + } + } + + return (LdapContext) ctx; + } + + @Override + protected LdapContext getOriginal() throws NamingException { + return checkAndCast(super.getOriginal()); + } + + public ExtendedResponse extendedOperation(ExtendedRequest request) throws NamingException { + return getOriginal().extendedOperation(request); + } + + public LdapContext newInstance(Control[] requestControls) throws NamingException { + return new URLPreferringLdapContextDecorator(getOriginal().newInstance(requestControls)); + } + + public void reconnect(Control[] connCtls) throws NamingException { + getOriginal().reconnect(connCtls); + } + + public Control[] getConnectControls() throws NamingException { + return getOriginal().getConnectControls(); + } + + public void setRequestControls(Control[] requestControls) throws NamingException { + getOriginal().setRequestControls(requestControls); + } + + public Control[] getRequestControls() throws NamingException { + return getOriginal().getRequestControls(); + } + + public Control[] getResponseControls() throws NamingException { + return getOriginal().getResponseControls(); + } + +} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/interfaces/java/javaURLContextFactory.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/interfaces/java/javaURLContextFactory.java new file mode 100644 index 0000000..fc4d02b --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/interfaces/java/javaURLContextFactory.java @@ -0,0 +1,32 @@ +package org.rhq.enterprise.server.naming.interfaces.java; + +import java.util.Hashtable; + +import javax.naming.CompositeName; +import javax.naming.Context; +import javax.naming.Name; +import javax.naming.spi.ObjectFactory; + +import org.jboss.as.naming.NamingContext; + +import org.rhq.enterprise.server.AllowRhqServerInternalsAccessPermission; + +/** @deprecated this is not used after all */ +@Deprecated +public class javaURLContextFactory implements ObjectFactory { + + private static final AllowRhqServerInternalsAccessPermission PERM = new AllowRhqServerInternalsAccessPermission(); + + @Override + @SuppressWarnings("unchecked") + public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment) + throws Exception { + + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + sm.checkPermission(PERM); + } + + return new NamingContext(name != null ? name : new CompositeName(""), (Hashtable<String, Object>) environment); + } +} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/util/DecoratingInvocationHandler.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/util/DecoratingInvocationHandler.java new file mode 100644 index 0000000..cda3a98 --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/util/DecoratingInvocationHandler.java @@ -0,0 +1,55 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.naming.util; + +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.List; + +public class DecoratingInvocationHandler<Type, Decorator extends Type> implements InvocationHandler { + + private final List<DecoratorPicker<Type, Decorator>> pickers; + private Type object; + + public DecoratingInvocationHandler(List<DecoratorPicker<Type, Decorator>> pickers, Type object) { + this.pickers = pickers; + this.object = object; + } + + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + Type target = object; + Class<?> methodClass = method.getDeclaringClass(); + + for(DecoratorPicker<Type, Decorator> picker : pickers) { + target = picker.decorate(target, methodClass); + } + + try { + return method.invoke(target, args); + } catch (InvocationTargetException e) { + if (e.getCause() != null) { + throw e.getCause(); + } else { + throw e; + } + } + } +} \ No newline at end of file diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/util/DecoratorPicker.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/util/DecoratorPicker.java new file mode 100644 index 0000000..12add1c --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/util/DecoratorPicker.java @@ -0,0 +1,195 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.naming.util; + +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +/** + * Given as set of decorators extending given type, this class can pick + * the most appropriate set of decorators for a class or a method call. + * <p> + * To configure the decorator, one has to provide a {@link DecoratorSetContext} that + * is then used to obtain the list of + * {@link DecoratorSetContext#getSupportedInterfaces() supported interfaces}, which are + * all the interfaces that should be used for decorator resolution (i.e. all other interfaces + * that a class might implement are ignored during decorator resolution), the list of + * {@link DecoratorSetContext#getDecoratorClasses() decorator classes}, which is a list + * of decorators the picker can choose from and is also used to instantiate and initialize + * the decorators. + * + * @author Lukas Krejci + */ +public class DecoratorPicker<Type, Decorator extends Type> { + + private DecoratorSetContext<Type, Decorator> context; + + public DecoratorSetContext<Type, Decorator> getContext() { + return context; + } + + public void setContext(DecoratorSetContext<Type, Decorator> decoratorSetContext) { + this.context = decoratorSetContext; + } + + /** + * Returns a set of decorators applicable for given method. The set is established based + * on the declaring class of the method. + * + * @param method the method to inspect + * @return the set of decorators that can be used to wrap a method call + * @throws Exception + */ + public Set<Decorator> getDecoratorsForMethod(Method method) throws Exception { + return getDecoratorsForClass_Private(method.getDeclaringClass()); + } + + /** + * Returns a set of decorators that can be used on instances of given class. + * @param cls the class to inspect + * @return + * @throws Exception + */ + public Set<Decorator> getDecoratorsForClass(Class<? extends Type> cls) throws Exception { + return getDecoratorsForClass_Private(cls); + } + + /** + * This method first establishes the set of decorators to use based on the class of the supplied + * object and then chains the decorators (in arbitrary order) with the supplied object at the + * "root" of the chain. + * <p> + * If a method is then called on the returned object, the methods of all the decorators are called + * in chain (each supposedly calling the next) and finally, at the end of the chain, the method on + * the original object (the one supplied to this method) is called. + * <p> + * Note that the above is only an intended behavior and actually depends on the implementation of + * the decorators that are resposinble for the chaining. Each decorator is initialized + * (@{link {@link DecoratorSetContext#init(Object, Object)} which should set it up for such chaining. + * + * @param object + * @return + * @throws Exception + */ + public Type decorate(Type object) throws Exception { + Set<Decorator> decs = getDecoratorsForClass_Private(object.getClass()); + Type ret = object; + for(Decorator d : decs) { + context.init(d, ret); + ret = d; + } + + return ret; + } + + /** + * Similar to {@link #decorate(Object)} but instead of the class of the object itself, + * uses the significantSuperClass as the basis for the decorator resolution. + * <p> + * This is important, because if the object implements two mutually incompatible sub-interfaces of <code>Type</code>, + * the chained decorators might fail to execute a method later on if the decorator depends on the upper part + * of the chain to implement certain sub-interface of <code>Type</code>. + * + * @param object the object to wrap in decorators + * @param significantSuperClass the class to base the decorator resolution on + * @return + * @throws Exception + */ + public Type decorate(Type object, Class<?> significantSuperClass) throws Exception { + Set<Decorator> decs = getDecoratorsForClass_Private(significantSuperClass); + Type ret = object; + for(Decorator d : decs) { + context.init(d, ret); + ret = d; + } + + return ret; + } + + private Set<Decorator> getDecoratorsForClass_Private(Class<?> cls) throws Exception { + Set<Class<? extends Type>> ifaces = getNearestApplicableInterfaces(cls); + + HashSet<Decorator> ret = new HashSet<Decorator>(); + + for (Class<? extends Type> iface : ifaces) { + for (Class<? extends Decorator> decClass : getMatch(iface)) { + ret.add(context.instantiate(decClass)); + } + } + + return ret; + } + + private Set<Class<? extends Type>> getNearestApplicableInterfaces(Class<?> cls) { + List<Class<? extends Type>> ifaces = new ArrayList<Class<? extends Type>>(getAllApplicableInterfaces(cls)); + + //now compact the set to only contain the most concrete interfaces + + Iterator<Class<? extends Type>> it = ifaces.iterator(); + while (it.hasNext()) { + Class<? extends Type> c = it.next(); + + for (int i = 0; i < ifaces.size(); ++i) { + Class<? extends Type> nextC = ifaces.get(i); + if (!c.equals(nextC) && c.isAssignableFrom(nextC)) { + it.remove(); + break; + } + } + } + + return new HashSet<Class<? extends Type>>(ifaces); + } + + private Set<Class<? extends Type>> getAllApplicableInterfaces(Class<?> cls) { + Set<Class<? extends Type>> ifaces = new HashSet<Class<? extends Type>>(); + + for (Class<? extends Type> iface : context.getSupportedInterfaces()) { + if (iface.isAssignableFrom(cls)) { + ifaces.add(iface); + } + } + + if (ifaces.isEmpty()) { + throw new IllegalArgumentException("Class " + cls + + " doesn't implement any of the applicable interfaces. Cannot find decorators for it."); + } + + return ifaces; + } + + private Set<Class<? extends Decorator>> getMatch(Class<?> targetIface) { + + Set<Class<? extends Decorator>> ret = new HashSet<Class<? extends Decorator>>(); + + for (Class<? extends Decorator> cls : context.getDecoratorClasses()) { + if (Arrays.asList(cls.getInterfaces()).contains(targetIface)) { + ret.add(cls); + } + } + + return ret; + } +} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/util/DecoratorSetContext.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/util/DecoratorSetContext.java new file mode 100644 index 0000000..4916a2d --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/naming/util/DecoratorSetContext.java @@ -0,0 +1,59 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.naming.util; + +import java.util.Set; + +/** + * Implementations of this interface provide a context to the {@link DecoratorPicker}. + * + * @author Lukas Krejci + */ +public interface DecoratorSetContext<Type, Decorator> { + + /** + * @return the set of interfaces that the decorators are able support. + * Usually this should be just a union of all interfaces the decorators implement + * but can be trimmed down. + */ + Set<Class<? extends Type>> getSupportedInterfaces(); + + /** + * @return the set of all decorator classes in this set + */ + Set<Class<? extends Decorator>> getDecoratorClasses(); + + /** + * Instantiates a new decorator of given class. + * @param decoratorClass + * @return + * @throws Exception + */ + Decorator instantiate(Class<? extends Decorator> decoratorClass) throws Exception; + + /** + * Initializes the decorator to decorate given object. + * + * @param decorator + * @param object + * @throws Exception on error + */ + void init(Decorator decorator, Type object) throws Exception; +} diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/naming/DecoratingInvocationHandlerTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/naming/DecoratingInvocationHandlerTest.java new file mode 100644 index 0000000..c92cc42 --- /dev/null +++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/naming/DecoratingInvocationHandlerTest.java @@ -0,0 +1,144 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.naming; + +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.Properties; +import java.util.Set; + +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.Name; +import javax.naming.NamingException; +import javax.naming.directory.DirContext; +import javax.naming.event.EventContext; +import javax.naming.event.NamingListener; +import javax.naming.spi.InitialContextFactory; +import javax.naming.spi.NamingManager; + +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +/** + * + * + * @author Lukas Krejci + */ +@Test +public class DecoratingInvocationHandlerTest { + private static final Set<String> INVOKED_METHODS = new HashSet<String>(); + + private static final InvocationHandler NOTE_TAKING_HANDLER = new InvocationHandler() { + + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + INVOKED_METHODS.add(method.getName()); + + if ("hashCode".equals(method.getName())) { + return 0; + } else if ("equals".equals(method.getName())) { + return false; + } + + return null; + } + }; + + private static Class<?>[] CONTEXT_INTERFACES; + + public static class Factory implements InitialContextFactory { + public Context getInitialContext(Hashtable<?, ?> environment) + throws NamingException { + + return (Context) Proxy.newProxyInstance(DecoratingInvocationHandlerTest.class.getClassLoader(), CONTEXT_INTERFACES, NOTE_TAKING_HANDLER); + } + } + + private static class DummyInitialEventContext extends InitialContext implements EventContext { + + /** + * @param environment + * @throws NamingException + */ + public DummyInitialEventContext(Hashtable<?, ?> environment) throws NamingException { + super(environment); + } + + public void addNamingListener(Name target, int scope, NamingListener l) throws NamingException { + ((EventContext)getURLOrDefaultInitCtx(target)).addNamingListener(target, scope, l); + } + + public void addNamingListener(String target, int scope, NamingListener l) throws NamingException { + ((EventContext)getURLOrDefaultInitCtx(target)).addNamingListener(target, scope, l); + } + + public void removeNamingListener(NamingListener l) throws NamingException { + ((EventContext)getDefaultInitCtx()).removeNamingListener(l); + } + + public boolean targetMustExist() throws NamingException { + return ((EventContext)getDefaultInitCtx()).targetMustExist(); + } + + + } + + @BeforeClass + public void setBuilder() throws Exception { + NamingManager.setInitialContextFactoryBuilder(new AccessCheckingInitialContextFactoryBuilder( + new org.jboss.as.naming.InitialContextFactory())); + } + + public void testSimpleDispatch() throws Exception { + INVOKED_METHODS.clear(); + Properties env = new Properties(); + env.put(Context.INITIAL_CONTEXT_FACTORY, Factory.class.getName()); + + CONTEXT_INTERFACES = new Class<?>[] { Context.class }; + + InitialContext ctx = new InitialContext(env); + + ctx.lookup("asdf"); + + assert INVOKED_METHODS.contains("lookup") : "The lookup doesn't seem to have propagated to the actual context to be used."; + } + + public void testMultiInterfaceDispatch() throws Exception { + INVOKED_METHODS.clear(); + Properties env = new Properties(); + env.put(Context.INITIAL_CONTEXT_FACTORY, Factory.class.getName()); + + CONTEXT_INTERFACES = new Class<?>[] { EventContext.class, DirContext.class }; + + InitialContext ctx = new InitialContext(env); + + ctx.lookup("asdf"); + + DummyInitialEventContext ectx = new DummyInitialEventContext(env); + + ectx.addNamingListener("hodiny", 0, null); + + assert INVOKED_METHODS.contains("lookup") : "The lookup doesn't seem to have propagated to the actual context to be used."; + assert INVOKED_METHODS.contains("addNamingListener") : "The addNamingListener doesn't seem to have propagated to the actual context to be used."; + } +} diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/naming/DecoratorPickerTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/naming/DecoratorPickerTest.java new file mode 100644 index 0000000..6a0892f --- /dev/null +++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/naming/DecoratorPickerTest.java @@ -0,0 +1,180 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.naming; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertTrue; + +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +import javax.naming.Context; +import javax.naming.directory.DirContext; +import javax.naming.event.EventContext; +import javax.naming.ldap.LdapContext; + +import org.testng.annotations.Test; + +import org.rhq.enterprise.server.naming.util.DecoratorPicker; +import org.rhq.enterprise.server.naming.util.DecoratorSetContext; + +/** + * @author Lukas Krejci + */ +@Test +public class DecoratorPickerTest { + + private static final InvocationHandler DUMMY_HANDLER = new InvocationHandler() { + + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + if ("hashCode".equals(method.getName())) { + return 0; + } else if ("equals".equals(method.getName())) { + return false; + } + + return null; + } + }; + + private static final Class<?> TEST_OBJECT_CLASS1 = createProxyClass(Context.class); + private static final Class<?> TEST_OBJECT_CLASS2 = createProxyClass(DirContext.class); + private static final Class<?> TEST_OBJECT_CLASS3 = createProxyClass(LdapContext.class); + private static final Class<?> TEST_OBJECT_CLASS4 = createProxyClass(LdapContext.class, EventContext.class); + private static final Class<?> DECORATOR_CLASS1 = createProxyClass(Context.class); + private static final Class<?> DECORATOR_CLASS2 = createProxyClass(EventContext.class); + private static final Class<?> DECORATOR_CLASS3 = createProxyClass(LdapContext.class); + private static final Class<?> DECORATOR_CLASS4 = createProxyClass(DirContext.class); + + public void testSimpleDecoratorIdentifiedByClass() throws Exception { + DecoratorPicker<Object, Object> picker = createTestPicker(); + + Set<Object> contextDecorators = picker.getDecoratorsForClass(TEST_OBJECT_CLASS1); + assertEquals(contextDecorators.size(), 1, "Expected exactly one decorator for Context class"); + assertEquals(contextDecorators.iterator().next().getClass().getInterfaces()[0], Context.class); + } + + public void testSuperClassDecoratorHasPrecedenceOverSubClassDecorator() throws Exception { + DecoratorPicker<Object, Object> picker = createTestPicker(); + + //this tests that the LdapContext isn't returned even though it subclasses the DirContext + Set<Object> contextDecorators = picker.getDecoratorsForClass(TEST_OBJECT_CLASS2); + assertEquals(contextDecorators.size(), 1, "Expected exactly one decorator for DirContext class"); + assertEquals(contextDecorators.iterator().next().getClass().getInterfaces()[0], DirContext.class); + } + + public void testSubClassDecoratorCorrectlyIdentified() throws Exception { + DecoratorPicker<Object, Object> picker = createTestPicker(); + + Set<Object> contextDecorators = picker.getDecoratorsForClass(TEST_OBJECT_CLASS3); + assertEquals(contextDecorators.size(), 1, "Expected exactly one decorator for LdapContext class"); + assertEquals(contextDecorators.iterator().next().getClass().getInterfaces()[0], LdapContext.class); + } + + public void testMultipleDecoratorsDetectable() throws Exception { + DecoratorPicker<Object, Object> picker = createTestPicker(); + + Set<Object> decorators = picker.getDecoratorsForClass(TEST_OBJECT_CLASS4); + assertEquals(decorators.size(), 2, + "Exactly 2 decorators should have been found for a class implementing 2 interfaces."); + + boolean ldapContextDecoratorFound = false; + boolean eventContextDecoratorFound = false; + + for (Object d : decorators) { + if (LdapContext.class.isAssignableFrom(d.getClass())) { + ldapContextDecoratorFound = true; + continue; //just to make sure that somehow the decorator doesn't implement both + } + if (EventContext.class.isAssignableFrom(d.getClass())) { + eventContextDecoratorFound = true; + } + } + + assertTrue(ldapContextDecoratorFound && eventContextDecoratorFound, + "The found decorators don't implement the desired interfaces."); + } + + public void testDecoratorsIdentifiedByMethod() throws Exception { + DecoratorPicker<Object, Object> picker = createTestPicker(); + + Set<Object> decorators = + picker.getDecoratorsForMethod(LdapContext.class.getMethod("getConnectControls", (Class<?>[]) null)); + assertEquals(decorators.size(), 1, + "Expected exactly one decorator for method 'getConnectControls()' from LdapContext class"); + assertEquals(decorators.iterator().next().getClass().getInterfaces()[0], LdapContext.class); + } + + public void testMethodFromSubclassMatchesSubclassDecorator() throws Exception { + DecoratorPicker<Object, Object> picker = createTestPicker(); + + //this is a method from the DirContext but we're asking for it from a class + //that implements also an LdapContext + //The LdapContext decorator also inherits from the DirContext decorator + //(by the virtue of LdapContext interface inheriting from the DirContext) + //The picker should therefore match the LdapContext decorator because its + //the "closest" one to the actual class. + Set<Object> decorators = + picker.getDecoratorsForMethod(TEST_OBJECT_CLASS3.getMethod("getSchemaClassDefinition", + new Class<?>[] { String.class })); + assertEquals(decorators.size(), 1, + "Expected exactly one decorator for method 'getSchemaClassDefinition(String)' from LdapContext class"); + assertEquals(decorators.iterator().next().getClass().getInterfaces()[0], LdapContext.class); + } + + private static Class<?> createProxyClass(Class<?>... ifaces) { + return Proxy.getProxyClass(DecoratorPickerTest.class.getClassLoader(), ifaces); + } + + private static DecoratorPicker<Object, Object> createTestPicker() { + DecoratorPicker<Object, Object> picker = new DecoratorPicker<Object, Object>(); + + DecoratorSetContext<Object, Object> decSet = new DecoratorSetContext<Object, Object>() { + + public Object instantiate(Class<? extends Object> decoratorClass) throws Exception { + Constructor<? extends Object> ctor = decoratorClass.getConstructor(InvocationHandler.class); + return ctor.newInstance(DUMMY_HANDLER); + } + + public void init(Object decorator, Object object) throws Exception { + } + + @SuppressWarnings("unchecked") + public Set<Class<? extends Object>> getSupportedInterfaces() { + return new HashSet<Class<? extends Object>>(Arrays.asList(Context.class, EventContext.class, + LdapContext.class, DirContext.class)); + } + + @SuppressWarnings("unchecked") + public Set<Class<? extends Object>> getDecoratorClasses() { + return new HashSet<Class<? extends Object>>(Arrays.asList(DECORATOR_CLASS1, DECORATOR_CLASS2, DECORATOR_CLASS3, DECORATOR_CLASS4)); + } + }; + + picker.setContext(decSet); + + return picker; + } +} diff --git a/modules/integration-tests/jndi-access/jndi-access-test/src/test/java/org/rhq/jndi/test/JndiAccessTest.java b/modules/integration-tests/jndi-access/jndi-access-test/src/test/java/org/rhq/jndi/test/JndiAccessTest.java index 05c59b6..46d211c 100644 --- a/modules/integration-tests/jndi-access/jndi-access-test/src/test/java/org/rhq/jndi/test/JndiAccessTest.java +++ b/modules/integration-tests/jndi-access/jndi-access-test/src/test/java/org/rhq/jndi/test/JndiAccessTest.java @@ -45,9 +45,9 @@ import org.rhq.bindings.StandardScriptPermissions; import org.rhq.bindings.util.PackageFinder; import org.rhq.core.domain.auth.Subject; import org.rhq.enterprise.client.LocalClient; +import org.rhq.enterprise.server.AllowRhqServerInternalsAccessPermission; import org.rhq.enterprise.server.test.AbstractEJB3Test; import org.rhq.enterprise.server.util.LookupUtil; -import org.rhq.jndi.AllowRhqServerInternalsAccessPermission; import org.rhq.test.PortScout;
/**
commit e499abf813bf6e92f7359d58ffd6f2ca442c5140 Author: John Sanda jsanda@redhat.com Date: Tue Dec 4 20:26:00 2012 -0500
adding test for getAggregate method when fetching raw data
The method under test is used for the measurement tables in the UI.
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBeanTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBeanTest.java index 190c3d5..9c2882c 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBeanTest.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBeanTest.java @@ -61,6 +61,7 @@ import org.rhq.enterprise.server.drift.DriftServerPluginService; import org.rhq.enterprise.server.measurement.util.MeasurementDataManagerUtility; import org.rhq.enterprise.server.test.AbstractEJB3Test; import org.rhq.enterprise.server.test.TransactionCallback; +import org.rhq.test.AssertUtils;
/** * @author John Sanda @@ -168,6 +169,34 @@ public class MeasurementDataManagerBeanTest extends AbstractEJB3Test { actualData.get(29)); }
+ @Test(enabled = true) + public void getRawAggregate() { + DateTime now = new DateTime(); + DateTime beginTime = now.minusHours(4); + DateTime endTime = now; + + Buckets buckets = new Buckets(beginTime, endTime); + + MeasurementScheduleRequest request = new MeasurementScheduleRequest(dynamicSchedule); + MeasurementReport report = new MeasurementReport(); + report.addData(new MeasurementDataNumeric(buckets.get(0) + 10, request, 1.1)); + report.addData(new MeasurementDataNumeric(buckets.get(0) + 20, request, 2.2)); + report.addData(new MeasurementDataNumeric(buckets.get(0) + 30, request, 3.3)); + report.addData(new MeasurementDataNumeric(buckets.get(59) + 10, request, 4.4)); + report.addData(new MeasurementDataNumeric(buckets.get(59) + 20, request, 5.5)); + report.addData(new MeasurementDataNumeric(buckets.get(59) + 30, request, 6.6)); + + dataManager.mergeMeasurementReport(report); + + MeasurementAggregate actual = dataManager.getAggregate(overlord, dynamicSchedule.getId(), + beginTime.getMillis(), endTime.getMillis()); + + MeasurementAggregate expected = new MeasurementAggregate(1.1, (1.1 + 2.2 + 3.3 + 4.4 + 5.5 + 6.6) / 6, + 6.6); + + AssertUtils.assertPropertiesMatch(expected, actual, "Aggregate does not match"); + } + @Test(enabled = ENABLED) public void find1HourNumericData() throws Exception { DateTime now = new DateTime();
commit 9c86cb4f8d7aea240dbe409f6702e2b6eb5a0316 Merge: 288582b 0be34a8 Author: John Mazzitelli mazz@redhat.com Date: Tue Dec 4 16:21:53 2012 -0500
Merge remote-tracking branch 'origin/master' into rhq-on-as7
commit 0be34a847aa77afbcd05dd96624af2a11386746c Author: Jay Shaughnessy jshaughn@redhat.com Date: Tue Dec 4 16:18:06 2012 -0500
First really clean run of server integration tests (itests-2) - Fix another issue in AbstractDriftServerTest cleanup code - Fix additional cleanup issues where we needed to deploy ytest services - uninventoty requires test agents (comm) service - system config requires (drift) server plugin service - Fix some JDoc in AbstractEJB3Test
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/drift/AbstractDriftServerTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/drift/AbstractDriftServerTest.java index 1bb0e0c..5f7d95c 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/drift/AbstractDriftServerTest.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/drift/AbstractDriftServerTest.java @@ -142,8 +142,10 @@ public abstract class AbstractDriftServerTest extends AbstractEJB3Test { "delete from JPADriftChangeSet cs where cs.id in ( select cast(ddt.changeSetId as int) from DriftDefinitionTemplate ddt where ddt.name like" + name + ")").executeUpdate();
- em.createNativeQuery( - "delete from rhq_drift_set ds where not exists ( select * from rhq_drift d where d.drift_set_id = ds.id ) ") + em.createNativeQuery("" // + + "delete from rhq_drift_set ds " // + + " where not exists ( select * from rhq_drift d where d.drift_set_id = ds.id ) " // + + " and not exists ( select * from rhq_drift_change_set cs where cs.drift_set_id = ds.id ) ") .executeUpdate();
em.createQuery("delete from JPADriftFile df where df.hashId like" + name).executeUpdate(); diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/drift/DriftManagerBeanTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/drift/DriftManagerBeanTest.java index 03cffdc..aa42a11 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/drift/DriftManagerBeanTest.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/drift/DriftManagerBeanTest.java @@ -94,6 +94,10 @@ public class DriftManagerBeanTest extends AbstractEJB3Test {
prepareScheduler();
+ DriftServerPluginService driftServerPluginService = new DriftServerPluginService(); + prepareCustomServerPluginService(driftServerPluginService); + driftServerPluginService.masterConfig.getPluginDirectory().mkdirs(); + deleteDriftFiles();
newResource = createNewResource(); @@ -104,6 +108,7 @@ public class DriftManagerBeanTest extends AbstractEJB3Test { try { deleteNewResource(newResource); } finally { + unprepareServerPluginService(); unprepareForTestAgents(); unprepareScheduler(); } diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/inventory/UninventoryTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/inventory/UninventoryTest.java index a7c0021..ab95c23 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/inventory/UninventoryTest.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/inventory/UninventoryTest.java @@ -48,10 +48,19 @@ public class UninventoryTest extends AbstractEJB3Test { private Resource newResource;
@Override + protected void beforeMethod() throws Exception { + prepareForTestAgents(); + } + + @Override protected void afterMethod() throws Exception { - if (newResource != null) { - deleteNewResource(newResource); - newResource = null; + try { + if (newResource != null) { + deleteNewResource(newResource); + newResource = null; + } + } finally { + unprepareForTestAgents(); } }
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java index 5ac610e..f180036 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java @@ -108,8 +108,10 @@ public class AvailabilityManagerTest extends AbstractEJB3Test { if (theResource != null) { // perform in-band and out-of-band work in quick succession // this also deletes our attached agent + prepareForTestAgents(); resourceManager.uninventoryResource(overlord, theResource.getId()); resourceManager.uninventoryResourceAsyncWork(overlord, theResource.getId()); + unprepareForTestAgents(); theResource = null; }
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementBaselineManagerTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementBaselineManagerTest.java index 5e41732..e8f8162 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementBaselineManagerTest.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementBaselineManagerTest.java @@ -72,10 +72,12 @@ public class MeasurementBaselineManagerTest extends AbstractEJB3Test { this.overlord = LookupUtil.getSubjectManager().getOverlord();
this.prepareScheduler(); + this.prepareForTestAgents(); }
@Override protected void afterMethod() throws Exception { + this.unprepareForTestAgents(); this.unprepareScheduler(); }
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/test/UpdatePluginMetadataTestBase.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/test/UpdatePluginMetadataTestBase.java index 7c815b7..f05e079 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/test/UpdatePluginMetadataTestBase.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/test/UpdatePluginMetadataTestBase.java @@ -50,6 +50,7 @@ import org.rhq.core.domain.resource.Resource; import org.rhq.core.domain.resource.ResourceType; import org.rhq.core.domain.util.PageList; import org.rhq.core.util.MessageDigestGenerator; +import org.rhq.enterprise.server.drift.DriftServerPluginService; import org.rhq.enterprise.server.resource.ResourceManagerLocal; import org.rhq.enterprise.server.resource.ResourceTypeManagerLocal; import org.rhq.enterprise.server.resource.metadata.PluginManagerLocal; @@ -76,6 +77,11 @@ public class UpdatePluginMetadataTestBase extends AbstractEJB3Test { prepareMockAgentServiceContainer(); prepareScheduler(); preparePluginScannerService(); + // we perform lookups of config settings from SystemManagerBean. + // SystemManagerBean.getDriftServerPluginManager method requires drift server plugin. + DriftServerPluginService driftServerPluginService = new DriftServerPluginService(); + prepareCustomServerPluginService(driftServerPluginService); + driftServerPluginService.masterConfig.getPluginDirectory().mkdirs();
pluginMgr = LookupUtil.getPluginManager(); resourceTypeManager = LookupUtil.getResourceTypeManager(); @@ -86,6 +92,7 @@ public class UpdatePluginMetadataTestBase extends AbstractEJB3Test { protected void afterMethod() throws Exception { cleanupTest();
+ unprepareServerPluginService(); unpreparePluginScannerService(); unprepareScheduler(); unprepareForTestAgents(); diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java index d8db4b9..f1ba91f 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java @@ -462,7 +462,7 @@ public abstract class AbstractEJB3Test extends Arquillian {
} catch (Throwable t) { // Arquillian is eating these, make sure they show up in some way - System.out.println("BEFORE METHOD FAILURE, TEST DID NOT RUN!!! "); + System.out.println("BEFORE METHOD FAILURE, TEST DID NOT RUN!!! [" + method.getName() + "]"); t.printStackTrace(); throw t; } @@ -484,7 +484,8 @@ public abstract class AbstractEJB3Test extends Arquillian { } } catch (Throwable t) { System.out - .println("AFTER METHOD FAILURE, TEST CLEAN UP FAILED!!! MAY NEED TO CLEAN DB BEFORE RUNNING MORE TESTS!"); + .println("AFTER METHOD FAILURE, TEST CLEAN UP FAILED!!! MAY NEED TO CLEAN DB BEFORE RUNNING MORE TESTS! [" + + method.getName() + "]"); t.printStackTrace(); throw t; } @@ -722,11 +723,12 @@ public abstract class AbstractEJB3Test extends Arquillian { }
/** - * If you need to test server plugins, you must first prepare the server plugin service. - * After this returns, the caller must explicitly start the PC by using the appropriate API - * on the given mbean; this method will only start the service, it will NOT start the master PC. + * This will register any custom service, replacing any service with the same objectName. + * <br/> + * It does nothing more than registration, any calls to the service (e.g. start) are up to the caller. * - * @param testServiceMBean the object that will house your test server plugins + * @param testServiceMBean the test service MBean to register + * @param objectNameStr the name of the service, which will be converted to an ObjectName * * @throws RuntimeException */ @@ -740,11 +742,12 @@ public abstract class AbstractEJB3Test extends Arquillian { }
/** - * If you need to test server plugins, you must first prepare the server plugin service. - * After this returns, the caller must explicitly start the PC by using the appropriate API - * on the given mbean; this method will only start the service, it will NOT start the master PC. + * This will register any custom service, replacing any service with the same objectName. + * <br/> + * It does nothing more than registration, any calls to the service (e.g. start) are up to the caller. * - * @param testServiceMBean the object that will house your test server plugins + * @param testServiceMBean the test service MBean to register + * @param objectName the name of the service * * @throws RuntimeException */
commit 288582ba14c3bf65eda3468806dbb6f5e18a2ede Author: John Mazzitelli mazz@redhat.com Date: Tue Dec 4 16:15:14 2012 -0500
do not look up coreservice mbean if we already set our plugin dirs (like we will do in our tests)
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java index d8db4b9..65e3904 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java @@ -948,7 +948,8 @@ public abstract class AbstractEJB3Test extends Arquillian { PluginDeploymentScanner scanner = new PluginDeploymentScanner(); String pluginDirPath = getTempDir() + "/plugins"; scanner.setAgentPluginDir(pluginDirPath); // we don't want to scan for these - scanner.setServerPluginDir(null); // we don't want to scan for these + scanner.setServerPluginDir("ignore no plugins here"); // we don't want to scan for these + scanner.setUserPluginDir("ignore no plugins here"); // we don't want to scan for these scanner.setScanPeriod("9999999"); // we want to manually scan - don't allow for auto-scan to happen
return preparePluginScannerService(scanner); diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/plugin/PluginDeploymentScanner.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/plugin/PluginDeploymentScanner.java index a674f23..688359c 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/plugin/PluginDeploymentScanner.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/plugin/PluginDeploymentScanner.java @@ -153,16 +153,35 @@ public class PluginDeploymentScanner implements PluginDeploymentScannerMBean { // the server's internal EJB/SLSBs are ready and can be called. This means we are allowed to start. // NOTE: Make sure we are called BEFORE the master plugin container is started!
- // setup our attributes - File homeDir = LookupUtil.getCoreServer().getInstallDir(); - File earDir = LookupUtil.getCoreServer().getEarDeploymentDir(); - setUserPluginDir(new File(homeDir, "plugins").getAbsolutePath()); - setAgentPluginDir(new File(earDir, "rhq-downloads/rhq-plugins").getAbsolutePath()); - setServerPluginDir(new File(earDir, "rhq-serverplugins").getAbsolutePath()); - - log.info("user plugin dir=" + getUserPluginDir()); - log.info("agent plugin dir=" + getAgentPluginDir()); - log.info("server plugin dir=" + getServerPluginDir()); + // setup our attributes - skip if the plugin dirs were already set (e.g. from test code) + String upd = getUserPluginDir(); + String apd = getAgentPluginDir(); + String spd = getServerPluginDir(); + + // don't look up the core server mbean if we don't need do + if (upd == null || apd == null || spd == null) { + File homeDir = LookupUtil.getCoreServer().getInstallDir(); + File earDir = LookupUtil.getCoreServer().getEarDeploymentDir(); + + if (upd == null) { + upd = new File(homeDir, "plugins").getAbsolutePath(); + setUserPluginDir(upd); + } + + if (apd == null) { + apd = new File(earDir, "rhq-downloads/rhq-plugins").getAbsolutePath(); + setAgentPluginDir(apd); + } + + if (spd == null) { + spd = new File(earDir, "rhq-serverplugins").getAbsolutePath(); + setServerPluginDir(spd); + } + } + + log.info("user plugin dir=" + upd); + log.info("agent plugin dir=" + apd); + log.info("server plugin dir=" + spd);
// This will check to see if there are any agent plugin records in the database // that do not have content associated with them and if so, will stream
commit 9b4a2c27ff66c62af50bbd8089a1dbb48211d701 Merge: d32fc31 e14b96b Author: John Mazzitelli mazz@redhat.com Date: Tue Dec 4 11:54:32 2012 -0500
Merge remote-tracking branch 'origin/master' into rhq-on-as7
commit e14b96b48e4a7faedf4dfcad1d3ebc7ad3ec0bd5 Author: Jay Shaughnessy jshaughn@redhat.com Date: Tue Dec 4 11:53:14 2012 -0500
Adding in the missing server plugin service prepare/unprepare.
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBeanTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBeanTest.java index a3ae638..190c3d5 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBeanTest.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBeanTest.java @@ -57,6 +57,7 @@ import org.rhq.core.domain.resource.Resource; import org.rhq.core.domain.resource.ResourceType; import org.rhq.core.util.jdbc.JDBCUtil; import org.rhq.enterprise.server.auth.SubjectManagerLocal; +import org.rhq.enterprise.server.drift.DriftServerPluginService; import org.rhq.enterprise.server.measurement.util.MeasurementDataManagerUtility; import org.rhq.enterprise.server.test.AbstractEJB3Test; import org.rhq.enterprise.server.test.TransactionCallback; @@ -66,16 +67,6 @@ import org.rhq.enterprise.server.test.TransactionCallback; */ public class MeasurementDataManagerBeanTest extends AbstractEJB3Test {
- // Tests in this class are failing currently do to a system initialization problem. - // MeasurementDataManagerUtility looks up config settings from SystemManagerBean. - // SystemManagerBean is however failing in its getDriftServerPluginManager method on - // the call to LookupUtil.getServerPluginService(). An InstanceNotFoundException is - // thrown, - // - // javax.management.InstanceNotFoundException: rhq:service=ServerPluginService - // - // Looks like the server plugin service is not getting deployed. - //private final Log log = LogFactory.getLog(MeasurementDataManagerBeanTest.class);
private static final boolean ENABLED = true; @@ -120,13 +111,21 @@ public class MeasurementDataManagerBeanTest extends AbstractEJB3Test { protected void beforeMethod() throws Exception { overlord = subjectManager.getOverlord();
+ // MeasurementDataManagerUtility looks up config settings from SystemManagerBean. + // SystemManagerBean.getDriftServerPluginManager method requires drift server plugin. + DriftServerPluginService driftServerPluginService = new DriftServerPluginService(); + prepareCustomServerPluginService(driftServerPluginService); + driftServerPluginService.masterConfig.getPluginDirectory().mkdirs(); + createInventory(); insertDummyReport(); }
@Override - protected void afterMethod() { + protected void afterMethod() throws Exception { purgeDB(); + + unprepareServerPluginService(); }
@Test(enabled = ENABLED)
commit d32fc3170963d9622f025498234b24fbc9cdf572 Merge: 68f57f8 6a533ab Author: John Mazzitelli mazz@redhat.com Date: Tue Dec 4 11:33:37 2012 -0500
Merge remote-tracking branch 'origin/master' into rhq-on-as7
commit 6a533abe4e252374aaa1760dde8bc1cf567e2d0a Author: Jay Shaughnessy jshaughn@redhat.com Date: Tue Dec 4 11:27:35 2012 -0500
Fix test failure, ensure that existing plugins are scanned and registered prior to easch test.
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/PluginManagerBeanTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/PluginManagerBeanTest.java index befaa1a..05bb9c0 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/PluginManagerBeanTest.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/PluginManagerBeanTest.java @@ -55,11 +55,13 @@ public class PluginManagerBeanTest extends MetadataBeanTest { subjectMgr = LookupUtil.getSubjectManager(); pluginMgr = LookupUtil.getPluginManager();
- FileUtil.purge(new File(getPluginScannerService().getAgentPluginDir()), true); + getPluginScannerService().startDeployment(); }
@Override protected void afterMethod() throws Exception { + FileUtil.purge(new File(getPluginScannerService().getAgentPluginDir()), true); + unpreparePluginScannerService(); }
@@ -86,7 +88,7 @@ public class PluginManagerBeanTest extends MetadataBeanTest { createPluginJarFile("test-plugin3.jar", "plugin_3.xml"); createPluginJarFile("test-plugin3.1.jar", "plugin_3.1.xml");
- getPluginScannerService().startDeployment(); + getPluginScannerService().scanAndRegister(); }
@Test(dependsOnMethods = { "registerPlugins" }) @@ -105,6 +107,8 @@ public class PluginManagerBeanTest extends MetadataBeanTest { public void doNotDisablePluginIfDependentPluginsAreNotAlsoDisabled() throws Exception { Plugin plugin = getPlugin("PluginManagerBeanTestPlugin1"); assertTrue("Plugin should not already be disabled", plugin.isEnabled()); + Plugin plugin2 = getPlugin("PluginManagerBeanTestPlugin2"); + assertTrue("Plugin should not already be disabled", plugin.isEnabled());
Exception exception = null;
commit bb6f2974eb61c5579c68137f1517ffe88d7b9a2c Author: Jay Shaughnessy jshaughn@redhat.com Date: Tue Dec 4 11:26:44 2012 -0500
trivial, comment re: potentially unnecessary call
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/plugin/ProductPluginDeployer.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/plugin/ProductPluginDeployer.java index 39ce392..ddff417 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/plugin/ProductPluginDeployer.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/plugin/ProductPluginDeployer.java @@ -92,7 +92,7 @@ public class ProductPluginDeployer { * allowed to begin registering types from deployed plugins. */ public void startDeployment() { - // we can now register our initial set of plugins + // we can now register our initial set of plugins (This may be a no-op at this point) registerPlugins();
// indicate that we are now ready for hot-deployment of new plugins
commit 5c02b44e2fc132e93e63f6f067f2cfd5b8e94808 Author: Jay Shaughnessy jshaughn@redhat.com Date: Tue Dec 4 11:18:48 2012 -0500
- override AbstractEJB3Test.afterMethod() as opposed to an explicitly annotated method
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/content/test/RepoSyncingTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/content/test/RepoSyncingTest.java index 3f0ef84..d2682af 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/content/test/RepoSyncingTest.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/content/test/RepoSyncingTest.java @@ -6,7 +6,6 @@ import javax.persistence.EntityManager; import javax.persistence.Query; import javax.transaction.TransactionManager;
-import org.testng.annotations.AfterMethod; import org.testng.annotations.Test;
import org.rhq.core.domain.auth.Subject; @@ -54,6 +53,41 @@ public class RepoSyncingTest extends AbstractEJB3Test { em.flush(); }
+ @Override + protected void afterMethod() throws Exception { + unprepareServerPluginService(); + + getTransactionManager().begin(); + EntityManager em = getEntityManager(); + ContentSource deleteSrc = em.find(ContentSource.class, contentSource.getId()); + // em.remove(deleteSrc.getContentSourceType()); + em.remove(deleteSrc); + + Query q = em.createNamedQuery(RepoDistribution.QUERY_FIND_BY_REPO_ID); + q.setParameter("repoId", repo.getId()); + List<RepoDistribution> rds = q.getResultList(); + for (RepoDistribution rd : rds) { + Distribution d = rd.getRepoDistributionPK().getDistribution(); + List<DistributionFile> dfiles = LookupUtil.getDistributionManagerLocal().getDistributionFilesByDistId( + d.getId()); + for (DistributionFile df : dfiles) { + DistributionFile dfl = em.find(DistributionFile.class, df.getId()); + em.remove(dfl); + } + em.remove(rd); + em.remove(d); + } + + Repo delRepo = em.find(Repo.class, repo.getId()); + em.remove(delRepo); + + TransactionManager tx = getTransactionManager(); + if (tx != null) { + tx.commit(); + } + + } + @Test(enabled = ENABLED) public void testSyncResults() throws Exception { // We have to commit because bean has new transaction inside it @@ -200,41 +234,6 @@ public class RepoSyncingTest extends AbstractEJB3Test { } }
- @AfterMethod - public void tearDownAfterMethod() throws Exception { - unprepareServerPluginService(); - - getTransactionManager().begin(); - EntityManager em = getEntityManager(); - ContentSource deleteSrc = em.find(ContentSource.class, contentSource.getId()); - // em.remove(deleteSrc.getContentSourceType()); - em.remove(deleteSrc); - - Query q = em.createNamedQuery(RepoDistribution.QUERY_FIND_BY_REPO_ID); - q.setParameter("repoId", repo.getId()); - List<RepoDistribution> rds = q.getResultList(); - for (RepoDistribution rd : rds) { - Distribution d = rd.getRepoDistributionPK().getDistribution(); - List<DistributionFile> dfiles = LookupUtil.getDistributionManagerLocal().getDistributionFilesByDistId( - d.getId()); - for (DistributionFile df : dfiles) { - DistributionFile dfl = em.find(DistributionFile.class, df.getId()); - em.remove(dfl); - } - em.remove(rd); - em.remove(d); - } - - Repo delRepo = em.find(Repo.class, repo.getId()); - em.remove(delRepo); - - TransactionManager tx = getTransactionManager(); - if (tx != null) { - tx.commit(); - } - - } - class SyncerThread extends Thread {
boolean synced = false;
commit 68f57f8fe40779de0553aa2b4430f6780662a4f3 Merge: 9eb1aa6 3a80401 Author: John Mazzitelli mazz@redhat.com Date: Tue Dec 4 10:32:08 2012 -0500
Merge remote-tracking branch 'origin/master' into rhq-on-as7
commit 3a80401e9899f9025b9119259467118b64338c87 Author: Simeon Pinder spinder@fulliautomatix.conchfritter.com Date: Tue Dec 4 07:50:29 2012 -0500
[BZ 871535] update product types to support EPP->JPP rename.
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/JBossProductType.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/JBossProductType.java index 87e31f3..7239c02 100644 --- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/JBossProductType.java +++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/JBossProductType.java @@ -34,6 +34,7 @@ public enum JBossProductType { EAP("EAP", "JBoss EAP 6", "JBoss Enterprise Application Platform 6", "EAP"), JDG("JDG", "JBoss JDG 6", "JBoss Data Grid 6", "Data Grid"), EPP("EPP", "JBoss EAP 6", "JBoss Enterprise Portal Platform 6", "EPP"), + JPP("JPP", "JBoss EAP 6", "JBoss Portal Platform 6", "JPP"), // EWP("EWP", "JBoss EWP 6", "JBoss Enterprise Web Platform 6", "EWP"), SOA("SOA-P", "JBoss SOA-P 6", "JBoss Enterprise SOA Platform (ESB)", "SOAP");
@@ -97,8 +98,10 @@ public enum JBossProductType { productType = JBossProductType.EAP; } else if (slot.equals("jdg")) { productType = JBossProductType.JDG; - } else if (slot.equals("epp")) { + } else if (slot.equals("epp")) {//old EPP productType = JBossProductType.EPP; + } else if (slot.equals("jpp")) {//new EPP->JPP plugin + productType = JBossProductType.JPP; } else if (slot.equals("soa-p")) { productType = JBossProductType.SOA; } else { @@ -122,6 +125,8 @@ public enum JBossProductType { productType = JBossProductType.JDG; } else if (homeDirName.contains("-epp-")) { productType = JBossProductType.EPP; + } else if (homeDirName.contains("-jpp-")) { + productType = JBossProductType.JPP; } else if (homeDirName.contains("soa-p-")) { productType = JBossProductType.SOA; } else {
commit 9eb1aa6aaf572db579cc5f67efdb84c80b2f22aa Merge: 63715b4 1e9d28d Author: John Mazzitelli mazz@redhat.com Date: Mon Dec 3 16:10:07 2012 -0500
Merge remote-tracking branch 'origin/master' into rhq-on-as7
Conflicts: modules/enterprise/server/itests-2/pom.xml
commit 63715b4348d2109050a81c18c7f15ec2cbb3b314 Merge: 51ed8e9 b12f68c Author: John Mazzitelli mazz@redhat.com Date: Mon Dec 3 15:48:59 2012 -0500
Merge remote-tracking branch 'origin/master' into rhq-on-as7
Conflicts: modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/core/CoreServerServiceImplTest.java
diff --cc modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/core/CoreServerServiceImplTest.java index 42a8cda,02a2fbc..0e25ee4 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/core/CoreServerServiceImplTest.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/core/CoreServerServiceImplTest.java @@@ -531,22 -531,17 +531,22 @@@ public class CoreServerServiceImplTest
@Override public File getJBossServerHomeDir() { - return null; - return getTempDir(); ++ return new File(getTempDir(), "CoreServerServiceImplTest"); }
@Override public File getJBossServerDataDir() { - return new File(System.getProperty("java.io.tmpdir"), "CoreServerServiceImplTest"); - return null; ++ return new File(getTempDir(), "CoreServerServiceImplTest"); }
@Override public File getJBossServerTempDir() { -- return null; ++ return new File(getTempDir(), "CoreServerServiceImplTest"); + } + + @Override + public File getEarDeploymentDir() { - return new File(System.getProperty("java.io.tmpdir"), "CoreServerServiceImplTest"); ++ return new File(getTempDir(), "CoreServerServiceImplTest"); }
@Override
commit 1e9d28d27bb1ba742dce4d4a946d56da4f7a9c39 Author: Jay Shaughnessy jshaughn@redhat.com Date: Mon Dec 3 15:48:05 2012 -0500
Variety of work to eliminate itest interaction issues (more work still in progress) - Improve the cleanup in AbstractDriftServerTest. The cleanup here was very aggressive, wiping pretty much all of the drift tables, including any data still in use by other test classes. Added more easily identifiable naming for the test drift entities to allow for more targeted cleanup. - Add itest.debug support in itests-2 (from mazz's branch work) - Use more unique (avoid clashing) and identifiable (trace back to creator) plugin names in test plugin xml files.
diff --git a/etc/eclipse-tools/RHQ Remote Debugging - itest.launch b/etc/eclipse-tools/RHQ Remote Debugging - itest.launch new file mode 100644 index 0000000..1ea5d31 --- /dev/null +++ b/etc/eclipse-tools/RHQ Remote Debugging - itest.launch @@ -0,0 +1,21 @@ +<?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> +<stringAttribute key="org.eclipse.debug.core.source_locator_id" value="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"/> +<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <sourceLookupDirector> <sourceContainers duplicates="false"> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;javaProject name=&quot;rhq&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.javaProject"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/integration/jboss-profileservice-spi/5.1.0.SP1/jboss-profileservice-spi-5.1.0.SP1.jar&quot;/&gt;&#13;&#10;" typeId="org.ec lipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/man/jboss-managed/2.1.1.GA/jboss-managed-2.1.1.GA.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/man/jboss-metatype/2.1.1.GA/jboss-metatype-2.1.1.GA.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encodi ng=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/apache/commons/commons-io/1.3.2/commons-io-1.3.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/com/sun/xml/bind/jaxb-impl/2.1.12/jaxb-impl-2.1.12.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/i18nlog/i18nlog/1.0.10/i18nlog-1. 0.10.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/gnu-getopt/getopt/1.0.13/getopt-1.0.13.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/commons-httpclient/commons-httpclient/3.0.1/commons-httpclient-3.0.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento= "&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/jboss/jboss-remoting/2.2.2.SP8/jboss-remoting-2.2.2.SP8.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/oswego-concurrent/concurrent/1.3.4/concurrent-1.3.4.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVari able path=&quot;M2_REPO/rss4j/rss4j/0.92-on.2/rss4j-0.92-on.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/apache/ant/ant/1.8.0/ant-1.8.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/apache/ant/ant-nodeps/1.8.0/ant-nodeps-1.8.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable" /> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/javax/servlet/servlet-api/2.4/servlet-api-2.4.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/struts/struts/1.2.9/struts-1.2.9.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;class pathVariable path=&quot;M2_REPO/javax/servlet/jsp-api/2.0/jsp-api-2.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/commons-validator/commons-validator/1.1.4/commons-validator-1.1.4.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/testng/testng/6.1.1/testng-6.1.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContai ner.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/snmp4j/snmp4j/1.8.2/snmp4j-1.8.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;& #10;&lt;classpathVariable path=&quot;M2_REPO/tomcat/tomcat-jk/4.1.31/tomcat-jk-4.1.31.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/jdom/jdom/1.0/jdom-1.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/commons-collections/commons-collections/3.2/commons-collections-3.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sour ceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/javax/persistence/persistence-api/1.0/persistence-api-1.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/jboss/jboss-jmx/4.2.3.GA/jboss-jmx-4.2.3.GA.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=& ;quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/tomcat/catalina/5.5.20/catalina-5.5.20.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/taglibs/standard/1.1.2/standard-1.1.2.jar&quot;/&gt;&#13;&#1 0;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/jboss/jboss-common/1.2.1.GA/jboss-common-1.2.1.GA.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/javax/servlet/jstl/1.1.2/jstl-1.1.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=& quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/struts-menu/struts-menu/2.3/struts-menu-2.3.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/junit/junit/3.8.2/junit-3.8.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/apache/velocity/velocity/1.5/velocity-1.5.jar&quot;/&gt;&am p;#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/xalan/xalan/2.5.1/xalan-2.5.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&qu ot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/javax/xml/bind/jsr173_api/1.0/jsr173_api-1.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/jboss/jboss-embeddable-ejb3/jboss-ejb3-all/1.0.0.Alpha9/jboss-ejb3-all-1.0.0.Alpha9.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/jboss/jbpm/3.1.1/j bpm-3.1.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/jboss/jboss-embeddable-ejb3/hibernate-all/1.0.0.Alpha9/hibernate-all-1.0.0.Alpha9.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jetbrains/annotations/7.0.2/annotations-7.0.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> 3; <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/apache/ant/ant-launcher/1.8.0/ant-launcher-1.8.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/cglib/cglib-nodep/2.1_3/cglib-nodep-2.1_3.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;& lt;classpathVariable path=&quot;M2_REPO/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/commons-lang/commons-lang/2.4/commons-lang-2.4.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/javax/faces/jsf-api/1.2_14/jsf-api-1.2_14.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launch ing.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/javax/faces/jsf-impl/1.2_14/jsf-impl-1.2_14.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/javax/el/el-api/1.0/el-api-1.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;? &gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/com/sun/facelets/jsf-facelets/1.1.15.B1/jsf-facelets-1.1.15.B1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/mc4j/org-mc4j-ems/1.2.16/org-mc4j-ems-1.2.16.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/opensymphony/quartz/quartz/1.6.5/quartz-1.6.5.jar&quot;/&gt;&#13;&#10;&q uot; typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/javax/mail/mail/1.4.2/mail-1.4.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/commons-fileupload/commons-fileupload/1.2/commons-fileupload-1.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encodi ng=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/richfaces/framework/richfaces-api/3.3.3.Final/richfaces-api-3.3.3.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/richfaces/framework/richfaces-impl/3.3.3.Final/richfaces-impl-3.3.3.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=& amp;quot;M2_REPO/org/richfaces/ui/richfaces-ui/3.3.3.Final/richfaces-ui-3.3.3.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/postgresql/postgresql/9.0-801.jdbc4/postgresql-9.0-801.jdbc4.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/jboss/jboss-cache/1.4.1.SP9/jboss-cache-1.4.1.SP9.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.laun ching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/hyperic/sigar/1.6.5.132/sigar-1.6.5.132.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/transaction/jboss-jta/4.2.3.SP5/jboss-jta-4.2.3.SP5.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; s tandalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/transaction/jboss-jts-common/4.2.3.SP5/jboss-jts-common-4.2.3.SP5.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/jbossws-spi/1.1.1.GA/jbossws-spi-1.1.1.GA.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/jbossws/jbossws-native-core/3 .1.1.GA/jbossws-native-core-3.1.1.GA.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/apache/maven/maven-project/2.0.8/maven-project-2.0.8.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/apache/maven/maven-plugin-api/2.0.8/maven-plugin-api-2.0.8.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariabl e"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/codehaus/swizzle/swizzle-confluence/1.6.1/swizzle-confluence-1.6.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jvnet/inflector/0.7.0/inflector-0.7.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot ;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/net/augeas/augeas/0.0.2/augeas-0.0.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/json/json/20080701/json-20080701.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/net/java/dev/jna/jna/3.2.5/jna-3.2.5.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.s ourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/freemarker/freemarker/2.3.11/freemarker-2.3.11.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/seam/jboss-seam/2.1.0.SP1/jboss-seam-2.1.0.SP1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standa lone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/seam/jboss-seam-ui/2.1.0.SP1/jboss-seam-ui-2.1.0.SP1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/hibernate/hibernate3/3.2.r14201-2/hibernate3-3.2.r14201-2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/jline/jline/0.9.94/jline-0.9.94.jar&quot;/& gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/javassist/javassist/3.9.0.GA/javassist-3.9.0.GA.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/net/sf/opencsv/opencsv/1.8/opencsv-1.8.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0& quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/bouncycastle/bcpg-jdk15/140/bcpg-jdk15-140.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/bouncycastle/bcprov-jdk15/140/bcprov-jdk15-140.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/apache/xmlrpc/xmlrpc-client/3.1 .2/xmlrpc-client-3.1.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/apache/xmlrpc/xmlrpc-common/3.1.2/xmlrpc-common-3.1.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/apache/ws/commons/util/ws-commons-util/1.0.2/ws-commons-util-1.0.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable&quo t;/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/commons-digester/commons-digester/1.8.1/commons-digester-1.8.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/commons-codec/commons-codec/1.4/commons-codec-1.4.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&am p;gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/pircbot/pircbot/1.4.2/pircbot-1.4.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/twitter4j/twitter4j-core/2.2.4/twitter4j-core-2.2.4.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jmock/jmock/2.5.1/jmock-2.5.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.l aunching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/hamcrest/hamcrest-library/1.1/hamcrest-library-1.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/antlr/antlr-runtime/3.2/antlr-runtime-3.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/jboss/web/jbossweb/2.0.1.GA/jbossweb-2.0.1.GA.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/libvirt/libvirt/0.4.1/libvirt-0.4.1.jar&quot;/&gt;&#13;&am p;#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/byteman/byteman/1.2.1/byteman-1.2.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/fedorahosted/cobbler/cobbler4j/0.1/cobbler4j-0.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quo t; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/com/google/gwt/gwt-user/2.4.0/gwt-user-2.4.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/com/google/gwt/gwt-dev/2.4.0/gwt-dev-2.4.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/com/smartgwt/smartgwt/3.0/smartgwt-3.0.j ar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/com/google/code/gwt-log/gwt-log/3.1.0/gwt-log-3.1.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/ca/nanometrics/gflot/1.0.0/gflot-1.0.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml vers ion=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/com/jcraft/jsch/0.1.29/jsch-0.1.29.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/commons-jxpath/commons-jxpath/1.3/commons-jxpath-1.3.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/dbunit/dbun it/2.4.8/dbunit-2.4.8.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/apache/poi/poi/3.7/poi-3.7.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/bsh/bsh/1.3.0/bsh-1.3.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot ;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/unitils/unitils-core/3.1/unitils-core-3.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/unitils/unitils-dbunit/3.1/unitils-dbunit-3.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/unitils/unitils- orm/3.1/unitils-orm-3.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/unitils/unitils-testng/3.1/unitils-testng-3.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/codehaus/jackson/jackson-core-asl/1.7.4/jackson-core-asl-1.7.4.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/>
 ; <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/codehaus/jackson/jackson-mapper-asl/1.7.4/jackson-mapper-asl-1.7.4.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/mongodb/mongo-java-driver/2.6.5/mongo-java-driver-2.6.5.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&qu ot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/com/googlecode/java-diff-utils/diffutils/1.2.1/diffutils-1.2.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/com/google/code/morphia/morphia/1.00-SNAPSHOT/morphia-1.00-SNAPSHOT.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/resteasy/resteasy-links/2.3.3.Final/resteasy-links-2.3. 3.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/resteasy/resteasy-jaxrs/2.3.3.Final/resteasy-jaxrs-2.3.3.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/resteasy/resteasy-jackson-provider/2.3.3.Final/resteasy-jackson-provider-2.3.3.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContain er.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/resteasy/jaxrs-api/2.3.3.Final/jaxrs-api-2.3.3.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/sasl/jboss-sasl/1.0.0.Beta9/jboss-sasl-1.0.0.Beta9.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; st andalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;JDK_HOME/lib/tools.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/mockito/mockito-all/1.9.0/mockito-all-1.9.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/powermock/powermock-api-mockito/1.4.11/powermock-api-mockito-1.4.11.jar&quot;/&gt;&#13;&# 10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/powermock/powermock-core/1.4.11/powermock-core-1.4.11.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/powermock/powermock-api-support/1.4.11/powermock-api-support-1.4.11.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml v ersion=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/powermock/powermock-module-testng-common/1.4.11/powermock-module-testng-common-1.4.11.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/powermock/powermock-module-testng/1.4.11/powermock-module-testng-1.4.11.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;& amp;#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/liquibase/liquibase-core/2.0.3/liquibase-core-2.0.3.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/shrinkwrap/shrinkwrap-impl-base/1.0.0/shrinkwrap-impl-base-1.0.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/shrinkwrap/shrinkwrap-api/1.0.0/shrinkwrap-api-1.0.0.jar&quot;/& amp;gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/shrinkwrap/shrinkwrap-spi/1.0.0/shrinkwrap-spi-1.0.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/shrinkwrap/descriptors/shrinkwrap-descriptors-api-base/2.0.0-alpha-2/shrinkwrap-descriptors-api-base-2.0.0-alpha-2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer. classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/shrinkwrap/resolver/shrinkwrap-resolver-api/1.0.0-beta-6/shrinkwrap-resolver-api-1.0.0-beta-6.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/shrinkwrap/resolver/shrinkwrap-resolver-api-maven/1.0.0-beta-6/shrinkwrap-resolver-api-maven-1.0.0-beta-6.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container mem ento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/arquillian/test/arquillian-test-spi/1.0.0.Final/arquillian-test-spi-1.0.0.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/arquillian/test/arquillian-test-api/1.0.0.Final/arquillian-test-api-1.0.0.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; stan dalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/arquillian/core/arquillian-core-spi/1.0.0.Final/arquillian-core-spi-1.0.0.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/arquillian/core/arquillian-core-api/1.0.0.Final/arquillian-core-api-1.0.0.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quo t;M2_REPO/org/jboss/arquillian/container/arquillian-container-spi/1.0.0.Final/arquillian-container-spi-1.0.0.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/arquillian/container/arquillian-container-test-api/1.0.0.Final/arquillian-container-test-api-1.0.0.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/arquillian/testng/arquillian-testng -core/1.0.0.Final/arquillian-testng-core-1.0.0.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;default/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.default"/> </sourceContainers> </sourceLookupDirector> "/> +<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="hostname" value="localhost"/> +<mapEntry key="port" value="8798"/> +</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> diff --git a/modules/enterprise/server/itests-2/pom.xml b/modules/enterprise/server/itests-2/pom.xml index f0c179f..1b50266 100644 --- a/modules/enterprise/server/itests-2/pom.xml +++ b/modules/enterprise/server/itests-2/pom.xml @@ -1,6 +1,4 @@ -<project - xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +<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> @@ -25,13 +23,14 @@ <properties> <jboss.zip>${settings.localRepository}/org/jboss/as/jboss-as-dist/${jboss.version}/jboss-as-dist-${jboss.version}.zip</jboss.zip> <jboss.unzip.location>${basedir}/target/jboss-as-${jboss.version}</jboss.unzip.location> + <jboss.vm.args>-Xmx700m -XX:MaxPermSize=200m</jboss.vm.args> + <jboss.vm.args.debug></jboss.vm.args.debug> <!-- -Ditest.debug can override this, see below --> </properties>
<dependencies> <!--================ Test Deps ================ -->
- <!-- Note, the test dep ordering can be important. Maven orders the [test] classpath in the order listed - in the pom. --> + <!-- Note, the test dep ordering can be important. Maven orders the [test] classpath in the order listed in the pom. -->
<dependency> <groupId>org.jboss.as</groupId> @@ -222,13 +221,9 @@ <configuration> <target> <echo>Unzipping JBossAS ${jboss.version} found at ${jboss.zip}</echo> - <unzip - src="${jboss.zip}" - dest="${jboss.unzip.location}/.." /> + <unzip src="${jboss.zip}" dest="${jboss.unzip.location}/.." /> <echo>JBossAS ${jboss.version} should now be at: ${jboss.unzip.location}</echo> - <property - name="jboss.conf" - location="${jboss.unzip.location}/standalone/configuration/standalone.xml" /> + <property name="jboss.conf" location="${jboss.unzip.location}/standalone/configuration/standalone.xml" /> <echo>Will now add test configuration to JBossAS config file: ${jboss.conf}</echo> <replace file="${jboss.conf}">
@@ -420,15 +415,10 @@
</replace>
- <property - name="jboss.modules.dir" - location="${jboss.unzip.location}/modules" /> + <property name="jboss.modules.dir" location="${jboss.unzip.location}/modules" /> <echo>Adding JDBC modules to ${jboss.modules.dir} ...</echo> - <copy - file="${settings.localRepository}/com/oracle/ojdbc6/${ojdbc6.version}/ojdbc6-${ojdbc6.version}.jar" - toDir="${jboss.modules.dir}/org/rhq/oracle/main" - failonerror="false" - verbose="true" /> + <copy file="${settings.localRepository}/com/oracle/ojdbc6/${ojdbc6.version}/ojdbc6-${ojdbc6.version}.jar" + toDir="${jboss.modules.dir}/org/rhq/oracle/main" failonerror="false" verbose="true" /> <echo file="${jboss.modules.dir}/org/rhq/oracle/main/module.xml"><![CDATA[<?xml version="1.0" encoding="UTF-8"?> <module xmlns="urn:jboss:module:1.1" name="org.rhq.oracle"> <resources> @@ -442,8 +432,7 @@ ]]></echo> <copy file="${settings.localRepository}/postgresql/postgresql/${postgresql.version}/postgresql-${postgresql.version}.jar" - toDir="${jboss.modules.dir}/org/rhq/postgres/main" - verbose="true" /> + toDir="${jboss.modules.dir}/org/rhq/postgres/main" verbose="true" /> <echo file="${jboss.modules.dir}/org/rhq/postgres/main/module.xml"><![CDATA[<?xml version="1.0" encoding="UTF-8"?> <module xmlns="urn:jboss:module:1.1" name="org.rhq.postgres"> <resources> @@ -469,9 +458,7 @@ <configuration> <skip>${skip.postgres}</skip> <target> - <property - name="jboss.conf" - location="${jboss.unzip.location}/standalone/configuration/standalone.xml" /> + <property name="jboss.conf" location="${jboss.unzip.location}/standalone/configuration/standalone.xml" /> <echo>Will now add test configuration datasource to JBossAS config file: ${jboss.conf}</echo> <replace file="${jboss.conf}">
@@ -546,9 +533,7 @@ <configuration> <skip>${skip.oracle}</skip> <target> - <property - name="jboss.conf" - location="${jboss.unzip.location}/standalone/configuration/standalone.xml" /> + <property name="jboss.conf" location="${jboss.unzip.location}/standalone/configuration/standalone.xml" /> <echo>Will now add test configuration datasource to JBossAS config file: ${jboss.conf}</echo> <replace file="${jboss.conf}">
@@ -705,5 +690,17 @@ <skip.oracle>false</skip.oracle> </properties> </profile> + + <profile> + <id>itest.debug</id> + <activation> + <property> + <name>itest.debug</name> + </property> + </activation> + <properties> + <jboss.vm.args.debug>-Xrunjdwp:transport=dt_socket,address=8798,server=y,suspend=y</jboss.vm.args.debug> + </properties> + </profile> </profiles> </project> diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/drift/AbstractDriftServerTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/drift/AbstractDriftServerTest.java index e8a8897..1bb0e0c 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/drift/AbstractDriftServerTest.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/drift/AbstractDriftServerTest.java @@ -48,11 +48,13 @@ import org.rhq.enterprise.server.util.ResourceTreeHelper; @Test(groups = "drift", singleThreaded = true) public abstract class AbstractDriftServerTest extends AbstractEJB3Test {
- protected final String RESOURCE_TYPE_NAME = getClass().getSimpleName() + "_RESOURCE_TYPE"; + protected final String NAME_PREFIX = getClass().getSimpleName() + "_";
- protected final String AGENT_NAME = getClass().getSimpleName() + "_AGENT"; + protected final String RESOURCE_TYPE_NAME = NAME_PREFIX + "RESOURCE_TYPE";
- protected final String RESOURCE_NAME = getClass().getSimpleName() + "_RESOURCE"; + protected final String AGENT_NAME = NAME_PREFIX + "AGENT"; + + protected final String RESOURCE_NAME = NAME_PREFIX + "RESOURCE";
protected DriftServerPluginService driftServerPluginService;
@@ -128,13 +130,27 @@ public abstract class AbstractDriftServerTest extends AbstractEJB3Test { executeInTransaction(false, new TransactionCallback() { @Override public void execute() throws Exception { + String name = " '" + NAME_PREFIX + "%' "; + + em.createQuery("delete from JPADrift d where d.newDriftFile like" + name).executeUpdate(); + + em.createQuery( + "delete from JPADriftChangeSet cs where cs.id in ( select cs1.id from JPADriftChangeSet cs1 where cs1.driftDefinition.name like" + + name + ")").executeUpdate(); + + em.createQuery( + "delete from JPADriftChangeSet cs where cs.id in ( select cast(ddt.changeSetId as int) from DriftDefinitionTemplate ddt where ddt.name like" + + name + ")").executeUpdate(); + + em.createNativeQuery( + "delete from rhq_drift_set ds where not exists ( select * from rhq_drift d where d.drift_set_id = ds.id ) ") + .executeUpdate(); + + em.createQuery("delete from JPADriftFile df where df.hashId like" + name).executeUpdate(); + + em.createQuery("delete from DriftDefinition dd where dd.name like" + name).executeUpdate();
- em.createQuery("delete from JPADrift ").executeUpdate(); - em.createQuery("delete from JPADriftChangeSet").executeUpdate(); - em.createQuery("delete from JPADriftSet").executeUpdate(); - em.createQuery("delete from JPADriftFile").executeUpdate(); - em.createQuery("delete from DriftDefinition").executeUpdate(); - em.createQuery("delete from DriftDefinitionTemplate").executeUpdate(); + em.createQuery("delete from DriftDefinitionTemplate ddt where ddt.name like" + name).executeUpdate();
deleteEntity(Resource.class, RESOURCE_NAME); deleteEntity(Agent.class, AGENT_NAME); diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/drift/DriftTemplateManagerBeanTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/drift/DriftTemplateManagerBeanTest.java index c877368..9e70997 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/drift/DriftTemplateManagerBeanTest.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/drift/DriftTemplateManagerBeanTest.java @@ -64,17 +64,18 @@ import org.rhq.test.AssertUtils;
public class DriftTemplateManagerBeanTest extends AbstractDriftServerTest {
- private static final String TEST_CREATE_TEMPLATE = "test-createTemplateForNegativeUpdateTests"; - private static final String TEST_PIN_TEMPLATE = "test-pinTemplate"; + private static final String drift1Path = "drift.1"; + private static final String drift2Path = "drift.2"; + + private final String TEST_CREATE_TEMPLATE = NAME_PREFIX + "createTemplateForNegativeUpdateTests"; + private final String TEST_PIN_TEMPLATE = NAME_PREFIX + "pinTemplate"; + + private final String driftFile1Hash = NAME_PREFIX + "a1b2c3"; + private final String driftFile2Hash = NAME_PREFIX + "1a2b3c";
private DriftTemplateManagerLocal templateMgr; private DriftManagerLocal driftMgr;
- private static final String drift1Path = "drift.1"; - private static final String drift2Path = "drift.2"; - - private static final String driftFile1Hash = "a1b2c3"; - private static final String driftFile2Hash = "1a2b3c";
// Note: Arquillian currently (1.0.2) runs each test in its own testng lifecycle. Think of it as each // test being in its own suite, and the test class being new'd for each test. Instance variables @@ -127,7 +128,7 @@ public class DriftTemplateManagerBeanTest extends AbstractDriftServerTest { @Test(dependsOnGroups = "pinning") public void createNewTemplate() { final DriftDefinition definition = new DriftDefinition(new Configuration()); - definition.setName("test-createNewTemplate"); + definition.setName(NAME_PREFIX + "createNewTemplate"); definition.setEnabled(true); definition.setDriftHandlingMode(normal); definition.setInterval(2400L); @@ -265,7 +266,7 @@ public class DriftTemplateManagerBeanTest extends AbstractDriftServerTest { //@Test(groups = "negativeUpdate", dependsOnMethods = "createTemplateForNegativeUpdateTests", expectedExceptions = EJBException.class, expectedExceptionsMessageRegExp = ".*name.*cannot be modified") private void doNotAllowTemplateNameToBeUpdated() { DriftDefinitionTemplate template = loadTemplate(TEST_CREATE_TEMPLATE); - template.setName("A new name"); + template.setName(NAME_PREFIX + "A new name");
templateMgr.updateTemplate(getOverlord(), template); } @@ -286,7 +287,7 @@ public class DriftTemplateManagerBeanTest extends AbstractDriftServerTest { public void createAndUpdateTemplate() { // create the template DriftDefinition definition = new DriftDefinition(new Configuration()); - definition.setName("test-updateTemplate"); + definition.setName(NAME_PREFIX + "test-updateTemplate"); definition.setDescription("update template test"); definition.setEnabled(true); definition.setDriftHandlingMode(normal); @@ -297,10 +298,10 @@ public class DriftTemplateManagerBeanTest extends AbstractDriftServerTest { definition);
// next create some definitions from the template - final DriftDefinition attachedDef1 = createDefinition(template, "attachedDef1", true); - final DriftDefinition attachedDef2 = createDefinition(template, "attachedDef2", true); - final DriftDefinition detachedDef1 = createDefinition(template, "detachedDef1", false); - final DriftDefinition detachedDef2 = createDefinition(template, "detachedDef2", false); + final DriftDefinition attachedDef1 = createDefinition(template, NAME_PREFIX + "attachedDef1", true); + final DriftDefinition attachedDef2 = createDefinition(template, NAME_PREFIX + "attachedDef2", true); + final DriftDefinition detachedDef1 = createDefinition(template, NAME_PREFIX + "detachedDef1", false); + final DriftDefinition detachedDef2 = createDefinition(template, NAME_PREFIX + "detachedDef2", false);
driftMgr.updateDriftDefinition(getOverlord(), forResource(resource.getId()), attachedDef1); driftMgr.updateDriftDefinition(getOverlord(), forResource(resource.getId()), attachedDef2); @@ -384,10 +385,10 @@ public class DriftTemplateManagerBeanTest extends AbstractDriftServerTest { templateDef);
// next create some resource level definitions - final DriftDefinition attachedDef1 = createDefinition(template, "attachedDef1", true); - final DriftDefinition attachedDef2 = createDefinition(template, "attachedDef2", true); - final DriftDefinition detachedDef1 = createDefinition(template, "detachedDef1", false); - final DriftDefinition detachedDef2 = createDefinition(template, "detachedDef2", false); + final DriftDefinition attachedDef1 = createDefinition(template, NAME_PREFIX + "attachedDef1", true); + final DriftDefinition attachedDef2 = createDefinition(template, NAME_PREFIX + "attachedDef2", true); + final DriftDefinition detachedDef1 = createDefinition(template, NAME_PREFIX + "detachedDef1", false); + final DriftDefinition detachedDef2 = createDefinition(template, NAME_PREFIX + "detachedDef2", false);
// create initial change set from which the snapshot will be generated final JPADriftChangeSet changeSet0 = new JPADriftChangeSet(resource, 0, COVERAGE, attachedDef1); @@ -474,7 +475,9 @@ public class DriftTemplateManagerBeanTest extends AbstractDriftServerTest { // get the attached definitions List<DriftDefinition> attachedDefs = new LinkedList<DriftDefinition>(); for (DriftDefinition d : template.getDriftDefinitions()) { - if (d.isAttached() && (d.getName().equals("attachedDef1") || d.getName().equals("attachedDef2"))) { + if (d.isAttached() + && (d.getName().equals(NAME_PREFIX + "attachedDef1") || d.getName() + .equals(NAME_PREFIX + "attachedDef2"))) { attachedDefs.add(d); } } @@ -490,7 +493,9 @@ public class DriftTemplateManagerBeanTest extends AbstractDriftServerTest { // get the detached definitions List<DriftDefinition> detachedDefs = new LinkedList<DriftDefinition>(); for (DriftDefinition d : template.getDriftDefinitions()) { - if (!d.isAttached() && (d.getName().equals("detachedDef1") || d.getName().equals("detachedDef2"))) { + if (!d.isAttached() + && (d.getName().equals(NAME_PREFIX + "detachedDef1") || d.getName() + .equals(NAME_PREFIX + "detachedDef2"))) { detachedDefs.add(d); } } @@ -513,10 +518,10 @@ public class DriftTemplateManagerBeanTest extends AbstractDriftServerTest { templateDef);
// next create some resource level definitions - final DriftDefinition attachedDef1 = createDefinition(template, "attachedDef1", true); - final DriftDefinition attachedDef2 = createDefinition(template, "attachedDef2", true); - final DriftDefinition detachedDef1 = createDefinition(template, "detachedDef1", false); - final DriftDefinition detachedDef2 = createDefinition(template, "detachedDef2", false); + final DriftDefinition attachedDef1 = createDefinition(template, NAME_PREFIX + "attachedDef1", true); + final DriftDefinition attachedDef2 = createDefinition(template, NAME_PREFIX + "attachedDef2", true); + final DriftDefinition detachedDef1 = createDefinition(template, NAME_PREFIX + "detachedDef1", false); + final DriftDefinition detachedDef2 = createDefinition(template, NAME_PREFIX + "detachedDef2", false);
// create some change sets final JPADriftChangeSet changeSet0 = new JPADriftChangeSet(resource, 0, COVERAGE, attachedDef1); diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/drift/JPADriftServerBeanTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/drift/JPADriftServerBeanTest.java index 8fe5ac5..edd5f01 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/drift/JPADriftServerBeanTest.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/drift/JPADriftServerBeanTest.java @@ -57,9 +57,9 @@ public class JPADriftServerBeanTest extends AbstractDriftServerTest {
private JPADriftServerLocal jpaDriftServer;
- private final String DRIFT_FILE_1_ID = "a1b2c3d4"; + private final String DRIFT_FILE_1_ID = NAME_PREFIX + "a1b2c3d4";
- private final String DRIFT_FILE_2_ID = "1ab2b3c4d"; + private final String DRIFT_FILE_2_ID = NAME_PREFIX + "1ab2b3c4d";
private JPADriftFile driftFile1;
@@ -90,7 +90,7 @@ public class JPADriftServerBeanTest extends AbstractDriftServerTest { public void persistResourceChangeSet() { // first create and persist the drift definition final DriftDefinition driftDef = new DriftDefinition(new Configuration()); - driftDef.setName("test::persistResourceChangeSet"); + driftDef.setName(NAME_PREFIX + "persistResourceChangeSet"); driftDef.setEnabled(true); driftDef.setDriftHandlingMode(normal); driftDef.setInterval(2400L); @@ -245,7 +245,7 @@ public class JPADriftServerBeanTest extends AbstractDriftServerTest {
// next create the drift definition final DriftDefinition driftDef = new DriftDefinition(new Configuration()); - driftDef.setName("test::copyChangeSet"); + driftDef.setName(NAME_PREFIX + "copyChangeSet"); driftDef.setEnabled(true); driftDef.setDriftHandlingMode(normal); driftDef.setInterval(2400L); diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/drift/ManageDriftDefinitionsTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/drift/ManageDriftDefinitionsTest.java index f31ffe5..18c7093 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/drift/ManageDriftDefinitionsTest.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/drift/ManageDriftDefinitionsTest.java @@ -63,9 +63,9 @@ import org.rhq.test.AssertUtils; @Test public class ManageDriftDefinitionsTest extends AbstractDriftServerTest {
- private final String DRIFT_NOT_SUPPORTED_TYPE = getClass().getSimpleName() + "DRIFT_NOT_SUPPORTED_RESOURCE_TYPE"; + private final String DRIFT_NOT_SUPPORTED_TYPE = NAME_PREFIX + "DRIFT_NOT_SUPPORTED_RESOURCE_TYPE";
- private final String DRIFT_NOT_SUPPORTED_RESOURCE = getClass().getSimpleName() + "DRIFT_NOT_SUPPORTED_RESOURCE"; + private final String DRIFT_NOT_SUPPORTED_RESOURCE = NAME_PREFIX + "DRIFT_NOT_SUPPORTED_RESOURCE";
private DriftManagerLocal driftMgr;
@@ -94,7 +94,7 @@ public class ManageDriftDefinitionsTest extends AbstractDriftServerTest { public void createDefinitionFromUnpinnedTemplate() { // first create a template final DriftDefinition templateDef = new DriftDefinition(new Configuration()); - templateDef.setName("test_createUnpinnedDefinition"); + templateDef.setName(NAME_PREFIX + "createUnpinnedDefinition"); templateDef.setEnabled(true); templateDef.setDriftHandlingMode(normal); templateDef.setInterval(2400L); @@ -184,8 +184,8 @@ public class ManageDriftDefinitionsTest extends AbstractDriftServerTest { final JPADriftChangeSet changeSet0 = new JPADriftChangeSet(null, 0, COVERAGE, null); changeSet0.setDriftHandlingMode(DriftConfigurationDefinition.DriftHandlingMode.normal);
- final JPADriftFile driftFile1 = new JPADriftFile("a1b2c3"); - final JPADriftFile driftFile2 = new JPADriftFile("1a2b3c"); + final JPADriftFile driftFile1 = new JPADriftFile(NAME_PREFIX + "a1b2c3"); + final JPADriftFile driftFile2 = new JPADriftFile(NAME_PREFIX + "1a2b3c");
JPADrift drift1 = new JPADrift(changeSet0, "drift.1", FILE_ADDED, null, driftFile1); JPADrift drift2 = new JPADrift(changeSet0, "drift.2", FILE_ADDED, null, driftFile2); @@ -196,7 +196,7 @@ public class ManageDriftDefinitionsTest extends AbstractDriftServerTest {
// create the template final DriftDefinition templateDef = new DriftDefinition(new Configuration()); - templateDef.setName("test_createUnpinnedDefinition"); + templateDef.setName(NAME_PREFIX + "createUnpinnedDefinition"); templateDef.setEnabled(true); templateDef.setDriftHandlingMode(normal); templateDef.setInterval(2400L); @@ -288,7 +288,7 @@ public class ManageDriftDefinitionsTest extends AbstractDriftServerTest { public void unpinDefinition() { // First create the template final DriftDefinition templateDef = new DriftDefinition(new Configuration()); - templateDef.setName("test_unpin_def_template"); + templateDef.setName(NAME_PREFIX + "unpin_def_template"); templateDef.setEnabled(true); templateDef.setDriftHandlingMode(normal); templateDef.setInterval(2400L); @@ -299,7 +299,7 @@ public class ManageDriftDefinitionsTest extends AbstractDriftServerTest {
// First create the definition DriftDefinition definition = template.createDefinition(); - definition.setName("test_unpin"); + definition.setName(NAME_PREFIX + "unpin"); definition.setEnabled(true); definition.setBasedir(new DriftDefinition.BaseDirectory(fileSystem, "/foo/bar/test")); definition.setComplianceStatus(DriftComplianceStatus.OUT_OF_COMPLIANCE_DRIFT); diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/drift/ManageSnapshotsTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/drift/ManageSnapshotsTest.java index f1212fd..ed316a4 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/drift/ManageSnapshotsTest.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/drift/ManageSnapshotsTest.java @@ -72,12 +72,12 @@ public class ManageSnapshotsTest extends AbstractDriftServerTest { }
public void pinningSnapshotShouldSetDriftDefAsPinned() { - final DriftDefinition driftDef = createAndPersistDriftDef("test::setPinnedFlag"); + final DriftDefinition driftDef = createAndPersistDriftDef(NAME_PREFIX + "setPinnedFlag");
// create initial change set final JPADriftChangeSet changeSet = new JPADriftChangeSet(resource, 0, COVERAGE, driftDef);
- final JPADriftFile driftFile1 = new JPADriftFile("a1b2c3"); + final JPADriftFile driftFile1 = new JPADriftFile(NAME_PREFIX + "a1b2c3"); JPADrift drift = new JPADrift(changeSet, "drift.1", FILE_ADDED, null, driftFile1);
final JPADriftSet driftSet = new JPADriftSet(); @@ -104,19 +104,19 @@ public class ManageSnapshotsTest extends AbstractDriftServerTest {
@SuppressWarnings("unchecked") public void pinningSnapshotShouldMakeSnapshotTheInitialChangeSet() throws Exception { - final DriftDefinition driftDef = createAndPersistDriftDef("test::makeSnapshotVersionZero"); + final DriftDefinition driftDef = createAndPersistDriftDef(NAME_PREFIX + "makeSnapshotVersionZero");
// create initial change set final JPADriftChangeSet changeSet0 = new JPADriftChangeSet(resource, 0, COVERAGE, driftDef);
- final JPADriftFile driftFile1 = new JPADriftFile("a1b2c3"); + final JPADriftFile driftFile1 = new JPADriftFile(NAME_PREFIX + "a1b2c3"); JPADrift drift1 = new JPADrift(changeSet0, "drift.1", FILE_ADDED, null, driftFile1);
final JPADriftSet driftSet = new JPADriftSet(); driftSet.addDrift(drift1);
// create change set v1 - final JPADriftFile driftFile2 = new JPADriftFile("1a2b3c"); + final JPADriftFile driftFile2 = new JPADriftFile(NAME_PREFIX + "1a2b3c"); final JPADriftChangeSet changeSet1 = new JPADriftChangeSet(resource, 1, DRIFT, driftDef); final JPADrift drift2 = new JPADrift(changeSet1, "drift.2", FILE_ADDED, null, driftFile2);
@@ -170,12 +170,12 @@ public class ManageSnapshotsTest extends AbstractDriftServerTest { }
public void pinningSnapshotShouldSendRequestToAgent() { - final DriftDefinition driftDef = createAndPersistDriftDef("test::setPinnedFlag"); + final DriftDefinition driftDef = createAndPersistDriftDef(NAME_PREFIX + "setPinnedFlag");
// create initial change set final JPADriftChangeSet changeSet = new JPADriftChangeSet(resource, 0, COVERAGE, driftDef);
- final JPADriftFile driftFile1 = new JPADriftFile("a1b2c3"); + final JPADriftFile driftFile1 = new JPADriftFile(NAME_PREFIX + "a1b2c3"); JPADrift drift = new JPADrift(changeSet, "drift.1", FILE_ADDED, null, driftFile1);
final JPADriftSet driftSet = new JPADriftSet(); @@ -221,7 +221,7 @@ public class ManageSnapshotsTest extends AbstractDriftServerTest { public void doNotAllowSnapshotToBePinnedWhenDefinitionIsAttachedToPinnedTemplate() { // First create the template final DriftDefinition templateDef = new DriftDefinition(new Configuration()); - templateDef.setName("Template-Pinned_Test"); + templateDef.setName(NAME_PREFIX + "Template-Pinned_Test"); templateDef.setEnabled(true); templateDef.setDriftHandlingMode(normal); templateDef.setInterval(2400L); diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/MetadataBeanTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/MetadataBeanTest.java index 38b1216..e5e5fea 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/MetadataBeanTest.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/MetadataBeanTest.java @@ -197,6 +197,7 @@ public class MetadataBeanTest extends AbstractEJB3Test {
List<ResourceType> resourceTypes = resourceTypeMgr.findResourceTypesByCriteria(subjectMgr.getOverlord(), criteria); + assertEquals("too many types!", 1, resourceTypes.size()); ResourceType resourceType = resourceTypes.get(0); Set<String> expectedSet = new HashSet<String>(expected); List<String> missing = new ArrayList<String>(); diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest.java index a5e23ff..1b6ebad 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest.java @@ -53,13 +53,15 @@ import org.rhq.enterprise.server.util.LookupUtil; @Test(groups = { "plugin.metadata" }) public class ResourceMetadataManagerBeanTest extends MetadataBeanTest {
+ private static final String PLUGIN_NAME = "ResourceMetadataManagerBeanTestPlugin"; + @Test(groups = { "plugin.resource.metadata.test", "NewPlugin" }) public void testRemovalOfObsoleteBundleAndDriftConfig() throws Exception { // create the initial type that has bundle and drift definitions createPlugin("test-plugin.jar", "1.0", "remove_bundle_drift_config_v1.xml");
// make sure the drift definition was persisted, and remember the type - ResourceType type1 = assertResourceTypeAssociationEquals("ServerWithBundleAndDriftConfig", "TestPlugin", + ResourceType type1 = assertResourceTypeAssociationEquals("ServerWithBundleAndDriftConfig", PLUGIN_NAME, "driftDefinitionTemplates", asList("drift1"));
// sanity check, make sure our queries work and that we did persist these things @@ -85,8 +87,6 @@ public class ResourceMetadataManagerBeanTest extends MetadataBeanTest { getTransactionManager().commit(); }
- // make sure the bundle config was also persisted - // NOTE: WHY DOES THIS WORK? I DIDN'T ASK TO FETCH IT AND IT IS MARKED AS LAZY LOAD assertNotNull(type1.getResourceTypeBundleConfiguration()); assertEquals("destdir1", type1.getResourceTypeBundleConfiguration().getBundleDestinationBaseDirectories() .iterator().next().getName()); @@ -139,14 +139,14 @@ public class ResourceMetadataManagerBeanTest extends MetadataBeanTest { @Test(dependsOnMethods = { "registerPlugin" }, groups = { "plugin.resource.metadata.test", "NewPlugin" }) public void persistNewTypes() { List<String> newTypes = asList("ServerA", "ServerB"); - assertTypesPersisted("Failed to persist new types", newTypes, "TestPlugin"); + assertTypesPersisted("Failed to persist new types", newTypes, PLUGIN_NAME); }
// @Test(dependsOnMethods = {"persistNewTypes"}, groups = {"plugin.resource.metadata.test", "NewPlugin"}) // public void persistSubcategories() throws Exception { // assertResourceTypeAssociationEquals( // "ServerA", - // "TestPlugin", + // PLUGIN_NAME, // "childSubCategories", // asList("Resources", "Applications") // ); @@ -154,29 +154,30 @@ public class ResourceMetadataManagerBeanTest extends MetadataBeanTest {
@Test(dependsOnMethods = { "persistNewTypes" }, groups = { "plugin.resource.metadata.test", "NewPlugin" }) public void persistMeasurementDefinitions() throws Exception { - assertResourceTypeAssociationEquals("ServerA", "TestPlugin", "metricDefinitions", + assertResourceTypeAssociationEquals("ServerA", PLUGIN_NAME, "metricDefinitions", asList("metric1", "metric2", "rhq.availability")); }
@Test(dependsOnMethods = { "persistNewTypes" }, groups = { "plugin.resource.metadata.test", "NewPlugin" }) public void persistEventDefinitions() throws Exception { - assertResourceTypeAssociationEquals("ServerA", "TestPlugin", "eventDefinitions", + assertResourceTypeAssociationEquals("ServerA", PLUGIN_NAME, "eventDefinitions", asList("logAEntry", "logBEntry")); }
@Test(dependsOnMethods = { "persistNewTypes" }, groups = { "plugin.resource.metadata.test", "NewPlugin" }) public void persistOperationDefinitions() throws Exception { - assertResourceTypeAssociationEquals("ServerA", "TestPlugin", "operationDefinitions", asList("start", "stop")); + assertResourceTypeAssociationEquals("ServerA", PLUGIN_NAME, "operationDefinitions", asList("start", "stop")); }
@Test(dependsOnMethods = { "persistNewTypes" }, groups = { "plugin.resource.metadata.test", "NewPlugin" }) public void persistProcessScans() throws Exception { - assertResourceTypeAssociationEquals("ServerA", "TestPlugin", "processScans", asList("serverA")); + assertResourceTypeAssociationEquals("ServerA", PLUGIN_NAME, "processScans", asList("serverA")); }
+ @Test(dependsOnMethods = { "persistNewTypes" }, groups = { "plugin.resource.metadata.test", "NewPlugin" }) public void persistDriftDefinitionTemplates() throws Exception { - ResourceType type = assertResourceTypeAssociationEquals("ServerA", "TestPlugin", "driftDefinitionTemplates", + ResourceType type = assertResourceTypeAssociationEquals("ServerA", PLUGIN_NAME, "driftDefinitionTemplates", asList("drift-pc", "drift-fs"));
DriftDefinition driftDef = null; @@ -216,7 +217,7 @@ public class ResourceMetadataManagerBeanTest extends MetadataBeanTest { @Test(dependsOnMethods = { "persistNewTypes" }, groups = { "plugin.resource.metadata.test", "NewPlugin" }) public void persistBundleTargetConfigurations() throws Exception { String resourceTypeName = "ServerA"; - String plugin = "TestPlugin"; + String plugin = PLUGIN_NAME;
SubjectManagerLocal subjectMgr = LookupUtil.getSubjectManager(); ResourceTypeManagerLocal resourceTypeMgr = LookupUtil.getResourceTypeManager(); @@ -227,6 +228,7 @@ public class ResourceMetadataManagerBeanTest extends MetadataBeanTest { criteria.fetchBundleConfiguration(true); List<ResourceType> resourceTypes = resourceTypeMgr.findResourceTypesByCriteria(subjectMgr.getOverlord(), criteria); + assertEquals("too many types returned!", 1, resourceTypes.size()); ResourceType resourceType = resourceTypes.get(0);
ResourceTypeBundleConfiguration rtbc = resourceType.getResourceTypeBundleConfiguration(); @@ -250,7 +252,7 @@ public class ResourceMetadataManagerBeanTest extends MetadataBeanTest {
@Test(dependsOnMethods = { "persistNewTypes" }, groups = { "plugin.resource.metadata.test", "NewPlugin" }) public void persistChildTypes() throws Exception { - assertResourceTypeAssociationEquals("ServerA", "TestPlugin", "childResourceTypes", asList("Child1", "Child2")); + assertResourceTypeAssociationEquals("ServerA", PLUGIN_NAME, "childResourceTypes", asList("Child1", "Child2")); }
@Test(dependsOnMethods = { "persistNewTypes" }, groups = { "plugin.resource.metadata.test", "NewPlugin" }) @@ -260,7 +262,7 @@ public class ResourceMetadataManagerBeanTest extends MetadataBeanTest {
@Test(dependsOnMethods = { "persistNewTypes" }, groups = { "plugin.resource.metadata.test", "NewPlugin" }) public void persistPackageTypes() throws Exception { - assertResourceTypeAssociationEquals("ServerA", "TestPlugin", "packageTypes", + assertResourceTypeAssociationEquals("ServerA", PLUGIN_NAME, "packageTypes", asList("ServerA.Content.1", "ServerA.Content.2")); }
@@ -271,34 +273,34 @@ public class ResourceMetadataManagerBeanTest extends MetadataBeanTest {
@Test(dependsOnMethods = { "upgradePlugin" }, groups = { "plugin.resource.metadata.test", "UpgradePlugin" }) public void upgradeOperationDefinitions() throws Exception { - assertResourceTypeAssociationEquals("ServerA", "TestPlugin", "operationDefinitions", + assertResourceTypeAssociationEquals("ServerA", PLUGIN_NAME, "operationDefinitions", asList("start", "shutdown", "restart")); }
@Test(dependsOnMethods = { "upgradePlugin" }, groups = { "plugin.resource.metadata.test", "UpgradePlugin" }) public void upgradeChildResources() throws Exception { - assertResourceTypeAssociationEquals("ServerA", "TestPlugin", "childResourceTypes", asList("Child1", "Child3")); + assertResourceTypeAssociationEquals("ServerA", PLUGIN_NAME, "childResourceTypes", asList("Child1", "Child3")); }
@Test(dependsOnMethods = { "upgradePlugin" }, groups = { "plugin.resource.metadata.test", "UpgradePlugin" }) public void upgradeParentTypeOfChild() throws Exception { - assertResourceTypeAssociationEquals("ServerB", "TestPlugin", "childResourceTypes", asList("Child2")); + assertResourceTypeAssociationEquals("ServerB", PLUGIN_NAME, "childResourceTypes", asList("Child2")); }
@Test(dependsOnMethods = { "upgradePlugin" }, groups = { "plugin.resource.metadata.test", "UpgradePlugin" }) public void upgradeEventDefinitions() throws Exception { - assertResourceTypeAssociationEquals("ServerA", "TestPlugin", "eventDefinitions", + assertResourceTypeAssociationEquals("ServerA", PLUGIN_NAME, "eventDefinitions", asList("logAEntry", "logCEntry")); }
@Test(dependsOnMethods = { "upgradePlugin" }, groups = { "plugin.resource.metadata.test", "UpgradePlugin" }) public void upgradeProcessScans() throws Exception { - assertResourceTypeAssociationEquals("ServerA", "TestPlugin", "processScans", asList("processA", "processB")); + assertResourceTypeAssociationEquals("ServerA", PLUGIN_NAME, "processScans", asList("processA", "processB")); }
@Test(dependsOnMethods = { "upgradePlugin" }, groups = { "plugin.resource.metadata.test", "UpgradePlugin" }) public void upgradeDriftDefinitionTemplates() throws Exception { - ResourceType type = assertResourceTypeAssociationEquals("ServerA", "TestPlugin", "driftDefinitionTemplates", + ResourceType type = assertResourceTypeAssociationEquals("ServerA", PLUGIN_NAME, "driftDefinitionTemplates", asList("drift-rc", "drift-mt"));
DriftDefinition driftDef = null; @@ -329,7 +331,7 @@ public class ResourceMetadataManagerBeanTest extends MetadataBeanTest { @Test(dependsOnMethods = { "upgradePlugin" }, groups = { "plugin.resource.metadata.test", "UpgradePlugin" }) public void upgradeBundleTargetConfigurations() throws Exception { String resourceTypeName = "ServerA"; - String plugin = "TestPlugin"; + String plugin = PLUGIN_NAME;
SubjectManagerLocal subjectMgr = LookupUtil.getSubjectManager(); ResourceTypeManagerLocal resourceTypeMgr = LookupUtil.getResourceTypeManager(); @@ -363,7 +365,7 @@ public class ResourceMetadataManagerBeanTest extends MetadataBeanTest {
@Test(dependsOnMethods = { "upgradePlugin" }, groups = { "plugin.resource.metadata.test", "UpgradePlugin" }) public void upgradePackageTypes() throws Exception { - assertResourceTypeAssociationEquals("ServerA", "TestPlugin", "packageTypes", + assertResourceTypeAssociationEquals("ServerA", PLUGIN_NAME, "packageTypes", asList("ServerA.Content.1", "ServerA.Content.3")); }
@@ -591,7 +593,7 @@ public class ResourceMetadataManagerBeanTest extends MetadataBeanTest { String fetch = "fetch" + WordUtils.capitalize(propertyName); ResourceTypeCriteria criteria = new ResourceTypeCriteria(); criteria.addFilterName(resourceTypeName); - criteria.addFilterPluginName("TestPlugin"); + criteria.addFilterPluginName(PLUGIN_NAME); MethodUtils.invokeMethod(criteria, fetch, true);
List<ResourceType> resourceTypes = resourceTypeMgr.findResourceTypesByCriteria(subjectMgr.getOverlord(), diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/test/UpdatePluginMetadataTestBase.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/test/UpdatePluginMetadataTestBase.java index 7c4fa43..7c815b7 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/test/UpdatePluginMetadataTestBase.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/test/UpdatePluginMetadataTestBase.java @@ -62,7 +62,7 @@ public class UpdatePluginMetadataTestBase extends AbstractEJB3Test {
protected TestServerCommunicationsService agentServiceContainer;
- protected static final String PLUGIN_NAME = "ResourceMetaDataManagerBeanTest"; // don't change this - our test descriptor .xml files use it as plugin name + protected static final String PLUGIN_NAME = "UpdatePluginMetadataTestBasePlugin"; // don't change this - our test descriptor .xml files use it as plugin name protected static final String AGENT_NAME = "-dummy agent-"; protected static final String COMMON_PATH_PREFIX = "./test/metadata/";
diff --git a/modules/enterprise/server/itests-2/src/test/resources/arquillian.xml b/modules/enterprise/server/itests-2/src/test/resources/arquillian.xml index d473413..c1dcf1b 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/arquillian.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/arquillian.xml @@ -21,6 +21,7 @@
<configuration> <property name="jbossHome">${jboss.unzip.location}</property> + <property name="javaVmArguments">${jboss.vm.args} ${jboss.vm.args.debug}</property> </configuration> </container> </arquillian> diff --git a/modules/enterprise/server/itests-2/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/dup_drift.xml b/modules/enterprise/server/itests-2/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/dup_drift.xml index bd9728b..7f79c93 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/dup_drift.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/dup_drift.xml @@ -1,4 +1,4 @@ -<plugin name="TestPlugin" displayName="Test Plugin" package="org.rhq.plugins.test" +<plugin name="ResourceMetadataManagerBeanTestPlugin" displayName="Test Plugin" package="org.rhq.plugins.test" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" xmlns:c="urn:xmlns:rhq-configuration"> diff --git a/modules/enterprise/server/itests-2/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/plugin_v1.xml b/modules/enterprise/server/itests-2/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/plugin_v1.xml index 88cd39c..8673ce4 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/plugin_v1.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/plugin_v1.xml @@ -1,4 +1,4 @@ -<plugin name="TestPlugin" displayName="Test Plugin" package="org.rhq.plugins.test" +<plugin name="ResourceMetadataManagerBeanTestPlugin" displayName="Test Plugin" package="org.rhq.plugins.test" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" xmlns:c="urn:xmlns:rhq-configuration"> diff --git a/modules/enterprise/server/itests-2/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/plugin_v2.xml b/modules/enterprise/server/itests-2/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/plugin_v2.xml index a89f679..3f9cebe 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/plugin_v2.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/plugin_v2.xml @@ -1,4 +1,4 @@ -<plugin name="TestPlugin" displayName="Test Plugin" package="org.rhq.plugins.test" +<plugin name="ResourceMetadataManagerBeanTestPlugin" displayName="Test Plugin" package="org.rhq.plugins.test" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" xmlns:c="urn:xmlns:rhq-configuration"> diff --git a/modules/enterprise/server/itests-2/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/remove_bundle_drift_config_v1.xml b/modules/enterprise/server/itests-2/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/remove_bundle_drift_config_v1.xml index 460954b..902dd0a 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/remove_bundle_drift_config_v1.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/remove_bundle_drift_config_v1.xml @@ -1,4 +1,4 @@ -<plugin name="TestPlugin" displayName="Test Plugin" package="org.rhq.plugins.test" +<plugin name="ResourceMetadataManagerBeanTestPlugin" displayName="Test Plugin" package="org.rhq.plugins.test" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" xmlns:c="urn:xmlns:rhq-configuration"> diff --git a/modules/enterprise/server/itests-2/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/remove_bundle_drift_config_v2.xml b/modules/enterprise/server/itests-2/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/remove_bundle_drift_config_v2.xml index c92919d..83d80bb 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/remove_bundle_drift_config_v2.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/remove_bundle_drift_config_v2.xml @@ -1,4 +1,4 @@ -<plugin name="TestPlugin" displayName="Test Plugin" package="org.rhq.plugins.test" +<plugin name="ResourceMetadataManagerBeanTestPlugin" displayName="Test Plugin" package="org.rhq.plugins.test" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" xmlns:c="urn:xmlns:rhq-configuration"> diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/alerts/type-with-metric.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/alerts/type-with-metric.xml index 1af82a9..73e95e2 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/alerts/type-with-metric.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/alerts/type-with-metric.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Type with Metric Test Plugin" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Type with Metric Test Plugin" package="org.rhq.plugins.mock.jboss" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/BZ_573034_v1.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/BZ_573034_v1.xml index 85de1cf..28680e5 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/BZ_573034_v1.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/BZ_573034_v1.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Bug 573034 Test Plugin" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Bug 573034 Test Plugin" package="org.rhq.plugins.mock.jboss" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/BZ_573034_v2.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/BZ_573034_v2.xml index 15b8d74..493da85 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/BZ_573034_v2.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/BZ_573034_v2.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Bug 573034 Test Plugin" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Bug 573034 Test Plugin" package="org.rhq.plugins.mock.jboss" version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/addDeleteTemplate1.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/addDeleteTemplate1.xml index bea3eef..c095380 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/addDeleteTemplate1.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/addDeleteTemplate1.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/addDeleteTemplate2.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/addDeleteTemplate2.xml index 47653a7..ccaf547 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/addDeleteTemplate2.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/addDeleteTemplate2.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/addDeleteTemplate3.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/addDeleteTemplate3.xml index e57a2ab..b85bc51 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/addDeleteTemplate3.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/addDeleteTemplate3.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="3.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/constraint.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/constraint.xml index 9c6cbe3..11462f4 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/constraint.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/constraint.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" xmlns:c="urn:xmlns:rhq-configuration"> diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/constraintMinMax.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/constraintMinMax.xml index 2653ee3..44f1f00 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/constraintMinMax.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/constraintMinMax.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" xmlns:c="urn:xmlns:rhq-configuration"> diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/groupDeleted-v1.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/groupDeleted-v1.xml index 4e3ef1d..74dc51b 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/groupDeleted-v1.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/groupDeleted-v1.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/groupDeleted-v2.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/groupDeleted-v2.xml index 755ee5c..3d4c2d7 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/groupDeleted-v2.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/groupDeleted-v2.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/groupPropDeleted-v1.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/groupPropDeleted-v1.xml index b5daf46..8ca3d83 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/groupPropDeleted-v1.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/groupPropDeleted-v1.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/groupPropDeleted-v2.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/groupPropDeleted-v2.xml index 3c16420..a197008 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/groupPropDeleted-v2.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/groupPropDeleted-v2.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/groupPropDeleted-v3.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/groupPropDeleted-v3.xml index 4360c2b..7bf6d2f 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/groupPropDeleted-v3.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/groupPropDeleted-v3.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/groupPropDeleted-v4.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/groupPropDeleted-v4.xml index 6da4878..6687398 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/groupPropDeleted-v4.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/groupPropDeleted-v4.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/groupPropMoved-v1.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/groupPropMoved-v1.xml index 2c73c28..04c23b7 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/groupPropMoved-v1.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/groupPropMoved-v1.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/groupPropMoved-v2.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/groupPropMoved-v2.xml index 4b7588a..ed48555 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/groupPropMoved-v2.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/groupPropMoved-v2.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/propertyChanging-v1.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/propertyChanging-v1.xml index 7c137eb..e921ed5 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/propertyChanging-v1.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/propertyChanging-v1.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/propertyChanging-v2.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/propertyChanging-v2.xml index 442d64b..41c26e4 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/propertyChanging-v2.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/propertyChanging-v2.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/propertyList-simple.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/propertyList-simple.xml index b64cbee..6fa92ed 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/propertyList-simple.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/propertyList-simple.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" xmlns:c="urn:xmlns:rhq-configuration"> diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/propertyList-v1.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/propertyList-v1.xml index aebbbac..5362890 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/propertyList-v1.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/propertyList-v1.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/propertyList-v2.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/propertyList-v2.xml index 23c2100..fed5af6 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/propertyList-v2.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/propertyList-v2.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/propertyMap-v1.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/propertyMap-v1.xml index 047a0a7..3ff2add 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/propertyMap-v1.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/propertyMap-v1.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/propertyMap-v2.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/propertyMap-v2.xml index d370778..4e34d4f 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/propertyMap-v2.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/propertyMap-v2.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/update5-v1_0.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/update5-v1_0.xml index 036e44e..e73f094 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/update5-v1_0.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/update5-v1_0.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/update5-v2_0.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/update5-v2_0.xml index 8db93dd..21a8e9e 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/update5-v2_0.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/update5-v2_0.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/updateDefaultTemplate1.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/updateDefaultTemplate1.xml index 0183c27..2293c7b 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/updateDefaultTemplate1.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/updateDefaultTemplate1.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/updateDefaultTemplate2.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/updateDefaultTemplate2.xml index 702de08..e493a44 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/updateDefaultTemplate2.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/configuration/updateDefaultTemplate2.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/events/event1-1.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/events/event1-1.xml index 11f345e..f8e196a 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/events/event1-1.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/events/event1-1.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin"> diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/events/event1-2.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/events/event1-2.xml index f2bc857..0f1aa83 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/events/event1-2.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/events/event1-2.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin"> diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/measurement/measurementDeletion-v1_0.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/measurement/measurementDeletion-v1_0.xml index db954f5..1200e34 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/measurement/measurementDeletion-v1_0.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/measurement/measurementDeletion-v1_0.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin"> diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/measurement/measurementDeletion-v2_0.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/measurement/measurementDeletion-v2_0.xml index 721375a..8bab712 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/measurement/measurementDeletion-v2_0.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/measurement/measurementDeletion-v2_0.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin"> diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/measurement/update-v1_0.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/measurement/update-v1_0.xml index 6ba4994..d62f05d 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/measurement/update-v1_0.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/measurement/update-v1_0.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin"> diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/measurement/update-v2_0.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/measurement/update-v2_0.xml index 419e171..a44a02c 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/measurement/update-v2_0.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/measurement/update-v2_0.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin"> diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/measurement/update6-1.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/measurement/update6-1.xml index df4caf1..185aae3 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/measurement/update6-1.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/measurement/update6-1.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin"> diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/measurement/update6-2.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/measurement/update6-2.xml index 0c31c6d..d76ede1 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/measurement/update6-2.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/measurement/update6-2.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin"> diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/measurement/update7-1.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/measurement/update7-1.xml index cac3941..1c56093 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/measurement/update7-1.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/measurement/update7-1.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin"> diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/measurement/update7-2.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/measurement/update7-2.xml index 99d5659..50e15fe 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/measurement/update7-2.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/measurement/update7-2.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin"> diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/natives/update5-v1_0.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/natives/update5-v1_0.xml index 036e44e..e73f094 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/natives/update5-v1_0.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/natives/update5-v1_0.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/natives/update5-v2_0.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/natives/update5-v2_0.xml index 8db93dd..21a8e9e 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/natives/update5-v2_0.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/natives/update5-v2_0.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/noTypes.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/noTypes.xml index 72bc8df..a279437 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/noTypes.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/noTypes.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="1000.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin"> diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/operation/operation1-1.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/operation/operation1-1.xml index 4587815..0671e30 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/operation/operation1-1.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/operation/operation1-1.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/operation/operation1-2.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/operation/operation1-2.xml index f32b862..463cda1 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/operation/operation1-2.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/operation/operation1-2.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" +<plugin name="UpdatePluginMetadataTestBasePlugin" version="2.0" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/operation/operation2-1.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/operation/operation2-1.xml index c04bc55..0937efd 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/operation/operation2-1.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/operation/operation2-1.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/operation/operation2-2.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/operation/operation2-2.xml index d28dabc..c58f267 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/operation/operation2-2.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/operation/operation2-2.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/operation/operation3-1.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/operation/operation3-1.xml index af34668..c2a98dd 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/operation/operation3-1.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/operation/operation3-1.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" +<plugin name="UpdatePluginMetadataTestBasePlugin" version="1.0" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/operation/operation3-2.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/operation/operation3-2.xml index 0589700..e43bba4 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/operation/operation3-2.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/operation/operation3-2.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" +<plugin name="UpdatePluginMetadataTestBasePlugin" version="2.0" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/operation/update3-v1_0.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/operation/update3-v1_0.xml index 658f24e..f45831e 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/operation/update3-v1_0.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/operation/update3-v1_0.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" +<plugin name="UpdatePluginMetadataTestBasePlugin" version="1.0" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/operation/update3-v2_0.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/operation/update3-v2_0.xml index 8a24c5d..3d3ead1 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/operation/update3-v2_0.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/operation/update3-v2_0.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" +<plugin name="UpdatePluginMetadataTestBasePlugin" version="2.0" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource-type/duplicateResourceType.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource-type/duplicateResourceType.xml index 5340b2e..689a922 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource-type/duplicateResourceType.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource-type/duplicateResourceType.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" xmlns:c="urn:xmlns:rhq-configuration"> diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource-type/update2-v1_0.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource-type/update2-v1_0.xml index bb70c9b..ca404e2 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource-type/update2-v1_0.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource-type/update2-v1_0.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin"> diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource-type/update2-v2_0.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource-type/update2-v2_0.xml index 91b63d9..62346a8 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource-type/update2-v2_0.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource-type/update2-v2_0.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin"> diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource-type/update4-v1_0.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource-type/update4-v1_0.xml index 614da65..cc55191 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource-type/update4-v1_0.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource-type/update4-v1_0.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin"> diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource-type/update4-v2_0.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource-type/update4-v2_0.xml index e8b90b1..e032a92 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource-type/update4-v2_0.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource-type/update4-v2_0.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin"> diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource-type/updateResourceTypeBundleTarget-v1.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource-type/updateResourceTypeBundleTarget-v1.xml index aa29ffd..b3d6130 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource-type/updateResourceTypeBundleTarget-v1.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource-type/updateResourceTypeBundleTarget-v1.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock" package="org.rhq.plugins.mock.jboss" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource-type/updateResourceTypeBundleTarget-v2.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource-type/updateResourceTypeBundleTarget-v2.xml index c4f11ad..b54f598 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource-type/updateResourceTypeBundleTarget-v2.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource-type/updateResourceTypeBundleTarget-v2.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock" package="org.rhq.plugins.mock.jboss" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/illegal-subcat-1.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/illegal-subcat-1.xml index e653736..efc39ed 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/illegal-subcat-1.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/illegal-subcat-1.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin"> diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/nested-subcat-2children.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/nested-subcat-2children.xml index 4aa4064..89cba82 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/nested-subcat-2children.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/nested-subcat-2children.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin"> diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/nested-subcat-grandchild.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/nested-subcat-grandchild.xml index 63afe40..d331fea 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/nested-subcat-grandchild.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/nested-subcat-grandchild.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin"> diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/nested-subcat-services-v1_0.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/nested-subcat-services-v1_0.xml index 91d6463..17044bb 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/nested-subcat-services-v1_0.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/nested-subcat-services-v1_0.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin"> diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/nested-subcat-services-v2_0.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/nested-subcat-services-v2_0.xml index 93310c1..6d73374 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/nested-subcat-services-v2_0.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/nested-subcat-services-v2_0.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin"> diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/nested-subcat-v1_0.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/nested-subcat-v1_0.xml index 18c05ef..c524878 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/nested-subcat-v1_0.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/nested-subcat-v1_0.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin"> diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/nested-subcat-v1_1.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/nested-subcat-v1_1.xml index 0a13158..8309a8a 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/nested-subcat-v1_1.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/nested-subcat-v1_1.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin"> diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/nested-subcat-v2_0.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/nested-subcat-v2_0.xml index 56563dc..420ed34 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/nested-subcat-v2_0.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/nested-subcat-v2_0.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin"> diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/no-subcat.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/no-subcat.xml index 064753f..999eeb0 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/no-subcat.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/no-subcat.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin">
diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/one-subcat-v1_0.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/one-subcat-v1_0.xml index c7d308e..ca33483 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/one-subcat-v1_0.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/one-subcat-v1_0.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin"> diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/one-subcat-v1_1.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/one-subcat-v1_1.xml index 36d6acd..ce3bf70 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/one-subcat-v1_1.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/one-subcat-v1_1.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin"> diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/one-subcat-v2_0.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/one-subcat-v2_0.xml index 21a0134..54265b0 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/one-subcat-v2_0.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/one-subcat-v2_0.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin"> diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/one-subcat-v3_0.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/one-subcat-v3_0.xml index 05bca6a..a4315cc 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/one-subcat-v3_0.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/one-subcat-v3_0.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="3.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin"> diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/services-v1_0.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/services-v1_0.xml index 27908e4..b204150 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/services-v1_0.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/services-v1_0.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin"> diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/services-v2_0.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/services-v2_0.xml index 0440e33..08fc0c3 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/services-v2_0.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/services-v2_0.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin"> diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/test-subcategories.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/test-subcategories.xml index 95f27d8..eaaa3b1 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/test-subcategories.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/test-subcategories.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin"> diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/test-subcategories2.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/test-subcategories2.xml index ec1e69d..3bdec86 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/test-subcategories2.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/test-subcategories2.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin"> diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/test-subcategories3.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/test-subcategories3.xml index 505a361..d97e4a4 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/test-subcategories3.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/test-subcategories3.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" version="3.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin"> diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/two-subcat.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/two-subcat.xml index 2f44202..3573e1e 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/two-subcat.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/two-subcat.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" +<plugin name="UpdatePluginMetadataTestBasePlugin" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin">
diff --git a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/undefined-child-subcat-1.xml b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/undefined-child-subcat-1.xml index 9870576..2caa635 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/undefined-child-subcat-1.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/test/metadata/resource/undefined-child-subcat-1.xml @@ -1,4 +1,4 @@ -<plugin name="ResourceMetaDataManagerBeanTest" +<plugin name="UpdatePluginMetadataTestBasePlugin" version="1.0" displayName="Mock JBoss AS" package="org.rhq.plugins.mock.jboss"
commit b12f68cf0ed1cd6f890d2b11b61a0ac818c1491e Author: John Sanda jsanda@redhat.com Date: Mon Dec 3 11:21:20 2012 -0500
fixing exception in JPQL query in set up/tear down code
Also removing references to LookUtil since we can directly inject managed components into tests.
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBeanTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBeanTest.java index 95a4dbe..a3ae638 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBeanTest.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBeanTest.java @@ -38,6 +38,8 @@ import java.sql.Statement; import java.util.Collections; import java.util.List;
+import javax.ejb.EJB; + import org.joda.time.DateTime; import org.joda.time.Hours; import org.testng.annotations.Test; @@ -58,13 +60,22 @@ import org.rhq.enterprise.server.auth.SubjectManagerLocal; import org.rhq.enterprise.server.measurement.util.MeasurementDataManagerUtility; import org.rhq.enterprise.server.test.AbstractEJB3Test; import org.rhq.enterprise.server.test.TransactionCallback; -import org.rhq.enterprise.server.util.LookupUtil;
/** * @author John Sanda */ public class MeasurementDataManagerBeanTest extends AbstractEJB3Test {
+ // Tests in this class are failing currently do to a system initialization problem. + // MeasurementDataManagerUtility looks up config settings from SystemManagerBean. + // SystemManagerBean is however failing in its getDriftServerPluginManager method on + // the call to LookupUtil.getServerPluginService(). An InstanceNotFoundException is + // thrown, + // + // javax.management.InstanceNotFoundException: rhq:service=ServerPluginService + // + // Looks like the server plugin service is not getting deployed. + //private final Log log = LogFactory.getLog(MeasurementDataManagerBeanTest.class);
private static final boolean ENABLED = true; @@ -99,9 +110,14 @@ public class MeasurementDataManagerBeanTest extends AbstractEJB3Test {
private Subject overlord;
+ @EJB + private SubjectManagerLocal subjectManager; + + @EJB + private MeasurementDataManagerLocal dataManager; + @Override protected void beforeMethod() throws Exception { - SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager(); overlord = subjectManager.getOverlord();
createInventory(); @@ -130,7 +146,6 @@ public class MeasurementDataManagerBeanTest extends AbstractEJB3Test { report.addData(new MeasurementDataNumeric(buckets.get(59) + 20, request, 5.5)); report.addData(new MeasurementDataNumeric(buckets.get(59) + 30, request, 6.6));
- MeasurementDataManagerLocal dataManager = LookupUtil.getMeasurementDataManager(); dataManager.mergeMeasurementReport(report);
List<MeasurementDataNumericHighLowComposite> actualData = findDataForContext(overlord, @@ -254,7 +269,7 @@ public class MeasurementDataManagerBeanTest extends AbstractEJB3Test { em.createQuery("delete from MeasurementDefinition " + "where dataType = :dataType and " + "name = :name") - .setParameter("dataType", DYNAMIC) + .setParameter("dataType", MEASUREMENT) .setParameter("name", DYNAMIC_DEF_NAME) .executeUpdate(); } @@ -291,7 +306,6 @@ public class MeasurementDataManagerBeanTest extends AbstractEJB3Test { MeasurementReport dummyReport = new MeasurementReport(); dummyReport.addData(new MeasurementDataNumeric(now.getMillis(), -1, 0.0));
- MeasurementDataManagerLocal dataManager = LookupUtil.getMeasurementDataManager(); dataManager.mergeMeasurementReport(dummyReport); }
@@ -380,7 +394,6 @@ public class MeasurementDataManagerBeanTest extends AbstractEJB3Test {
private List<MeasurementDataNumericHighLowComposite> findDataForContext(Subject subject, EntityContext context, MeasurementSchedule schedule, long beginTime, long endTime) { - MeasurementDataManagerLocal dataManager = LookupUtil.getMeasurementDataManager(); List<List<MeasurementDataNumericHighLowComposite>> data = dataManager.findDataForContext(subject, context, schedule.getDefinition().getId(), beginTime, endTime, 60);
commit a8d94d9619c760f372499502be72db3384487154 Author: Jay Shaughnessy jshaughn@redhat.com Date: Sat Dec 1 19:29:10 2012 -0500
Server i-test work to address many test interaction issues ( ** There are still some test failures ** ) - thin rhq.ear by removing the services SAR. The standard services actually just get in the way, tests are responsible for prepare/unprepare of any services they need and should not depend on the production services, which may perform undesired work anyway. - Add AbstractEJB3Test.preparePluginScannerService(), which will prepare a default test deployment scanner, and make use of it in more classes that need that service deployed, and were previously depending on the production deployment scanner. - Apply more consistent temp directory usage by settling on java.io.tmpdir/rhq/<class.simplename> as the convention. Add AbstractEJB3Test.getTempDir() and use it ubiquitously. This consolidates the test files under and "rhq" root dir and also identofies them by creating class name. - DatabaseAndFilePluginDeploymentTest - make a non-test method private, not public so it doesn't execute as a test - remove the obsolete OldAbstractEJB3Test class
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/TestServerPluginService.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/TestServerPluginService.java index be9b752..796a562 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/TestServerPluginService.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/TestServerPluginService.java @@ -53,7 +53,7 @@ public abstract class TestServerPluginService extends ServerPluginService implem
protected TestServerPluginService() { // build the config at constructor time so tests have it even before the PC is initialized - File dir = new File(System.getProperty("java.io.tmpdir"), "test-server-plugins"); + File dir = new File(System.getProperty("java.io.tmpdir") + "/rhq", this.getClass().getSimpleName()); this.masterConfig = new MasterServerPluginContainerConfiguration(dir, dir, dir, null); }
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/bundle/TestBundleServerPluginService.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/bundle/TestBundleServerPluginService.java index 61c53d3..45f210c 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/bundle/TestBundleServerPluginService.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/bundle/TestBundleServerPluginService.java @@ -68,7 +68,7 @@ public class TestBundleServerPluginService extends ServerPluginService implement
public TestBundleServerPluginService() { // build the config at constructor time so tests have it even before the PC is initialized - File dir = new File(System.getProperty("java.io.tmpdir"), "test-server-plugins"); + File dir = new File(System.getProperty("java.io.tmpdir") + "/rhq", this.getClass().getSimpleName()); this.masterConfig = new MasterServerPluginContainerConfiguration(dir, dir, dir, null); }
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/content/test/ContentUIManagerBeanTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/content/test/ContentUIManagerBeanTest.java index 311d521..51bd984 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/content/test/ContentUIManagerBeanTest.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/content/test/ContentUIManagerBeanTest.java @@ -268,12 +268,13 @@ public class ContentUIManagerBeanTest extends AbstractEJB3Test { // contents into memory every time.
// destination once pulled from db - String pulledFilename = System.getProperty("java.io.tmpdir") + "/" - + this.getClass().getSimpleName() - + "/pulled.jar"; - File retrieved = new File(pulledFilename); + File tempDir = getTempDir(); + if (!tempDir.exists()) { + assertTrue("Unable to mkdirs " + tempDir + " for test.", tempDir.mkdirs()); + } + File retrieved = new File(tempDir, "pulled.jar"); if (retrieved.exists()) { - assertTrue("Unable to delete " + pulledFilename + " for test cleanup.", retrieved.delete()); + assertTrue("Unable to delete " + retrieved.getPath() + " for test cleanup.", retrieved.delete()); }
//any jar should be fine. Use canned jar diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/core/CoreServerServiceImplTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/core/CoreServerServiceImplTest.java index 645e35c..02a2fbc 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/core/CoreServerServiceImplTest.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/core/CoreServerServiceImplTest.java @@ -531,7 +531,7 @@ public class CoreServerServiceImplTest extends AbstractEJB3Test {
@Override public File getJBossServerHomeDir() { - return new File(System.getProperty("java.io.tmpdir"), "CoreServerServiceImplTest"); + return getTempDir(); }
@Override diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/core/plugin/DatabaseAndFilePluginDeploymentTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/core/plugin/DatabaseAndFilePluginDeploymentTest.java index 6d649f5..d031926 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/core/plugin/DatabaseAndFilePluginDeploymentTest.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/core/plugin/DatabaseAndFilePluginDeploymentTest.java @@ -48,13 +48,12 @@ import org.rhq.enterprise.server.util.LookupUtil;
//make sure we run this after the plugins.metadata tests are done so that //the db contents don't interfere -@Test -//(dependsOnGroups = "plugin.metadata") +//@Test(dependsOnGroups = "plugin.metadata") public class DatabaseAndFilePluginDeploymentTest extends AbstractEJB3Test {
private static final String PLUGIN_NAME = "DeployTest"; // as defined in our test descriptors private static final String DESCRIPTORS_LOCATION = "test/deployment/"; - private static final String TEST_DIR = System.getProperty("java.io.tmpdir") + "/" + private static final String TEST_DIR = System.getProperty("java.io.tmpdir") + "/rhq/" + DatabaseAndFilePluginDeploymentTest.class.getName() + "/"; private static final String JARS_LOCATION = TEST_DIR + "jars"; private static final String DEPLOY_LOCATION = TEST_DIR + "deploy"; @@ -116,7 +115,7 @@ public class DatabaseAndFilePluginDeploymentTest extends AbstractEJB3Test { // is important that afterClassStandIn() have a dependency such that it runs in the last test-set.
//@BeforeClass - public void beforeClass() throws Exception { + private void beforeClass() throws Exception { Calendar cal = Calendar.getInstance(); cal.set(2009, Calendar.FEBRUARY, 1, 1, 0, 0); cal.set(Calendar.MILLISECOND, 0); diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/drift/DriftManagerBeanTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/drift/DriftManagerBeanTest.java index 8389f17..03cffdc 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/drift/DriftManagerBeanTest.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/drift/DriftManagerBeanTest.java @@ -111,7 +111,7 @@ public class DriftManagerBeanTest extends AbstractEJB3Test {
@Test public void testStoreChangeSet() throws Exception { - File rootDir = new File(System.getProperty("java.io.tmpdir")); + File rootDir = getTempDir(); File changeSetsDir = new File(rootDir, "changesets"); deleteDirectory(changeSetsDir); changeSetsDir.mkdirs(); diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/plugin/pc/content/TestContentServerPluginService.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/plugin/pc/content/TestContentServerPluginService.java index da94c58..5850985 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/plugin/pc/content/TestContentServerPluginService.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/plugin/pc/content/TestContentServerPluginService.java @@ -86,7 +86,7 @@ public class TestContentServerPluginService extends ServerPluginService implemen
protected MasterServerPluginContainer createMasterPluginContainer() { MasterServerPluginContainer master = new TestMasterServerPluginContainer(); - File dir = new File(System.getProperty("java.io.tmpdir"), "test-server-plugins"); + File dir = new File(System.getProperty("java.io.tmpdir") + "/rhq", this.getClass().getSimpleName()); MasterServerPluginContainerConfiguration config = new MasterServerPluginContainerConfiguration(dir, dir, dir, null); master.initialize(config); diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/plugin/pc/generic/TestGenericServerPluginService.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/plugin/pc/generic/TestGenericServerPluginService.java index e8cdb51..85f45d0 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/plugin/pc/generic/TestGenericServerPluginService.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/plugin/pc/generic/TestGenericServerPluginService.java @@ -57,7 +57,7 @@ public class TestGenericServerPluginService extends ServerPluginService implemen
public TestGenericServerPluginService() { // build the config at constructor time so tests have it even before the PC is initialized - File dir = new File(System.getProperty("java.io.tmpdir"), "test-server-plugins"); + File dir = new File(System.getProperty("java.io.tmpdir" + "/rhq"), this.getClass().getSimpleName()); this.masterConfig = new MasterServerPluginContainerConfiguration(dir, dir, dir, null); }
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/MetadataBeanTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/MetadataBeanTest.java index dbdb765..38b1216 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/MetadataBeanTest.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/MetadataBeanTest.java @@ -39,7 +39,6 @@ import org.rhq.core.util.MessageDigestGenerator; import org.rhq.core.util.stream.StreamUtil; import org.rhq.enterprise.server.auth.SubjectManagerLocal; import org.rhq.enterprise.server.bundle.TestBundleServerPluginService; -import org.rhq.enterprise.server.core.plugin.PluginDeploymentScanner; import org.rhq.enterprise.server.resource.ResourceTypeManagerLocal; import org.rhq.enterprise.server.scheduler.jobs.PurgePluginsJob; import org.rhq.enterprise.server.scheduler.jobs.PurgeResourceTypesJob; @@ -48,8 +47,6 @@ import org.rhq.enterprise.server.util.LookupUtil;
public class MetadataBeanTest extends AbstractEJB3Test {
- protected PluginDeploymentScanner pluginScanner; - private List<Integer> pluginIds = new ArrayList<Integer>();
/** @@ -81,6 +78,7 @@ public class MetadataBeanTest extends AbstractEJB3Test { prepareCustomServerPluginService(bundleService); bundleService.startMasterPluginContainerWithoutSchedulingJobs(); prepareScheduler(); + preparePluginScannerService(); }
/** @@ -91,6 +89,7 @@ public class MetadataBeanTest extends AbstractEJB3Test { @Override protected void afterMethod() throws Exception {
+ unpreparePluginScannerService(); unprepareServerPluginService(); unprepareScheduler(); } @@ -145,7 +144,7 @@ public class MetadataBeanTest extends AbstractEJB3Test { protected void createPlugin(String pluginFileName, String version, String descriptorFileName) throws Exception { URL descriptorURL = getDescriptorURL(descriptorFileName); PluginDescriptor pluginDescriptor = loadPluginDescriptor(descriptorURL); - String pluginFilePath = getPluginWorkDir() + "/" + pluginFileName + ".jar"; + String pluginFilePath = getPluginScannerService().getAgentPluginDir() + "/" + pluginFileName + ".jar";
Plugin plugin = new Plugin(pluginDescriptor.getName(), pluginFilePath); plugin.setDisplayName(pluginDescriptor.getName()); @@ -162,37 +161,11 @@ public class MetadataBeanTest extends AbstractEJB3Test { pluginIds.add(plugin.getId()); }
- protected void preparePluginScannerService() { - if (this.pluginScanner == null) { - this.pluginScanner = new PluginDeploymentScanner(); - - String pluginDirPath = null; - try { - pluginDirPath = getPluginWorkDir(); - } catch (Exception e) { - throw new RuntimeException("Cannot determine where to put the plugin jar files", e); - } - this.pluginScanner.setAgentPluginDir(pluginDirPath); // we don't want to scan for these - this.pluginScanner.setServerPluginDir(null); // we don't want to scan for these - this.pluginScanner.setScanPeriod("9999999"); // we want to manually scan - don't allow for auto-scan to happen - } - - preparePluginScannerService(this.pluginScanner); - } - private URL getDescriptorURL(String descriptor) { String dir = getClass().getSimpleName(); return getClass().getResource(dir + "/" + descriptor); }
- protected String getPluginWorkDir() throws Exception { - return getCurrentWorkingDir() + "/" + this.getClass().getSimpleName() + "/" + "plugins"; - } - - protected String getCurrentWorkingDir() throws Exception { - return System.getProperty("java.io.tmpdir"); - } - String getAmpsVersion(PluginDescriptor pluginDescriptor) { if (pluginDescriptor.getAmpsVersion() == null) { return "2.0"; @@ -283,7 +256,7 @@ public class MetadataBeanTest extends AbstractEJB3Test { InputStream in = null;
try { - String pluginDirPath = getPluginWorkDir(); + String pluginDirPath = getPluginScannerService().getAgentPluginDir(); File pluginDir = new File(pluginDirPath); pluginDir.mkdirs(); File jarFile = new File(pluginDir, jarName); diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/PluginManagerBeanTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/PluginManagerBeanTest.java index 36b0821..befaa1a 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/PluginManagerBeanTest.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/PluginManagerBeanTest.java @@ -55,9 +55,7 @@ public class PluginManagerBeanTest extends MetadataBeanTest { subjectMgr = LookupUtil.getSubjectManager(); pluginMgr = LookupUtil.getPluginManager();
- FileUtil.purge(new File(getPluginWorkDir()), true); - - preparePluginScannerService(); + FileUtil.purge(new File(getPluginScannerService().getAgentPluginDir()), true); }
@Override @@ -88,7 +86,7 @@ public class PluginManagerBeanTest extends MetadataBeanTest { createPluginJarFile("test-plugin3.jar", "plugin_3.xml"); createPluginJarFile("test-plugin3.1.jar", "plugin_3.1.xml");
- pluginScanner.startDeployment(); + getPluginScannerService().startDeployment(); }
@Test(dependsOnMethods = { "registerPlugins" }) diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/PluginScanningExtensionMetadataTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/PluginScanningExtensionMetadataTest.java index 5417305..1667dee 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/PluginScanningExtensionMetadataTest.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/PluginScanningExtensionMetadataTest.java @@ -56,8 +56,6 @@ public class PluginScanningExtensionMetadataTest extends MetadataBeanTest { protected void beforeMethod() throws Exception { super.beforeMethod();
- preparePluginScannerService(); - subjectMgr = LookupUtil.getSubjectManager(); resourceTypeMgr = LookupUtil.getResourceTypeManager();
@@ -80,8 +78,6 @@ public class PluginScanningExtensionMetadataTest extends MetadataBeanTest { } createdJarFiles.clear();
- unpreparePluginScannerService(); - super.afterMethod(); }
@@ -110,7 +106,7 @@ public class PluginScanningExtensionMetadataTest extends MetadataBeanTest { private void registerParentPluginV1() throws Exception { // register the plugin, load the new type and test to make sure its what we expect createdJarFiles.add(createPluginJarFile("parent-plugin.jar", "parent_plugin_v1.xml")); - this.pluginScanner.startDeployment(); // first time we need to scan so call startDeployment which will call scanAndRegister + getPluginScannerService().startDeployment(); // first time we need to scan so call startDeployment which will call scanAndRegister ResourceType resourceType = loadResourceTypeFully(TYPE_NAME_PARENT, PLUGIN_NAME_PARENT); assert resourceType.getName().equals(TYPE_NAME_PARENT); assert resourceType.getPlugin().equals(PLUGIN_NAME_PARENT); @@ -120,7 +116,7 @@ public class PluginScanningExtensionMetadataTest extends MetadataBeanTest { private void registerChild1PluginV1() throws Exception { // register the plugin, load the new type and test to make sure its what we expect createdJarFiles.add(createPluginJarFile("child1-plugin.jar", "child1_plugin_v1.xml")); - this.pluginScanner.scanAndRegister(); + getPluginScannerService().scanAndRegister(); ResourceType resourceType = loadResourceTypeFully(TYPE_NAME_CHILD1, PLUGIN_NAME_CHILD1); assert resourceType.getName().equals(TYPE_NAME_CHILD1); assert resourceType.getPlugin().equals(PLUGIN_NAME_CHILD1); @@ -137,7 +133,7 @@ public class PluginScanningExtensionMetadataTest extends MetadataBeanTest { private void registerChild2PluginV1() throws Exception { // register the plugin, load the new type and test to make sure its what we expect createdJarFiles.add(createPluginJarFile("child2-plugin.jar", "child2_plugin_v1.xml")); - this.pluginScanner.scanAndRegister(); + getPluginScannerService().scanAndRegister(); ResourceType resourceType = loadResourceTypeFully(TYPE_NAME_CHILD2, PLUGIN_NAME_CHILD2); assert resourceType.getName().equals(TYPE_NAME_CHILD2); assert resourceType.getPlugin().equals(PLUGIN_NAME_CHILD2); @@ -147,7 +143,7 @@ public class PluginScanningExtensionMetadataTest extends MetadataBeanTest { private void registerParentPluginV2() throws Exception { // register the plugin, load the new type and test to make sure its what we expect createdJarFiles.add(createPluginJarFile("parent-plugin.jar", "parent_plugin_v2.xml")); - this.pluginScanner.scanAndRegister(); + getPluginScannerService().scanAndRegister(); ResourceType resourceType = loadResourceTypeFully(TYPE_NAME_PARENT, PLUGIN_NAME_PARENT); assert resourceType.getName().equals(TYPE_NAME_PARENT); assert resourceType.getPlugin().equals(PLUGIN_NAME_PARENT); diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/test/UpdatePluginMetadataTestBase.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/test/UpdatePluginMetadataTestBase.java index ddf59f0..7c4fa43 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/test/UpdatePluginMetadataTestBase.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/metadata/test/UpdatePluginMetadataTestBase.java @@ -75,6 +75,7 @@ public class UpdatePluginMetadataTestBase extends AbstractEJB3Test { agentServiceContainer = prepareForTestAgents(); prepareMockAgentServiceContainer(); prepareScheduler(); + preparePluginScannerService();
pluginMgr = LookupUtil.getPluginManager(); resourceTypeManager = LookupUtil.getResourceTypeManager(); @@ -85,6 +86,7 @@ public class UpdatePluginMetadataTestBase extends AbstractEJB3Test { protected void afterMethod() throws Exception { cleanupTest();
+ unpreparePluginScannerService(); unprepareScheduler(); unprepareForTestAgents(); } diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java index 975efb8..d8db4b9 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java @@ -58,6 +58,7 @@ import org.rhq.core.util.stream.StreamUtil; import org.rhq.enterprise.server.RHQConstants; import org.rhq.enterprise.server.auth.SessionManager; import org.rhq.enterprise.server.core.comm.ServerCommunicationsServiceMBean; +import org.rhq.enterprise.server.core.plugin.PluginDeploymentScanner; import org.rhq.enterprise.server.core.plugin.PluginDeploymentScannerMBean; import org.rhq.enterprise.server.plugin.pc.ServerPluginService; import org.rhq.enterprise.server.plugin.pc.ServerPluginServiceMBean; @@ -292,9 +293,10 @@ public abstract class AbstractEJB3Test extends Arquillian { EnterpriseArchive testEar = ShrinkWrap.create(EnterpriseArchive.class, "rhq.ear"); EnterpriseArchive rhqEar = earResolver.artifact("org.rhq:rhq-enterprise-server-ear:ear:4.6.0-SNAPSHOT") .resolveAs(EnterpriseArchive.class).iterator().next(); - // merge rhq.ear into testEar but include only the EJB jars, the SAR, and the supporting libraries - testEar = testEar.merge(rhqEar, - Filters.include("/lib.*|/rhq.*ejb3\.jar.*|/rhq-enterprise-server-services-sar.*")); + // merge rhq.ear into testEar but include only the EJB jars and the supporting libraries. Note that we + // don't include the services sar because tests are responsible for prepare/unprepare of all required services, + // we don't want the production services performig any unexpected work. + testEar = testEar.merge(rhqEar, Filters.include("/lib.*|/rhq.*ejb3\.jar.*")); // remove startup beans and shutdown listeners, we don't want this to be a full server deployment. The tests // start/stop what they need, typically with test services or mocks. testEar.delete(ArchivePaths @@ -932,12 +934,33 @@ public abstract class AbstractEJB3Test extends Arquillian { }
/** + * Prepares a test deployment scanner with the following characteristics<br/>. + * - start() is called but startDeployment() is not called.<br/> + * - agentPluginDir is set to getTempDir() + "/plugins"<br/> + * - serverPluginDir is set to null (no scanning for server plugins)<br/> + * - scanPeriod is set to 9999999 (basically prevent autoscan)<br/> + */ + protected PluginDeploymentScannerMBean preparePluginScannerService() { + if (null != pluginScannerService) { + return pluginScannerService; + } + + PluginDeploymentScanner scanner = new PluginDeploymentScanner(); + String pluginDirPath = getTempDir() + "/plugins"; + scanner.setAgentPluginDir(pluginDirPath); // we don't want to scan for these + scanner.setServerPluginDir(null); // we don't want to scan for these + scanner.setScanPeriod("9999999"); // we want to manually scan - don't allow for auto-scan to happen + + return preparePluginScannerService(scanner); + } + + /** * Note that the standard plugin scanner service is deployed automatically with the test rhq ear, * this is only necessary if you want a custom service. * * @param scannerService */ - public void preparePluginScannerService(PluginDeploymentScannerMBean scannerService) { + public PluginDeploymentScannerMBean preparePluginScannerService(PluginDeploymentScannerMBean scannerService) { try { MBeanServer mbs = getPlatformMBeanServer(); if (mbs.isRegistered(PluginDeploymentScannerMBean.OBJECT_NAME)) { @@ -949,6 +972,8 @@ public abstract class AbstractEJB3Test extends Arquillian { pluginScannerService = scannerService; pluginScannerService.start();
+ return pluginScannerService; + } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e); @@ -998,7 +1023,7 @@ public abstract class AbstractEJB3Test extends Arquillian { * @throws Exception */ protected void writeObjects(String filename, Object... objects) throws Exception { - File file = new File(System.getProperty("java.io.tmpdir"), this.getClass().getName() + "-" + filename); + File file = new File(getTempDir(), "-" + filename); file.delete(); ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(file)); for (Object o : objects) { @@ -1021,7 +1046,7 @@ public abstract class AbstractEJB3Test extends Arquillian { ObjectInputStream ois = null;
try { - File file = new File(System.getProperty("java.io.tmpdir"), this.getClass().getName() + "-" + filename); + File file = new File(getTempDir(), "-" + filename); ois = new ObjectInputStream(new FileInputStream(file)); for (int i = 0; i < numObjects; ++i) { result.add(ois.readObject()); @@ -1040,8 +1065,15 @@ public abstract class AbstractEJB3Test extends Arquillian { * @return true if deleted, false otherwise. */ protected boolean deleteObjects(String filename) { - File file = new File(System.getProperty("java.io.tmpdir"), this.getClass().getName() + "-" + filename); + File file = new File(getTempDir(), "-" + filename); return file.delete(); }
+ /** + * @return a temp directory for testing that is specific to this test class. + */ + protected File getTempDir() { + return new File(System.getProperty("java.io.tmpdir") + "/rhq", this.getClass().getSimpleName()); + } + } diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/OldAbstractEJB3Test.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/OldAbstractEJB3Test.java deleted file mode 100644 index a8337b7..0000000 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/OldAbstractEJB3Test.java +++ /dev/null @@ -1,445 +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.server.test; - -import org.testng.AssertJUnit; - - -//import static org.rhq.test.JPAUtils.lookupEntityManager; -//import static org.rhq.test.JPAUtils.lookupTransactionManager; -// -//import java.sql.Connection; -//import java.sql.SQLException; -//import java.util.Hashtable; -//import java.util.Properties; -// -//import javax.management.MBeanServer; -//import javax.management.MBeanServerFactory; -//import javax.naming.InitialContext; -//import javax.naming.NamingException; -//import javax.persistence.EntityManager; -//import javax.transaction.TransactionManager; -// -//import org.hibernate.SessionFactory; -//import org.hibernate.stat.Statistics; -//import org.testng.AssertJUnit; -//import org.testng.annotations.AfterMethod; -//import org.testng.annotations.AfterSuite; -//import org.testng.annotations.BeforeMethod; -//import org.testng.annotations.BeforeSuite; -// -//import org.jboss.ejb3.embedded.EJB3StandaloneBootstrap; -//import org.jboss.ejb3.embedded.EJB3StandaloneDeployer; -//import org.jboss.mx.util.MBeanServerLocator; -// -//import org.rhq.core.db.DatabaseTypeFactory; -//import org.rhq.core.db.PostgresqlDatabaseType; -//import org.rhq.core.domain.auth.Subject; -//import org.rhq.core.domain.server.PersistenceUtility; -//import org.rhq.enterprise.server.RHQConstants; -//import org.rhq.enterprise.server.auth.SessionManager; -//import org.rhq.enterprise.server.content.ContentSourceManagerBean; -//import org.rhq.enterprise.server.core.comm.ServerCommunicationsServiceMBean; -//import org.rhq.enterprise.server.core.plugin.PluginDeploymentScanner; -//import org.rhq.enterprise.server.core.plugin.PluginDeploymentScannerMBean; -//import org.rhq.enterprise.server.plugin.pc.ServerPluginService; -//import org.rhq.enterprise.server.plugin.pc.ServerPluginServiceMBean; -//import org.rhq.enterprise.server.scheduler.SchedulerService; -//import org.rhq.enterprise.server.scheduler.SchedulerServiceMBean; -//import org.rhq.enterprise.server.util.LookupUtil; -// -//// -/////** -//// * This is the abstract test base for server jar tests. -//// * -//// * @author Greg Hinkle -//// */ -public abstract class OldAbstractEJB3Test extends AssertJUnit { - // - // private static EJB3StandaloneDeployer deployer; - // private static Statistics stats; - // @SuppressWarnings("unused") - // private static long start; // see endTest() if you want to output this - // private SchedulerService schedulerService; - // private ServerPluginService serverPluginService; - // private MBeanServer dummyJBossMBeanServer; - // private PluginDeploymentScannerMBean pluginScannerService; - // - // - // //@BeforeSuite(groups = {"integration.ejb3","PERF"}) // TODO investigate again - // @BeforeSuite(alwaysRun = true) - // public static void startupEmbeddedJboss() throws Exception { - // // The embeddedDeployment property needs to be set for running tests - // // with the embedded container. It is set in the surefire configuration - // // in pom.xml but setting here makes it easier to run tests directly - // // from your IDE. - // // - // // jsanda - // System.setProperty("embeddedDeployment", "true"); - // - // // Setting content location to the tmp dir - // System.setProperty(ContentSourceManagerBean.FILESYSTEM_PROPERTY, System.getProperty("java.io.tmpdir")); - // - // System.out.println("Starting JBoss EJB3 Embedded Container..."); - // String deployDir = System.getProperty("deploymentDirectory", "target/classes"); - // System.out.println("Loading EJB3 deployments from directory: " + deployDir); - // try { - // EJB3StandaloneBootstrap.boot(null); - // // EJB3StandaloneBootstrap.scanClasspath(); - // - // System.err.println("...... embedded container booted...."); - // - // deployer = EJB3StandaloneBootstrap.createDeployer(); - // - // deployer.setClassLoader(AbstractEJB3Test.class.getClassLoader()); - // System.err.println("...... embedded container classloader set...."); - // - // deployer.getArchivesByResource().add("META-INF/persistence.xml"); - // System.err.println("...... embedded container persistence xml deployed...."); - // - // deployer.getArchivesByResource().add("META-INF/ejb-jar.xml"); - // System.err.println("...... embedded container ejb-jar xml deployed...."); - // - // EJB3StandaloneBootstrap.deployXmlResource("jboss-jms-beans.xml"); - // System.err.println("...... embedded container jboss-jms-beans xml deployed...."); - // - // EJB3StandaloneBootstrap.deployXmlResource("rhq-mdb-beans.xml"); - // System.err.println("...... embedded container rhq-mdb-beans xml deployed...."); - // - // /* - // * File core = new File(deployDir, "on-core-domain-ejb.ejb3"); if (!core.exists()) - // * System.err.println("Deployment directory does not exist: " + core.getAbsolutePath()); - // * deployer.getArchives().add(core.toURI().toURL()); - // * - // * File server = new File(deployDir, "on-enterprise-server-ejb.ejb3"); if (!server.exists()) - // * System.err.println("Deployment directory does not exist: " + server.getAbsolutePath()); - // * deployer.getArchives().add(server.toURI().toURL()); - // * - // */ - // - // //deployer.setKernel(EJB3StandaloneBootstrap.getKernel()); - // deployer.create(); - // System.err.println("...... deployer created...."); - // - // deployer.start(); - // System.err.println("...... deployer started...."); - // - // System.err.println("...... start statistics"); - // SessionFactory sessionFactory = PersistenceUtility.getHibernateSession(getEntityManager()) - // .getSessionFactory(); - // stats = sessionFactory.getStatistics(); - // stats.setStatisticsEnabled(true); - // - // System.err.println("...... embedded container initialized and ready for testing...."); - // - // } catch (Throwable t) { - // // Catch RuntimeExceptions and Errors and dump their stack trace, because Surefire will completely swallow them - // // and throw a cryptic NPE (see http://jira.codehaus.org/browse/SUREFIRE-157)! - // t.printStackTrace(); - // throw new RuntimeException(t); - // } - // } - // - // //@Configuration(groups = "integration.ejb3", afterSuite = true) - // @AfterSuite(alwaysRun = true) - // public static void shutdownEmbeddedJboss() { - // System.out.println("Stopping JBoss EJB3 Embedded Container..."); - // - // System.err.println("!!! Any errors occurring after this point !!!"); - // System.err.println("!!! occurred during embedded server shutdown !!!"); - // System.err.println("!!! and are probably not a real problem. !!!"); - // if (deployer != null) { - // try { - // deployer.stop(); - // deployer.destroy(); - // deployer = null; - // } catch (Throwable t) { - // System.err.println("Failed to stop embedded deployer"); - // t.printStackTrace(System.err); - // } - // } - // EJB3StandaloneBootstrap.shutdown(); - // } - // - // @BeforeMethod - // public static void startTest() { - // if (DatabaseTypeFactory.getDefaultDatabaseType() == null) { - // try { - // Connection conn = getConnection(); - // DatabaseTypeFactory.setDefaultDatabaseType(DatabaseTypeFactory.getDatabaseType(conn)); - // } catch (Exception e) { - // System.err.println("!!! WARNING !!! cannot set default database type, some tests may fail"); - // e.printStackTrace(); - // } - // } - // - // if (stats != null) - // start = stats.getQueryExecutionCount(); - // else - // start = 0; - // } - // - // public static Connection getConnection() throws SQLException { - // return LookupUtil.getDataSource().getConnection(); - // } - // - // @AfterMethod - // public static void endTest() { - // //System.out.println("Connections used: " + (stats.getQueryExecutionCount() - start)); - // } - // - // public TransactionManager getTransactionManager() { - // return lookupTransactionManager(); - // } - // - // public static EntityManager getEntityManager() { - // return lookupEntityManager(); - // } - // - // public static InitialContext getInitialContext() { - // Hashtable<String, String> env = new Hashtable<String, String>(); - // env.put("java.naming.factory.initial", "org.jnp.interfaces.LocalOnlyContextFactory"); - // env.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces"); - // try { - // return new InitialContext(env); - // } catch (NamingException e) { - // e.printStackTrace(); - // throw new RuntimeException("Failed to load initial context", e); - // } - // } - // - // public boolean isPostgres() throws Exception { - // return DatabaseTypeFactory.getDatabaseType(getInitialContext(), RHQConstants.DATASOURCE_JNDI_NAME) instanceof PostgresqlDatabaseType; - // } - // - // /** - // * This creates a session for the given user and associates that session with the subject. You can test the security - // * annotations by creating sessions for different users with different permissions. - // * - // * @param subject a JON subject - // * @return the session activated subject, a copy of the subject passed in. - // */ - // public Subject createSession(Subject subject) { - // return SessionManager.getInstance().put(subject); - // } - // - // /** - // * Returns an MBeanServer that simulates the JBossAS MBeanServer. - // * - // * @return MBeanServer instance - // */ - // public MBeanServer getJBossMBeanServer() { - // if (dummyJBossMBeanServer == null) { - // dummyJBossMBeanServer = MBeanServerFactory.createMBeanServer("jboss"); - // MBeanServerLocator.setJBoss(dummyJBossMBeanServer); - // } - // - // return dummyJBossMBeanServer; - // } - // - // public void releaseJBossMBeanServer() { - // if (dummyJBossMBeanServer != null) { - // MBeanServerFactory.releaseMBeanServer(dummyJBossMBeanServer); - // dummyJBossMBeanServer = null; - // } - // } - // - // /** - // * If you need to test round trips from server to agent and back, you first must install the server communications - // * service that houses all the agent clients. Call this method and add your test agent services to the public fields - // * in the returned object. - // * - // * @return the object that will house your test agent service impls and the agent clients. - // * - // * @throws RuntimeException - // */ - // public TestServerCommunicationsService prepareForTestAgents() { - // try { - // MBeanServer mbs = getJBossMBeanServer(); - // if (mbs.isRegistered(ServerCommunicationsServiceMBean.OBJECT_NAME)) { - // mbs.unregisterMBean(ServerCommunicationsServiceMBean.OBJECT_NAME); - // } - // TestServerCommunicationsService testAgentContainer = new TestServerCommunicationsService(); - // mbs.registerMBean(testAgentContainer, ServerCommunicationsServiceMBean.OBJECT_NAME); - // return testAgentContainer; - // } catch (Exception e) { - // throw new RuntimeException(e); - // } - // } - // - // /** - // * Call this after your tests have finished. You only need to call this if your test previously called - // * {@link #prepareForTestAgents()}. - // */ - // public void unprepareForTestAgents() { - // unprepareForTestAgents(false); - // } - // - // public void unprepareForTestAgents(boolean beanOnly) { - // try { - // if (beanOnly) { - // MBeanServer mbs = getJBossMBeanServer(); - // if (mbs.isRegistered(ServerCommunicationsServiceMBean.OBJECT_NAME)) { - // mbs.unregisterMBean(ServerCommunicationsServiceMBean.OBJECT_NAME); - // } - // } else { - // releaseJBossMBeanServer(); - // } - // } catch (Exception e) { - // throw new RuntimeException(e); - // } - // } - // - // /** - // * If you need to test server plugins, you must first prepare the server plugin service. - // * After this returns, the caller must explicitly start the PC by using the appropriate API - // * on the given mbean; this method will only start the service, it will NOT start the master PC. - // * - // * @param testServiceMBean the object that will house your test server plugins - // * - // * @throws RuntimeException - // */ - // public void prepareCustomServerPluginService(ServerPluginService testServiceMBean) { - // try { - // MBeanServer mbs = getJBossMBeanServer(); - // testServiceMBean.start(); - // mbs.registerMBean(testServiceMBean, ServerPluginServiceMBean.OBJECT_NAME); - // serverPluginService = testServiceMBean; - // return; - // } catch (Exception e) { - // throw new RuntimeException(e); - // } - // } - // - // public void unprepareServerPluginService() throws Exception { - // unprepareServerPluginService(false); - // } - // - // public void unprepareServerPluginService(boolean beanOnly) throws Exception { - // if (serverPluginService != null) { - // serverPluginService.stopMasterPluginContainer(); - // serverPluginService.stop(); - // if (beanOnly) { - // MBeanServer mbs = getJBossMBeanServer(); - // if (mbs.isRegistered(ServerPluginService.OBJECT_NAME)) { - // getJBossMBeanServer().unregisterMBean(ServerPluginService.OBJECT_NAME); - // } - // if (mbs.isRegistered(ServerPluginServiceMBean.OBJECT_NAME)) { - // getJBossMBeanServer().unregisterMBean(ServerPluginServiceMBean.OBJECT_NAME); - // } - // - // } else { - // releaseJBossMBeanServer(); - // } - // serverPluginService = null; - // } - // } - // - // public SchedulerService getSchedulerService() { - // return schedulerService; - // } - // - // public void prepareScheduler() { - // try { - // if (schedulerService != null) { - // return; - // } - // - // Properties quartzProps = new Properties(); - // quartzProps.load(this.getClass().getClassLoader().getResourceAsStream("test-scheduler.properties")); - // - // schedulerService = new SchedulerService(); - // schedulerService.setQuartzProperties(quartzProps); - // schedulerService.start(); - // getJBossMBeanServer().registerMBean(schedulerService, SchedulerServiceMBean.SCHEDULER_MBEAN_NAME); - // schedulerService.startQuartzScheduler(); - // return; - // } catch (Exception e) { - // e.printStackTrace(); - // throw new RuntimeException(e); - // } - // } - // - // public void unprepareScheduler() throws Exception { - // unprepareScheduler(false); - // } - // - // public void unprepareScheduler(boolean beanOnly) throws Exception { - // if (schedulerService != null) { - // schedulerService.stop(); - // if (beanOnly) { - // MBeanServer mbs = getJBossMBeanServer(); - // if (mbs.isRegistered(SchedulerServiceMBean.SCHEDULER_MBEAN_NAME)) { - // getJBossMBeanServer().unregisterMBean(SchedulerServiceMBean.SCHEDULER_MBEAN_NAME); - // } - // } else { - // releaseJBossMBeanServer(); - // } - // - // schedulerService = null; - // } - // } - // - // public PluginDeploymentScannerMBean getPluginScannerService() { - // return pluginScannerService; - // } - // - // protected void preparePluginScannerService() { - // preparePluginScannerService(null); - // } - // - // public void preparePluginScannerService(PluginDeploymentScannerMBean scannerService) { - // try { - // if (scannerService == null) { - // scannerService = new PluginDeploymentScanner(); - // } - // MBeanServer mbs = getJBossMBeanServer(); - // mbs.registerMBean(scannerService, PluginDeploymentScannerMBean.OBJECT_NAME); - // pluginScannerService = scannerService; - // return; - // } catch (Exception e) { - // e.printStackTrace(); - // throw new RuntimeException(e); - // } - // } - // - // public void unpreparePluginScannerService() throws Exception { - // unpreparePluginScannerService(false); - // } - // - // public void unpreparePluginScannerService(boolean beanOnly) throws Exception { - // if (pluginScannerService != null) { - // pluginScannerService.stop(); - // if (beanOnly) { - // MBeanServer mbs = getJBossMBeanServer(); - // if (mbs.isRegistered(PluginDeploymentScannerMBean.OBJECT_NAME)) { - // getJBossMBeanServer().unregisterMBean(PluginDeploymentScannerMBean.OBJECT_NAME); - // } - // } else { - // releaseJBossMBeanServer(); - // } - // - // pluginScannerService = null; - // } - // } - // - // protected void executeInTransaction(TransactionCallback callback) { - // executeInTransaction(callback); - // } -} diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/StandardServerPluginService.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/StandardServerPluginService.java index 5f5692f..adcde42 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/StandardServerPluginService.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/StandardServerPluginService.java @@ -84,7 +84,7 @@ public class StandardServerPluginService extends ServerPluginService implements public List<Class<? extends AbstractTypeServerPluginContainer>> pluginContainerClasses;
public StandardServerPluginService() { - File dir = new File(System.getProperty("java.io.tmpdir"), "test-server-plugins"); + File dir = new File(System.getProperty("java.io.tmpdir") + "/rhq", this.getClass().getSimpleName()); this.masterConfig = new MasterServerPluginContainerConfiguration(dir, dir, dir, null); pluginContainerClasses = new ArrayList<Class<? extends AbstractTypeServerPluginContainer>>(); pluginContainerClasses.add(AlertServerPluginContainer.class); diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/TestServerPluginService.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/TestServerPluginService.java index c28256b..a8b134e 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/TestServerPluginService.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/TestServerPluginService.java @@ -46,7 +46,7 @@ public class TestServerPluginService extends ServerPluginService implements Test
public TestServerPluginService() { // build the config at constructor time so tests have it even before the PC is initialized - File dir = new File(System.getProperty("java.io.tmpdir"), "test-server-plugins"); + File dir = new File(System.getProperty("java.io.tmpdir") + "/rhq", this.getClass().getSimpleName()); this.masterConfig = new MasterServerPluginContainerConfiguration(dir, dir, dir, null); }
commit 51ed8e9ea125c4e33685573751af7c3e73a8115f Merge: dadcd3f 943cc78 Author: John Mazzitelli mazz@redhat.com Date: Fri Nov 30 21:02:24 2012 -0500
Merge remote-tracking branch 'origin/master' into rhq-on-as7
commit dadcd3fbff9d883c7d6a166ad42687c26c9b5a70 Author: John Mazzitelli mazz@redhat.com Date: Fri Nov 30 17:11:20 2012 -0500
[BZ 882280] purge old perspective plugin from the DB during db upgrade
diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml index d47e864..c110636 100644 --- a/modules/core/dbutils/pom.xml +++ b/modules/core/dbutils/pom.xml @@ -17,7 +17,7 @@ <description>Database schema setup, upgrade and other utilities</description>
<properties> - <db.schema.version>2.127</db.schema.version> + <db.schema.version>2.128</db.schema.version> <rhq.ds.type-mapping>${rhq.test.ds.type-mapping}</rhq.ds.type-mapping> <rhq.ds.server-name>${rhq.test.ds.server-name}</rhq.ds.server-name> <rhq.ds.db-name>${rhq.test.ds.db-name}</rhq.ds.db-name> diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml index 7188198..19ac9dd 100644 --- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml +++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml @@ -30,8 +30,8 @@ <!-- Empty initial schema to avoid install failure on default latest schema version --> </schemaSpec>
- <!-- 2.1 through 2.69 removed, no longer needed as these versions are not in use --> - + <!-- 2.1 through 2.69 removed, no longer needed as these versions are not in use --> + <schemaSpec version="2.70"> <schema-addColumn table="RHQ_ALERT" column="ACK_TIME" columnType="LONG" /> <schema-addColumn table="RHQ_ALERT" column="ACK_SUBJECT" precision="100" columnType="VARCHAR2" /> @@ -1267,10 +1267,10 @@ UPDATE RHQ_RESOURCE_TYPE SET DELETED = false </statement> - <statement targetDBVendor="oracle" desc="Set deleted flag for existing resources types to false"> + <statement targetDBVendor="oracle" desc="Set deleted flag for existing resources types to false"> UPDATE RHQ_RESOURCE_TYPE SET DELETED = 0 - </statement> + </statement> </schema-directSQL> <schema-alterColumn table="RHQ_RESOURCE_TYPE" column="DELETED" nullable="FALSE" /> </schemaSpec> @@ -1351,14 +1351,14 @@ <schemaSpec version="2.105"> <schema-addColumn table="RHQ_REPO" column="OWNER_ID" columnType="INTEGER" /> <schema-addColumn table="RHQ_REPO" column="IS_PRIVATE" columnType="BOOLEAN" /> - <schema-directSQL> + <schema-directSQL> <statement targetDBVendor="postgresql" desc="Set is_private flag for existing repos to false"> UPDATE RHQ_REPO SET IS_PRIVATE = false </statement> <statement targetDBVendor="oracle" desc="Set is_private flag for existing repos to false"> UPDATE RHQ_REPO SET IS_PRIVATE = 0 </statement> - </schema-directSQL> + </schema-directSQL> <schema-alterColumn table="RHQ_REPO" column="IS_PRIVATE" nullable="FALSE"/> <schema-directSQL> <statement desc="Creating OWNER_ID foreign key relation on RHQ_REPO"> @@ -1970,7 +1970,7 @@ </schema-directSQL> </schemaSpec>
- <!-- Remove unnecessary tables for RHQ on AS7 --> + <!-- Remove unnecessary tables for RHQ on AS7 --> <schemaSpec version="2.127"> <schema-dropTable table="JMS_MESSAGES" ignoreError="true" /> <schema-dropTable table="JMS_TRANSACTIONS" ignoreError="true" /> @@ -1978,7 +1978,16 @@ <schema-dropTable table="JMS_ROLES" ignoreError="true" /> <schema-dropTable table="JMS_SUBSCRIPTIONS" ignoreError="true" /> </schemaSpec> - + + <!-- The perspective server plugin type has been removed - delete perspective plugin from DB --> + <schemaSpec version="2.128"> + <schema-directSQL> + <statement> + DELETE FROM RHQ_PLUGIN WHERE NAME = 'CorePerspective' + </statement> + </schema-directSQL> + </schemaSpec> + </dbupgrade> </target> </project>
commit b1fcd4e34d014b7fef9b469436e92566e4512053 Author: John Mazzitelli mazz@redhat.com Date: Fri Nov 30 17:00:57 2012 -0500
windows installer script for the new installer
diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-installer.bat b/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-installer.bat new file mode 100644 index 0000000..81d83ad --- /dev/null +++ b/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-installer.bat @@ -0,0 +1,161 @@ +@echo off + +rem =========================================================================== +rem RHQ Server Windows Install Script +rem +rem This file is used to complete the installation of the RHQ Server on a +rem Windows platform. +rem +rem This script is customizable by setting the following environment variables: +rem +rem RHQ_SERVER_DEBUG - If this is defined, the script will emit debug +rem messages. +rem If not set or set to "false", debug is turned off. +rem +rem RHQ_SERVER_HOME - Defines where the Server's home install directory is. +rem If not defined, it will be assumed to be the parent +rem directory of the directory where this script lives. +rem +rem +rem RHQ_SERVER_JAVA_HOME - The location of the JRE that the Server will +rem use. This will be ignored if +rem RHQ_SERVER_JAVA_EXE_FILE_PATH is set. +rem If this and RHQ_SERVER_JAVA_EXE_FILE_PATH are +rem not set, the Server's embedded JRE will be used. +rem +rem RHQ_SERVER_JAVA_EXE_FILE_PATH - Defines the full path to the Java +rem executable to use. If this is set, +rem RHQ_SERVER_JAVA_HOME is ignored. +rem If this is not set, then +rem %RHQ_SERVER_JAVA_HOME%\bin\java.exe +rem is used. If this and +rem RHQ_SERVER_JAVA_HOME are not set, the +rem Server's embedded JRE will be used. +rem +rem RHQ_SERVER_INSTALLER_JAVA_OPTS - Java VM command line options to be +rem passed into the Java VM. If this is not defined +rem this script will pass in a default set of options. +rem If you only want to add options to the defaults, +rem then you will want to use +rem RHQ_SERVER_INSTALLER_ADDITIONAL_JAVA_OPTS instead. +rem +rem RHQ_SERVER_INSTALLER_ADDITIONAL_JAVA_OPTS - additional Java VM command +rem line options to be passed into the VM. +rem This is added to +rem RHQ_SERVER_INSTALLER_JAVA_OPTS; it +rem is mainly used to augment the +rem default set of options. This can be +rem left unset if it is not needed. +rem +rem If the embedded JRE is to be used but is not available, the fallback +rem JRE to be used will be determined by the JAVA_HOME environment variable. +rem =========================================================================== + +setlocal + +rem if debug variable is set, it is assumed to be on, unless its value is false +if "%RHQ_SERVER_DEBUG%" == "false" ( + set RHQ_SERVER_DEBUG= +) + +rem ---------------------------------------------------------------------- +rem Change directory so the current directory is the Server home. +rem ---------------------------------------------------------------------- + +set RHQ_SERVER_BIN_DIR_PATH=%~dp0 + +if not defined RHQ_SERVER_HOME ( + cd "%RHQ_SERVER_BIN_DIR_PATH%.." +) else ( + cd "%RHQ_SERVER_HOME%" || ( + echo Cannot go to the RHQ_SERVER_HOME directory: %RHQ_SERVER_HOME% + exit /B 1 + ) +) + +set RHQ_SERVER_HOME=%CD% + +if defined RHQ_SERVER_DEBUG echo RHQ_SERVER_HOME: %RHQ_SERVER_HOME% + +rem ---------------------------------------------------------------------- +rem Find the Java executable and verify we have a VM available. +rem ---------------------------------------------------------------------- + +if not defined RHQ_SERVER_JAVA_EXE_FILE_PATH ( + if not defined RHQ_SERVER_JAVA_HOME call :prepare_embedded_jre +) + +if not defined RHQ_SERVER_JAVA_EXE_FILE_PATH set RHQ_SERVER_JAVA_EXE_FILE_PATH=%RHQ_SERVER_JAVA_HOME%\bin\java.exe + +if defined RHQ_SERVER_DEBUG echo RHQ_SERVER_JAVA_HOME: %RHQ_SERVER_JAVA_HOME% +if defined RHQ_SERVER_DEBUG echo RHQ_SERVER_JAVA_EXE_FILE_PATH: %RHQ_SERVER_JAVA_EXE_FILE_PATH% + +if not exist "%RHQ_SERVER_JAVA_EXE_FILE_PATH%" ( + echo There is no JVM available. + echo Please set RHQ_SERVER_JAVA_HOME or RHQ_SERVER_JAVA_EXE_FILE_PATH appropriately. + exit /B 1 +) + +if not exist "%RHQ_SERVER_HOME%\jbossas\jboss-modules.jar" ( + echo ERROR! RHQ_SERVER_HOME is not pointing to a valid RHQ instance + echo Missing %RHQ_SERVER_HOME%\jboss-modules.jar + exit /B 1 +) + +rem ---------------------------------------------------------------------- +rem Determine the logs directory +rem ---------------------------------------------------------------------- + +set _LOG_DIR_PATH=%RHQ_SERVER_HOME%\logs + +rem ---------------------------------------------------------------------- +rem Prepare the VM command line options to be passed in +rem ---------------------------------------------------------------------- + +if not defined RHQ_SERVER_INSTALLER_JAVA_OPTS set RHQ_SERVER_INSTALLER_JAVA_OPTS=-Xms512M -Xmx512M -XX:PermSize=128M -XX:MaxPermSize=128M -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true + +rem Add the JVM opts that we always want to specify, whether or not the user set RHQ_SERVER_INSTALLER_JAVA_OPTS. +if defined RHQ_SERVER_DEBUG set _RHQ_LOGLEVEL=DEBUG +if not defined RHQ_SERVER_DEBUG set _RHQ_LOGLEVEL=INFO +set RHQ_SERVER_INSTALLER_JAVA_OPTS=%RHQ_SERVER_INSTALLER_JAVA_OPTS% -Djava.awt.headless=true -Drhq.server.properties-file=%RHQ_SERVER_HOME%\bin\rhq-server.properties -Drhq.server.installer.logdir=%RHQ_SERVER_HOME%\logs -Drhq.server.installer.loglevel=%_RHQ_LOGLEVEL% + +rem Sample JPDA settings for remote socket debugging +rem RHQ_SERVER_INSTALLER_JAVA_OPTS=%RHQ_SERVER_INSTALLER_JAVA_OPTS% -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y + +if defined RHQ_SERVER_DEBUG echo RHQ_SERVER_INSTALLER_JAVA_OPTS: %RHQ_SERVER_INSTALLER_JAVA_OPTS% +if defined RHQ_SERVER_DEBUG echo RHQ_SERVER_INSTALLER_ADDITIONAL_JAVA_OPTS: %RHQ_SERVER_INSTALLER_ADDITIONAL_JAVA_OPTS% + +rem ---------------------------------------------------------------------- +rem We need to add our own modules to the core set of JBossAS modules. +rem ---------------------------------------------------------------------- +set _RHQ_MODULES_PATH=%RHQ_SERVER_HOME%\modules +set _INTERNAL_MODULES_PATH=%RHQ_SERVER_HOME%\jbossas\modules +set _JBOSS_MODULEPATH=%_RHQ_MODULES_PATH%;%_INTERNAL_MODULES_PATH% +if defined RHQ_SERVER_DEBUG echo _JBOSS_MODULEPATH: %_JBOSS_MODULEPATH% + +echo Starting RHQ Server installer ... + +rem start the AS instance with our main installer module +%RHQ_SERVER_JAVA_EXE_FILE_PATH% %RHQ_SERVER_INSTALLER_JAVA_OPTS% %RHQ_SERVER_INSTALLER_ADDITIONAL_JAVA_OPTS% -jar %RHQ_SERVER_HOME%\jbossas\jboss-modules.jar -mp %_JBOSS_MODULEPATH% org.rhq.rhq-installer-util %* + +goto :done + +rem ---------------------------------------------------------------------- +rem CALL subroutine that prepares to use the embedded JRE +rem ---------------------------------------------------------------------- + +:prepare_embedded_jre +set RHQ_SERVER_JAVA_HOME=%RHQ_SERVER_HOME%\jre +if defined RHQ_SERVER_DEBUG echo Using the embedded JRE +if not exist "%RHQ_SERVER_JAVA_HOME%" ( + if defined RHQ_SERVER_DEBUG echo No embedded JRE found - will try to use JAVA_HOME: %JAVA_HOME% + set RHQ_SERVER_JAVA_HOME=%JAVA_HOME% +) +goto :eof + +rem ---------------------------------------------------------------------- +rem CALL subroutine that exits this script normally +rem ---------------------------------------------------------------------- + +:done +endlocal
commit 54d5bcbe908c2ab6fad13cc1f641d66c7a35ad11 Merge: b396842 48ca15b Author: John Mazzitelli mazz@redhat.com Date: Fri Nov 30 15:43:06 2012 -0500
Merge remote-tracking branch 'origin/master' into rhq-on-as7
commit b39684227421d5a09fe0ab5d0b932d45179fefc2 Author: John Mazzitelli mazz@redhat.com Date: Fri Nov 30 15:39:20 2012 -0500
all a user to point to an external JBossAS installation via JBOSS_HOME or RHQ_SERVER_JBOSS_HOME
diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-server.sh b/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-server.sh index dc93347..e917230 100644 --- a/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-server.sh +++ b/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-server.sh @@ -25,6 +25,13 @@ # If not defined, it will be assumed to be the parent # directory of the directory where this script lives. # +# RHQ_SERVER_JBOSS_HOME - The location of the AS instance that will +# host RHQ. If this is set, it overrides any +# JBOSS_HOME that might be set. If this not +# set, JBOSS_HOME is used as a fallback. If +# neither is set, it is assumed the AS bundled +# under RHQ_SERVER_HOME/jbossas is to be used. +# # RHQ_SERVER_JAVA_HOME - The location of the JRE that the server will # use. This will be ignored if # RHQ_SERVER_JAVA_EXE_FILE_PATH is set. @@ -107,17 +114,6 @@ #export LD_LIBRARY_PATH="$JPROFILER_HOME/bin/linux-x64"
# ---------------------------------------------------------------------- -# Make sure we unset any lingering JBossAS environment variables that -# were set in the user's environment. This might happen if the user -# has an external JBossAS configured. -# ---------------------------------------------------------------------- - -unset JBOSS_HOME -unset RUN_CONF -unset JAVAC_JAR -unset JBOSS_CLASSPATH - -# ---------------------------------------------------------------------- # Dumps a message iff debug mode is enabled # ----------------------------------------------------------------------
@@ -182,6 +178,22 @@ remove_pid_files () }
# ---------------------------------------------------------------------- +# Unset any lingering JBossAS environment variables that were set in +# the user's environment. This might happen if the user has an external +# JBossAS installed and configured but doesn't want RHQ to use it. +# ---------------------------------------------------------------------- +unset_jboss_as_env () +{ + unset JBOSS_HOME + unset RUN_CONF + unset JAVAC_JAR + unset JBOSS_CLASSPATH + unset JBOSS_BASE_DIR + unset JBOSS_LOG_DIR + unset JBOSS_CONFIG_DIR +} + +# ---------------------------------------------------------------------- # Determine what specific platform we are running on. # Set some platform-specific variables. # ---------------------------------------------------------------------- @@ -199,6 +211,11 @@ case "`uname`" in ;; esac
+# only certain platforms support the -e argument for readlink +if [ -n "${_LINUX}${_SOLARIS}${_CYGWIN}" ]; then + _READLINK_ARG="-e" +fi + # ---------------------------------------------------------------------- # Determine the RHQ Server installation directory. # If RHQ_SERVER_HOME is not defined, we will assume we are running @@ -206,10 +223,6 @@ esac # ----------------------------------------------------------------------
if [ -z "$RHQ_SERVER_HOME" ]; then - if [ -n "${_LINUX}${_SOLARIS}${_CYGWIN}" ]; then - # only certain platforms support the -e argument for readlink - _READLINK_ARG="-e" - fi _DOLLARZERO=`readlink $_READLINK_ARG "$0" 2>/dev/null || echo "$0"` RHQ_SERVER_HOME=`dirname "$_DOLLARZERO"`/.. else @@ -225,9 +238,45 @@ RHQ_SERVER_HOME=`pwd`
debug_msg "RHQ_SERVER_HOME: $RHQ_SERVER_HOME"
-if [ ! -f "${RHQ_SERVER_HOME}/jbossas/jboss-modules.jar" ]; then - echo "ERROR! RHQ_SERVER_HOME is not pointing to a valid RHQ Server" - echo "Missing ${RHQ_SERVER_HOME}/jbossas/jboss-modules.jar" +# ---------------------------------------------------------------------- +# Determine what JBossAS instance to use. +# If RHQ_SERVER_JBOSS_HOME and JBOSS_HOME are both not defined, we will +# assume we are to run the embedded AS instance from the RHQ +# installation directory - RHQ_SERVER_HOME/jbossas +# ---------------------------------------------------------------------- + +if [ -z "$RHQ_SERVER_JBOSS_HOME" ]; then + if [ -z "$JBOSS_HOME" ]; then + RHQ_SERVER_JBOSS_HOME="${RHQ_SERVER_HOME}/jbossas" + # Unset any lingering JBossAS environment variables that we don't want. + # These could be in the user's environment for an external AS install. + unset_jboss_as_env + else + if [ ! -d "$JBOSS_HOME" ]; then + echo "ERROR! JBOSS_HOME is not pointing to a valid AS directory" + echo "JBOSS_HOME: $JBOSS_HOME" + exit 1 + fi + RHQ_SERVER_JBOSS_HOME="${JBOSS_HOME}" + fi +else + if [ ! -d "$RHQ_SERVER_JBOSS_HOME" ]; then + echo "ERROR! RHQ_SERVER_JBOSS_HOME is not pointing to a valid AS directory" + echo "RHQ_SERVER_JBOSS_HOME: $RHQ_SERVER_JBOSS_HOME" + exit 1 + fi + unset_jboss_as_env +fi + +cd "$RHQ_SERVER_JBOSS_HOME" +RHQ_SERVER_JBOSS_HOME=`pwd` + +debug_msg "RHQ_SERVER_JBOSS_HOME: $RHQ_SERVER_JBOSS_HOME" + + +if [ ! -f "${RHQ_SERVER_JBOSS_HOME}/jboss-modules.jar" ]; then + echo "ERROR! RHQ_SERVER_JBOSS_HOME is not pointing to a valid RHQ Server" + echo "Missing ${RHQ_SERVER_JBOSS_HOME}/jboss-modules.jar" exit 1 fi
@@ -242,7 +291,10 @@ if [ -z "$JAVA_HOME" ]; then fi fi
+# ---------------------------------------------------------------------- # create the logs directory +# ---------------------------------------------------------------------- + _LOG_DIR_PATH="${RHQ_SERVER_HOME}/logs" if [ -n "$_CYGWIN" ]; then _LOG_DIR_PATH=`cygpath --windows --path "$_LOG_DIR_PATH"` @@ -335,7 +387,7 @@ _CMDLINE_OPTS="$RHQ_SERVER_CMDLINE_OPTS $RHQ_SERVER_ADDITIONAL_CMDLINE_OPTS" # JBOSS_MODULEPATH tells standalone.sh what to use. # ---------------------------------------------------------------------- _RHQ_MODULES_PATH="${RHQ_SERVER_HOME}/modules" -_INTERNAL_MODULES_PATH="${RHQ_SERVER_HOME}/jbossas/modules" +_INTERNAL_MODULES_PATH="${RHQ_SERVER_JBOSS_HOME}/modules" if [ -n "$_CYGWIN" ]; then _RHQ_MODULES_PATH=`cygpath --windows --path "$_RHQ_MODULES_PATH"` _INTERNAL_MODULES_PATH=`cygpath --windows --path "$_INTERNAL_MODULES_PATH"` @@ -348,7 +400,7 @@ debug_msg "JBOSS_MODULEPATH: $JBOSS_MODULEPATH" # Now find the JBossAS standalone.sh script # ----------------------------------------------------------------------
-_JBOSS_RUN_SCRIPT="${RHQ_SERVER_HOME}/jbossas/bin/standalone.sh" +_JBOSS_RUN_SCRIPT="${RHQ_SERVER_JBOSS_HOME}/bin/standalone.sh"
if [ ! -f "$_JBOSS_RUN_SCRIPT" ]; then echo "ERROR! Cannot find the JBossAS run script" @@ -392,7 +444,7 @@ case "$1" in echo "$$" > "$_JVM_PIDFILE"
# start the server, making sure its working directory is the JBossAS bin directory - cd "${RHQ_SERVER_HOME}/jbossas/bin" + cd "${RHQ_SERVER_JBOSS_HOME}/bin" "$_JBOSS_RUN_SCRIPT" $_CMDLINE_OPTS
_JBOSS_STATUS=$? @@ -416,7 +468,7 @@ case "$1" in export JBOSS_PIDFILE
# start the server, making sure its working directory is the JBossAS bin directory - cd "${RHQ_SERVER_HOME}/jbossas/bin" + cd "${RHQ_SERVER_JBOSS_HOME}/bin" if [ -n "$RHQ_SERVER_DEBUG" ] && [ "$RHQ_SERVER_DEBUG" != "false" ]; then "$_JBOSS_RUN_SCRIPT" $_CMDLINE_OPTS & else @@ -498,8 +550,8 @@ case "$1" in fi
echo "Cleaning data, tmp and log directories..." - rm -rf "${RHQ_SERVER_HOME}/jbossas/standalone/data" - rm -rf "${RHQ_SERVER_HOME}/jbossas/standalone/tmp" + rm -rf "${RHQ_SERVER_JBOSS_HOME}/standalone/data" + rm -rf "${RHQ_SERVER_JBOSS_HOME}/standalone/tmp" rm -rf "${RHQ_SERVER_HOME}/logs" ;;
@@ -514,4 +566,3 @@ case "$1" in exit 1 ;; esac -
commit 9c9b1c4efb093e45f871dbb116f0aa881a1cc15f Author: John Mazzitelli mazz@redhat.com Date: Fri Nov 30 15:01:12 2012 -0500
name the master PC's data directory name so it better identifies itself as being owned by rhq
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/ServerPluginService.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/ServerPluginService.java index e421ee5..2bd3b2b 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/ServerPluginService.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/ServerPluginService.java @@ -132,7 +132,7 @@ public class ServerPluginService implements ServerPluginServiceMBean { File pluginDir = getServerPluginsDirectory();
File serverDataDir = LookupUtil.getCoreServer().getJBossServerDataDir(); - File dataDir = new File(serverDataDir, "server-plugins"); + File dataDir = new File(serverDataDir, "rhq-masterpc-server-plugins"); dataDir.mkdirs(); // make sure the data directory exists
File tmpDir = LookupUtil.getCoreServer().getJBossServerTempDir();
commit cbd256f0f18d4ecd89f914386ded765701ef9f77 Author: John Mazzitelli mazz@redhat.com Date: Fri Nov 30 15:00:43 2012 -0500
add new remote client SLSB so it can manage the version file in the data directory
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/SystemGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/SystemGWTServiceImpl.java index 9ae1b11..0080751 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/SystemGWTServiceImpl.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/SystemGWTServiceImpl.java @@ -31,6 +31,7 @@ import org.rhq.core.domain.common.ServerDetails; import org.rhq.core.domain.common.composite.SystemSettings; import org.rhq.enterprise.gui.coregui.client.gwt.SystemGWTService; import org.rhq.enterprise.server.core.AgentManagerLocal; +import org.rhq.enterprise.server.core.RemoteClientManagerLocal; import org.rhq.enterprise.server.system.SystemManagerLocal; import org.rhq.enterprise.server.util.LookupUtil;
@@ -47,6 +48,7 @@ public class SystemGWTServiceImpl extends AbstractGWTServiceImpl implements Syst
private SystemManagerLocal systemManager = LookupUtil.getSystemManager(); private AgentManagerLocal agentManager = LookupUtil.getAgentManager(); + private RemoteClientManagerLocal remoteClientManager = LookupUtil.getRemoteClientManager();
@Override public ProductInfo getProductInfo() throws RuntimeException { @@ -171,18 +173,11 @@ public class SystemGWTServiceImpl extends AbstractGWTServiceImpl implements Syst
@Override public HashMap<String, String> getClientVersionProperties() throws RuntimeException { - File versionFile = new File(getClientDataDownloadDir(), "rhq-client-version.properties"); try { - Properties p = new Properties(); - FileInputStream inStream = new FileInputStream(versionFile); - try { - p.load(inStream); - } finally { - inStream.close(); - } - return convertFromProperties(p); + Properties props = remoteClientManager.getRemoteClientVersionFileContent(); + return convertFromProperties(props); } catch (Throwable t) { - throw getExceptionToThrowToClient(t, "Unable to retrieve client version info."); + throw getExceptionToThrowToClient(t, "Unable to retrieve CLI version info."); } }
@@ -240,15 +235,6 @@ public class SystemGWTServiceImpl extends AbstractGWTServiceImpl implements Syst return downloadDir; }
- private File getClientDataDownloadDir() { - File earDir = LookupUtil.getCoreServer().getJBossServerDataDir(); - File downloadDir = new File(earDir, "rhq-downloads/rhq-client"); - if (!downloadDir.isDirectory()) { - throw new RuntimeException("Server is missing client download directory at [" + downloadDir + "]"); - } - return downloadDir; - } - private File getBundleDeployerDownloadDir() { File homeDir = getDownloadHomeDir(); File downloadDir = new File(homeDir, "bundle-deployer"); diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/client/RemoteClientServlet.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/client/RemoteClientServlet.java index baceb79..9127927 100644 --- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/client/RemoteClientServlet.java +++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/client/RemoteClientServlet.java @@ -20,8 +20,6 @@ package org.rhq.enterprise.gui.client;
import java.io.File; import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; import java.io.IOException;
import javax.servlet.ServletException; @@ -33,9 +31,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory;
import org.rhq.core.domain.cloud.Server.OperationMode; -import org.rhq.core.util.MessageDigestGenerator; import org.rhq.core.util.stream.StreamUtil; -import org.rhq.enterprise.server.core.CoreServerMBean; import org.rhq.enterprise.server.util.LookupUtil;
/** @@ -47,10 +43,6 @@ public class RemoteClientServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
- private static final String RHQ_SERVER_VERSION = "rhq-server.version"; - private static final String RHQ_SERVER_BUILD_NUMBER = "rhq-server.build-number"; - private static final String RHQ_CLIENT_MD5 = "rhq-client.md5"; - // the system property that defines how many concurrent downloads we will allow private static String SYSPROP_CLIENT_DOWNLOADS_LIMIT = "rhq.server.client-downloads-limit";
@@ -69,29 +61,6 @@ public class RemoteClientServlet extends HttpServlet { private Log log = LogFactory.getLog(this.getClass());
@Override - public void init() throws ServletException { - log.info("Starting the RHQ remote client servlet..."); - - // make sure we have a binary distro file; log its location - try { - log.info("Remote Client Binary File: " + getRemoteClientZip()); - } catch (Throwable t) { - log.error("Remote client is not available for deployment - cause: " + t); - return; - } - - // make sure we create a version file if we have to by getting the version file now - try { - File versionFile = getVersionFile(); - - // log the version info - this also makes sure we can read it back in - log.debug(versionFile + ":\n" + new String(StreamUtil.slurp(new FileInputStream(versionFile)))); - } catch (Throwable t) { - log.error("Cannot determine the remote client version information.", t); - } - } - - @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // seeing odd browser caching issues, even though we set Last-Modified. so force no caching for now disableBrowserCache(resp); @@ -133,7 +102,7 @@ public class RemoteClientServlet extends HttpServlet { }
try { - File zip = getRemoteClientZip(); + File zip = LookupUtil.getRemoteClientManager().getRemoteClientBinaryFile(); if (!zip.exists()) { disableBrowserCache(resp); resp.sendError(HttpServletResponse.SC_NOT_FOUND, "Remote Client binary does not exist: " @@ -161,42 +130,9 @@ public class RemoteClientServlet extends HttpServlet { return; }
- private File getRemoteClientZip() throws Exception { - File dir = getDownloadDir(); - for (File file : dir.listFiles()) { - if (file.getName().endsWith(".zip")) { - return file; - } - } - - throw new FileNotFoundException("Missing remote client binary in [" + dir + "]"); - } - - private File getDownloadDir() throws Exception { - File earDir = LookupUtil.getCoreServer().getEarDeploymentDir(); - File downloadDir = new File(earDir, "rhq-downloads/rhq-client"); - if (!downloadDir.exists()) { - throw new FileNotFoundException("Missing remote client download directory at [" + downloadDir + "]"); - } - return downloadDir; - } - - private File getDataDownloadDir() throws Exception { - File earDir = LookupUtil.getCoreServer().getJBossServerDataDir(); - File downloadDir = new File(earDir, "rhq-downloads/rhq-client"); - if (!downloadDir.isDirectory()) { - downloadDir.mkdirs(); - if (!downloadDir.isDirectory()) { - throw new FileNotFoundException("Missing remote client data download directory at [" + downloadDir - + "]"); - } - } - return downloadDir; - } - private void getVersion(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { try { - File versionFile = getVersionFile(); + File versionFile = LookupUtil.getRemoteClientManager().getRemoteClientVersionFile(); resp.setContentType("text/plain"); resp.setDateHeader("Last-Modified", versionFile.lastModified());
@@ -248,36 +184,6 @@ public class RemoteClientServlet extends HttpServlet { resp.sendError(ERROR_CODE_TOO_MANY_DOWNLOADS, "Maximum limit exceeded - download client later"); }
- private File getVersionFile() throws Exception { - File versionFile = new File(getDataDownloadDir(), "rhq-client-version.properties"); - if (!versionFile.exists()) { - // we do not have the version properties file yet, let's extract some info and create one - StringBuilder serverVersionInfo = new StringBuilder(); - - CoreServerMBean coreServer = LookupUtil.getCoreServer(); - serverVersionInfo.append(RHQ_SERVER_VERSION + '=').append(coreServer.getVersion()).append('\n'); - serverVersionInfo.append(RHQ_SERVER_BUILD_NUMBER + '=').append(coreServer.getBuildNumber()).append('\n'); - - // calculate the MD5 of the client zip - File zip = getRemoteClientZip(); - String md5Property = RHQ_CLIENT_MD5 + '=' + MessageDigestGenerator.getDigestString(zip) + '\n'; - - // now write the server version info in our internal version file our servlet will use - FileOutputStream versionFileOutputStream = new FileOutputStream(versionFile); - try { - versionFileOutputStream.write(serverVersionInfo.toString().getBytes()); - versionFileOutputStream.write(md5Property.getBytes()); - } finally { - try { - versionFileOutputStream.close(); - } catch (Exception ignore) { - } - } - } - - return versionFile; - } - private boolean isServerAcceptingRequests() { try { OperationMode mode = LookupUtil.getServerManager().getServer().getOperationMode(); diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/RemoteClientManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/RemoteClientManagerBean.java new file mode 100644 index 0000000..2d053eb --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/RemoteClientManagerBean.java @@ -0,0 +1,149 @@ +/* + * 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.core; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.util.Properties; + +import javax.ejb.Stateless; +import javax.interceptor.ExcludeDefaultInterceptors; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import org.rhq.core.util.MessageDigestGenerator; +import org.rhq.enterprise.server.util.LookupUtil; + +/** + * Provides access to the remote client binary distribution (the CLI). + * + * @author John Mazzitelli + */ +@Stateless +public class RemoteClientManagerBean implements RemoteClientManagerLocal { + private final Log log = LogFactory.getLog(RemoteClientManagerBean.class); + + // constants used for the cli version file + private static final String RHQ_SERVER_VERSION = "rhq-server.version"; + private static final String RHQ_SERVER_BUILD_NUMBER = "rhq-server.build-number"; + private static final String RHQ_CLIENT_MD5 = "rhq-client.md5"; + + @ExcludeDefaultInterceptors + @Override + public File getRemoteClientVersionFile() throws Exception { + File versionFile = new File(getDataDownloadDir(), "rhq-client-version.properties"); + if (!versionFile.exists()) { + // we do not have the version properties file yet, let's extract some info and create one + StringBuilder serverVersionInfo = new StringBuilder(); + + CoreServerMBean coreServer = LookupUtil.getCoreServer(); + serverVersionInfo.append(RHQ_SERVER_VERSION + '=').append(coreServer.getVersion()).append('\n'); + serverVersionInfo.append(RHQ_SERVER_BUILD_NUMBER + '=').append(coreServer.getBuildNumber()).append('\n'); + + // calculate the MD5 of the client zip + File zip = getRemoteClientBinaryFile(); + log.info("Remote Client Binary File: " + zip.getAbsolutePath()); + + String md5Property = RHQ_CLIENT_MD5 + '=' + MessageDigestGenerator.getDigestString(zip) + '\n'; + + // now write the server version info in our internal version file our servlet will use + FileOutputStream versionFileOutputStream = new FileOutputStream(versionFile); + try { + versionFileOutputStream.write(serverVersionInfo.toString().getBytes()); + versionFileOutputStream.write(md5Property.getBytes()); + } finally { + try { + versionFileOutputStream.close(); + } catch (Exception ignore) { + } + } + + log.info("Remote Client Version File: " + versionFile); + } + + return versionFile; + } + + @ExcludeDefaultInterceptors + @Override + public Properties getRemoteClientVersionFileContent() throws Exception { + FileInputStream stream = new FileInputStream(getRemoteClientVersionFile()); + try { + Properties props = new Properties(); + props.load(stream); + return props; + } finally { + try { + stream.close(); + } catch (Exception e) { + } + } + } + + @ExcludeDefaultInterceptors + @Override + public File getRemoteClientBinaryFile() throws Exception { + File downloadDir = getDownloadDir(); + for (File file : downloadDir.listFiles()) { + if (file.getName().endsWith(".zip")) { + return file; + } + } + + throw new FileNotFoundException("Missing CLI binary in [" + downloadDir + "]"); + } + + /** + * The directory on the server's file system where the CLI binary file is found. + * + * @return directory where the downloads are found + * + * @throws Exception if could not determine the location or it does not exist + */ + private File getDownloadDir() throws Exception { + File earDir = LookupUtil.getCoreServer().getEarDeploymentDir(); + File downloadDir = new File(earDir, "rhq-downloads/rhq-client"); + if (!downloadDir.isDirectory()) { + throw new FileNotFoundException("Missing remote client download directory at [" + downloadDir + "]"); + } + return downloadDir; + } + + /** + * The directory on the server's file system where the CLI version file is found. + * + * @return directory where the version file is found + * + * @throws Exception if could not determine the location or it does not exist + */ + private File getDataDownloadDir() throws Exception { + File earDir = LookupUtil.getCoreServer().getJBossServerDataDir(); + File downloadDir = new File(earDir, "rhq-downloads/rhq-client"); + if (!downloadDir.isDirectory()) { + downloadDir.mkdirs(); + if (!downloadDir.isDirectory()) { + throw new FileNotFoundException("Missing remote client data download directory [" + downloadDir + "]"); + } + } + return downloadDir; + } +} \ No newline at end of file diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/RemoteClientManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/RemoteClientManagerLocal.java new file mode 100644 index 0000000..1f8ebb5 --- /dev/null +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/RemoteClientManagerLocal.java @@ -0,0 +1,67 @@ +/* + * 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.core; + +import java.io.File; +import java.util.Properties; + +import javax.ejb.Local; + +/** + * Local interface to the {@link RemoteAgentClientManagerBean} SLSB. This manager performs + * things related to the remote client (CLI) distribution. + * + * @author John Mazzitelli + */ +@Local +public interface RemoteClientManagerLocal { + + /** + * Returns the path on the server's file system where the CLI version file is found. + * The CLI version file contains information about the CLI binary, such + * as what version it is. + * + * @return version file location + * + * @throws Exception if the file could not be created or found + */ + File getRemoteClientVersionFile() throws Exception; + + /** + * Returns the content of the CLI version file, which simply consists + * of some name/value pairs. + * The version file contains information about the CLI binary, such + * as what version it is. + * + * @return version properties found in the version file. + * + * @throws Exception if cannot read the version file + */ + Properties getRemoteClientVersionFileContent() throws Exception; + + /** + * Returns the path on the server's file system where the CLI binary is found. + * This is the actual CLI distribution that can be installed on remote client machines. + * + * @return binary location + * + * @throws Exception if the binary file does not exist + */ + File getRemoteClientBinaryFile() throws Exception; +} \ No newline at end of file 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 7b784fa..a7bd680 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 @@ -102,6 +102,8 @@ import org.rhq.enterprise.server.core.AgentManagerLocal; import org.rhq.enterprise.server.core.CoreServerMBean; import org.rhq.enterprise.server.core.EmailManagerBean; import org.rhq.enterprise.server.core.EmailManagerLocal; +import org.rhq.enterprise.server.core.RemoteClientManagerBean; +import org.rhq.enterprise.server.core.RemoteClientManagerLocal; import org.rhq.enterprise.server.core.plugin.PluginDeploymentScannerMBean; import org.rhq.enterprise.server.dashboard.DashboardManagerBean; import org.rhq.enterprise.server.dashboard.DashboardManagerLocal; @@ -275,6 +277,10 @@ public final class LookupUtil { return lookupLocal(AlertConditionConsumerBean.class); }
+ public static RemoteClientManagerLocal getRemoteClientManager() { + return lookupLocal(RemoteClientManagerBean.class); + } + public static AgentManagerLocal getAgentManager() { return lookupLocal(AgentManagerBean.class); }
commit 9acf82454a07dcbc0397ad76b2a16f08e3f70e30 Author: John Mazzitelli mazz@redhat.com Date: Fri Nov 30 13:39:06 2012 -0500
opps..forgot to delete the import
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java index 00ace88..0057d83 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java @@ -55,7 +55,6 @@ import org.rhq.core.util.ObjectNameFactory; import org.rhq.core.util.exception.ThrowableUtil; import org.rhq.enterprise.communications.ServiceContainerConfigurationConstants; import org.rhq.enterprise.communications.util.SecurityUtil; -import org.rhq.enterprise.gui.client.RemoteClientServlet; import org.rhq.enterprise.server.RHQConstants; import org.rhq.enterprise.server.alert.engine.internal.AlertConditionCacheCoordinator; import org.rhq.enterprise.server.auth.SessionManager;
commit 698e3ea30232b05f29bdad9e1dce895498da45e8 Author: John Mazzitelli mazz@redhat.com Date: Fri Nov 30 12:13:06 2012 -0500
there is no need for this undeployInstaller method anymore
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java index 9e92a69..00ace88 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java @@ -55,6 +55,7 @@ import org.rhq.core.util.ObjectNameFactory; import org.rhq.core.util.exception.ThrowableUtil; import org.rhq.enterprise.communications.ServiceContainerConfigurationConstants; import org.rhq.enterprise.communications.util.SecurityUtil; +import org.rhq.enterprise.gui.client.RemoteClientServlet; import org.rhq.enterprise.server.RHQConstants; import org.rhq.enterprise.server.alert.engine.internal.AlertConditionCacheCoordinator; import org.rhq.enterprise.server.auth.SessionManager; @@ -142,9 +143,6 @@ public class StartupBean {
log.info("All business tier deployments are complete - finishing the startup...");
- // As a security measure, make sure the installer has been undeployed - systemManager.undeployInstaller(); - // get singletons right now so we load the classes immediately into our classloader AlertConditionCacheCoordinator.getInstance(); SessionManager.getInstance(); diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerBean.java index 9d9155c..52cd33d 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerBean.java @@ -620,7 +620,9 @@ public class SystemManagerBean implements SystemManagerLocal, SystemManagerRemot
/** * Ensures the installer is no longer deployed. + * @deprecated */ + @Deprecated public void undeployInstaller() { // No need for this anymore - the new RHQ installer in AS7 detects it already installed things and will point the user to login screen // We leave this in here in case we want to re-introduce the ability to uninstall the installer. diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerLocal.java index 53fe6e0..50da8ed 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerLocal.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerLocal.java @@ -117,6 +117,7 @@ public interface SystemManagerLocal { * Ensures the installer has been undeployed. Installer must be undeployed * to ensure the server deployment is secure. */ + @Deprecated void undeployInstaller();
/**
commit 2a697b6c844152ae08dcbb1373c0f2b7e13e7dca Merge: b63b3f9 24a906c Author: John Mazzitelli mazz@redhat.com Date: Fri Nov 30 11:05:22 2012 -0500
Merge remote-tracking branch 'origin/master' into rhq-on-as7
commit b63b3f9baac7eaaba70abce502505c630b1e147d Author: John Mazzitelli mazz@redhat.com Date: Thu Nov 29 17:20:43 2012 -0500
look for CLI version info in proper place
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/SystemGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/SystemGWTServiceImpl.java index 3394e03..9ae1b11 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/SystemGWTServiceImpl.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/SystemGWTServiceImpl.java @@ -171,7 +171,7 @@ public class SystemGWTServiceImpl extends AbstractGWTServiceImpl implements Syst
@Override public HashMap<String, String> getClientVersionProperties() throws RuntimeException { - File versionFile = new File(getClientDownloadDir(), "rhq-client-version.properties"); + File versionFile = new File(getClientDataDownloadDir(), "rhq-client-version.properties"); try { Properties p = new Properties(); FileInputStream inStream = new FileInputStream(versionFile); @@ -216,7 +216,7 @@ public class SystemGWTServiceImpl extends AbstractGWTServiceImpl implements Syst private File getConnectorDownloadsDir() { File homeDir = getDownloadHomeDir(); File downloadDir = new File(homeDir, "connectors"); - if (!downloadDir.exists()) { + if (!downloadDir.isDirectory()) { throw new RuntimeException("Server is missing connectors download directory at [" + downloadDir + "]"); } return downloadDir; @@ -225,7 +225,7 @@ public class SystemGWTServiceImpl extends AbstractGWTServiceImpl implements Syst private File getCliAlertScriptDownloadsDir() { File homeDir = getDownloadHomeDir(); File downloadDir = new File(homeDir, "cli-alert-scripts"); - if (!downloadDir.exists()) { + if (!downloadDir.isDirectory()) { throw new RuntimeException("Server is missing connectors download directory at [" + downloadDir + "]"); } return downloadDir; @@ -234,16 +234,16 @@ public class SystemGWTServiceImpl extends AbstractGWTServiceImpl implements Syst private File getScriptModulesDownloadsDir() { File homeDir = getDownloadHomeDir(); File downloadDir = new File(homeDir, "script-modules"); - if (!downloadDir.exists()) { + if (!downloadDir.isDirectory()) { throw new RuntimeException("Server is missing connectors download directory at [" + downloadDir + "]"); } return downloadDir; }
- private File getClientDownloadDir() { - File homeDir = getDownloadHomeDir(); - File downloadDir = new File(homeDir, "rhq-client"); - if (!downloadDir.exists()) { + private File getClientDataDownloadDir() { + File earDir = LookupUtil.getCoreServer().getJBossServerDataDir(); + File downloadDir = new File(earDir, "rhq-downloads/rhq-client"); + if (!downloadDir.isDirectory()) { throw new RuntimeException("Server is missing client download directory at [" + downloadDir + "]"); } return downloadDir; @@ -252,7 +252,7 @@ public class SystemGWTServiceImpl extends AbstractGWTServiceImpl implements Syst private File getBundleDeployerDownloadDir() { File homeDir = getDownloadHomeDir(); File downloadDir = new File(homeDir, "bundle-deployer"); - if (!downloadDir.exists()) { + if (!downloadDir.isDirectory()) { throw new RuntimeException("Missing bundle deployer download directory at [" + downloadDir + "]"); } return downloadDir;
commit ea04f6041e97342fa51995f73fb59357b99d762d Author: John Mazzitelli mazz@redhat.com Date: Thu Nov 29 16:40:30 2012 -0500
make sure installer detects if it already ran
diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java index 8c3812b..c15c5bb 100644 --- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java +++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java @@ -26,6 +26,9 @@ import java.util.HashMap; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory;
+import org.rhq.enterprise.server.installer.InstallerService.AlreadyInstalledException; +import org.rhq.enterprise.server.installer.InstallerService.AutoInstallDisabledException; + /** * The entry point to the RHQ Installer. * @@ -65,27 +68,29 @@ public class Installer { displayUsage(); return; } catch (TestRequestedException vre) { - new InstallerServiceImpl(installerConfig).test(); + try { + new InstallerServiceImpl(installerConfig).test(); + } catch (AutoInstallDisabledException e) { + LOG.error(e.getMessage()); + System.exit(1); + } catch (AlreadyInstalledException e) { + LOG.info(e.getMessage()); + System.exit(0); + } return; }
- final InstallerService installerService = new InstallerServiceImpl(installerConfig); - HashMap<String, String> serverProperties = installerService.preInstall(); - if (serverProperties == null) { - LOG.error("Auto-installation is disabled. Please fully configure rhq-server.properties"); - System.exit(1); - } - - String result = installerService.getInstallationResults(); - if (result == null) { + try { + final InstallerService installerService = new InstallerServiceImpl(installerConfig); + final HashMap<String, String> serverProperties = installerService.preInstall(); installerService.install(serverProperties, null, null); LOG.info("Installation is complete. The server should be ready shortly."); - } else if (result.length() == 0) { - LOG.info("Already installed."); + } catch (AutoInstallDisabledException e) { + LOG.error(e.getMessage()); + System.exit(1); + } catch (AlreadyInstalledException e) { + LOG.info(e.getMessage()); System.exit(0); - } else { - LOG.error("Not properly installed: " + result); - System.exit(2); }
return; diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerService.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerService.java index deb8eb6..b192c51 100644 --- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerService.java +++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerService.java @@ -21,7 +21,6 @@ package org.rhq.enterprise.server.installer; import java.util.ArrayList; import java.util.HashMap;
- /** * @author John Mazzitelli */ @@ -32,18 +31,24 @@ public interface InstallerService { * You can use this to see if, for example, the database settings are correct or the installer * can successfully connect to the running AS instance where RHQ is to be installed. * - * @throws Exception if the test fails meaning something in the server configuration is not valid + * @throws AutoInstallDisabledException if the server configuration properties does not have auto-install enabled + * @throws AlreadyInstalledException if it appears the installer was already run and the server is fully installed + * @throws Exception some other exception that should disallow the installation from continuing */ - void test() throws Exception; + void test() throws AutoInstallDisabledException, AlreadyInstalledException, Exception;
/** * Call this prior to installing to see if we are ready to install. * This will do some pre-install checks - if the installation should proceed, the map of server properties is returned. - * If null is returned, the install should not proceed. + * Exceptions are thrown if the install should not proceed. * * @return properties if the caller should next call {@link #install(HashMap, ServerDetails, String)}. + * + * @throws AutoInstallDisabledException if the server configuration properties does not have auto-install enabled + * @throws AlreadyInstalledException if it appears the installer was already run and the server is fully installed + * @throws Exception some other exception that should disallow the installation from continuing */ - HashMap<String, String> preInstall(); + HashMap<String, String> preInstall() throws AutoInstallDisabledException, AlreadyInstalledException, Exception;
/** * Use this to determine if the server has already been completely installed or not. @@ -71,10 +76,12 @@ public interface InstallerService { * existing schema. Must be one of the names of the * {@link ServerInstallUtil.ExistingSchemaOption} enum. * If in auto-install mode, this value is ignored and can be anything. - * @throws Exception + * @throws AutoInstallDisabledException if the server configuration properties does not have auto-install enabled + * @throws AlreadyInstalledException if it appears the installer was already run and the server is fully installed + * @throws Exception some other exception that should disallow the installation from continuing */ void install(HashMap<String, String> serverProperties, ServerDetails serverDetails, String existingSchemaOption) - throws Exception; + throws AutoInstallDisabledException, AlreadyInstalledException, Exception;
/** * Returns a list of all registered servers in the database. @@ -141,4 +148,20 @@ public interface InstallerService { * @throws Exception */ String getOperatingSystem() throws Exception; + + class AutoInstallDisabledException extends Exception { + private static final long serialVersionUID = 1L; + + public AutoInstallDisabledException(String msg) { + super(msg); + } + } + + class AlreadyInstalledException extends Exception { + private static final long serialVersionUID = 1L; + + public AlreadyInstalledException(String msg) { + super(msg); + } + } } diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java index 0cd8669..f9e12d3 100644 --- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java +++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java @@ -66,14 +66,11 @@ public class InstallerServiceImpl implements InstallerService { }
@Override - public void test() throws Exception { + public void test() throws AutoInstallDisabledException, AlreadyInstalledException, Exception { // checks to make sure we can read rhq-server.properties and auto-install is turned on // checks to make sure we aren't already installed // checks to make sure we can successfully connect to the AS instance HashMap<String, String> serverProperties = preInstall(); - if (serverProperties == null) { - throw new Exception("Auto-installation is disabled. Please fully configure rhq-server.properties"); - }
// make sure the data is valid verifyDataFormats(serverProperties); @@ -116,7 +113,8 @@ public class InstallerServiceImpl implements InstallerService { }
@Override - public HashMap<String, String> preInstall() { + public HashMap<String, String> preInstall() throws AutoInstallDisabledException, AlreadyInstalledException, + Exception { // first, make sure auto-install mode has been enabled, this at least tells us // the user edited the server properties for their environment. final boolean autoInstallMode; @@ -126,36 +124,30 @@ public class InstallerServiceImpl implements InstallerService { serverProperties = getServerProperties(); autoInstallMode = ServerInstallUtil.isAutoinstallEnabled(serverProperties); } catch (Throwable t) { - log("Cannot determine if in auto-install mode", t); - return null; + throw new Exception("Cannot determine if in auto-install mode", t); }
if (autoInstallMode) { log("The server is preconfigured and ready for auto-install."); } else { - log("User must complete the installation configuration."); - return null; + throw new AutoInstallDisabledException( + "Auto-installation is disabled. Please fully configure rhq-server.properties"); }
// make an attempt to connect to the app server - we must make sure its running and we can connect to it final String asVersion = testModelControllerClient(serverProperties); log("Installing into app server version [" + asVersion + "]");
- try { - // If we are already fully installed, we don't have to do anything. Just return false immediately. - final String installationResults = getInstallationResults(); - if (installationResults != null) { - if (installationResults.length() == 0) { - log("The installer has already been told to perform its work. The server should be ready soon."); - } else { - log("The installer has already attempted to install the server but errors occurred:\n" - + installationResults); - } - return null; + // If we are already fully installed, we don't have to do anything. Just return false immediately. + final String installationResults = getInstallationResults(); + if (installationResults != null) { + if (installationResults.length() == 0) { + throw new AlreadyInstalledException( + "The installer has already been told to perform its work. The server should be ready soon."); + } else { + throw new Exception("The installer has already attempted to install the server but errors occurred:\n" + + installationResults); } - } catch (Throwable t) { - log("Cannot determine if server has already been installed.", t); - return null; }
// ready for installation @@ -164,22 +156,20 @@ public class InstallerServiceImpl implements InstallerService {
@Override public String getInstallationResults() throws Exception { - ModelControllerClient mcc = null; - try { - mcc = getModelControllerClient(); - DeploymentJBossASClient client = new DeploymentJBossASClient(mcc); - if (client.isDeployment(EAR_NAME)) { - return ""; // everything looks OK and the ear either has been successfully deployed or is deploying - } - return null; - } finally { - safeClose(mcc); + if (isEarDeployed()) { + return ""; // if the ear is deployed, we've already been fully installed } + return null; }
@Override public void install(HashMap<String, String> serverProperties, ServerDetails serverDetails, - String existingSchemaOption) throws Exception { + String existingSchemaOption) throws AutoInstallDisabledException, AlreadyInstalledException, Exception { + + if (isEarDeployed()) { + throw new AlreadyInstalledException( + "It looks like the installation has already been completed - there is nothing for the installer to do."); + }
verifyDataFormats(serverProperties);
@@ -212,7 +202,7 @@ public class InstallerServiceImpl implements InstallerService {
SupportedDatabaseType supportedDbType = ServerInstallUtil.getSupportedDatabaseType(databaseType); if (supportedDbType == null) { - throw new IllegalArgumentException("Invalid database type: " + databaseType); + throw new Exception("Invalid database type: " + databaseType); }
// parse the database connection URL to extract the servername/port/dbname; this is needed for the XA datasource @@ -244,7 +234,7 @@ public class InstallerServiceImpl implements InstallerService { serverProperties.put(ServerProperties.PROP_DATABASE_DB_NAME, ""); } } catch (Exception e) { - throw new Exception("JDBC connection URL seems to be invalid: " + ThrowableUtil.getAllMessages(e)); + throw new Exception("JDBC connection URL seems to be invalid", e); }
// make sure the internal database related settings are correct @@ -268,7 +258,7 @@ public class InstallerServiceImpl implements InstallerService { serverProperties.put(ServerProperties.PROP_QUARTZ_LOCK_HANDLER_CLASS, quartzLockHandlerClass);
} catch (Exception e) { - throw new Exception("Cannot configure internal database settings: " + ThrowableUtil.getAllMessages(e)); + throw new Exception("Cannot configure internal database settings", e); }
// test the connection to make sure everything is OK - note that if we are in auto-install mode, @@ -307,24 +297,28 @@ public class InstallerServiceImpl implements InstallerService { existingSchemaOptionEnum = ExistingSchemaOption.valueOf(existingSchemaOption); }
- if (ExistingSchemaOption.SKIP != existingSchemaOptionEnum) { - if (isDatabaseSchemaExist(dbUrl, dbUsername, clearTextDbPassword)) { - if (ExistingSchemaOption.OVERWRITE == existingSchemaOptionEnum) { - log("Database schema exists but installer was told to overwrite it - a new schema will be created now."); + try { + if (ExistingSchemaOption.SKIP != existingSchemaOptionEnum) { + if (isDatabaseSchemaExist(dbUrl, dbUsername, clearTextDbPassword)) { + if (ExistingSchemaOption.OVERWRITE == existingSchemaOptionEnum) { + log("Database schema exists but installer was told to overwrite it - a new schema will be created now."); + ServerInstallUtil.createNewDatabaseSchema(serverProperties, serverDetails, clearTextDbPassword, + getLogDir()); + } else { + log("Database schema exists - it will now be updated."); + ServerInstallUtil.upgradeExistingDatabaseSchema(serverProperties, serverDetails, + clearTextDbPassword, getLogDir()); + } + } else { + log("Database schema does not yet exist - it will now be created."); ServerInstallUtil.createNewDatabaseSchema(serverProperties, serverDetails, clearTextDbPassword, getLogDir()); - } else { - log("Database schema exists - it will now be updated."); - ServerInstallUtil.upgradeExistingDatabaseSchema(serverProperties, serverDetails, - clearTextDbPassword, getLogDir()); } } else { - log("Database schema does not yet exist - it will now be created."); - ServerInstallUtil.createNewDatabaseSchema(serverProperties, serverDetails, clearTextDbPassword, - getLogDir()); + log("Ignoring database schema - installer will assume it exists and is already up-to-date."); } - } else { - log("Ignoring database schema - installer will assume it exists and is already up-to-date."); + } catch (Exception e) { + throw new Exception("Could not complete the database schema installation", e); }
// ensure the server info is up to date and stored in the DB @@ -372,7 +366,7 @@ public class InstallerServiceImpl implements InstallerService { }
@Override - public ArrayList<String> getServerNames(String connectionUrl, String username, String password) throws Exception { + public ArrayList<String> getServerNames(String connectionUrl, String username, String password) { try { return ServerInstallUtil.getServerNames(connectionUrl, username, password); } catch (Exception e) { @@ -382,8 +376,7 @@ public class InstallerServiceImpl implements InstallerService { }
@Override - public ServerDetails getServerDetails(String connectionUrl, String username, String password, String serverName) - throws Exception { + public ServerDetails getServerDetails(String connectionUrl, String username, String password, String serverName) { try { final ServerDetails sd = ServerInstallUtil.getServerDetails(connectionUrl, username, password, serverName); if (sd != null) { @@ -410,7 +403,7 @@ public class InstallerServiceImpl implements InstallerService { }
@Override - public boolean isDatabaseSchemaExist(String connectionUrl, String username, String password) throws Exception { + public boolean isDatabaseSchemaExist(String connectionUrl, String username, String password) { try { return ServerInstallUtil.isDatabaseSchemaExist(connectionUrl, username, password); } catch (Exception e) { @@ -420,7 +413,7 @@ public class InstallerServiceImpl implements InstallerService { }
@Override - public String testConnection(String connectionUrl, String username, String password) throws Exception { + public String testConnection(String connectionUrl, String username, String password) { final String results = ServerInstallUtil.testConnection(connectionUrl, username, password); return results; } @@ -488,7 +481,6 @@ public class InstallerServiceImpl implements InstallerService { * this data outside of the normal installation process (see {@link #install()}). * * @param serverProperties the server properties to save - * * @throws Exception if failed to save the properties to the .properties file */ private void saveServerProperties(HashMap<String, String> serverProperties) throws Exception { @@ -562,6 +554,18 @@ public class InstallerServiceImpl implements InstallerService { } }
+ private boolean isEarDeployed() throws Exception { + ModelControllerClient mcc = null; + try { + mcc = getModelControllerClient(); + final DeploymentJBossASClient client = new DeploymentJBossASClient(mcc); + boolean isDeployed = client.isDeployment(EAR_NAME); + return isDeployed; + } finally { + safeClose(mcc); + } + } + private String getLogDir() throws Exception { ModelControllerClient mcc = null; try { @@ -701,17 +705,17 @@ public class InstallerServiceImpl implements InstallerService { * @param secsToWait the number of seconds to wait before aborting the test * @return the app server version that we are connected to * - * @throws RuntimeException if the connection attempts fail + * @throws Exception if the connection attempts fail */ - private String testModelControllerClient(int secsToWait) throws RuntimeException { + private String testModelControllerClient(int secsToWait) throws Exception { final long start = System.currentTimeMillis(); final long end = start + (secsToWait * 1000L); - RuntimeException error = null; + Exception error = null;
while (System.currentTimeMillis() < end) { try { return testModelControllerClient(null); - } catch (RuntimeException e) { + } catch (Exception e) { error = e; try { Thread.sleep(1000L); @@ -734,9 +738,9 @@ public class InstallerServiceImpl implements InstallerService { * if the initial connection attempt fails. If null, will be ignored. * @return the app server version that we are connected to * - * @throws RuntimeException if the connection attempts fail + * @throws Exception if the connection attempts fail */ - private String testModelControllerClient(HashMap<String, String> fallbackProps) throws RuntimeException { + private String testModelControllerClient(HashMap<String, String> fallbackProps) throws Exception { String host = this.installerConfiguration.getManagementHost(); int port = this.installerConfiguration.getManagementPort(); ModelControllerClient mcc = null; @@ -757,7 +761,7 @@ public class InstallerServiceImpl implements InstallerService {
// if the caller didn't give us any fallback props, just immediately fail if (fallbackProps == null) { - throw new RuntimeException("Cannot obtain client connection to the app server", e); + throw new Exception("Cannot obtain client connection to the app server", e); }
try { @@ -776,7 +780,7 @@ public class InstallerServiceImpl implements InstallerService { differentValues = true; } if (!differentValues) { - throw new RuntimeException("Cannot obtain client connection to the app server", e); + throw new Exception("Cannot obtain client connection to the app server", e); }
mcc = ModelControllerClient.Factory.create(host, port); @@ -787,7 +791,7 @@ public class InstallerServiceImpl implements InstallerService { return asVersion; } catch (Exception e2) { // make the cause the very first exception in case it was something other than bad host/port as the problem - throw new RuntimeException("Cannot obtain client connection to the app server!", e); + throw new Exception("Cannot obtain client connection to the app server!", e); } finally { safeClose(mcc); } @@ -879,7 +883,7 @@ public class InstallerServiceImpl implements InstallerService { } }
- private void reloadConfiguration() throws Exception { + private void reloadConfiguration() { log("Will now ask the app server to reload its configuration"); ModelControllerClient mcc = null; try {
commit e04b4e2f0a5f4531d535244dee8210ad346af260 Author: John Mazzitelli mazz@redhat.com Date: Thu Nov 29 13:02:29 2012 -0500
be able to attach debugger to the arquillian-launched AS container. you do this by passing in -Ditest.debug on the mvn cmd line this also adds an eclipse launcher to connect to it on the proper port
diff --git a/etc/eclipse-tools/RHQ Remote Debugging - Integration Test.launch b/etc/eclipse-tools/RHQ Remote Debugging - Integration Test.launch new file mode 100644 index 0000000..db416be --- /dev/null +++ b/etc/eclipse-tools/RHQ Remote Debugging - Integration Test.launch @@ -0,0 +1,21 @@ +<?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> +<stringAttribute key="org.eclipse.debug.core.source_locator_id" value="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"/> +<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <sourceLookupDirector> <sourceContainers duplicates="false"> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;javaProject name=&quot;rhq&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.javaProject"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/integration/jboss-profileservice-spi/5.1.0.SP1/jboss-profileservice-spi-5.1.0.SP1.jar&quot;/&gt;&#13;&#10;" typeId="org.ec lipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/man/jboss-managed/2.1.1.GA/jboss-managed-2.1.1.GA.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/man/jboss-metatype/2.1.1.GA/jboss-metatype-2.1.1.GA.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encodi ng=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/apache/commons/commons-io/1.3.2/commons-io-1.3.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/com/sun/xml/bind/jaxb-impl/2.1.12/jaxb-impl-2.1.12.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/i18nlog/i18nlog/1.0.10/i18nlog-1. 0.10.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/gnu-getopt/getopt/1.0.13/getopt-1.0.13.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/commons-httpclient/commons-httpclient/3.0.1/commons-httpclient-3.0.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento= "&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/jboss/jboss-remoting/2.2.2.SP8/jboss-remoting-2.2.2.SP8.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/oswego-concurrent/concurrent/1.3.4/concurrent-1.3.4.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVari able path=&quot;M2_REPO/rss4j/rss4j/0.92-on.2/rss4j-0.92-on.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/apache/ant/ant/1.8.0/ant-1.8.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/apache/ant/ant-nodeps/1.8.0/ant-nodeps-1.8.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable" /> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/javax/servlet/servlet-api/2.4/servlet-api-2.4.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/struts/struts/1.2.9/struts-1.2.9.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;class pathVariable path=&quot;M2_REPO/javax/servlet/jsp-api/2.0/jsp-api-2.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/commons-validator/commons-validator/1.1.4/commons-validator-1.1.4.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/testng/testng/6.1.1/testng-6.1.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContai ner.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/snmp4j/snmp4j/1.8.2/snmp4j-1.8.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;& #10;&lt;classpathVariable path=&quot;M2_REPO/tomcat/tomcat-jk/4.1.31/tomcat-jk-4.1.31.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/jdom/jdom/1.0/jdom-1.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/commons-collections/commons-collections/3.2/commons-collections-3.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sour ceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/javax/persistence/persistence-api/1.0/persistence-api-1.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/jboss/jboss-jmx/4.2.3.GA/jboss-jmx-4.2.3.GA.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=& ;quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/tomcat/catalina/5.5.20/catalina-5.5.20.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/taglibs/standard/1.1.2/standard-1.1.2.jar&quot;/&gt;&#13;&#1 0;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/jboss/jboss-common/1.2.1.GA/jboss-common-1.2.1.GA.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/javax/servlet/jstl/1.1.2/jstl-1.1.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=& quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/struts-menu/struts-menu/2.3/struts-menu-2.3.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/junit/junit/3.8.2/junit-3.8.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/apache/velocity/velocity/1.5/velocity-1.5.jar&quot;/&gt;&am p;#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/xalan/xalan/2.5.1/xalan-2.5.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&qu ot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/javax/xml/bind/jsr173_api/1.0/jsr173_api-1.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/jboss/jboss-embeddable-ejb3/jboss-ejb3-all/1.0.0.Alpha9/jboss-ejb3-all-1.0.0.Alpha9.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/jboss/jbpm/3.1.1/j bpm-3.1.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/jboss/jboss-embeddable-ejb3/hibernate-all/1.0.0.Alpha9/hibernate-all-1.0.0.Alpha9.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jetbrains/annotations/7.0.2/annotations-7.0.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> 3; <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/apache/ant/ant-launcher/1.8.0/ant-launcher-1.8.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/cglib/cglib-nodep/2.1_3/cglib-nodep-2.1_3.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;& lt;classpathVariable path=&quot;M2_REPO/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/commons-lang/commons-lang/2.4/commons-lang-2.4.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/javax/faces/jsf-api/1.2_14/jsf-api-1.2_14.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launch ing.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/javax/faces/jsf-impl/1.2_14/jsf-impl-1.2_14.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/javax/el/el-api/1.0/el-api-1.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;? &gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/com/sun/facelets/jsf-facelets/1.1.15.B1/jsf-facelets-1.1.15.B1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/mc4j/org-mc4j-ems/1.2.16/org-mc4j-ems-1.2.16.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/opensymphony/quartz/quartz/1.6.5/quartz-1.6.5.jar&quot;/&gt;&#13;&#10;&q uot; typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/javax/mail/mail/1.4.2/mail-1.4.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/commons-fileupload/commons-fileupload/1.2/commons-fileupload-1.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encodi ng=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/richfaces/framework/richfaces-api/3.3.3.Final/richfaces-api-3.3.3.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/richfaces/framework/richfaces-impl/3.3.3.Final/richfaces-impl-3.3.3.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=& amp;quot;M2_REPO/org/richfaces/ui/richfaces-ui/3.3.3.Final/richfaces-ui-3.3.3.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/postgresql/postgresql/9.0-801.jdbc4/postgresql-9.0-801.jdbc4.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/jboss/jboss-cache/1.4.1.SP9/jboss-cache-1.4.1.SP9.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.laun ching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/hyperic/sigar/1.6.5.132/sigar-1.6.5.132.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/transaction/jboss-jta/4.2.3.SP5/jboss-jta-4.2.3.SP5.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; s tandalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/transaction/jboss-jts-common/4.2.3.SP5/jboss-jts-common-4.2.3.SP5.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/jbossws-spi/1.1.1.GA/jbossws-spi-1.1.1.GA.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/jbossws/jbossws-native-core/3 .1.1.GA/jbossws-native-core-3.1.1.GA.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/apache/maven/maven-project/2.0.8/maven-project-2.0.8.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/apache/maven/maven-plugin-api/2.0.8/maven-plugin-api-2.0.8.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariabl e"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/codehaus/swizzle/swizzle-confluence/1.6.1/swizzle-confluence-1.6.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jvnet/inflector/0.7.0/inflector-0.7.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot ;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/net/augeas/augeas/0.0.2/augeas-0.0.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/json/json/20080701/json-20080701.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/net/java/dev/jna/jna/3.2.5/jna-3.2.5.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.s ourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/freemarker/freemarker/2.3.11/freemarker-2.3.11.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/seam/jboss-seam/2.1.0.SP1/jboss-seam-2.1.0.SP1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standa lone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/seam/jboss-seam-ui/2.1.0.SP1/jboss-seam-ui-2.1.0.SP1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/hibernate/hibernate3/3.2.r14201-2/hibernate3-3.2.r14201-2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/jline/jline/0.9.94/jline-0.9.94.jar&quot;/& gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/javassist/javassist/3.9.0.GA/javassist-3.9.0.GA.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/net/sf/opencsv/opencsv/1.8/opencsv-1.8.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0& quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/bouncycastle/bcpg-jdk15/140/bcpg-jdk15-140.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/bouncycastle/bcprov-jdk15/140/bcprov-jdk15-140.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/apache/xmlrpc/xmlrpc-client/3.1 .2/xmlrpc-client-3.1.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/apache/xmlrpc/xmlrpc-common/3.1.2/xmlrpc-common-3.1.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/apache/ws/commons/util/ws-commons-util/1.0.2/ws-commons-util-1.0.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable&quo t;/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/commons-digester/commons-digester/1.8.1/commons-digester-1.8.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/commons-codec/commons-codec/1.4/commons-codec-1.4.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&am p;gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/pircbot/pircbot/1.4.2/pircbot-1.4.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/twitter4j/twitter4j-core/2.2.4/twitter4j-core-2.2.4.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jmock/jmock/2.5.1/jmock-2.5.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.l aunching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/hamcrest/hamcrest-library/1.1/hamcrest-library-1.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/antlr/antlr-runtime/3.2/antlr-runtime-3.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/jboss/web/jbossweb/2.0.1.GA/jbossweb-2.0.1.GA.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/libvirt/libvirt/0.4.1/libvirt-0.4.1.jar&quot;/&gt;&#13;&am p;#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/byteman/byteman/1.2.1/byteman-1.2.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/fedorahosted/cobbler/cobbler4j/0.1/cobbler4j-0.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quo t; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/com/google/gwt/gwt-user/2.4.0/gwt-user-2.4.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/com/google/gwt/gwt-dev/2.4.0/gwt-dev-2.4.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/com/smartgwt/smartgwt/3.0/smartgwt-3.0.j ar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/com/google/code/gwt-log/gwt-log/3.1.0/gwt-log-3.1.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/ca/nanometrics/gflot/1.0.0/gflot-1.0.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml vers ion=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/com/jcraft/jsch/0.1.29/jsch-0.1.29.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/commons-jxpath/commons-jxpath/1.3/commons-jxpath-1.3.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/dbunit/dbun it/2.4.8/dbunit-2.4.8.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/apache/poi/poi/3.7/poi-3.7.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/bsh/bsh/1.3.0/bsh-1.3.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot ;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/unitils/unitils-core/3.1/unitils-core-3.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/unitils/unitils-dbunit/3.1/unitils-dbunit-3.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/unitils/unitils- orm/3.1/unitils-orm-3.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/unitils/unitils-testng/3.1/unitils-testng-3.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/codehaus/jackson/jackson-core-asl/1.7.4/jackson-core-asl-1.7.4.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/>
 ; <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/codehaus/jackson/jackson-mapper-asl/1.7.4/jackson-mapper-asl-1.7.4.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/mongodb/mongo-java-driver/2.6.5/mongo-java-driver-2.6.5.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&qu ot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/com/googlecode/java-diff-utils/diffutils/1.2.1/diffutils-1.2.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/com/google/code/morphia/morphia/1.00-SNAPSHOT/morphia-1.00-SNAPSHOT.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/resteasy/resteasy-links/2.3.3.Final/resteasy-links-2.3. 3.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/resteasy/resteasy-jaxrs/2.3.3.Final/resteasy-jaxrs-2.3.3.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/resteasy/resteasy-jackson-provider/2.3.3.Final/resteasy-jackson-provider-2.3.3.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContain er.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/resteasy/jaxrs-api/2.3.3.Final/jaxrs-api-2.3.3.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/sasl/jboss-sasl/1.0.0.Beta9/jboss-sasl-1.0.0.Beta9.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; st andalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;JDK_HOME/lib/tools.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/mockito/mockito-all/1.9.0/mockito-all-1.9.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/powermock/powermock-api-mockito/1.4.11/powermock-api-mockito-1.4.11.jar&quot;/&gt;&#13;&# 10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/powermock/powermock-core/1.4.11/powermock-core-1.4.11.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/powermock/powermock-api-support/1.4.11/powermock-api-support-1.4.11.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml v ersion=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/powermock/powermock-module-testng-common/1.4.11/powermock-module-testng-common-1.4.11.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/powermock/powermock-module-testng/1.4.11/powermock-module-testng-1.4.11.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;& amp;#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/liquibase/liquibase-core/2.0.3/liquibase-core-2.0.3.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/shrinkwrap/shrinkwrap-impl-base/1.0.0/shrinkwrap-impl-base-1.0.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/shrinkwrap/shrinkwrap-api/1.0.0/shrinkwrap-api-1.0.0.jar&quot;/& amp;gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/shrinkwrap/shrinkwrap-spi/1.0.0/shrinkwrap-spi-1.0.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/shrinkwrap/descriptors/shrinkwrap-descriptors-api-base/2.0.0-alpha-2/shrinkwrap-descriptors-api-base-2.0.0-alpha-2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer. classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/shrinkwrap/resolver/shrinkwrap-resolver-api/1.0.0-beta-6/shrinkwrap-resolver-api-1.0.0-beta-6.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/shrinkwrap/resolver/shrinkwrap-resolver-api-maven/1.0.0-beta-6/shrinkwrap-resolver-api-maven-1.0.0-beta-6.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container mem ento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/arquillian/test/arquillian-test-spi/1.0.0.Final/arquillian-test-spi-1.0.0.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/arquillian/test/arquillian-test-api/1.0.0.Final/arquillian-test-api-1.0.0.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; stan dalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/arquillian/core/arquillian-core-spi/1.0.0.Final/arquillian-core-spi-1.0.0.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/arquillian/core/arquillian-core-api/1.0.0.Final/arquillian-core-api-1.0.0.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quo t;M2_REPO/org/jboss/arquillian/container/arquillian-container-spi/1.0.0.Final/arquillian-container-spi-1.0.0.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/arquillian/container/arquillian-container-test-api/1.0.0.Final/arquillian-container-test-api-1.0.0.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/arquillian/testng/arquillian-testng -core/1.0.0.Final/arquillian-testng-core-1.0.0.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;default/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.default"/> </sourceContainers> </sourceLookupDirector> "/> +<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="hostname" value="localhost"/> +<mapEntry key="port" value="8798"/> +</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> diff --git a/modules/enterprise/server/itests-2/pom.xml b/modules/enterprise/server/itests-2/pom.xml index f0c179f..40ab722 100644 --- a/modules/enterprise/server/itests-2/pom.xml +++ b/modules/enterprise/server/itests-2/pom.xml @@ -25,6 +25,8 @@ <properties> <jboss.zip>${settings.localRepository}/org/jboss/as/jboss-as-dist/${jboss.version}/jboss-as-dist-${jboss.version}.zip</jboss.zip> <jboss.unzip.location>${basedir}/target/jboss-as-${jboss.version}</jboss.unzip.location> + <jboss.vm.args>-Xmx700m -XX:MaxPermSize=200m</jboss.vm.args> + <jboss.vm.args.debug></jboss.vm.args.debug> <!-- -Ditest.debug can override this, see below --> </properties>
<dependencies> @@ -705,5 +707,17 @@ <skip.oracle>false</skip.oracle> </properties> </profile> + + <profile> + <id>itest.debug</id> + <activation> + <property> + <name>itest.debug</name> + </property> + </activation> + <properties> + <jboss.vm.args.debug>-Xrunjdwp:transport=dt_socket,address=8798,server=y,suspend=y</jboss.vm.args.debug> + </properties> + </profile> </profiles> </project> diff --git a/modules/enterprise/server/itests-2/src/test/resources/arquillian.xml b/modules/enterprise/server/itests-2/src/test/resources/arquillian.xml index d473413..c1dcf1b 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/arquillian.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/arquillian.xml @@ -21,6 +21,7 @@
<configuration> <property name="jbossHome">${jboss.unzip.location}</property> + <property name="javaVmArguments">${jboss.vm.args} ${jboss.vm.args.debug}</property> </configuration> </container> </arquillian>
commit de51266aca0688203ce654612211f1e2dc209f6b Author: John Mazzitelli mazz@redhat.com Date: Thu Nov 29 03:10:13 2012 -0500
look in the proper places for files inside the ear
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/client/RemoteClientServlet.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/client/RemoteClientServlet.java index b6edc07..baceb79 100644 --- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/client/RemoteClientServlet.java +++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/client/RemoteClientServlet.java @@ -173,14 +173,27 @@ public class RemoteClientServlet extends HttpServlet { }
private File getDownloadDir() throws Exception { - File serverHomeDir = LookupUtil.getCoreServer().getJBossServerHomeDir(); - File downloadDir = new File(serverHomeDir, "deployments/rhq.ear/rhq-downloads/rhq-client"); + File earDir = LookupUtil.getCoreServer().getEarDeploymentDir(); + File downloadDir = new File(earDir, "rhq-downloads/rhq-client"); if (!downloadDir.exists()) { throw new FileNotFoundException("Missing remote client download directory at [" + downloadDir + "]"); } return downloadDir; }
+ private File getDataDownloadDir() throws Exception { + File earDir = LookupUtil.getCoreServer().getJBossServerDataDir(); + File downloadDir = new File(earDir, "rhq-downloads/rhq-client"); + if (!downloadDir.isDirectory()) { + downloadDir.mkdirs(); + if (!downloadDir.isDirectory()) { + throw new FileNotFoundException("Missing remote client data download directory at [" + downloadDir + + "]"); + } + } + return downloadDir; + } + private void getVersion(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { try { File versionFile = getVersionFile(); @@ -236,7 +249,7 @@ public class RemoteClientServlet extends HttpServlet { }
private File getVersionFile() throws Exception { - File versionFile = new File(getDownloadDir(), "rhq-client-version.properties"); + File versionFile = new File(getDataDownloadDir(), "rhq-client-version.properties"); if (!versionFile.exists()) { // we do not have the version properties file yet, let's extract some info and create one StringBuilder serverVersionInfo = new StringBuilder(); diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/download/DownloadServlet.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/download/DownloadServlet.java index 52e17b3..59369a7 100644 --- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/download/DownloadServlet.java +++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/download/DownloadServlet.java @@ -68,7 +68,7 @@ public class DownloadServlet extends HttpServlet { disableBrowserCache(resp);
if (isServerAcceptingRequests()) { - File requestedDirectory = getRequestedDirectory(req); + String requestedDirectory = getRequestedDirectory(req); if (requestedDirectory == null) { numActiveDownloads++; download(req, resp); @@ -87,24 +87,35 @@ public class DownloadServlet extends HttpServlet { return; }
- private File getRequestedDirectory(HttpServletRequest req) throws ServletException { + /** + * Returns the relative path of the requested directory but only if it exists in + * one of the root directories. If the requested path is a file or the directory + * doesn't exist under a root directory, null is returned. + * + * @param req + * @return relative path of the directory being requested + * @throws ServletException + */ + private String getRequestedDirectory(HttpServletRequest req) throws ServletException {
String pathInfo = req.getPathInfo();
- File rootDownloadsDir; + File[] rootDownloadsDirs; try { - rootDownloadsDir = getRootDownloadsDir(); + rootDownloadsDirs = getRootDownloadsDirs(); } catch (Throwable t) { throw new ServletException(t); }
if (pathInfo == null || pathInfo.equals("") || pathInfo.equals("/")) { - return rootDownloadsDir; + return ""; }
- File downloadDir = new File(rootDownloadsDir, pathInfo); - if (downloadDir.isDirectory()) { - return downloadDir; + for (File rootDownloadsDir : rootDownloadsDirs) { + File downloadDir = new File(rootDownloadsDir, pathInfo); + if (downloadDir.isDirectory()) { + return pathInfo; + } }
// either the path does not exist or its a file, not a directory @@ -113,26 +124,38 @@ public class DownloadServlet extends HttpServlet {
private void download(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { try { - File downloadDir = getRootDownloadsDir(); - File downloadFile = new File(downloadDir, req.getPathInfo()); - if (!isForbiddenPath(downloadFile, resp)) { - if (!downloadFile.exists()) { - disableBrowserCache(resp); - resp.sendError(HttpServletResponse.SC_NOT_FOUND, "File does not exist: " + downloadFile.getName()); - return; + if (isForbiddenPath(req.getPathInfo(), resp)) { + return; + } + + // look for the file in one of the root download directories + File fileToDownload = null; + File[] downloadDirs = getRootDownloadsDirs(); + for (File downloadDir : downloadDirs) { + File file = new File(downloadDir, req.getPathInfo()); + if (file.exists()) { + fileToDownload = file; + break; } - resp.setContentType(getMimeType(downloadFile)); - resp.setHeader("Content-Disposition", "attachment; filename=" + downloadFile.getName()); - resp.setContentLength((int) downloadFile.length()); - resp.setDateHeader("Last-Modified", downloadFile.lastModified()); + } + + if (fileToDownload == null) { + disableBrowserCache(resp); + resp.sendError(HttpServletResponse.SC_NOT_FOUND, "File does not exist: " + req.getPathInfo()); + return; + }
- FileInputStream stream = new FileInputStream(downloadFile); + resp.setContentType(getMimeType(fileToDownload)); + resp.setHeader("Content-Disposition", "attachment; filename=" + fileToDownload.getName()); + resp.setContentLength((int) fileToDownload.length()); + resp.setDateHeader("Last-Modified", fileToDownload.lastModified()); + + FileInputStream stream = new FileInputStream(fileToDownload); try { StreamUtil.copy(stream, resp.getOutputStream(), false); } finally { stream.close(); } - } } catch (Throwable t) { log.error("Failed to stream download content.", t); disableBrowserCache(resp); @@ -158,12 +181,13 @@ public class DownloadServlet extends HttpServlet { return mimeType; }
- private void outputFileList(File requestedDirectory, HttpServletRequest req, HttpServletResponse resp) + private void outputFileList(String requestedDirectory, HttpServletRequest req, HttpServletResponse resp) throws ServletException {
try { if (!isForbiddenPath(requestedDirectory, resp)) { - String dirName = requestedDirectory.getName(); + File requestedDirectoryRelativePath = new File(requestedDirectory); + String dirName = requestedDirectoryRelativePath.getName(); disableBrowserCache(resp); resp.setContentType("text/html"); PrintWriter writer = resp.getWriter(); @@ -192,11 +216,11 @@ public class DownloadServlet extends HttpServlet { } }
- private boolean isForbiddenPath(File requestedFile, HttpServletResponse resp) throws IOException { + private boolean isForbiddenPath(String requestedPath, HttpServletResponse resp) throws IOException { boolean forbidden = true; // assume it is forbidden - if (requestedFile.toString().contains("rhq-agent")) { + if (requestedPath.toString().contains("rhq-agent")) { resp.sendError(HttpServletResponse.SC_FORBIDDEN, "Use /agentupdate/download to obtain the agent"); - } else if (requestedFile.toString().contains("rhq-client")) { + } else if (requestedPath.toString().contains("rhq-client")) { resp.sendError(HttpServletResponse.SC_FORBIDDEN, "Use /client/download to obtain the client"); } else { forbidden = false; @@ -215,28 +239,46 @@ public class DownloadServlet extends HttpServlet { resp.setHeader("Pragma", "no-cache"); }
- private List<File> getDownloadFiles(File requestedDirectory) throws Exception { - File[] filesArray = requestedDirectory.listFiles(); - - // this is simple - we only serve up files located in the requested directory - no content from subdirectories - List<File> files = new ArrayList<File>(); - if (filesArray != null) { - for (File file : filesArray) { - if (file.isFile()) { - files.add(file); + private List<File> getDownloadFiles(String requestedDirectory) throws Exception { + // its possible if more than one root dir has the file, we'll get duplicates. + // this should never happen, so ignore this edge case. + List<File> returnFiles = new ArrayList<File>(); + File[] rootDownloadDirs = getRootDownloadsDirs(); + for (File rootDownloadDir : rootDownloadDirs) { + File dir = new File(rootDownloadDir, requestedDirectory); + File[] filesArray = dir.listFiles(); + // this is simple - we only serve up files located in the requested directory - no content from subdirectories + if (filesArray != null) { + for (File file : filesArray) { + if (file.isFile()) { + returnFiles.add(file); + } } } } - return files; + + return returnFiles; }
- private File getRootDownloadsDir() throws Exception { - File serverHomeDir = LookupUtil.getCoreServer().getJBossServerHomeDir(); - File downloadDir = new File(serverHomeDir, "deployments/rhq.ear/rhq-downloads"); + /** + * There are two locations for downloads - the static content under the EAR's rhq-downloads + * and dynamic content in the data directory. + * + * @return the two root locations + * + * @throws Exception + */ + private File[] getRootDownloadsDirs() throws Exception { + File earDir = LookupUtil.getCoreServer().getEarDeploymentDir(); + File downloadDir = new File(earDir, "rhq-downloads"); if (!downloadDir.exists()) { throw new FileNotFoundException("Missing downloads directory at [" + downloadDir + "]"); } - return downloadDir; + + File dataDir = LookupUtil.getCoreServer().getJBossServerDataDir(); + File dataDownloadDir = new File(dataDir, "rhq-downloads"); + + return new File[] { dataDownloadDir, downloadDir }; // put the data dir first, I think that should take precedence }
private boolean isServerAcceptingRequests() { diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/core/CoreServerServiceImplTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/core/CoreServerServiceImplTest.java index e39ae31..42a8cda 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/core/CoreServerServiceImplTest.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/core/CoreServerServiceImplTest.java @@ -145,8 +145,8 @@ public class CoreServerServiceImplTest extends AbstractEJB3Test { // in order to register, we need to mock out the agent version file used by the server // to determine the agent version it supports. agentVersion = new AgentVersion("1.2.3", "12345"); - File agentVersionFile = new File(mbean.getJBossServerHomeDir(), - "deployments/rhq.ear/rhq-downloads/rhq-agent/rhq-server-agent-versions.properties"); + File agentVersionFile = new File(mbean.getJBossServerDataDir(), + "rhq-downloads/rhq-agent/rhq-server-agent-versions.properties"); agentVersionFile.getParentFile().mkdirs(); agentVersionFile.delete(); Properties agentVersionProps = new Properties(); @@ -531,12 +531,12 @@ public class CoreServerServiceImplTest extends AbstractEJB3Test {
@Override public File getJBossServerHomeDir() { - return new File(System.getProperty("java.io.tmpdir"), "CoreServerServiceImplTest"); + return null; }
@Override public File getJBossServerDataDir() { - return null; + return new File(System.getProperty("java.io.tmpdir"), "CoreServerServiceImplTest"); }
@Override @@ -546,7 +546,7 @@ public class CoreServerServiceImplTest extends AbstractEJB3Test {
@Override public File getEarDeploymentDir() { - return null; + return new File(System.getProperty("java.io.tmpdir"), "CoreServerServiceImplTest"); }
@Override diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerBean.java index bf3ff6f..9cced72 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerBean.java @@ -490,7 +490,7 @@ public class AgentManagerBean implements AgentManagerLocal {
@ExcludeDefaultInterceptors public File getAgentUpdateVersionFile() throws Exception { - File agentDownloadDir = getAgentDownloadDir(); + File agentDownloadDir = getAgentDataDownloadDir(); File versionFile = new File(agentDownloadDir, "rhq-server-agent-versions.properties"); if (!versionFile.exists()) { // we do not have the version properties file yet, let's extract some info and create one @@ -562,16 +562,42 @@ public class AgentManagerBean implements AgentManagerLocal { throw new FileNotFoundException("Missing agent update binary in [" + agentDownloadDir + "]"); }
- @ExcludeDefaultInterceptors + /** + * The directory on the server's file system where the agent update binary file is found. + * + * @return directory where the agent binary downloads are found + * + * @throws Exception if could not determine the location or it does not exist + */ + // SHOULD BE PRIVATE AND REMOVED FROM LOCAL INTERFACE - NOTHING (OTHER THAN THIS CLASS ITSELF) SHOULD USE THIS public File getAgentDownloadDir() throws Exception { - File serverHomeDir = LookupUtil.getCoreServer().getJBossServerHomeDir(); - File agentDownloadDir = new File(serverHomeDir, "deployments/rhq.ear/rhq-downloads/rhq-agent"); + File earDir = LookupUtil.getCoreServer().getEarDeploymentDir(); + File agentDownloadDir = new File(earDir, "rhq-downloads/rhq-agent"); if (!agentDownloadDir.exists()) { throw new FileNotFoundException("Missing agent downloads directory at [" + agentDownloadDir + "]"); } return agentDownloadDir; }
+ /** + * The directory on the server's file system where the agent update version file is found. + * + * @return directory where the agent version file is found + * + * @throws Exception if could not determine the location or it does not exist + */ + private File getAgentDataDownloadDir() throws Exception { + File earDir = LookupUtil.getCoreServer().getJBossServerDataDir(); + File agentDownloadDir = new File(earDir, "rhq-downloads/rhq-agent"); + if (!agentDownloadDir.exists()) { + agentDownloadDir.mkdirs(); + if (!agentDownloadDir.exists()) { + throw new FileNotFoundException("Missing agent data downloads directory at [" + agentDownloadDir + "]"); + } + } + return agentDownloadDir; + } + @Override public PingRequest handlePingRequest(PingRequest request) {
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerLocal.java index afd566b..e09cfaa 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerLocal.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerLocal.java @@ -269,13 +269,13 @@ public interface AgentManagerLocal { File getAgentUpdateBinaryFile() throws Exception;
/** - * The directory on the server's file system where the agent update version file - * and binary file are found. + * DO NOT USE THIS. You should be using one of the getAgentUpdateXXX methods directly rather + * than looking in the download directory. Not all agent update files are located in this download + * directory anymore. This API will be removed from the public API in the near future. * - * @return directory where the agent downloads are found - * - * @throws Exception if could not determine the location or it does not exist + * @deprecated */ + @Deprecated File getAgentDownloadDir() throws Exception;
void setAgentBackfilled(int agentId, boolean backfilled); diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/plugin/PluginDeploymentScanner.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/plugin/PluginDeploymentScanner.java index 3225c48..a674f23 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/plugin/PluginDeploymentScanner.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/plugin/PluginDeploymentScanner.java @@ -31,6 +31,7 @@ import org.rhq.core.clientapi.descriptor.AgentPluginDescriptorUtil; import org.rhq.core.util.MessageDigestGenerator; import org.rhq.core.util.exception.ThrowableUtil; import org.rhq.core.util.file.FileUtil; +import org.rhq.enterprise.server.util.LookupUtil; import org.rhq.enterprise.server.xmlschema.ServerPluginDescriptorUtil;
/** @@ -139,15 +140,6 @@ public class PluginDeploymentScanner implements PluginDeploymentScannerMBean { }
public void start() throws Exception { - // This will check to see if there are any agent plugin records in the database - // that do not have content associated with them and if so, will stream - // the content from the file system to the database. This is needed only - // in the case when this server has recently been upgraded from an old - // version of the software that did not originally have content stored in the DB. - // Once we do that, we can start the agent plugin deployer. - this.agentPluginScanner.fixMissingAgentPluginContent(); - this.agentPluginScanner.getAgentPluginDeployer().start(); - return; }
@@ -161,6 +153,30 @@ public class PluginDeploymentScanner implements PluginDeploymentScannerMBean { // the server's internal EJB/SLSBs are ready and can be called. This means we are allowed to start. // NOTE: Make sure we are called BEFORE the master plugin container is started!
+ // setup our attributes + File homeDir = LookupUtil.getCoreServer().getInstallDir(); + File earDir = LookupUtil.getCoreServer().getEarDeploymentDir(); + setUserPluginDir(new File(homeDir, "plugins").getAbsolutePath()); + setAgentPluginDir(new File(earDir, "rhq-downloads/rhq-plugins").getAbsolutePath()); + setServerPluginDir(new File(earDir, "rhq-serverplugins").getAbsolutePath()); + + log.info("user plugin dir=" + getUserPluginDir()); + log.info("agent plugin dir=" + getAgentPluginDir()); + log.info("server plugin dir=" + getServerPluginDir()); + + // This will check to see if there are any agent plugin records in the database + // that do not have content associated with them and if so, will stream + // the content from the file system to the database. This is needed only + // in the case when this server has recently been upgraded from an old + // version of the software that did not originally have content stored in the DB. + // Once we do that, we can start the agent plugin deployer. + try { + this.agentPluginScanner.fixMissingAgentPluginContent(); + this.agentPluginScanner.getAgentPluginDeployer().start(); + } catch (Exception e) { + throw new RuntimeException("Cannot start plugin deployment scanner properly", e); + } + this.agentPluginScanner.getAgentPluginDeployer().startDeployment();
// do the initial scan now diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/ServerPluginService.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/ServerPluginService.java index 5d7b3d1..e421ee5 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/ServerPluginService.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/ServerPluginService.java @@ -113,8 +113,8 @@ public class ServerPluginService implements ServerPluginServiceMBean { }
public File getServerPluginsDirectory() { - File serverHomeDir = LookupUtil.getCoreServer().getJBossServerHomeDir(); - File pluginDir = new File(serverHomeDir, "deployments/rhq.ear/rhq-serverplugins"); + File earDir = LookupUtil.getCoreServer().getEarDeploymentDir(); + File pluginDir = new File(earDir, "rhq-serverplugins"); return pluginDir; }
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/support/SupportManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/support/SupportManagerBean.java index 8ef6dc4..fdb9fe6 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/support/SupportManagerBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/support/SupportManagerBean.java @@ -93,8 +93,8 @@ public class SupportManagerBean implements SupportManagerLocal, SupportManagerRe }
private File getDownloadsDir() throws Exception { - File serverHomeDir = LookupUtil.getCoreServer().getJBossServerHomeDir(); - File downloadDir = new File(serverHomeDir, "deploy/rhq.ear/rhq-downloads/support"); + File dataDir = LookupUtil.getCoreServer().getJBossServerDataDir(); + File downloadDir = new File(dataDir, "rhq-downloads/support"); if (!downloadDir.isDirectory()) { downloadDir.mkdirs(); if (!downloadDir.isDirectory()) { diff --git a/modules/enterprise/server/sars/services-sar/src/main/resources/META-INF/jboss-service.xml b/modules/enterprise/server/sars/services-sar/src/main/resources/META-INF/jboss-service.xml index b8eb098..a4b3a9a 100644 --- a/modules/enterprise/server/sars/services-sar/src/main/resources/META-INF/jboss-service.xml +++ b/modules/enterprise/server/sars/services-sar/src/main/resources/META-INF/jboss-service.xml @@ -21,9 +21,6 @@ <mbean code="org.rhq.enterprise.server.core.plugin.PluginDeploymentScanner" name="rhq:service=PluginDeploymentScanner"> <attribute name="ScanPeriod">${rhq.server.plugin-scan-period-ms:300000}</attribute> - <attribute name="AgentPluginDir">${rhq.server.home}/modules/org/rhq/rhq-enterprise-server-startup-subsystem/main/deployments/rhq.ear/rhq-downloads/rhq-plugins</attribute> - <attribute name="ServerPluginDir">${rhq.server.home}/modules/org/rhq/rhq-enterprise-server-startup-subsystem/main/deployments/rhq.ear/rhq-serverplugins</attribute> - <attribute name="UserPluginDir">${rhq.server.home}/plugins</attribute> </mbean>
<mbean code="org.rhq.enterprise.server.scheduler.SchedulerService"
commit 2ce8b7aa063a56840090ed553f47b6e3a0ba7845 Author: John Mazzitelli mazz@redhat.com Date: Thu Nov 29 00:19:58 2012 -0500
disable secure jndi lookup checks for now
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/security/test/JndiAccessTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/security/test/JndiAccessTest.java index 274e94f..5dcf8c3 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/security/test/JndiAccessTest.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/security/test/JndiAccessTest.java @@ -40,14 +40,14 @@ import org.rhq.enterprise.server.RHQConstants; import org.rhq.enterprise.server.auth.SubjectManagerBean; import org.rhq.enterprise.server.test.AbstractEJB3Test; import org.rhq.enterprise.server.util.LookupUtil; -import org.rhq.jndi.AllowRhqServerInternalsAccessPermission;
/** * * * @author Lukas Krejci */ -@Test +@Test(enabled = false) +// TODO JNDI: reenable after fixing secure jndi lookups public class JndiAccessTest extends AbstractEJB3Test {
public void testEjbsAccessibleThroughPrivilegedCode() { @@ -210,14 +210,14 @@ public class JndiAccessTest extends AbstractEJB3Test {
private static void checkIsDesiredSecurityException(ScriptException e) { String message = e.getMessage(); - String permissionTrace = AllowRhqServerInternalsAccessPermission.class.getName(); + String permissionTrace = null; // TODO JNDI: AllowRhqServerInternalsAccessPermission.class.getName();
Assert.assertTrue(message.contains(permissionTrace), "The script exception doesn't seem to be caused by the AllowRhqServerInternalsAccessPermission security exception. " + message); }
private static void checkIsNotASecurityException(ScriptException e) { String message = e.getMessage(); - String permissionTrace = AllowRhqServerInternalsAccessPermission.class.getName(); + String permissionTrace = null; // TODO JNDI: AllowRhqServerInternalsAccessPermission.class.getName();
Assert.assertFalse(message.contains(permissionTrace), "The script exception does seem to be caused by the AllowRhqServerInternalsAccessPermission security exception although it shouldn't. " + message); } diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SessionManager.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SessionManager.java index ecf2f6f..279b360 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SessionManager.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SessionManager.java @@ -26,7 +26,6 @@ import java.util.Random;
import org.rhq.core.domain.auth.Subject; import org.rhq.enterprise.server.util.LookupUtil; -import org.rhq.jndi.AllowRhqServerInternalsAccessPermission;
/** * This is the JON Server's own session ID generator. It is outside any container-provided session mechanism. Its sole @@ -45,7 +44,8 @@ import org.rhq.jndi.AllowRhqServerInternalsAccessPermission; */ public final class SessionManager {
- private static final AllowRhqServerInternalsAccessPermission ACCESS_PERMISSION = new AllowRhqServerInternalsAccessPermission(); + // TODO JNDI + // private static final AllowRhqServerInternalsAccessPermission ACCESS_PERMISSION = new AllowRhqServerInternalsAccessPermission();
/** * Our source for random session IDs. @@ -277,7 +277,8 @@ public final class SessionManager { }
private static void checkPermission() { - SecurityManager sm = System.getSecurityManager(); - if (sm != null) sm.checkPermission(ACCESS_PERMISSION); + // TODO JNDI + // SecurityManager sm = System.getSecurityManager(); + // if (sm != null) sm.checkPermission(ACCESS_PERMISSION); } } \ No newline at end of file diff --git a/modules/integration-tests/jndi-access/jndi-access-test/src/test/java/org/rhq/jndi/test/JndiAccessTest.java b/modules/integration-tests/jndi-access/jndi-access-test/src/test/java/org/rhq/jndi/test/JndiAccessTest.java index abfd376..3bb8569 100644 --- a/modules/integration-tests/jndi-access/jndi-access-test/src/test/java/org/rhq/jndi/test/JndiAccessTest.java +++ b/modules/integration-tests/jndi-access/jndi-access-test/src/test/java/org/rhq/jndi/test/JndiAccessTest.java @@ -47,7 +47,6 @@ import org.rhq.core.domain.auth.Subject; import org.rhq.enterprise.client.LocalClient; import org.rhq.enterprise.server.test.AbstractEJB3Test; import org.rhq.enterprise.server.util.LookupUtil; -import org.rhq.jndi.AllowRhqServerInternalsAccessPermission; import org.rhq.test.PortScout;
/** @@ -55,7 +54,8 @@ import org.rhq.test.PortScout; * * @author Lukas Krejci */ -@Test +@Test(enabled = false) +// TODO JNDI: re-enable after secure JNDI lookups are fixed public class JndiAccessTest extends AbstractEJB3Test { private static final Log JNP_SERVER_LOG = LogFactory.getLog("Test JNP Server"); private static final Log LOG = LogFactory.getLog(JndiAccessTest.class); @@ -192,7 +192,7 @@ public class JndiAccessTest extends AbstractEJB3Test {
private static void checkIsDesiredSecurityException(ScriptException e) { String message = e.getMessage(); - String permissionTrace = AllowRhqServerInternalsAccessPermission.class.getName(); + String permissionTrace = null; // TODO JNDI: AllowRhqServerInternalsAccessPermission.class.getName();
Assert.assertTrue(message.contains(permissionTrace), "The script exception doesn't seem to be caused by the AllowRhqServerInternalsAccessPermission security exception. " + message); }
commit 53dd3a2a3721ecb8c447f89bd5315b080d7683c8 Author: John Mazzitelli mazz@redhat.com Date: Wed Nov 28 21:41:23 2012 -0500
we don't use this anymore, don't bother with directories under rhq.ear in this class
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/DownloadsUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/DownloadsUIBean.java index e9695fb..3b0a689 100644 --- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/DownloadsUIBean.java +++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/DownloadsUIBean.java @@ -62,21 +62,11 @@ public class DownloadsUIBean implements Serializable { }
private File getConnectorDownloadsDir() throws Exception { - File serverHomeDir = LookupUtil.getCoreServer().getJBossServerHomeDir(); - File downloadDir = new File(serverHomeDir, "deploy/rhq.ear/rhq-downloads/connectors"); - if (!downloadDir.exists()) { - throw new FileNotFoundException("Missing connectors download directory at [" + downloadDir + "]"); - } - return downloadDir; + throw new FileNotFoundException("Missing connectors download directory"); }
private File getClientDownloadDir() throws Exception { - File serverHomeDir = LookupUtil.getCoreServer().getJBossServerHomeDir(); - File downloadDir = new File(serverHomeDir, "deploy/rhq.ear/rhq-downloads/rhq-client"); - if (!downloadDir.exists()) { - throw new FileNotFoundException("Missing remote client download directory at [" + downloadDir + "]"); - } - return downloadDir; + throw new FileNotFoundException("Missing remote client download directory"); }
public Properties getClientVersionProperties() throws Exception { @@ -103,12 +93,7 @@ public class DownloadsUIBean implements Serializable { }
private File getBundleDeployerDownloadDir() throws Exception { - File serverHomeDir = LookupUtil.getCoreServer().getJBossServerHomeDir(); - File downloadDir = new File(serverHomeDir, "deploy/rhq.ear/rhq-downloads/bundle-deployer"); - if (!downloadDir.exists()) { - throw new FileNotFoundException("Missing bundle deployer download directory at [" + downloadDir + "]"); - } - return downloadDir; + throw new FileNotFoundException("Missing bundle deployer download directory"); }
private static List<File> getFiles(File downloadDir) {
commit eef8e20dca5ef7a85c08e4764f376575b39c3a09 Author: John Mazzitelli mazz@redhat.com Date: Wed Nov 28 21:41:04 2012 -0500
get server client-api module to get the scripts from new correct place
diff --git a/.classpath b/.classpath index e4ac1a7..e974d52 100644 --- a/.classpath +++ b/.classpath @@ -59,6 +59,7 @@ <classpathentry kind="src" path="modules/enterprise/server/installer/src/test/java"/> <classpathentry kind="src" path="modules/enterprise/gui/content_http-war/src/main/java"/> <classpathentry kind="src" path="modules/enterprise/server/client-api/src/main/java"/> + <classpathentry kind="src" path="modules/enterprise/server/client-api/src/test/java"/> <classpathentry kind="src" path="modules/enterprise/remoting/client-api/src/main/java"/> <classpathentry kind="src" path="modules/enterprise/remoting/cli/src/main/java"/> <classpathentry kind="src" path="modules/enterprise/remoting/cli/src/test/java"/> diff --git a/modules/enterprise/server/client-api/src/main/java/org/rhq/enterprise/client/RhqDownloadsScriptSourceProvider.java b/modules/enterprise/server/client-api/src/main/java/org/rhq/enterprise/client/RhqDownloadsScriptSourceProvider.java index 61ababb..1cbbe39 100644 --- a/modules/enterprise/server/client-api/src/main/java/org/rhq/enterprise/client/RhqDownloadsScriptSourceProvider.java +++ b/modules/enterprise/server/client-api/src/main/java/org/rhq/enterprise/client/RhqDownloadsScriptSourceProvider.java @@ -31,10 +31,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory;
import org.rhq.bindings.script.BaseRhqSchemeScriptSourceProvider; -import org.rhq.core.domain.auth.Subject; -import org.rhq.core.domain.common.ServerDetails; -import org.rhq.enterprise.server.auth.SubjectManagerLocal; -import org.rhq.enterprise.server.system.SystemManagerLocal; +import org.rhq.enterprise.server.core.CoreServerMBean; import org.rhq.enterprise.server.util.LookupUtil;
/** @@ -46,30 +43,22 @@ public class RhqDownloadsScriptSourceProvider extends BaseRhqSchemeScriptSourceP
private static final String AUTHORITY = "downloads";
- private SystemManagerLocal systemManager; - private SubjectManagerLocal subjectManager; + private CoreServerMBean coreServer;
public RhqDownloadsScriptSourceProvider() { - this(LookupUtil.getSystemManager(), LookupUtil.getSubjectManager()); + this(LookupUtil.getCoreServer()); }
- public RhqDownloadsScriptSourceProvider(SystemManagerLocal systemManager, SubjectManagerLocal subjectManager) { + public RhqDownloadsScriptSourceProvider(CoreServerMBean coreServerMBean) { super(AUTHORITY); - this.systemManager = systemManager; - this.subjectManager = subjectManager; + this.coreServer = coreServerMBean; }
@Override protected Reader doGetScriptSource(URI scriptUri) { String path = scriptUri.getPath().substring(1); //remove the leading /
- Subject overlord = subjectManager.getOverlord(); - - ServerDetails serverDetails = systemManager.getServerDetails(overlord); - - String installHomeDir = serverDetails.getDetails().get(ServerDetails.Detail.SERVER_INSTALL_DIR); - File downloadsDir = new File(installHomeDir, - "modules/org/rhq/rhq-enterprise-server-startup-subsystem/main/deployments/rhq.ear/rhq-downloads"); + File downloadsDir = getDownloadHomeDir(); File scriptDownloads = new File(downloadsDir, "script-modules"); File file = new File(scriptDownloads, path);
@@ -81,4 +70,9 @@ public class RhqDownloadsScriptSourceProvider extends BaseRhqSchemeScriptSourceP } }
+ private File getDownloadHomeDir() { + File earDeployDir = this.coreServer.getEarDeploymentDir(); + File downloadDir = new File(earDeployDir, "rhq-downloads"); + return downloadDir; + } } diff --git a/modules/enterprise/server/client-api/src/test/java/org/rhq/enterprise/client/test/RhqDownloadsScriptSourceProviderTest.java b/modules/enterprise/server/client-api/src/test/java/org/rhq/enterprise/client/test/RhqDownloadsScriptSourceProviderTest.java index a2c4a33..e62dd32 100644 --- a/modules/enterprise/server/client-api/src/test/java/org/rhq/enterprise/client/test/RhqDownloadsScriptSourceProviderTest.java +++ b/modules/enterprise/server/client-api/src/test/java/org/rhq/enterprise/client/test/RhqDownloadsScriptSourceProviderTest.java @@ -25,20 +25,16 @@ import java.io.File; import java.io.FileOutputStream; import java.io.Reader; import java.net.URI; -import java.util.HashMap;
import org.mockito.Mockito; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test;
-import org.rhq.core.domain.auth.Subject; -import org.rhq.core.domain.common.ServerDetails; import org.rhq.core.util.file.FileUtil; import org.rhq.core.util.stream.StreamUtil; import org.rhq.enterprise.client.RhqDownloadsScriptSourceProvider; -import org.rhq.enterprise.server.auth.SubjectManagerLocal; -import org.rhq.enterprise.server.system.SystemManagerLocal; +import org.rhq.enterprise.server.core.CoreServerMBean;
/** * @@ -54,7 +50,7 @@ public class RhqDownloadsScriptSourceProviderTest { @BeforeClass public void createTmpDir() throws Exception { tmpDir = FileUtil.createTempDirectory(getClass().getName(), null, null); - File downloadsDir = new File(new File(new File(new File(tmpDir, "deploy"), "rhq.ear"), "rhq-downloads"), "script-modules"); + File downloadsDir = new File(tmpDir, "rhq-downloads/script-modules"); downloadsDir.mkdirs();
File testScript = new File(downloadsDir, "test-script.js"); @@ -76,17 +72,11 @@ public class RhqDownloadsScriptSourceProviderTest { }
public void canLocateScripts() throws Exception { - SystemManagerLocal systemManager = Mockito.mock(SystemManagerLocal.class); - SubjectManagerLocal subjectManager = Mockito.mock(SubjectManagerLocal.class); + CoreServerMBean coreServer = Mockito.mock(CoreServerMBean.class);
- ServerDetails details = new ServerDetails(); - HashMap<ServerDetails.Detail, String> map = new HashMap<ServerDetails.Detail, String>(); - map.put(ServerDetails.Detail.SERVER_HOME_DIR, tmpDir.getAbsolutePath()); - details.setDetails(map); - - Mockito.when(systemManager.getServerDetails(Mockito.<Subject>any())).thenReturn(details); + Mockito.when(coreServer.getEarDeploymentDir()).thenReturn(tmpDir);
- RhqDownloadsScriptSourceProvider provider = new RhqDownloadsScriptSourceProvider(systemManager, subjectManager); + RhqDownloadsScriptSourceProvider provider = new RhqDownloadsScriptSourceProvider(coreServer);
URI location = new URI("rhq://downloads/test-script.js");
commit 5d02eedf321779657faa27f9cb045b4069173d3f Author: John Mazzitelli mazz@redhat.com Date: Wed Nov 28 17:47:53 2012 -0500
starting to get the downloads stuff to work
diff --git a/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/DeploymentJBossASClient.java b/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/DeploymentJBossASClient.java index 19999a2..16266c3 100644 --- a/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/DeploymentJBossASClient.java +++ b/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/DeploymentJBossASClient.java @@ -30,6 +30,8 @@ public class DeploymentJBossASClient extends JBossASClient {
public static final String SUBSYSTEM_DEPLOYMENT = "deployment"; public static final String ENABLED = "enabled"; + public static final String CONTENT = "content"; + public static final String PATH = "path";
public DeploymentJBossASClient(ModelControllerClient client) { super(client); @@ -81,4 +83,34 @@ public class DeploymentJBossASClient extends JBossASClient { } return; // everything is OK } + + /** + * Given the name of a deployment, this returns where the deployment is (specifically, + * it returns the PATH of the deployment). + * + * @param name the name of the deployment + * @return the path where the deployment is found + * + * @throws Exception + */ + public String getDeploymentPath(String name) throws Exception { + Address addr = Address.root().add(SUBSYSTEM_DEPLOYMENT, name); + ModelNode op = createReadAttributeRequest(CONTENT, addr); + final ModelNode results = execute(op); + if (isSuccess(results)) { + ModelNode path; + try { + path = getResults(results).asList().get(0).asObject().get(PATH); + } catch (Exception e) { + throw new Exception("Cannot get path associated with deployment [" + name + "]"); + } + if (path != null) { + return path.asString(); + } else { + throw new Exception("No path associated with deployment [" + name + "]"); + } + } else { + throw new FailureException(results, "Cannot get the deployment path"); + } + } } diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/SystemGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/SystemGWTServiceImpl.java index a665f03..3394e03 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/SystemGWTServiceImpl.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/SystemGWTServiceImpl.java @@ -214,8 +214,8 @@ public class SystemGWTServiceImpl extends AbstractGWTServiceImpl implements Syst }
private File getConnectorDownloadsDir() { - File serverHomeDir = getServerHomeDir(); - File downloadDir = new File(serverHomeDir, "deployments/rhq.ear/rhq-downloads/connectors"); + File homeDir = getDownloadHomeDir(); + File downloadDir = new File(homeDir, "connectors"); if (!downloadDir.exists()) { throw new RuntimeException("Server is missing connectors download directory at [" + downloadDir + "]"); } @@ -223,8 +223,8 @@ public class SystemGWTServiceImpl extends AbstractGWTServiceImpl implements Syst }
private File getCliAlertScriptDownloadsDir() { - File serverHomeDir = getServerHomeDir(); - File downloadDir = new File(serverHomeDir, "deployments/rhq.ear/rhq-downloads/cli-alert-scripts"); + File homeDir = getDownloadHomeDir(); + File downloadDir = new File(homeDir, "cli-alert-scripts"); if (!downloadDir.exists()) { throw new RuntimeException("Server is missing connectors download directory at [" + downloadDir + "]"); } @@ -232,8 +232,8 @@ public class SystemGWTServiceImpl extends AbstractGWTServiceImpl implements Syst }
private File getScriptModulesDownloadsDir() { - File serverHomeDir = getServerHomeDir(); - File downloadDir = new File(serverHomeDir, "deployments/rhq.ear/rhq-downloads/script-modules"); + File homeDir = getDownloadHomeDir(); + File downloadDir = new File(homeDir, "script-modules"); if (!downloadDir.exists()) { throw new RuntimeException("Server is missing connectors download directory at [" + downloadDir + "]"); } @@ -241,8 +241,8 @@ public class SystemGWTServiceImpl extends AbstractGWTServiceImpl implements Syst }
private File getClientDownloadDir() { - File serverHomeDir = getServerHomeDir(); - File downloadDir = new File(serverHomeDir, "deployments/rhq.ear/rhq-downloads/rhq-client"); + File homeDir = getDownloadHomeDir(); + File downloadDir = new File(homeDir, "rhq-client"); if (!downloadDir.exists()) { throw new RuntimeException("Server is missing client download directory at [" + downloadDir + "]"); } @@ -250,18 +250,18 @@ public class SystemGWTServiceImpl extends AbstractGWTServiceImpl implements Syst }
private File getBundleDeployerDownloadDir() { - File serverHomeDir = getServerHomeDir(); - File downloadDir = new File(serverHomeDir, "deployments/rhq.ear/rhq-downloads/bundle-deployer"); + File homeDir = getDownloadHomeDir(); + File downloadDir = new File(homeDir, "bundle-deployer"); if (!downloadDir.exists()) { throw new RuntimeException("Missing bundle deployer download directory at [" + downloadDir + "]"); } return downloadDir; }
- private File getServerHomeDir() { - ServerDetails details = systemManager.getServerDetails(LookupUtil.getSubjectManager().getOverlord()); - File serverHomeDir = new File(details.getDetails().get(ServerDetails.Detail.SERVER_HOME_DIR)); - return serverHomeDir; + private File getDownloadHomeDir() { + File earDeployDir = LookupUtil.getCoreServer().getEarDeploymentDir(); + File downloadDir = new File(earDeployDir, "rhq-downloads"); + return downloadDir; }
private static List<File> getFiles(File downloadDir) { diff --git a/modules/enterprise/server/client-api/src/main/java/org/rhq/enterprise/client/RhqDownloadsScriptSourceProvider.java b/modules/enterprise/server/client-api/src/main/java/org/rhq/enterprise/client/RhqDownloadsScriptSourceProvider.java index c065b48..61ababb 100644 --- a/modules/enterprise/server/client-api/src/main/java/org/rhq/enterprise/client/RhqDownloadsScriptSourceProvider.java +++ b/modules/enterprise/server/client-api/src/main/java/org/rhq/enterprise/client/RhqDownloadsScriptSourceProvider.java @@ -67,11 +67,11 @@ public class RhqDownloadsScriptSourceProvider extends BaseRhqSchemeScriptSourceP
ServerDetails serverDetails = systemManager.getServerDetails(overlord);
- String serverHomeDir = serverDetails.getDetails().get(ServerDetails.Detail.SERVER_HOME_DIR); - - File downloads = new File(serverHomeDir, "deploy/rhq.ear/rhq-downloads/script-modules"); - - File file = new File(downloads, path); + String installHomeDir = serverDetails.getDetails().get(ServerDetails.Detail.SERVER_INSTALL_DIR); + File downloadsDir = new File(installHomeDir, + "modules/org/rhq/rhq-enterprise-server-startup-subsystem/main/deployments/rhq.ear/rhq-downloads"); + File scriptDownloads = new File(downloadsDir, "script-modules"); + File file = new File(scriptDownloads, path);
try { return new InputStreamReader(new FileInputStream(file)); diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/core/CoreServerServiceImplTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/core/CoreServerServiceImplTest.java index 645e35c..e39ae31 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/core/CoreServerServiceImplTest.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/core/CoreServerServiceImplTest.java @@ -545,6 +545,11 @@ public class CoreServerServiceImplTest extends AbstractEJB3Test { }
@Override + public File getEarDeploymentDir() { + return null; + } + + @Override public ProductInfo getProductInfo() { return null; } diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CoreServer.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CoreServer.java index c14a549..9a60f12 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CoreServer.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CoreServer.java @@ -32,8 +32,13 @@ import javax.management.ObjectName; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory;
+import org.jboss.as.controller.client.ModelControllerClient; + +import org.rhq.common.jbossas.client.controller.DeploymentJBossASClient; import org.rhq.core.domain.common.ProductInfo; import org.rhq.core.util.ObjectNameFactory; +import org.rhq.enterprise.server.RHQConstants; +import org.rhq.enterprise.server.core.service.ManagementService;
/** * Get information about RHQ's underlying AS Server. @@ -83,40 +88,70 @@ public class CoreServer implements CoreServerMBean { return "RHQ Server"; }
+ @Override public String getVersion() { return this.buildProps.getProperty(PROP_PRODUCT_VERSION, "?"); }
+ @Override public String getBuildNumber() { return this.buildProps.getProperty(PROP_BUILD_NUMBER, "?"); }
+ @Override public Date getBootTime() { return bootTime; }
+ @Override public File getInstallDir() { - // use logDir explicitly - NOT homeDir because AS could be installed elsewhere (e.g. via rpm) - // but our log dir is always under our own installation directory + String rhqHome = System.getProperty("rhq.server.home"); + if (rhqHome != null) { + return new File(rhqHome); + } + + // I think that sysprop should always be set, but just in case, fallback on using + // logDir explicitly - log dir is always under our own installation directory File homeDir = new File(getServerEnvironmentAttribute("logDir")); return homeDir.getParentFile(); // logDir is "rhq-install-dir/logs", so the install dir is .. from there }
+ @Override public File getJBossServerHomeDir() { File baseDir = new File(getServerEnvironmentAttribute("baseDir")); return baseDir; }
+ @Override public File getJBossServerDataDir() { File dataDir = new File(getServerEnvironmentAttribute("dataDir")); return dataDir; }
+ @Override public File getJBossServerTempDir() { File tempDir = new File(getServerEnvironmentAttribute("tempDir")); return tempDir; }
+ @Override + public File getEarDeploymentDir() { + ModelControllerClient mcc = ManagementService.getClient(); + try { + DeploymentJBossASClient client = new DeploymentJBossASClient(mcc); + String earPath = client.getDeploymentPath(RHQConstants.EAR_FILE_NAME); + return new File(earPath); + } catch (Exception e) { + throw new RuntimeException(e); + } finally { + try { + mcc.close(); + } catch (IOException ignore) { + } + } + } + + @Override public ProductInfo getProductInfo() { ClassLoader classLoader = this.getClass().getClassLoader(); InputStream inputStream = classLoader.getResourceAsStream(PRODUCT_INFO_PROPERTIES_RESOURCE_PATH); diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CoreServerMBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CoreServerMBean.java index 1e4796f..03c0ba0 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CoreServerMBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CoreServerMBean.java @@ -83,6 +83,13 @@ public interface CoreServerMBean { File getJBossServerTempDir();
/** + * Where the main app EAR is located. + * + * @return the ear deployment directory + */ + File getEarDeploymentDir(); + + /** * Product information - the product name, homepage URL, docs URL, etc. * * @return product information - the product name, homepage URL, docs URL, etc.
commit f306953242462ac73d25264cd061426d253040c2 Merge: c8a3999 1a86bb9 Author: John Mazzitelli mazz@redhat.com Date: Wed Nov 28 14:12:14 2012 -0500
Merge remote-tracking branch 'origin/master' into merge-rhq-on-as7
Conflicts: modules/plugins/JBossOSGi/pom.xml
commit c8a3999309669b96d5d3876019b9c25c5303ca9a Author: John Mazzitelli mazz@redhat.com Date: Wed Nov 28 14:08:22 2012 -0500
the start of the new-new installer. the old-new installer (the GWT webapp) is now removed. there is now a new standalone installer. this also fixes the poms so dev mode puts the artifacts in the module where the ear is now deployed
diff --git a/.classpath b/.classpath index 5cd1dde..e4ac1a7 100644 --- a/.classpath +++ b/.classpath @@ -57,9 +57,6 @@ <classpathentry kind="src" path="modules/enterprise/gui/portal-war/src/test/java"/> <classpathentry kind="src" path="modules/enterprise/server/installer/src/main/java"/> <classpathentry kind="src" path="modules/enterprise/server/installer/src/test/java"/> - <classpathentry kind="src" path="modules/enterprise/gui/installer/src/main/java"/> - <classpathentry kind="src" path="modules/enterprise/gui/installer/src/test/java"/> - <classpathentry kind="src" path="modules/enterprise/gui/installer/target/generated-sources/gwt"/> <classpathentry kind="src" path="modules/enterprise/gui/content_http-war/src/main/java"/> <classpathentry kind="src" path="modules/enterprise/server/client-api/src/main/java"/> <classpathentry kind="src" path="modules/enterprise/remoting/client-api/src/main/java"/> diff --git a/etc/agent-versioning/build.xml b/etc/agent-versioning/build.xml index 6d61608..d6c18a1 100644 --- a/etc/agent-versioning/build.xml +++ b/etc/agent-versioning/build.xml @@ -112,7 +112,7 @@ ant -Dserver.home.dir=/my/server/rhq-agent -Dnew.version=0.0.0.GA -Dnew.build=0 <target name="init-server"> <property name="env.RHQ_SERVER_HOME" location="dev-container"/> <property name="server.home.dir" location="${env.RHQ_SERVER_HOME}"/> - <property name="server.download.dir" location="${server.home.dir}/jbossas/server/default/deploy/rhq.ear/rhq-downloads/rhq-agent"/> + <property name="server.download.dir" location="${server.home.dir}/modules/org/rhq/rhq-enterprise-server-startup-subsystem/main/deployments/rhq.ear/rhq-downloads/rhq-agent"/> <available property="_server.download.dir.exists" file="${server.download.dir}"/> <fail unless="_server.download.dir.exists" message="Cannot find the server download directory at ${server.download.dir}"/>
diff --git a/etc/apt/pom.xml b/etc/apt/pom.xml index a759975..66c6fb5 100644 --- a/etc/apt/pom.xml +++ b/etc/apt/pom.xml @@ -135,7 +135,7 @@ <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> <rhq.deploymentDir> - ${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins + ${rhq.containerDir}/${rhq.agentPluginDir} </rhq.deploymentDir> </properties>
diff --git a/etc/classloaders-test/plugin1/pom.xml b/etc/classloaders-test/plugin1/pom.xml index 2c405e2..e2f93d9 100644 --- a/etc/classloaders-test/plugin1/pom.xml +++ b/etc/classloaders-test/plugin1/pom.xml @@ -158,7 +158,7 @@ <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/standalone/deployments/rhq.ear/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties> <build> <plugins> diff --git a/etc/classloaders-test/plugin2/pom.xml b/etc/classloaders-test/plugin2/pom.xml index a67aff1..0be4a5a 100644 --- a/etc/classloaders-test/plugin2/pom.xml +++ b/etc/classloaders-test/plugin2/pom.xml @@ -158,7 +158,7 @@ <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/standalone/deployments/rhq.ear/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties> <build> <plugins> diff --git a/etc/samples/skeleton-plugin/pom.xml b/etc/samples/skeleton-plugin/pom.xml index 6d173ff..9ea4633 100644 --- a/etc/samples/skeleton-plugin/pom.xml +++ b/etc/samples/skeleton-plugin/pom.xml @@ -159,7 +159,7 @@ <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/standalone/deployments/rhq.ear/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties> <build> <plugins> diff --git a/modules/common/drift/pom.xml b/modules/common/drift/pom.xml index c9cfb49..2b0a46a 100644 --- a/modules/common/drift/pom.xml +++ b/modules/common/drift/pom.xml @@ -35,7 +35,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/lib</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.earLibDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/common/jboss-as-dmr-client/pom.xml b/modules/common/jboss-as-dmr-client/pom.xml index 672a21b..260bd92 100644 --- a/modules/common/jboss-as-dmr-client/pom.xml +++ b/modules/common/jboss-as-dmr-client/pom.xml @@ -45,7 +45,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/lib</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.earLibDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/core/client-api/pom.xml b/modules/core/client-api/pom.xml index 4f12876..ee8f1dc 100644 --- a/modules/core/client-api/pom.xml +++ b/modules/core/client-api/pom.xml @@ -128,7 +128,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/lib</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.earLibDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/core/comm-api/pom.xml b/modules/core/comm-api/pom.xml index da095ea..bf4b745 100644 --- a/modules/core/comm-api/pom.xml +++ b/modules/core/comm-api/pom.xml @@ -26,7 +26,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/lib</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.earLibDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml index 615b252..d47e864 100644 --- a/modules/core/dbutils/pom.xml +++ b/modules/core/dbutils/pom.xml @@ -378,7 +378,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/lib</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.earLibDir}</rhq.deploymentDir>
<!-- these are defined in the db.dev profile also - but if you just use -Pdev without -Ddb=dev or -Pdb.dev then you won't be using the dev DB. These properties allow -Pdev -Ddbsetup to do what you'd expect diff --git a/modules/core/domain/pom.xml b/modules/core/domain/pom.xml index 11e4e3e..1c2d940 100644 --- a/modules/core/domain/pom.xml +++ b/modules/core/domain/pom.xml @@ -407,7 +407,7 @@ <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> <rhq.deploymentName>${project.build.finalName}.jar</rhq.deploymentName> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/${rhq.deploymentName}</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.earDeployDir}/${rhq.deploymentName}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/core/gui/pom.xml b/modules/core/gui/pom.xml index 8cbfab1..d17353c 100644 --- a/modules/core/gui/pom.xml +++ b/modules/core/gui/pom.xml @@ -113,7 +113,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-portal.war/WEB-INF/lib</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.earDeployDir}/rhq-portal.war/WEB-INF/lib</rhq.deploymentDir> </properties>
<build> diff --git a/modules/core/util/pom.xml b/modules/core/util/pom.xml index 43c2ffc..ef4b285 100644 --- a/modules/core/util/pom.xml +++ b/modules/core/util/pom.xml @@ -87,7 +87,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/lib</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.earLibDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/enterprise/agentupdate/pom.xml b/modules/enterprise/agentupdate/pom.xml index 1823b19..b26d8e3 100644 --- a/modules/enterprise/agentupdate/pom.xml +++ b/modules/enterprise/agentupdate/pom.xml @@ -150,7 +150,7 @@ rhq-agent.latest.build-number=${buildNumber} <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> <rhq.projectJar>${project.build.finalName}.jar</rhq.projectJar> <rhq.deploymentJar>rhq-enterprise-agent-${project.version}.jar</rhq.deploymentJar> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-agent</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.earDeployDir}/rhq-downloads/rhq-agent</rhq.deploymentDir> </properties>
<build> diff --git a/modules/enterprise/binding/pom.xml b/modules/enterprise/binding/pom.xml index e16d39b..e0e88af 100644 --- a/modules/enterprise/binding/pom.xml +++ b/modules/enterprise/binding/pom.xml @@ -259,7 +259,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/lib</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.earLibDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/enterprise/comm/pom.xml b/modules/enterprise/comm/pom.xml index eb56bfb..48fad0c 100644 --- a/modules/enterprise/comm/pom.xml +++ b/modules/enterprise/comm/pom.xml @@ -170,7 +170,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/lib</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.earLibDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/enterprise/gui/content_http-war/pom.xml b/modules/enterprise/gui/content_http-war/pom.xml index 87d5b6b..6ca6272 100644 --- a/modules/enterprise/gui/content_http-war/pom.xml +++ b/modules/enterprise/gui/content_http-war/pom.xml @@ -166,7 +166,7 @@ <rhq.rootDir>../../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> <rhq.deploymentName>${project.build.finalName}.war</rhq.deploymentName> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/${rhq.deploymentName}</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.earDeployDir}/${rhq.deploymentName}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/enterprise/gui/coregui/pom.xml b/modules/enterprise/gui/coregui/pom.xml index a373e54..4b5c522 100644 --- a/modules/enterprise/gui/coregui/pom.xml +++ b/modules/enterprise/gui/coregui/pom.xml @@ -382,9 +382,7 @@ <rhq.rootDir>../../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> <rhq.deploymentName>${project.build.finalName}.war</rhq.deploymentName> - <rhq.deploymentDir> - ${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/${rhq.deploymentName} - </rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.earDeployDir}/${rhq.deploymentName}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/enterprise/gui/installer/pom.xml b/modules/enterprise/gui/installer/pom.xml deleted file mode 100644 index 81fda8e..0000000 --- a/modules/enterprise/gui/installer/pom.xml +++ /dev/null @@ -1,413 +0,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%22%3E - - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.rhq</groupId> - <artifactId>rhq-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> - <relativePath>../../../../pom.xml</relativePath> - </parent> - - <groupId>org.rhq</groupId> - <artifactId>rhq-installer</artifactId> - <packaging>war</packaging> - - <name>RHQ Enterprise GWT Installer GUI</name> - <description>The RHQ Enterprise GWT Installer GUI webapp</description> - - <properties> - <!-- dependency versions --> - <gwt.version>2.4.0</gwt.version> - <smartgwt.version>3.0</smartgwt.version> - - <installerGuiParams /> - <installerGuiRunTarget>'http://localhost:7080/rhq-installer/index.html$%7BinstallerGuiParams%7D'</installerGuiRunTarget> - - <!-- If this is too much memory to allocate to your gwt:debug process then - override this property in in your settings.xml --> - <gwt-plugin.extraJvmArgs>-Xms512M -Xmx512M -XX:PermSize=128M -XX:MaxPermSize=256M</gwt-plugin.extraJvmArgs> - <gwt-plugin.localWorkers>4</gwt-plugin.localWorkers> - - <gwt.userAgent>ie8,ie9,gecko1_8,safari,opera</gwt.userAgent> - <gwt.draftCompile>false</gwt.draftCompile> - <gwt.soyc>false</gwt.soyc> - <gwt.style>PRETTY</gwt.style> - <!-- <gwt.locale>en,de,ja,pt,zh,ru,cs</gwt.locale> --> - <gwt.locale>en</gwt.locale> - <gwt.fallback.locale>en</gwt.fallback.locale> - - <enable-tags>true</enable-tags> - </properties> - - <dependencyManagement> - <dependencies> - <!-- JBoss distributes a complete set of Java EE 6 APIs. We use this here - so that we always get the correct versions of artifacts. - TODO: We should probably move this up to the root pom. --> - <dependency> - <groupId>org.jboss.spec</groupId> - <artifactId>jboss-javaee-6.0</artifactId> - <version>3.0.0.Final</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - - <dependencies> - <dependency> - <groupId>org.rhq</groupId> - <artifactId>rhq-core-util</artifactId> - <version>${project.version}</version> - </dependency> - - <dependency> - <groupId>org.rhq</groupId> - <artifactId>rhq-core-dbutils</artifactId> - <version>${project.version}</version> - </dependency> - - <dependency> - <!-- need this solely for SecurityUtils --> - <groupId>org.rhq</groupId> - <artifactId>rhq-enterprise-comm</artifactId> - <version>${project.version}</version> - </dependency> - - <dependency> - <groupId>org.rhq</groupId> - <artifactId>rhq-jboss-as-dmr-client</artifactId> - <version>${project.version}</version> - </dependency> - - <!-- dbutils has transitive dep on ant-launcher but with test scope - installer needs it for real --> - <dependency> - <groupId>ant</groupId> - <artifactId>ant-launcher</artifactId> - <version>1.6.5</version> - </dependency> - - <dependency> - <groupId>com.google.gwt</groupId> - <artifactId>gwt-servlet</artifactId> - <version>${gwt.version}</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>com.google.gwt</groupId> - <artifactId>gwt-user</artifactId> - <version>${gwt.version}</version> - <scope>provided</scope> - </dependency> - - <!-- This is so we can compile custom GWT Generators to be called during - gwt compilation. Is is not needed at runtime and so is not included in the - WAR. --> - <dependency> - <groupId>com.google.gwt</groupId> - <artifactId>gwt-dev</artifactId> - <version>${gwt.version}</version> - <scope>provided</scope> - </dependency> - - <dependency> - <groupId>com.smartgwt</groupId> - <artifactId>smartgwt</artifactId> - <version>${smartgwt.version}</version> - </dependency> - - <!-- Import the Servlet API --> - <dependency> - <groupId>org.jboss.spec.javax.servlet</groupId> - <artifactId>jboss-servlet-api_3.0_spec</artifactId> - <scope>provided</scope> <!-- provided by AS7 --> - </dependency> - - - <dependency> - <groupId>org.jboss.as</groupId> - <artifactId>jboss-as-server</artifactId> - <version>${jboss.version}</version> - <scope>provided</scope> <!-- provided by AS7 --> - </dependency> - - <!-- test deps --> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <version>1.9.0</version> - <scope>test</scope> - </dependency> - - </dependencies> - - <build> - <finalName>rhq-installer</finalName> - - <resources> - <resource> - <targetPath>${project.build.directory}/generated-sources/gwt</targetPath> - <directory>src/main/resources</directory> - <filtering>true</filtering> - <includes> - <include>**/*.gwt.xml</include> - <include>**/*.properties</include> - </includes> - </resource> - <resource> - <directory>src/main/java</directory> - <includes> - <include>**/*.java</include> - </includes> - </resource> - </resources> - - <plugins> - - <plugin> - <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <systemPropertyVariables> - <rhq.test.ds.type-mapping>${rhq.test.ds.type-mapping}</rhq.test.ds.type-mapping> - <rhq.test.ds.server-name>${rhq.test.ds.server-name}</rhq.test.ds.server-name> - <rhq.test.ds.db-name>${rhq.test.ds.db-name}</rhq.test.ds.db-name> - <rhq.test.ds.connection-url>${rhq.test.ds.connection-url}</rhq.test.ds.connection-url> - <rhq.db.admin.username>${rhq.db.admin.username}</rhq.db.admin.username> - <rhq.db.admin.password>${rhq.db.admin.password}</rhq.db.admin.password> - <rhq.test.ds.user-name>${rhq.test.ds.user-name}</rhq.test.ds.user-name> - <rhq.test.ds.password>${rhq.test.ds.password}</rhq.test.ds.password> - </systemPropertyVariables> - </configuration> - </plugin> - - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>gwt-maven-plugin</artifactId> - <version>2.4.0</version> - <configuration> - <noServer>true</noServer> - <inplace>false</inplace> - <logLevel>INFO</logLevel> - <runTarget>${installerGuiRunTarget}</runTarget> - <extraJvmArgs>${gwt-plugin.extraJvmArgs}</extraJvmArgs> - <localWorkers>${gwt-plugin.localWorkers}</localWorkers> - <draftCompile>${gwt.draftCompile}</draftCompile> - <soyc>${gwt.soyc}</soyc> - <buildOutputDirectory>target/gwtclasses</buildOutputDirectory> - <hostedWebapp>target/hostedWar</hostedWebapp> - <debugSuspend>false</debugSuspend> - <servicePattern>**/gwt/*GWTService.java</servicePattern> - <i18nMessagesBundle>org.rhq.enterprise.gui.installer.client.Messages</i18nMessagesBundle> - <i18nConstantsWithLookupBundle>org.rhq.enterprise.gui.installer.client.ServerPropertiesMessages</i18nConstantsWithLookupBundle> - <style>${gwt.style}</style> - <strict>true</strict> - <!-- compiles gwt artifacts like symbolMap outside of war so it doesnt - get packaged --> - <deploy>${project.build.directory}/gwt-deploy</deploy> - </configuration> - - <executions> - <execution> - <id>gwt-goals</id> - <goals> - <goal>compile</goal> - <goal>generateAsync</goal> - <goal>i18n</goal> - </goals> - </execution> - <execution> - <!-- This id is what does the trick, don't change it. For this to work - maven 2.2.0 and later is needed. --> - <id>default-cli</id> - <goals> - <goal>debug</goal> - </goals> - <configuration> - <module>org.rhq.enterprise.gui.installer.Installer</module> - </configuration> - </execution> - </executions> - </plugin> - - <plugin> - <artifactId>maven-war-plugin</artifactId> - <configuration> - <archive> - <manifest> - <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries> - <addDefaultImplementationEntries>true</addDefaultImplementationEntries> - </manifest> - <manifestEntries> - <Build-Number>${buildNumber}</Build-Number> - <Dependencies>org.jboss.msc,org.jboss.as.controller-client,org.jboss.as.controller,org.jboss.as.server</Dependencies> - </manifestEntries> - </archive> - <webResources> - <resource> - <filtering>false</filtering> - <directory>${basedir}/src/main/webapp</directory> - </resource> - </webResources> - </configuration> - </plugin> - - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>build-helper-maven-plugin</artifactId> - <executions> - <execution> - <id>add-gwt-source</id> - <phase>generate-sources</phase> - <goals> - <goal>add-source</goal> - </goals> - <configuration> - <sources> - <source>${basedir}/target/generated-sources/gwt</source> - </sources> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - - </build> - - <profiles> - <profile> - <id>dev</id> - - <properties> - <rhq.rootDir>../../../..</rhq.rootDir> - <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentName>${project.build.finalName}.war</rhq.deploymentName> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.deploymentName}</rhq.deploymentDir> - </properties> - - <build> - <plugins> - - <plugin> - <artifactId>maven-antrun-plugin</artifactId> - <executions> - - <execution> - <id>deploy</id> - <phase>package</phase> - <configuration> - <target> - <property name="deployment.dir" location="${rhq.deploymentDir}" /> - <echo>*** Copying updated files from target${file.separator}${project.build.finalName}${file.separator} to ${deployment.dir}${file.separator}...</echo> - <copy todir="${deployment.dir}" verbose="${rhq.verbose}"> - <fileset dir="${basedir}/target/${project.build.finalName}" /> - </copy> - <echo>*** Copying MANIFEST.MF from target${file.separator}${project.build.finalName}.war to ${deployment.dir}${file.separator}META-INF...</echo> - <unwar src="${basedir}/target/${project.build.finalName}.war" - dest="${deployment.dir}"> - <patternset> - <include name="META-INF/MANIFEST.MF" /> - </patternset> - </unwar> - <delete file="${deployment.dir}/../${rhq.deploymentName}.failed" /> <!-- in case we previously failed --> - <!-- TODO: do we want to deploy the installer even if dev mode? --> - <touch file="${deployment.dir}/../${rhq.deploymentName}.dodeploy" /> - </target> - </configuration> - <goals> - <goal>run</goal> - </goals> - </execution> - - <execution> - <id>undeploy</id> - <phase>clean</phase> - <configuration> - <target> - <property name="deployment.dir" location="${rhq.deploymentDir}" /> - <echo>*** Deleting ${deployment.dir}${file.separator}...</echo> - <delete dir="${deployment.dir}" /> - <delete file="${deployment.dir}/../${rhq.deploymentName}.failed" /> <!-- in case we previously failed --> - </target> - </configuration> - <goals> - <goal>run</goal> - </goals> - </execution> - - </executions> - </plugin> - - </plugins> - </build> - </profile> - - <!-- Change the installerGuiRunTarget to not have single quotes. The quotes - work for linux but not win --> - <profile> - <id>windows</id> - <activation> - <os> - <family>Windows</family> - </os> - </activation> - <properties> - <installerGuiRunTarget>http://localhost:7080//rhq-installer/index.html$%7BinstallerGuiParams%7D</installerGuiRunTarget> - </properties> - </profile> - - <profile> - <id>msg</id> - <build> - <plugins> - <plugin> - <artifactId>maven-compiler-plugin</artifactId> - <configuration> - <includes> - <include>org/rhq/enterprise/gui/installer/client/*Messages.java</include> - </includes> - </configuration> - </plugin> - </plugins> - </build> - </profile> - - <profile> - <id>disable-tags</id> - <activation> - <property> - <name>brew</name> - </property> - </activation> - <properties> - <enable.tags>false</enable.tags> - </properties> - </profile> - - </profiles> - - - <repositories> - <repository> - <id>smartgwt</id> - <name>SmartGWT Releases</name> - <url>http://www.smartclient.com/maven2/</url> - <snapshots> - <enabled>false</enabled> - </snapshots> - </repository> - - <repository> - <id>codehaus</id> - <name>Codehaus Releases</name> - <url>http://repository.codehaus.org/</url> - <snapshots> - <enabled>false</enabled> - </snapshots> - </repository> - - </repositories> - -</project> diff --git a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/client/Installer.java b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/client/Installer.java deleted file mode 100644 index 2dd4e4c..0000000 --- a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/client/Installer.java +++ /dev/null @@ -1,771 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.installer.client; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.Map; - -import com.google.gwt.core.client.EntryPoint; -import com.google.gwt.core.client.GWT; -import com.google.gwt.dom.client.Element; -import com.google.gwt.user.client.DOM; -import com.google.gwt.user.client.Window; -import com.google.gwt.user.client.rpc.AsyncCallback; -import com.smartgwt.client.types.Alignment; -import com.smartgwt.client.types.Side; -import com.smartgwt.client.types.VerticalAlignment; -import com.smartgwt.client.util.BooleanCallback; -import com.smartgwt.client.util.SC; -import com.smartgwt.client.widgets.Button; -import com.smartgwt.client.widgets.Canvas; -import com.smartgwt.client.widgets.IButton; -import com.smartgwt.client.widgets.Label; -import com.smartgwt.client.widgets.events.ClickEvent; -import com.smartgwt.client.widgets.events.ClickHandler; -import com.smartgwt.client.widgets.form.DynamicForm; -import com.smartgwt.client.widgets.form.fields.ButtonItem; -import com.smartgwt.client.widgets.form.fields.FormItem; -import com.smartgwt.client.widgets.form.fields.FormItemIcon; -import com.smartgwt.client.widgets.form.fields.PasswordItem; -import com.smartgwt.client.widgets.form.fields.SelectItem; -import com.smartgwt.client.widgets.form.fields.SpacerItem; -import com.smartgwt.client.widgets.form.fields.SpinnerItem; -import com.smartgwt.client.widgets.form.fields.TextItem; -import com.smartgwt.client.widgets.form.fields.events.ChangedEvent; -import com.smartgwt.client.widgets.form.fields.events.ChangedHandler; -import com.smartgwt.client.widgets.form.fields.events.IconClickEvent; -import com.smartgwt.client.widgets.form.fields.events.IconClickHandler; -import com.smartgwt.client.widgets.form.validator.IntegerRangeValidator; -import com.smartgwt.client.widgets.form.validator.RequiredIfFunction; -import com.smartgwt.client.widgets.form.validator.RequiredIfValidator; -import com.smartgwt.client.widgets.grid.ListGrid; -import com.smartgwt.client.widgets.grid.ListGridField; -import com.smartgwt.client.widgets.grid.events.EditCompleteEvent; -import com.smartgwt.client.widgets.grid.events.EditCompleteHandler; -import com.smartgwt.client.widgets.grid.events.EditorExitEvent; -import com.smartgwt.client.widgets.grid.events.EditorExitHandler; -import com.smartgwt.client.widgets.layout.VLayout; -import com.smartgwt.client.widgets.tab.Tab; -import com.smartgwt.client.widgets.tab.TabSet; -import com.smartgwt.client.widgets.toolbar.ToolStrip; - -import org.rhq.enterprise.gui.installer.client.gwt.InstallerGWTServiceAsync; -import org.rhq.enterprise.gui.installer.client.shared.ServerDetails; -import org.rhq.enterprise.gui.installer.client.shared.ServerProperties; - -/** - * The GWT {@link EntryPoint entry point} to the RHQ Installer GUI. - * - * @author John Mazzitelli - */ -public class Installer implements EntryPoint { - - // This must come first to ensure proper I18N class loading for dev mode - private static final Messages MSG = GWT.create(Messages.class); - private static final ServerPropertiesMessages PROPS_MSG = GWT.create(ServerPropertiesMessages.class); - - private static final String INSTALLED_APP_URL = "/"; // if already installed, this is the URL context where it can be accessed - private static final String NEW_SERVER_TO_REGISTER = "*new*"; - - private final InstallerGWTServiceAsync installerService = InstallerGWTServiceAsync.Util.getInstance(); - private final ServerPropertyRecordList serverProperties = new ServerPropertyRecordList(); - private final HashMap<String, String> originalProperties = new HashMap<String, String>(); - private final LinkedHashMap<String, String> registeredServerNames = new LinkedHashMap<String, String>(); - - private VLayout mainCanvas; - - private ListGrid advancedPropertyItemGrid; - private Button mainInstallButton; - - private TextItem dbConnectionUrl; - private TextItem dbUsername; - private PasswordItem dbPassword; - private SelectItem dbExistingSchemaOption; - private ButtonItem testConnectionButton; - private SelectItem dbType; - - private DynamicForm serverSettingsForm; - private TextItem serverSettingServerName; - private TextItem serverSettingPublicAddress; - private SpinnerItem serverSettingWebHttpPort; - private SpinnerItem serverSettingWebSecureHttpPort; - private SelectItem registeredServersSelection; - private TextItem serverSettingEmailSMTPHostname; - private TextItem serverSettingEmailFromAddress; - - public void onModuleLoad() { - mainCanvas = new VLayout(); - mainCanvas.setWidth100(); - mainCanvas.setHeight100(); - mainCanvas.setLayoutMargin(10); - mainCanvas.setMembersMargin(5); - mainCanvas.setDefaultLayoutAlign(Alignment.CENTER); - mainCanvas.draw(); - - installerService.getInstallationResults(new AsyncCallback<String>() { - public void onSuccess(String result) { - if (result == null) { - prepareInstallerView(); // we need the user to complete the installation - } else if (result.length() == 0) { - showInstalledDialog(); // nothing needs to be done, we are already installed - } else { - showInstallationErrorDialog(result); - } - } - - public void onFailure(Throwable caught) { - SC.warn(MSG.message_install_doNotKnowIfInstalled(caught.toString()), new BooleanCallback() { - public void execute(Boolean value) { - prepareInstallerView(); - } - }); - } - }); - - // Remove loading image in case we don't completely cover it - Element loadingPanel = DOM.getElementById("Loading-Panel"); - loadingPanel.removeFromParent(); - - return; - } - - private void showInstallationErrorDialog(String error) { - SC.warn(MSG.message_install_failed() + "<br/>" + error); - } - - private void showInstalledDialog() { - String loginMsg = MSG.message_install_loginHere(INSTALLED_APP_URL); - SC.say(loginMsg, new BooleanCallback() { - public void execute(Boolean value) { - Window.open(INSTALLED_APP_URL, "_self", null); - } - }); - } - - private void prepareInstallerView() { - Canvas header = createHeader(); - mainInstallButton = createMainInstallButton(); - Canvas tabSet = createTabSet(); - - mainCanvas.addMember(header); - mainCanvas.addMember(mainInstallButton); - mainCanvas.addMember(tabSet); - mainCanvas.draw(); - - // get the server properties from the server - loadServerProperties(); - } - - private void updateServerProperty(String name, Object value) { - serverProperties.putServerProperty(name, value == null ? "" : value.toString()); - refreshAdvancedView(); - } - - private void loadServerProperties() { - // load the initial server properties - installerService.getServerProperties(new AsyncCallback<HashMap<String, String>>() { - public void onSuccess(HashMap<String, String> result) { - if (result.size() == 0) { - SC.say("Initial server properties are missing."); - } - serverProperties.replaceServerProperties(result); - - // remember these original properties in case the user wants to reset them back - originalProperties.clear(); - originalProperties.putAll(result); - - // refresh the simple view with the new data - refreshSimpleView(); - - // refresh the advanced view with the new data - refreshAdvancedView(); - } - - public void onFailure(Throwable caught) { - SC.say("Cannot load properties: " + caught); - } - }); - } - - private void refreshSimpleView() { - Map<String, String> props = serverProperties.getMap(); - - // DB SETTINGS - dbType.setValue(props.get(ServerProperties.PROP_DATABASE_TYPE)); - dbConnectionUrl.setValue(props.get(ServerProperties.PROP_DATABASE_CONNECTION_URL)); - dbUsername.setValue(props.get(ServerProperties.PROP_DATABASE_USERNAME)); - // do not prefill the database password - force the user to know it and type it in for security purposes - - // SERVER SETTINGS - serverSettingServerName.setValue(props.get(ServerProperties.PROP_HIGH_AVAILABILITY_NAME)); - serverSettingWebHttpPort.setValue(props.get(ServerProperties.PROP_WEB_HTTP_PORT)); - serverSettingWebSecureHttpPort.setValue(props.get(ServerProperties.PROP_WEB_HTTPS_PORT)); - serverSettingEmailSMTPHostname.setValue(props.get(ServerProperties.PROP_EMAIL_SMTP_HOST)); - serverSettingEmailFromAddress.setValue(props.get(ServerProperties.PROP_EMAIL_FROM_ADDRESS)); - - forceAnotherTestConnection(); - } - - private void refreshAdvancedView() { - advancedPropertyItemGrid.markForRedraw(); - } - - private Canvas createHeader() { - ToolStrip strip = new ToolStrip(); - strip.setWidth100(); - strip.setAlign(Alignment.CENTER); - - Label title = new Label(); - title.setWidth100(); - title.setHeight100(); - title.setWrap(false); - title.setValign(VerticalAlignment.CENTER); - title.setAlign(Alignment.CENTER); - title.setContents("<span style="font-size:16pt;font-weight:bold;">" + MSG.welcome_title() + "</span>"); - strip.addMember(title); - return strip; - } - - private Button createMainInstallButton() { - Button installButton = new Button(MSG.button_startInstallation()); - installButton.setWrap(false); - installButton.setAutoFit(true); - installButton.setDisabled(true); // we can't allow the user to install yet - installButton.addClickHandler(new ClickHandler() { - public void onClick(ClickEvent event) { - if (!serverSettingsForm.validate()) { - SC.say(MSG.message_formDidNotValidate()); - return; - } - String highAvailabilityName = serverSettingServerName.getValueAsString(); - String publicEndpoint = serverSettingPublicAddress.getValueAsString(); - int httpPort = Integer.parseInt(serverSettingWebHttpPort.getValueAsString()); - int httpsPort = Integer.parseInt(serverSettingWebSecureHttpPort.getValueAsString()); - String existingSchemaOption = dbExistingSchemaOption.getValueAsString(); - - SC.say(MSG.message_install_started()); - mainCanvas.disable(); - - HashMap<String, String> propMap = serverProperties.getMap(); - ServerDetails svrDetails = new ServerDetails(highAvailabilityName, publicEndpoint, httpPort, httpsPort); - installerService.install(propMap, svrDetails, existingSchemaOption, new AsyncCallback<Void>() { - @Override - public void onSuccess(Void result) { - mainCanvas.enable(); - showInstalledDialog(); - } - - @Override - public void onFailure(Throwable caught) { - mainCanvas.enable(); - showInstallationErrorDialog(caught.toString()); - } - }); - } - }); - - return installButton; - } - - private TabSet createTabSet() { - final TabSet topTabSet = new TabSet(); - topTabSet.setTabBarPosition(Side.TOP); - topTabSet.setTabBarAlign(Side.LEFT); - topTabSet.setWidth("90%"); - - final Tab welcomeTab = new Tab(MSG.tab_welcome()); - Label welcomeLabel = new Label(MSG.tab_welcome_content()); - welcomeTab.setPane(welcomeLabel); - - final Tab simpleViewTab = new Tab(MSG.tab_simpleView()); - Canvas simpleForm = createSimpleForm(); - simpleViewTab.setPane(simpleForm); - - final Tab advancedViewTab = new Tab(MSG.tab_advancedView()); - Canvas advancedView = createAdvancedView(); - advancedViewTab.setPane(advancedView); - - topTabSet.addTab(welcomeTab); - topTabSet.addTab(simpleViewTab); - topTabSet.addTab(advancedViewTab); - - return topTabSet; - } - - private Canvas createAdvancedView() { - VLayout layout = new VLayout(); - - ToolStrip strip = new ToolStrip(); - strip.setWidth100(); - - IButton resetButton = new IButton(MSG.button_reset()); - resetButton.addClickHandler(new ClickHandler() { - public void onClick(ClickEvent event) { - serverProperties.replaceServerProperties(originalProperties); - refreshSimpleView(); - refreshAdvancedView(); - forceAnotherTestConnection(); - } - }); - strip.addMember(resetButton); - layout.addMember(strip); - - advancedPropertyItemGrid = new ListGrid(); - advancedPropertyItemGrid.setWidth100(); - advancedPropertyItemGrid.setHeight100(); - advancedPropertyItemGrid.setData(serverProperties); - - ListGridField nameField = new ListGridField(ServerPropertyRecordList.PROPERTY_NAME, MSG.property_name_label()); - nameField.setCanEdit(false); - - ListGridField valueField = new ListGridField(ServerPropertyRecordList.PROPERTY_VALUE, - MSG.property_value_label()); - valueField.setCanEdit(true); - - advancedPropertyItemGrid.setFields(nameField, valueField); - advancedPropertyItemGrid.setSortField(ServerPropertyRecordList.PROPERTY_NAME); - advancedPropertyItemGrid.addEditorExitHandler(new EditorExitHandler() { - public void onEditorExit(EditorExitEvent event) { - String changedProperty = event.getRecord().getAttribute(ServerPropertyRecordList.PROPERTY_NAME); - if (ServerProperties.BOOLEAN_PROPERTIES.contains(changedProperty)) { - String newValue = event.getNewValue().toString(); - if (!(newValue.equals("true") || newValue.equals("false"))) { - event.cancel(); - advancedPropertyItemGrid.setFieldError(event.getRowNum(), - ServerPropertyRecordList.PROPERTY_VALUE, MSG.message_notValidBoolean()); - } - } else if (ServerProperties.INTEGER_PROPERTIES.contains(changedProperty)) { - String newValue = event.getNewValue().toString(); - try { - Integer.parseInt(newValue); - } catch (NumberFormatException e) { - event.cancel(); - advancedPropertyItemGrid.setFieldError(event.getRowNum(), - ServerPropertyRecordList.PROPERTY_VALUE, MSG.message_notValidInteger()); - } - } - } - }); - advancedPropertyItemGrid.addEditCompleteHandler(new EditCompleteHandler() { - public void onEditComplete(EditCompleteEvent event) { - String newValue = event.getNewValues().values().iterator().next().toString(); - String changedProperty = event.getOldRecord().getAttribute(ServerPropertyRecordList.PROPERTY_NAME); - serverProperties.getMap().put(changedProperty, newValue); // so this is reflected in the internal map - refreshSimpleView(); - } - }); - - layout.addMember(advancedPropertyItemGrid); - - return layout; - } - - private Canvas createSimpleForm() { - - final int fieldWidth = 300; - - //////////////////////////////////////////////////////// - // The Database form - - final DynamicForm databaseForm = new DynamicForm(); - databaseForm.setAutoWidth(); - databaseForm.setPadding(5); - databaseForm.setCellPadding(5); - databaseForm.setWrapItemTitles(false); - databaseForm.setIsGroup(true); - databaseForm.setGroupTitle(MSG.tab_simpleView_database()); - - dbConnectionUrl = new TextItem(ServerProperties.PROP_DATABASE_CONNECTION_URL, - PROPS_MSG.rhq_server_database_connection_url()); - dbConnectionUrl.setWidth(fieldWidth); - dbConnectionUrl.setValue("jdbc:postgresql://127.0.0.1:5432/rhq"); - dbConnectionUrl.addChangedHandler(new ChangedHandler() { - public void onChanged(ChangedEvent event) { - updateServerProperty(ServerProperties.PROP_DATABASE_CONNECTION_URL, String.valueOf(event.getValue())); - forceAnotherTestConnection(); - } - }); - - dbUsername = new TextItem(ServerProperties.PROP_DATABASE_USERNAME, - PROPS_MSG.rhq_server_database_user_name()); - dbUsername.setWidth(fieldWidth); - dbUsername.addChangedHandler(new ChangedHandler() { - public void onChanged(ChangedEvent event) { - updateServerProperty(ServerProperties.PROP_DATABASE_USERNAME, String.valueOf(event.getValue())); - forceAnotherTestConnection(); - } - }); - - dbPassword = new PasswordItem(ServerProperties.PROP_DATABASE_PASSWORD, - PROPS_MSG.rhq_server_database_password()); - dbPassword.setWidth(fieldWidth); - dbPassword.addChangedHandler(new ChangedHandler() { - public void onChanged(ChangedEvent event) { - updateServerProperty(ServerProperties.PROP_DATABASE_PASSWORD, String.valueOf(event.getValue())); - forceAnotherTestConnection(); - } - }); - - dbExistingSchemaOption = new SelectItem("existingSchemaOption", MSG.schema_update_question()); - // keys must match ServerInstallUtil.ExistingSchemaOption enum names - final LinkedHashMap<String, String> schemaOpt = new LinkedHashMap<String, String>(); - schemaOpt.put("KEEP", MSG.schema_update_keep()); - schemaOpt.put("OVERWRITE", MSG.schema_update_overwrite()); - schemaOpt.put("SKIP", MSG.schema_update_skip()); - dbExistingSchemaOption.setValueMap(schemaOpt); - dbExistingSchemaOption.setDefaultToFirstOption(true); - dbExistingSchemaOption.setVisible(false); - dbExistingSchemaOption.setWidth(fieldWidth); - dbExistingSchemaOption.setWrapTitle(true); - dbExistingSchemaOption.addChangedHandler(new ChangedHandler() { - public void onChanged(ChangedEvent event) { - if (registeredServersSelection != null) { - String selected = event.getValue().toString(); - if ("OVERWRITE".equals(selected)) { - registeredServersSelection.setValue((String) null); - registeredServersSelection.disable(); - } else { - registeredServersSelection.enable(); - } - } - } - }); - - testConnectionButton = new ButtonItem("testConnectionButton", MSG.button_testConnection()); - testConnectionButton.addClickHandler(new com.smartgwt.client.widgets.form.fields.events.ClickHandler() { - public void onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent event) { - final Conn conn = new Conn(); - installerService.testConnection(conn.url(), conn.username(), conn.password(), - new AsyncCallback<String>() { - public void onSuccess(String result) { - if (result != null) { - forceAnotherTestConnection(); - testConnectionButton.setIcon("[SKIN]/actions/exclamation.png"); - SC.say("Could not connect to the database: " + result); - } else { - connectedToDatabase(); - } - } - - public void onFailure(Throwable caught) { - forceAnotherTestConnection(); - testConnectionButton.setIcon("[SKIN]/actions/exclamation.png"); - SC.say("Failed to test connection: " + caught.toString()); - } - }); - - } - }); - - dbType = new SelectItem(ServerProperties.PROP_DATABASE_TYPE, - PROPS_MSG.rhq_server_database_type_mapping()); - final LinkedHashMap<String, String> dbs = new LinkedHashMap<String, String>(); - dbs.put("PostgreSQL", "PostgreSQL"); - dbs.put("Oracle", "Oracle"); - dbType.setValueMap(dbs); - dbType.setDefaultToFirstOption(true); - dbType.addChangedHandler(new ChangedHandler() { - public void onChanged(ChangedEvent event) { - forceAnotherTestConnection(); - - String newDBType = (String) event.getValue(); - String newURL = ""; - String dialect = ""; - String quartzDriverDelegateClass = "org.quartz.impl.jdbcjobstore.StdJDBCDelegate"; - String quartzSelectWithLockSQL = "SELECT * FROM {0}LOCKS ROWLOCK WHERE LOCK_NAME = ? FOR UPDATE"; - String quartzLockHandlerClass = "org.quartz.impl.jdbcjobstore.StdRowLockSemaphore"; - - if ("PostgreSQL".equalsIgnoreCase(newDBType)) { - newURL = "jdbc:postgresql://127.0.0.1:5432/rhq"; - dialect = "org.hibernate.dialect.PostgreSQLDialect"; - quartzDriverDelegateClass = "org.quartz.impl.jdbcjobstore.PostgreSQLDelegate"; - } else if ("Oracle".equalsIgnoreCase(newDBType)) { - newURL = "jdbc:oracle:thin:@127.0.0.1:1521:rhq"; - dialect = "org.hibernate.dialect.Oracle10gDialect"; - quartzDriverDelegateClass = "org.quartz.impl.jdbcjobstore.oracle.OracleDelegate"; - } - dbConnectionUrl.setValue(newURL); - - updateServerProperty(ServerProperties.PROP_DATABASE_CONNECTION_URL, newURL); - updateServerProperty(ServerProperties.PROP_DATABASE_HIBERNATE_DIALECT, dialect); - updateServerProperty(ServerProperties.PROP_QUARTZ_DRIVER_DELEGATE_CLASS, quartzDriverDelegateClass); - updateServerProperty(ServerProperties.PROP_QUARTZ_SELECT_WITH_LOCK_SQL, quartzSelectWithLockSQL); - updateServerProperty(ServerProperties.PROP_QUARTZ_LOCK_HANDLER_CLASS, quartzLockHandlerClass); - updateServerProperty(ServerProperties.PROP_DATABASE_TYPE, newDBType); - } - }); - - // use this to move the button over to the second column - it looks better this way - SpacerItem buttonSpacer = new SpacerItem(); - buttonSpacer.setEndRow(false); - testConnectionButton.setStartRow(false); - - // add contextual help for users - addContextualHelp(dbType, MSG.help_dbType()); - addContextualHelp(dbConnectionUrl, MSG.help_dbConnectionUrl()); - addContextualHelp(dbUsername, MSG.help_dbUsername()); - addContextualHelp(dbPassword, MSG.help_dbPassword()); - addContextualHelp(testConnectionButton, MSG.help_testConnectionButton()); - addContextualHelp(dbExistingSchemaOption, MSG.help_dbExistingSchemaOption()); - - databaseForm.setFields(dbType, dbConnectionUrl, dbUsername, dbPassword, buttonSpacer, testConnectionButton, - dbExistingSchemaOption); - - //////////////////////////////////////////////////////// - // The Server Settings form - - RequiredIfValidator notEmptyValidator = new RequiredIfValidator(); - notEmptyValidator.setExpression(new RequiredIfFunction() { - public boolean execute(FormItem formItem, Object value) { - return true; - } - }); - - IntegerRangeValidator portValidator = new IntegerRangeValidator(); - portValidator.setMin(1); - portValidator.setMax(65535); - - serverSettingsForm = new DynamicForm(); - serverSettingsForm.setPadding(5); - serverSettingsForm.setCellPadding(5); - serverSettingsForm.setAutoWidth(); - serverSettingsForm.setIsGroup(true); - serverSettingsForm.setValidateOnChange(true); - serverSettingsForm.setWrapItemTitles(false); - serverSettingsForm.setGroupTitle(MSG.tab_simpleView_serverSettings()); - - serverSettingServerName = new TextItem(ServerProperties.PROP_HIGH_AVAILABILITY_NAME, - PROPS_MSG.rhq_server_high_availability_name()); - serverSettingServerName.setWidth(fieldWidth); - serverSettingServerName.setValidators(notEmptyValidator); - serverSettingServerName.addChangedHandler(new ChangedHandler() { - public void onChanged(ChangedEvent event) { - updateServerProperty(ServerProperties.PROP_HIGH_AVAILABILITY_NAME, String.valueOf(event.getValue())); - if (registeredServersSelection != null) { - registeredServersSelection.setValue((String) null); // flip it back to *new* since the server name changed - } - } - }); - - serverSettingPublicAddress = new TextItem("serverPublicAddress", - MSG.tab_simpleView_serverSettings_publicAddress()); - serverSettingPublicAddress.setWidth(fieldWidth); - - serverSettingWebHttpPort = new SpinnerItem(ServerProperties.PROP_WEB_HTTP_PORT, - PROPS_MSG.rhq_server_startup_web_http_port()); - serverSettingWebHttpPort.setWidth(fieldWidth); - serverSettingWebHttpPort.setMin(1); - serverSettingWebHttpPort.setMax(65535); - serverSettingWebHttpPort.setDefaultValue(ServerDetails.DEFAULT_ENDPOINT_PORT); - serverSettingWebHttpPort.setValidators(portValidator); - serverSettingWebHttpPort.addChangedHandler(new ChangedHandler() { - public void onChanged(ChangedEvent event) { - updateServerProperty(ServerProperties.PROP_WEB_HTTP_PORT, String.valueOf(event.getValue())); - } - }); - - serverSettingWebSecureHttpPort = new SpinnerItem(ServerProperties.PROP_WEB_HTTPS_PORT, - PROPS_MSG.rhq_server_startup_web_https_port()); - serverSettingWebSecureHttpPort.setWidth(fieldWidth); - serverSettingWebSecureHttpPort.setMin(1); - serverSettingWebSecureHttpPort.setMax(65535); - serverSettingWebSecureHttpPort.setDefaultValue(ServerDetails.DEFAULT_ENDPOINT_SECURE_PORT); - serverSettingWebSecureHttpPort.setValidators(portValidator); - serverSettingWebSecureHttpPort.addChangedHandler(new ChangedHandler() { - public void onChanged(ChangedEvent event) { - updateServerProperty(ServerProperties.PROP_WEB_HTTPS_PORT, String.valueOf(event.getValue())); - } - }); - - registeredServersSelection = new SelectItem("registeredServersSelectItem", - MSG.tab_simpleView_serverSettings_registeredServers()); - registeredServersSelection.setWidth(fieldWidth); - registeredServerNames.put(NEW_SERVER_TO_REGISTER, - MSG.tab_simpleView_serverSettings_registeredServers_newServer()); - registeredServersSelection.setValueMap(registeredServerNames); - registeredServersSelection.setDefaultToFirstOption(true); - registeredServersSelection.addChangedHandler(new ChangedHandler() { - public void onChanged(ChangedEvent event) { - final String selectedServerName = String.valueOf(event.getValue()); - final boolean newServer = NEW_SERVER_TO_REGISTER.equals(selectedServerName); - if (newServer) { - serverSettingServerName.setValue(""); - serverSettingPublicAddress.setValue(""); - updateServerProperty(ServerProperties.PROP_HIGH_AVAILABILITY_NAME, ""); - serverSettingsForm.validate(); - } else { - final Conn conn = new Conn(); - installerService.getServerDetails(conn.url(), conn.username(), conn.password(), selectedServerName, - new AsyncCallback<ServerDetails>() { - public void onSuccess(ServerDetails details) { - serverSettingServerName.setValue(details.getName()); - serverSettingPublicAddress.setValue(details.getEndpointAddress()); - serverSettingWebHttpPort.setValue(details.getEndpointPortString()); - serverSettingWebSecureHttpPort.setValue(details.getEndpointSecurePortString()); - updateServerProperty(ServerProperties.PROP_HIGH_AVAILABILITY_NAME, details.getName()); - updateServerProperty(ServerProperties.PROP_WEB_HTTP_PORT, - details.getEndpointPortString()); - updateServerProperty(ServerProperties.PROP_WEB_HTTPS_PORT, - details.getEndpointSecurePortString()); - serverSettingsForm.validate(); - } - - public void onFailure(Throwable caught) { - SC.say("Failed to get details on selected server [" + selectedServerName + "]"); - } - }); - } - } - }); - - serverSettingEmailSMTPHostname = new TextItem(ServerProperties.PROP_EMAIL_SMTP_HOST, - PROPS_MSG.rhq_server_email_smtp_host()); - serverSettingEmailSMTPHostname.setWidth(fieldWidth); - serverSettingEmailSMTPHostname.addChangedHandler(new ChangedHandler() { - public void onChanged(ChangedEvent event) { - updateServerProperty(ServerProperties.PROP_EMAIL_SMTP_HOST, String.valueOf(event.getValue())); - } - }); - - serverSettingEmailFromAddress = new TextItem(ServerProperties.PROP_EMAIL_FROM_ADDRESS, - PROPS_MSG.rhq_server_email_from_address()); - serverSettingEmailFromAddress.setWidth(fieldWidth); - serverSettingEmailFromAddress.addChangedHandler(new ChangedHandler() { - public void onChanged(ChangedEvent event) { - updateServerProperty(ServerProperties.PROP_EMAIL_FROM_ADDRESS, String.valueOf(event.getValue())); - } - }); - - // add contextual help for users - addContextualHelp(registeredServersSelection, MSG.help_registeredServers()); - addContextualHelp(serverSettingServerName, MSG.help_ssServerName()); - addContextualHelp(serverSettingPublicAddress, MSG.help_ssPublicAddress()); - addContextualHelp(serverSettingWebHttpPort, MSG.help_ssHttpPort()); - addContextualHelp(serverSettingWebSecureHttpPort, MSG.help_ssHttpsPort()); - addContextualHelp(serverSettingEmailSMTPHostname, MSG.help_ssEmailHostname()); - addContextualHelp(serverSettingEmailFromAddress, MSG.help_ssEmailFromAddress()); - - serverSettingsForm.setItems(registeredServersSelection, serverSettingServerName, serverSettingPublicAddress, - serverSettingWebHttpPort, serverSettingWebSecureHttpPort, serverSettingEmailSMTPHostname, - serverSettingEmailFromAddress); - - //////////////////////////////////////////////////////// - // The layout holding the forms in the simple view tab - - VLayout simpleForm = new VLayout(); - simpleForm.setLayoutMargin(5); - simpleForm.setMembersMargin(5); - simpleForm.setWidth100(); - simpleForm.setHeight100(); - simpleForm.setDefaultLayoutAlign(Alignment.CENTER); - simpleForm.addMember(databaseForm); - simpleForm.addMember(serverSettingsForm); - - return simpleForm; - } - - private void connectedToDatabase() { - final Conn conn = new Conn(); - testConnectionButton.setIcon("[SKIN]/actions/ok.png"); - installerService.isDatabaseSchemaExist(conn.url(), conn.username(), conn.password(), - new AsyncCallback<Boolean>() { - public void onSuccess(Boolean schemaExists) { - if (schemaExists) { - dbExistingSchemaOption.show(); - registeredServersSelection.enable(); - - installerService.getServerNames(conn.url(), conn.username(), conn.password(), - new AsyncCallback<ArrayList<String>>() { - public void onSuccess(ArrayList<String> servers) { - registeredServerNames.clear(); - registeredServerNames.put(NEW_SERVER_TO_REGISTER, - MSG.tab_simpleView_serverSettings_registeredServers_newServer()); - for (String server : servers) { - registeredServerNames.put(server, server); - } - registeredServersSelection.setValueMap(registeredServerNames); - } - - public void onFailure(Throwable caught) { - SC.say("Cannot get the registered server names"); - } - }); - } else { - dbExistingSchemaOption.hide(); - registeredServersSelection.setValue((String) null); - registeredServersSelection.disable(); - } - mainInstallButton.enable(); - } - - public void onFailure(Throwable caught) { - SC.say("Cannot determine the status of the database schema: " + caught); - } - }); - } - - private void addContextualHelp(final FormItem item, final String helpText) { - final FormItemIcon helpIcon = new FormItemIcon(); - helpIcon.setSrc("[SKIN]/actions/help.png"); - helpIcon.setNeverDisable(true); - item.setIcons(helpIcon); - - item.addIconClickHandler(new IconClickHandler() { - public void onIconClick(IconClickEvent event) { - if (event.getIcon().equals(helpIcon)) { - SC.say(helpText); - } - } - }); - } - - /** - * Call this when the user changed something (like connection URL or password) that renders - * the old connection test invalid. This will ensure the user is forced to re-test the connection. - */ - private void forceAnotherTestConnection() { - mainInstallButton.disable(); - testConnectionButton.setIcon(null); - dbExistingSchemaOption.hide(); - - if (registeredServerNames.size() > 1) { - registeredServerNames.clear(); - registeredServerNames.put(NEW_SERVER_TO_REGISTER, MSG.tab_simpleView_serverSettings_registeredServers_newServer()); - } - registeredServersSelection.setValue((String) null); - registeredServersSelection.setValueMap(registeredServerNames); - } - - // for convienence, so we can get the conn url, user, pass in one object - private class Conn { - public String url() { - return Installer.this.dbConnectionUrl.getValueAsString(); - } - - public String username() { - return Installer.this.dbUsername.getValueAsString(); - } - - public String password() { - return Installer.this.dbPassword.getValueAsString(); - } - } -} diff --git a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/client/ServerPropertyRecordList.java b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/client/ServerPropertyRecordList.java deleted file mode 100644 index 654e3cf..0000000 --- a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/client/ServerPropertyRecordList.java +++ /dev/null @@ -1,62 +0,0 @@ -package org.rhq.enterprise.gui.installer.client; - -import java.util.HashMap; -import java.util.Map; - -import com.smartgwt.client.data.Record; -import com.smartgwt.client.data.RecordList; - -/** - * This provides a RecordList that is really a map underneath (each record is nothing more - * than a name/value pair; that is, each record has two attributes: name and value). - * - * We use this because this RecordList will be the list backing the Advanced View grid. - * So changing this list will be automatically reflected in that grid. - * - * @author John Mazzitelli - */ -public class ServerPropertyRecordList extends RecordList { - - public static final String PROPERTY_NAME = "n"; - public static final String PROPERTY_VALUE = "v"; - - // this map is kept in sync with the record list - private HashMap<String, String> map = new HashMap<String, String>(); - - public HashMap<String, String> getMap() { - return map; - } - - public String getServerProperty(String name) { - String value = map.get(name); - return (value == null) ? "" : value; - } - - public void putServerProperty(String name, String value) { - // fill in the internal map - map.put(name, value); - - // now update the record list - Record found = find(PROPERTY_NAME, name); - if (found == null) { - Record record = new Record(); - record.setAttribute(PROPERTY_NAME, name); - record.setAttribute(PROPERTY_VALUE, value); - add(record); - } else { - found.setAttribute(PROPERTY_VALUE, value); - } - } - - public void replaceServerProperties(Map<String, String> newMap) { - // first update the internal map - map.clear(); - map.putAll(newMap); - - // now update the record list - setLength(0); - for (Map.Entry<String, String> entry : newMap.entrySet()) { - putServerProperty(entry.getKey(), entry.getValue()); - } - } -} diff --git a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/client/gwt/InstallerGWTService.java b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/client/gwt/InstallerGWTService.java deleted file mode 100644 index 5788b22..0000000 --- a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/client/gwt/InstallerGWTService.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.installer.client.gwt; - -import java.util.ArrayList; -import java.util.HashMap; - -import com.google.gwt.user.client.rpc.RemoteService; - -import org.rhq.enterprise.gui.installer.client.shared.ServerDetails; -import org.rhq.enterprise.gui.installer.server.servlet.ServerInstallUtil; - -/** - * Remote RPC API for the GWT Installer. - * - * @author John Mazzitelli - */ -public interface InstallerGWTService extends RemoteService { - - /** - * Use this to determine if the server has already been completely installed or not. - * This returns a String to indicate the last installation attempt. If this returns null, - * then the installer has not done anything yet - you need to complete the installation. - * If an empty string is returned, it means the installer ran and it appears the application - * has successfully installed. If a non-empty string is returned, it means the installer attempted - * to complete the installation, but an error occurred. When a non-empty string is returned, - * it means that an administrator probably has to do some manual intervention because something - * went wrong with the application deployment. - * - * @return indicating of the last installation attempt (see above) - * @throws Exception if it cannot be determined if the server has been fully installed. - */ - String getInstallationResults() throws Exception; - - /** - * Starts the installation process. Once complete, the installer has nothing more it needs to do. - * - * @param serverProperties the server's settings to use. These will be persisted to - * the server's .properties file. - * @param serverDetails details on the server being installed. - * If in auto-install mode, this value is ignored and can be anything. - * @param existingSchemaOption if not in auto-install mode, this tells the installer what to do with any - * existing schema. Must be one of the names of the - * {@link ServerInstallUtil.ExistingSchemaOption} enum. - * If in auto-install mode, this value is ignored and can be anything. - * @throws Exception - */ - void install(HashMap<String, String> serverProperties, ServerDetails serverDetails, String existingSchemaOption) - throws Exception; - - /** - * Returns a list of all registered servers in the database. - * - * @param connectionUrl - * @param username - * @param password - * @return list of all existing servers registered in the database. - * @throws Exception - */ - ArrayList<String> getServerNames(String connectionUrl, String username, String password) throws Exception; - - /** - * Returns details on a specific server that is registered in the database. - * - * @param connectionUrl - * @param username - * @param password - * @param serverName the name of the server whose details are to be retrieved - * @return the details of the server or null if the server does not exist - * @throws Exception - */ - ServerDetails getServerDetails(String connectionUrl, String username, String password, String serverName) - throws Exception; - - /** - * Tests to see if there is already a schema installed. - * - * @param connectionUrl - * @param username - * @param password - * @return <code>true</code> if there appears to be a schema installed in the database already. - * @throws Exception - */ - boolean isDatabaseSchemaExist(String connectionUrl, String username, String password) throws Exception; - - /** - * Tests that the database can be connected to with the given URL and credentials. - * @param connectionUrl - * @param username - * @param password - * @return <code>null</code> if the connection succeeded; this will be an error message if failed - * @throws Exception - */ - String testConnection(String connectionUrl, String username, String password) throws Exception; - - /** - * Returns the rhq-server.properties values in a map. - * @return server properties - * @throws Exception - */ - HashMap<String, String> getServerProperties() throws Exception; - - /** - * Returns the version string for the app server itself (e.g. "7.1.2.Final"). - * @return version string of app server - * @throws Exception - */ - String getAppServerVersion() throws Exception; - - /** - * Returns the general type of operating system the server is running on (e.g. "Linux"). - * @return os type name - * @throws Exception - */ - String getOperatingSystem() throws Exception; -} diff --git a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/client/shared/ServerDetails.java b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/client/shared/ServerDetails.java deleted file mode 100644 index 44bfb6a..0000000 --- a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/client/shared/ServerDetails.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.installer.client.shared; - -import java.io.Serializable; - -/** - * Provides details about the server if it is already a known one (by "known" meaning it is - * in the database already). - * - * @author John Mazzitelli - */ -public class ServerDetails implements Serializable { - private static final long serialVersionUID = 1L; - - public static final String DEFAULT_AFFINITY_GROUP = ""; - public static final int DEFAULT_ENDPOINT_PORT = 7080; - public static final int DEFAULT_ENDPOINT_SECURE_PORT = 7443; - - private String name; - private String endpointAddress; - private int endpointPort; - private int endpointSecurePort; - - protected ServerDetails() { - // for GWT - } - - public ServerDetails(String name, String endpointAddress, int port, int securePort) { - this.name = name; - this.endpointAddress = endpointAddress; - this.endpointPort = port; - this.endpointSecurePort = securePort; - } - - public String getName() { - return name; - } - - public void setName(String name) { - if ((null != name) && (!"".equals(name.trim()))) { - this.name = name; - } - } - - public String getEndpointAddress() { - return endpointAddress; - } - - public void setEndpointAddress(String endpointAddress) { - if ((null != endpointAddress) && (!"".equals(endpointAddress.trim()))) { - this.endpointAddress = endpointAddress; - } - } - - public int getEndpointPort() { - return endpointPort; - } - - public void setEndpointPort(int endpointPort) { - this.endpointPort = endpointPort; - } - - public String getEndpointPortString() { - return (String.valueOf(endpointPort)); - } - - public void setEndpointPortString(String endpointPort) { - this.endpointPort = Integer.valueOf(endpointPort).intValue(); - } - - public int getEndpointSecurePort() { - return endpointSecurePort; - } - - public void setEndpointSecurePort(int endpointSecurePort) { - this.endpointSecurePort = endpointSecurePort; - } - - public String getEndpointSecurePortString() { - return (String.valueOf(endpointSecurePort)); - } - - public void setEndpointSecurePortString(String endpointSecurePort) { - this.endpointSecurePort = Integer.valueOf(endpointSecurePort).intValue(); - } - - @Override - public String toString() { - return "[name=" + name + ", address=" + endpointAddress + ", port=" + endpointPort + ", secureport=" - + endpointSecurePort + "]"; - } -} diff --git a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/client/shared/ServerProperties.java b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/client/shared/ServerProperties.java deleted file mode 100644 index 7a04a6a..0000000 --- a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/client/shared/ServerProperties.java +++ /dev/null @@ -1,174 +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.installer.client.shared; - -import java.util.HashSet; -import java.util.Set; - -/** - * Settings found in the rhq-server.properties file that controls the startup configuration of the server. - * - * @author John Mazzitelli - */ -public class ServerProperties { - public static final String PROP_DATABASE_TYPE = "rhq.server.database.type-mapping"; - public static final String PROP_DATABASE_CONNECTION_URL = "rhq.server.database.connection-url"; - public static final String PROP_DATABASE_USERNAME = "rhq.server.database.user-name"; - public static final String PROP_DATABASE_PASSWORD = "rhq.server.database.password"; - public static final String PROP_DATABASE_SERVER_NAME = "rhq.server.database.server-name"; - public static final String PROP_DATABASE_PORT = "rhq.server.database.port"; - public static final String PROP_DATABASE_DB_NAME = "rhq.server.database.db-name"; - public static final String PROP_DATABASE_HIBERNATE_DIALECT = "hibernate.dialect"; - - public static final String PROP_QUARTZ_DRIVER_DELEGATE_CLASS = "rhq.server.quartz.driverDelegateClass"; - public static final String PROP_QUARTZ_SELECT_WITH_LOCK_SQL = "rhq.server.quartz.selectWithLockSQL"; - public static final String PROP_QUARTZ_LOCK_HANDLER_CLASS = "rhq.server.quartz.lockHandlerClass"; - - public static final String PROP_WEB_HTTP_PORT = "rhq.server.socket.binding.port.http"; - public static final String PROP_WEB_HTTPS_PORT = "rhq.server.socket.binding.port.https"; - - public static final String PROP_EMAIL_SMTP_HOST = "rhq.server.email.smtp-host"; - public static final String PROP_EMAIL_SMTP_PORT = "rhq.server.email.smtp-port"; - public static final String PROP_EMAIL_FROM_ADDRESS = "rhq.server.email.from-address"; - - public static final String PROP_AUTOINSTALL_ENABLE = "rhq.autoinstall.enabled"; - public static final String PROP_AUTOINSTALL_DATABASE = "rhq.autoinstall.database"; - public static final String PROP_AUTOINSTALL_PUBLIC_ADDR = "rhq.autoinstall.public-endpoint-address"; - - public static final String PROP_TOMCAT_SECURITY_CLIENT_AUTH_MOD = "rhq.server.tomcat.security.client-auth-mode"; - public static final String PROP_TOMCAT_SECURITY_SSL_PROTOCOL = "rhq.server.tomcat.security.secure-socket-protocol"; - public static final String PROP_TOMCAT_SECURITY_ALGORITHM = "rhq.server.tomcat.security.algorithm"; - public static final String PROP_TOMCAT_SECURITY_KEYSTORE_ALIAS = "rhq.server.tomcat.security.keystore.alias"; - public static final String PROP_TOMCAT_SECURITY_KEYSTORE_FILENAME = "rhq.server.tomcat.security.keystore.file"; - public static final String PROP_TOMCAT_SECURITY_KEYSTORE_PASSWORD = "rhq.server.tomcat.security.keystore.password"; - public static final String PROP_TOMCAT_SECURITY_KEYSTORE_TYPE = "rhq.server.tomcat.security.keystore.type"; - public static final String PROP_TOMCAT_SECURITY_TRUSTSTORE_FILENAME = "rhq.server.tomcat.security.truststore.file"; - public static final String PROP_TOMCAT_SECURITY_TRUSTSTORE_PASSWORD = "rhq.server.tomcat.security.truststore.password"; - public static final String PROP_TOMCAT_SECURITY_TRUSTSTORE_TYPE = "rhq.server.tomcat.security.truststore.type"; - - public static final String PROP_CONNECTOR_TRANSPORT = "rhq.communications.connector.transport"; - public static final String PROP_CONNECTOR_BIND_ADDRESS = "rhq.communications.connector.bind-address"; - public static final String PROP_CONNECTOR_BIND_PORT = "rhq.communications.connector.bind-port"; - public static final String PROP_CONNECTOR_TRANSPORT_PARAMS = "rhq.communications.connector.transport-params"; - - public static final String PROP_SECURITY_SERVER_SECURE_SOCKET_PROTOCOL = "rhq.communications.connector.security.secure-socket-protocol"; - public static final String PROP_SECURITY_SERVER_KEYSTORE_FILE = "rhq.communications.connector.security.keystore.file"; - public static final String PROP_SECURITY_SERVER_KEYSTORE_ALGORITHM = "rhq.communications.connector.security.keystore.algorithm"; - public static final String PROP_SECURITY_SERVER_KEYSTORE_TYPE = "rhq.communications.connector.security.keystore.type"; - public static final String PROP_SECURITY_SERVER_KEYSTORE_PASSWORD = "rhq.communications.connector.security.keystore.password"; - public static final String PROP_SECURITY_SERVER_KEYSTORE_KEY_PASSWORD = "rhq.communications.connector.security.keystore.key-password"; - public static final String PROP_SECURITY_SERVER_KEYSTORE_ALIAS = "rhq.communications.connector.security.keystore.alias"; - public static final String PROP_SECURITY_SERVER_TRUSTSTORE_FILE = "rhq.communications.connector.security.truststore.file"; - public static final String PROP_SECURITY_SERVER_TRUSTSTORE_ALGORITHM = "rhq.communications.connector.security.truststore.algorithm"; - public static final String PROP_SECURITY_SERVER_TRUSTSTORE_TYPE = "rhq.communications.connector.security.truststore.type"; - public static final String PROP_SECURITY_SERVER_TRUSTSTORE_PASSWORD = "rhq.communications.connector.security.truststore.password"; - public static final String PROP_SECURITY_SERVER_CLIENT_AUTH_MODE = "rhq.communications.connector.security.client-auth-mode"; - - public static final String PROP_SECURITY_CLIENT_SECURE_SOCKET_PROTOCOL = "rhq.server.client.security.secure-socket-protocol"; - public static final String PROP_SECURITY_CLIENT_KEYSTORE_FILE = "rhq.server.client.security.keystore.file"; - public static final String PROP_SECURITY_CLIENT_KEYSTORE_ALGORITHM = "rhq.server.client.security.keystore.algorithm"; - public static final String PROP_SECURITY_CLIENT_KEYSTORE_TYPE = "rhq.server.client.security.keystore.type"; - public static final String PROP_SECURITY_CLIENT_KEYSTORE_PASSWORD = "rhq.server.client.security.keystore.password"; - public static final String PROP_SECURITY_CLIENT_KEYSTORE_KEY_PASSWORD = "rhq.server.client.security.keystore.key-password"; - public static final String PROP_SECURITY_CLIENT_KEYSTORE_ALIAS = "rhq.server.client.security.keystore.alias"; - public static final String PROP_SECURITY_CLIENT_TRUSTSTORE_FILE = "rhq.server.client.security.truststore.file"; - public static final String PROP_SECURITY_CLIENT_TRUSTSTORE_ALGORITHM = "rhq.server.client.security.truststore.algorithm"; - public static final String PROP_SECURITY_CLIENT_TRUSTSTORE_TYPE = "rhq.server.client.security.truststore.type"; - public static final String PROP_SECURITY_CLIENT_TRUSTSTORE_PASSWORD = "rhq.server.client.security.truststore.password"; - public static final String PROP_SECURITY_CLIENT_SERVER_AUTH_MODE_ENABLED = "rhq.server.client.security.server-auth-mode-enabled"; - - public static final String PROP_AGENT_MULTICAST_DETECTOR_ENABLED = "rhq.communications.multicast-detector.enabled"; - public static final String PROP_AGENT_MULTICAST_DETECTOR_BIND_ADDRESS = "rhq.communications.multicast-detector.bind-address"; - public static final String PROP_AGENT_MULTICAST_DETECTOR_MULTICAST_ADDRESS = "rhq.communications.multicast-detector.multicast-address"; - public static final String PROP_AGENT_MULTICAST_DETECTOR_PORT = "rhq.communications.multicast-detector.port"; - - public static final String PROP_CONCURRENCY_LIMIT_WEBCONNS = "rhq.server.startup.web.max-connections"; - public static final String PROP_CONCURRENCY_LIMIT_GLOBAL = "rhq.communications.global-concurrency-limit"; - public static final String PROP_CONCURRENCY_LIMIT_INV_REPORT = "rhq.server.concurrency-limit.inventory-report"; - public static final String PROP_CONCURRENCY_LIMIT_AVAIL_REPORT = "rhq.server.concurrency-limit.availability-report"; - public static final String PROP_CONCURRENCY_LIMIT_INV_SYNC = "rhq.server.concurrency-limit.inventory-sync"; - public static final String PROP_CONCURRENCY_LIMIT_CONTENT_REPORT = "rhq.server.concurrency-limit.content-report"; - public static final String PROP_CONCURRENCY_LIMIT_CONTENT_DOWNLOAD = "rhq.server.concurrency-limit.content-download"; - public static final String PROP_CONCURRENCY_LIMIT_MEAS_REPORT = "rhq.server.concurrency-limit.measurement-report"; - public static final String PROP_CONCURRENCY_LIMIT_MEASSCHED_REQ = "rhq.server.concurrency-limit.measurement-schedule-request"; - - public static final String PROP_JBOSS_BIND_ADDRESS = "jboss.bind.address"; - public static final String PROP_HIGH_AVAILABILITY_NAME = "rhq.server.high-availability.name"; - public static final String PROP_MM_AT_START = "rhq.server.maintenance-mode-at-startup"; - public static final String PROP_OPERATION_TIMEOUT = "rhq.server.operation-timeout"; - - // this list contains all the properties that are to have boolean values (true | false) - public static final Set<String> BOOLEAN_PROPERTIES; - static { - BOOLEAN_PROPERTIES = new HashSet<String>(); - BOOLEAN_PROPERTIES.add(PROP_SECURITY_CLIENT_SERVER_AUTH_MODE_ENABLED); - BOOLEAN_PROPERTIES.add(PROP_MM_AT_START); - BOOLEAN_PROPERTIES.add(PROP_AUTOINSTALL_ENABLE); - BOOLEAN_PROPERTIES.add(PROP_AGENT_MULTICAST_DETECTOR_ENABLED); - } - - // this list contains all the properties that are to have integer values - public static final Set<String> INTEGER_PROPERTIES; - static { - INTEGER_PROPERTIES = new HashSet<String>(); - INTEGER_PROPERTIES.add(PROP_WEB_HTTP_PORT); - INTEGER_PROPERTIES.add(PROP_WEB_HTTPS_PORT); - INTEGER_PROPERTIES.add(PROP_CONNECTOR_BIND_PORT); - INTEGER_PROPERTIES.add(PROP_EMAIL_SMTP_PORT); - INTEGER_PROPERTIES.add(PROP_OPERATION_TIMEOUT); - INTEGER_PROPERTIES.add(PROP_CONCURRENCY_LIMIT_AVAIL_REPORT); - INTEGER_PROPERTIES.add(PROP_CONCURRENCY_LIMIT_CONTENT_DOWNLOAD); - INTEGER_PROPERTIES.add(PROP_CONCURRENCY_LIMIT_CONTENT_REPORT); - INTEGER_PROPERTIES.add(PROP_CONCURRENCY_LIMIT_GLOBAL); - INTEGER_PROPERTIES.add(PROP_CONCURRENCY_LIMIT_INV_REPORT); - INTEGER_PROPERTIES.add(PROP_CONCURRENCY_LIMIT_INV_SYNC); - INTEGER_PROPERTIES.add(PROP_CONCURRENCY_LIMIT_MEAS_REPORT); - INTEGER_PROPERTIES.add(PROP_CONCURRENCY_LIMIT_MEASSCHED_REQ); - INTEGER_PROPERTIES.add(PROP_CONCURRENCY_LIMIT_WEBCONNS); - INTEGER_PROPERTIES.add(PROP_AGENT_MULTICAST_DETECTOR_PORT); - } - - public static final Set<String> CLIENT_AUTH_MODES; - static { - CLIENT_AUTH_MODES = new HashSet<String>(); - CLIENT_AUTH_MODES.add("none"); - CLIENT_AUTH_MODES.add("want"); - CLIENT_AUTH_MODES.add("need"); - } - - public static final Set<String> TOMCAT_CLIENT_AUTH_MODES; - static { - TOMCAT_CLIENT_AUTH_MODES = new HashSet<String>(); - TOMCAT_CLIENT_AUTH_MODES.add("false"); - TOMCAT_CLIENT_AUTH_MODES.add("want"); - TOMCAT_CLIENT_AUTH_MODES.add("true"); - } - - // all of the settings in this list have to be hardcoded to a specific IBM security algorithm - // if we are installing a server that is running in an IBM JVM - public static final Set<String> IBM_ALGOROTHM_SETTINGS; - static { - IBM_ALGOROTHM_SETTINGS = new HashSet<String>(); - IBM_ALGOROTHM_SETTINGS.add(PROP_TOMCAT_SECURITY_ALGORITHM); - IBM_ALGOROTHM_SETTINGS.add(PROP_SECURITY_SERVER_KEYSTORE_ALGORITHM); - IBM_ALGOROTHM_SETTINGS.add(PROP_SECURITY_SERVER_TRUSTSTORE_ALGORITHM); - IBM_ALGOROTHM_SETTINGS.add(PROP_SECURITY_CLIENT_KEYSTORE_ALGORITHM); - IBM_ALGOROTHM_SETTINGS.add(PROP_SECURITY_CLIENT_TRUSTSTORE_ALGORITHM); - } -} \ No newline at end of file diff --git a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/service/ManagementService.java b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/service/ManagementService.java deleted file mode 100644 index f7d0c38..0000000 --- a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/service/ManagementService.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.installer.server.service; - -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.ThreadFactory; - -import org.jboss.as.controller.ModelController; -import org.jboss.as.controller.client.ModelControllerClient; -import org.jboss.as.server.Services; -import org.jboss.msc.service.Service; -import org.jboss.msc.service.ServiceActivator; -import org.jboss.msc.service.ServiceActivatorContext; -import org.jboss.msc.service.ServiceName; -import org.jboss.msc.service.ServiceRegistryException; -import org.jboss.msc.service.StartContext; -import org.jboss.msc.service.StartException; -import org.jboss.msc.service.StopContext; -import org.jboss.msc.value.InjectedValue; - -/** - * This will provide our co-located management service. - * This is useful because it helps us avoid performing any management - * over a remote connector. Since we know we are running co-located - * in the same app server container that we want to manage, this - * service will provide us with a management client that does not go - * over a remote connector to talk to our app server container. - * - * @author John Mazzitelli - */ -public class ManagementService implements ServiceActivator { - - private static volatile ModelController controller; - private static volatile ExecutorService executor; - - /** - * The caller should call ModelControllerClient.close() when finished with the client. - * - * @return the ModelControllerClient - */ - public static ModelControllerClient getClient() { - return controller.createClient(executor); - } - - @Override - public void activate(ServiceActivatorContext context) throws ServiceRegistryException { - final GetModelControllerService service = new GetModelControllerService(); - context - .getServiceTarget() - .addService(ServiceName.of("rhq", "installer", "management", "client", "getter"), service) - .addDependency(Services.JBOSS_SERVER_CONTROLLER, ModelController.class, service.modelControllerValue) - .install(); - } - - private class GetModelControllerService implements Service<Void> { - private InjectedValue<ModelController> modelControllerValue = new InjectedValue<ModelController>(); - - @Override - public Void getValue() throws IllegalStateException, IllegalArgumentException { - return null; - } - - @Override - public void start(StartContext context) throws StartException { - ManagementService.executor = Executors.newFixedThreadPool(5, new ThreadFactory() { - @Override - public Thread newThread(Runnable r) { - Thread t = new Thread(r); - t.setDaemon(true); - t.setName("ManagementServiceModelControllerClientThread"); - return t; - } - }); - ManagementService.controller = modelControllerValue.getValue(); - } - - @Override - public void stop(StopContext context) { - try { - ManagementService.executor.shutdownNow(); - } finally { - ManagementService.executor = null; - ManagementService.controller = null; - } - } - - } -} diff --git a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/InstallerGWTServiceImpl.java b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/InstallerGWTServiceImpl.java deleted file mode 100644 index c252569..0000000 --- a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/InstallerGWTServiceImpl.java +++ /dev/null @@ -1,782 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.installer.server.servlet; - -import java.io.BufferedInputStream; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.net.InetAddress; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; -import java.util.Properties; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import javax.servlet.ServletException; -import javax.servlet.annotation.WebServlet; - -import com.google.gwt.user.server.rpc.RemoteServiceServlet; - -import org.jboss.as.controller.client.ModelControllerClient; - -import org.rhq.common.jbossas.client.controller.CoreJBossASClient; -import org.rhq.common.jbossas.client.controller.WebJBossASClient; -import org.rhq.core.db.DatabaseTypeFactory; -import org.rhq.core.util.PropertiesFileUpdate; -import org.rhq.core.util.exception.ThrowableUtil; -import org.rhq.enterprise.gui.installer.client.gwt.InstallerGWTService; -import org.rhq.enterprise.gui.installer.client.shared.ServerDetails; -import org.rhq.enterprise.gui.installer.client.shared.ServerProperties; -import org.rhq.enterprise.gui.installer.server.service.ManagementService; -import org.rhq.enterprise.gui.installer.server.servlet.ServerInstallUtil.ExistingSchemaOption; -import org.rhq.enterprise.gui.installer.server.servlet.ServerInstallUtil.Marker; -import org.rhq.enterprise.gui.installer.server.servlet.ServerInstallUtil.SupportedDatabaseType; - -/** - * Remote RPC API implementation for the GWT Installer. - * - * @author John Mazzitelli - */ -@WebServlet(value = "/org.rhq.enterprise.gui.installer.Installer/InstallerGWTService", loadOnStartup = 1) -public class InstallerGWTServiceImpl extends RemoteServiceServlet implements InstallerGWTService { - - private static final long serialVersionUID = 1L; - - private static final String INSTALLER_NAME = "rhq-installer.war"; - private static final String EAR_NAME = "rhq.ear"; - - @Override - public void init() throws ServletException { - super.init(); - - try { - // If we are already fully installed, we don't have to do anything. Just return immediately. - String installationResults = getInstallationResults(); - if (installationResults != null) { - if (installationResults.length() == 0) { - log("The installer has already been told to perform its work. The server should be ready soon."); - } else { - log("The installer has already attempted to install the server but errors occurred:\n" - + installationResults); - } - return; - } - } catch (Throwable t) { - log("Cannot determine if server has already been installed; aborting auto-install if enabled. Installer may not work properly.", - t); - return; - } - - // our installer is ready - let's see if we are in auto-install mode - if so, begin the install immediately - final boolean autoInstallMode; - final HashMap<String, String> serverProperties; - - try { - serverProperties = getServerProperties(); - autoInstallMode = ServerInstallUtil.isAutoinstallEnabled(serverProperties); - } catch (Throwable t) { - log("Cannot determine if in auto-install mode; using manual mode but installer may not work properly.", t); - return; - } - - if (autoInstallMode) { - Runnable asyncAutoInstall = new Runnable() { - public void run() { - try { - log("The server is preconfigured - performing auto-install immediately..."); - install(serverProperties, null, null); - log("The server has been auto-installed and should be ready shortly."); - } catch (Throwable t) { - log("The server was preconfigured but it failed to auto-install!", t); - } - } - }; - new Thread(asyncAutoInstall, "RHQ Server Auto-Install Thread").start(); - } else { - log("In manual-install mode, user must complete the installation via the Installer GUI"); - } - } - - @Override - public String getInstallationResults() throws Exception { - ModelControllerClient mcc = null; - try { - mcc = getModelControllerClient(); - - // use JBossAS's marker files to determine the status of the application EAR - CoreJBossASClient client = new CoreJBossASClient(mcc); - String deployDir = client.getAppServerDefaultDeploymentDir(); - boolean deployedExists = ServerInstallUtil.markerFileExists(deployDir, EAR_NAME, Marker.DEPLOYED); - boolean failedExists = ServerInstallUtil.markerFileExists(deployDir, EAR_NAME, Marker.FAILED); - boolean isDeployingExists = ServerInstallUtil.markerFileExists(deployDir, EAR_NAME, Marker.ISDEPLOYING); - if (!failedExists) { - if (deployedExists || isDeployingExists) { - return ""; // everything looks OK and the ear either has been successfully deployed or is deploying - } else { - return null; // installer hasn't done anything yet - } - } else { - String error = slurpFile(ServerInstallUtil.getMarkerFile(deployDir, EAR_NAME, Marker.FAILED)); - if (error.length() == 0) { - error = "Unknown installation error"; - } - return error; - } - } finally { - safeClose(mcc); - } - } - - @Override - public void install(HashMap<String, String> serverProperties, ServerDetails serverDetails, - String existingSchemaOption) throws Exception { - - // make sure the data is at least in the correct format (booleans are true/false, integers are valid numbers) - final StringBuilder dataErrors = new StringBuilder(); - for (Map.Entry<String, String> entry : serverProperties.entrySet()) { - final String name = entry.getKey(); - if (ServerProperties.BOOLEAN_PROPERTIES.contains(name)) { - final String newValue = entry.getValue(); - if (!(newValue.equals("true") || newValue.equals("false"))) { - dataErrors.append("[" + name + "] must be 'true' or 'false' : [" + newValue + "]\n"); - } - } else if (ServerProperties.INTEGER_PROPERTIES.contains(name)) { - final String newValue = entry.getValue(); - try { - Integer.parseInt(newValue); - } catch (NumberFormatException e) { - if (ServerInstallUtil.isEmpty(newValue) && name.equals(ServerProperties.PROP_CONNECTOR_BIND_PORT)) { - // this is a special setting and is allowed to be empty - } else { - dataErrors.append("[" + name + "] must be a number : [" + newValue + "]\n"); - } - } - } - } - if (dataErrors.length() > 0) { - throw new Exception("Cannot install due to data errors:\n" + dataErrors.toString()); - } - - // if we are in auto-install mode, ignore the server details passed in and build our own using the given server properties - // if not in auto-install mode, make sure user gave us the server details that we will need - final boolean autoInstallMode = ServerInstallUtil.isAutoinstallEnabled(serverProperties); - if (autoInstallMode) { - serverDetails = getServerDetailsFromPropertiesOnly(serverProperties); - } else { - if (ServerInstallUtil.isEmpty(serverDetails.getName())) { - throw new Exception("Please enter a server name"); - } - if (ServerInstallUtil.isEmpty(serverDetails.getEndpointAddress())) { - try { - serverDetails.setEndpointAddress(InetAddress.getLocalHost().getCanonicalHostName()); - } catch (Exception e) { - throw new Exception("Could not assign a server public address automatically - please specify one."); - } - } - } - - // its possible the JDBC URL was changed, clear the factory cache in case the DB version is different now - DatabaseTypeFactory.clearDatabaseTypeCache(); - - // determine the type of database to connect to - final String databaseType = serverProperties.get(ServerProperties.PROP_DATABASE_TYPE); - if (ServerInstallUtil.isEmpty(databaseType)) { - throw new Exception("Please indicate the type of database to connect to"); - } - - SupportedDatabaseType supportedDbType = ServerInstallUtil.getSupportedDatabaseType(databaseType); - if (supportedDbType == null) { - throw new IllegalArgumentException("Invalid database type: " + databaseType); - } - - // parse the database connection URL to extract the servername/port/dbname; this is needed for the XA datasource - try { - final String url = serverProperties.get(ServerProperties.PROP_DATABASE_CONNECTION_URL); - Pattern pattern = null; - if (supportedDbType == SupportedDatabaseType.POSTGRES) { - pattern = Pattern.compile(".*://(.*):([0123456789]+)/(.*)"); // jdbc:postgresql://host.name:5432/rhq - } else if (supportedDbType == SupportedDatabaseType.ORACLE) { - // if we ever find that we'll need these props set, uncomment below and it should all work - //pattern = Pattern.compile(".*@(.*):([0123456789]+)[:/](.*)"); // jdbc:oracle:thin:@host.name:1521:rhq (or /rhq) - } - - if (pattern != null) { - final Matcher match = pattern.matcher(url); - if (match.find() && (match.groupCount() == 3)) { - final String serverName = match.group(1); - final String port = match.group(2); - final String dbName = match.group(3); - serverProperties.put(ServerProperties.PROP_DATABASE_SERVER_NAME, serverName); - serverProperties.put(ServerProperties.PROP_DATABASE_PORT, port); - serverProperties.put(ServerProperties.PROP_DATABASE_DB_NAME, dbName); - } else { - throw new Exception("Cannot get server, port or db name from connection URL: " + url); - } - } else { - serverProperties.put(ServerProperties.PROP_DATABASE_SERVER_NAME, ""); - serverProperties.put(ServerProperties.PROP_DATABASE_PORT, ""); - serverProperties.put(ServerProperties.PROP_DATABASE_DB_NAME, ""); - } - } catch (Exception e) { - throw new Exception("JDBC connection URL seems to be invalid: " + ThrowableUtil.getAllMessages(e)); - } - - // make sure the internal database related settings are correct - try { - String dialect = null; - String quartzDriverDelegateClass = "org.quartz.impl.jdbcjobstore.StdJDBCDelegate"; - String quartzSelectWithLockSQL = "SELECT * FROM {0}LOCKS ROWLOCK WHERE LOCK_NAME = ? FOR UPDATE"; - String quartzLockHandlerClass = "org.quartz.impl.jdbcjobstore.StdRowLockSemaphore"; - - if (supportedDbType == SupportedDatabaseType.POSTGRES) { - dialect = "org.hibernate.dialect.PostgreSQLDialect"; - quartzDriverDelegateClass = "org.quartz.impl.jdbcjobstore.PostgreSQLDelegate"; - } else if (supportedDbType == SupportedDatabaseType.ORACLE) { - dialect = "org.hibernate.dialect.Oracle10gDialect"; - quartzDriverDelegateClass = "org.quartz.impl.jdbcjobstore.oracle.OracleDelegate"; - } - - serverProperties.put(ServerProperties.PROP_DATABASE_HIBERNATE_DIALECT, dialect); - serverProperties.put(ServerProperties.PROP_QUARTZ_DRIVER_DELEGATE_CLASS, quartzDriverDelegateClass); - serverProperties.put(ServerProperties.PROP_QUARTZ_SELECT_WITH_LOCK_SQL, quartzSelectWithLockSQL); - serverProperties.put(ServerProperties.PROP_QUARTZ_LOCK_HANDLER_CLASS, quartzLockHandlerClass); - - } catch (Exception e) { - throw new Exception("Cannot configure internal database settings: " + ThrowableUtil.getAllMessages(e)); - } - - // test the connection to make sure everything is OK - note that if we are in auto-install mode, - // the password will have been obfuscated, so we need to de-obfucate it in order to use it. - // make sure the server properties map itself has an obfuscated password - final String dbUrl = serverProperties.get(ServerProperties.PROP_DATABASE_CONNECTION_URL); - final String dbUsername = serverProperties.get(ServerProperties.PROP_DATABASE_USERNAME); - String clearTextDbPassword; - String obfuscatedDbPassword; - if (autoInstallMode) { - obfuscatedDbPassword = serverProperties.get(ServerProperties.PROP_DATABASE_PASSWORD); - clearTextDbPassword = ServerInstallUtil.deobfuscatePassword(obfuscatedDbPassword); - } else { - clearTextDbPassword = serverProperties.get(ServerProperties.PROP_DATABASE_PASSWORD); - obfuscatedDbPassword = ServerInstallUtil.obfuscatePassword(clearTextDbPassword); - serverProperties.put(ServerProperties.PROP_DATABASE_PASSWORD, obfuscatedDbPassword); - } - final String testConnectionErrorMessage = testConnection(dbUrl, dbUsername, clearTextDbPassword); - if (testConnectionErrorMessage != null) { - throw new Exception("Cannot connect to the database: " + testConnectionErrorMessage); - } - - // write the new properties to the rhq-server.properties file - saveServerProperties(serverProperties); - - // Prepare the db schema. - // existingSchemaOption is either overwrite, keep or skip. - // If in auto-install mode, we can be told to overwrite, skip or auto (meaning "keep" if schema exists) - ExistingSchemaOption existingSchemaOptionEnum; - if (autoInstallMode) { - final String s = serverProperties.get(ServerProperties.PROP_AUTOINSTALL_DATABASE); - if (s == null || s.equalsIgnoreCase("auto")) { - existingSchemaOptionEnum = ExistingSchemaOption.KEEP; - } else { - existingSchemaOptionEnum = ExistingSchemaOption.valueOf(s.toUpperCase()); - } - } else { - if (existingSchemaOption == null) { - throw new Exception("Don't know what to do with the database schema"); - } - existingSchemaOptionEnum = ExistingSchemaOption.valueOf(existingSchemaOption); - } - - if (ExistingSchemaOption.SKIP != existingSchemaOptionEnum) { - if (isDatabaseSchemaExist(dbUrl, dbUsername, clearTextDbPassword)) { - if (ExistingSchemaOption.OVERWRITE == existingSchemaOptionEnum) { - log("Database schema exists but installer was told to overwrite it - a new schema will be created now."); - ServerInstallUtil.createNewDatabaseSchema(serverProperties, serverDetails, clearTextDbPassword, - getLogDir()); - } else { - log("Database schema exists - it will now be updated."); - ServerInstallUtil.upgradeExistingDatabaseSchema(serverProperties, serverDetails, - clearTextDbPassword, getLogDir()); - } - } else { - log("Database schema does not yet exist - it will now be created."); - ServerInstallUtil.createNewDatabaseSchema(serverProperties, serverDetails, clearTextDbPassword, - getLogDir()); - } - } else { - log("Ignoring database schema - installer will assume it exists and is already up-to-date."); - } - - // ensure the server info is up to date and stored in the DB - ServerInstallUtil.storeServerDetails(serverProperties, clearTextDbPassword, serverDetails); - - String appServerConfigDir = getAppServerConfigDir(); - - // create a keystore whose cert has a CN of this server's public endpoint address - ServerInstallUtil.createKeystore(serverDetails, appServerConfigDir); - - // create an rhqadmin/rhqadmin management user so when discovered, the AS7 plugin can immediately - // connect to the RHQ Server. - ServerInstallUtil.createDefaultManagementUser(serverDetails, appServerConfigDir); - - // perform stuff that has to get done via the JBossAS management client - ModelControllerClient mcc = null; - try { - mcc = getModelControllerClient(); - - // ensure the server info is up to date and stored in the DB - ServerInstallUtil.setSocketBindings(mcc, serverProperties); - - // Make sure our deployment scanner is configured to be ready for deploy our services and application - ServerInstallUtil.configureDeploymentScanner(mcc); - } finally { - safeClose(mcc); - } - - // now create our deployment services and our main EAR - deployServices(serverProperties); - - // deploy the EAR - deployApp(); - - // some of the changes we made require the app server container to reload - reloadConfiguration(); - - return; - } - - @Override - public ArrayList<String> getServerNames(String connectionUrl, String username, String password) throws Exception { - try { - return ServerInstallUtil.getServerNames(connectionUrl, username, password); - } catch (Exception e) { - log("Could not get the list of registered server names", e); - return null; - } - } - - @Override - public ServerDetails getServerDetails(String connectionUrl, String username, String password, String serverName) - throws Exception { - try { - final ServerDetails sd = ServerInstallUtil.getServerDetails(connectionUrl, username, password, serverName); - if (ServerInstallUtil.isEmpty(sd.getName())) { - try { - sd.setEndpointAddress(InetAddress.getLocalHost().getCanonicalHostName()); - } catch (Exception ignore) { - // oh well.. we'll have to expect the user to set the name they want to use - } - } - if (ServerInstallUtil.isEmpty(sd.getEndpointAddress())) { - try { - sd.setEndpointAddress(InetAddress.getLocalHost().getHostAddress()); - } catch (Exception ignore) { - // oh well.. we'll have to expect the user to set the address they want to use - } - } - return sd; - } catch (Exception e) { - log("Could not get server details for [" + serverName + "]", e); - return null; - } - } - - @Override - public boolean isDatabaseSchemaExist(String connectionUrl, String username, String password) throws Exception { - try { - return ServerInstallUtil.isDatabaseSchemaExist(connectionUrl, username, password); - } catch (Exception e) { - log("Could not determine database existence", e); - return false; - } - } - - @Override - public String testConnection(String connectionUrl, String username, String password) throws Exception { - final String results = ServerInstallUtil.testConnection(connectionUrl, username, password); - return results; - } - - @Override - public HashMap<String, String> getServerProperties() throws Exception { - final File serverPropertiesFile = getServerPropertiesFile(); - final PropertiesFileUpdate propsFile = new PropertiesFileUpdate(serverPropertiesFile.getAbsolutePath()); - final Properties props = propsFile.loadExistingProperties(); - - // force some hardcoded defaults for IBM JVMs that must have specific values - final boolean isIBM = System.getProperty("java.vendor", "").contains("IBM"); - if (isIBM) { - for (String algPropName : ServerProperties.IBM_ALGOROTHM_SETTINGS) { - props.setProperty(algPropName, "IbmX509"); - } - } - - // GWT can't handle Properties - convert to HashMap - final HashMap<String, String> map = new HashMap<String, String>(props.size()); - for (Object property : props.keySet()) { - map.put(property.toString(), props.getProperty(property.toString())); - } - return map; - } - - /** - * Save the given properties to the server's .properties file. - * - * Note that this is private - it is not exposed to the installer UI. It should have no need to save - * this data outside of the normal installation process (see {@link #install()}). - * - * @param serverProperties the server properties to save - * - * @throws Exception if failed to save the properties to the .properties file - */ - private void saveServerProperties(HashMap<String, String> serverProperties) throws Exception { - final File serverPropertiesFile = getServerPropertiesFile(); - final PropertiesFileUpdate propsFile = new PropertiesFileUpdate(serverPropertiesFile.getAbsolutePath()); - - // GWT can't handle Properties - so we use HashMap but convert to Properties internally - final Properties props = new Properties(); - for (Map.Entry<String, String> entry : serverProperties.entrySet()) { - props.setProperty(entry.getKey(), entry.getValue()); - } - - propsFile.update(props); - - // we need to put them as system properties now so when we hot deploy, - // the replacement variables in the config files pick up the new values - for (Map.Entry<String, String> entry : serverProperties.entrySet()) { - System.setProperty(entry.getKey(), entry.getValue()); - } - - return; - } - - @Override - public String getAppServerVersion() throws Exception { - ModelControllerClient mcc = null; - try { - mcc = getModelControllerClient(); - final CoreJBossASClient client = new CoreJBossASClient(mcc); - final String version = client.getAppServerVersion(); - return version; - } finally { - safeClose(mcc); - } - } - - @Override - public String getOperatingSystem() throws Exception { - ModelControllerClient mcc = null; - try { - mcc = getModelControllerClient(); - final CoreJBossASClient client = new CoreJBossASClient(mcc); - final String osName = client.getOperatingSystem(); - return osName; - } finally { - safeClose(mcc); - } - } - - private String getAppServerHomeDir() throws Exception { - ModelControllerClient mcc = null; - try { - mcc = getModelControllerClient(); - final CoreJBossASClient client = new CoreJBossASClient(mcc); - final String dir = client.getAppServerHomeDir(); - return dir; - } finally { - safeClose(mcc); - } - } - - private String getAppServerConfigDir() throws Exception { - ModelControllerClient mcc = null; - try { - mcc = getModelControllerClient(); - final CoreJBossASClient client = new CoreJBossASClient(mcc); - final String dir = client.getAppServerConfigDir(); - return dir; - } finally { - safeClose(mcc); - } - } - - private String getLogDir() throws Exception { - ModelControllerClient mcc = null; - try { - mcc = getModelControllerClient(); - final CoreJBossASClient client = new CoreJBossASClient(mcc); - final String dir = client.getAppServerLogDir(); - return dir; - } finally { - safeClose(mcc); - } - } - - private File getServerPropertiesFile() throws Exception { - final File appServerHomeDir = new File(getAppServerHomeDir()); - final File serverPropertiesFile = new File(appServerHomeDir, "../bin/rhq-server.properties"); - return serverPropertiesFile; - } - - /** - * Returns server details based on information found solely in the given server properties. - * It does not rely on any database access. - * - * This is used by the auto-installation process. - * - * @param serverProperties the server properties - * @throws Exception - */ - private ServerDetails getServerDetailsFromPropertiesOnly(HashMap<String, String> serverProperties) throws Exception { - - String highAvailabilityName = serverProperties.get(ServerProperties.PROP_HIGH_AVAILABILITY_NAME); - String publicEndpoint = serverProperties.get(ServerProperties.PROP_AUTOINSTALL_PUBLIC_ADDR); - int port; - int securePort; - - if (ServerInstallUtil.isEmpty(highAvailabilityName)) { - try { - highAvailabilityName = InetAddress.getLocalHost().getCanonicalHostName(); - } catch (Exception e) { - log("Could not determine default server name: ", e); - throw new Exception("Server name is not preconfigured and could not be determined automatically"); - } - } - - // the public endpoint address is one that can be preconfigured in the special autoinstall property. - // if that is not specified, then we use either the connector's bind address or the server bind address. - // if nothing was specified, we'll default to the canonical host name. - if (ServerInstallUtil.isEmpty(publicEndpoint)) { - String connBindAddress = serverProperties.get(ServerProperties.PROP_CONNECTOR_BIND_ADDRESS); - - if ((!ServerInstallUtil.isEmpty(connBindAddress)) && (!"0.0.0.0".equals(connBindAddress.trim()))) { - // the server-side connector bind address is explicitly set, use that - publicEndpoint = connBindAddress.trim(); - - } else { - String serverBindAddress = serverProperties.get(ServerProperties.PROP_JBOSS_BIND_ADDRESS); - if ((!ServerInstallUtil.isEmpty(serverBindAddress)) && (!"0.0.0.0".equals(serverBindAddress.trim()))) { - // the main JBossAS server bind address is set and it isn't 0.0.0.0, use that - publicEndpoint = serverBindAddress.trim(); - - } else { - try { - publicEndpoint = InetAddress.getLocalHost().getCanonicalHostName(); - } catch (Exception e) { - log("Could not determine default public endpoint address: ", e); - throw new Exception( - "Public endpoint address not preconfigured and could not be determined automatically"); - } - } - } - } - - // define the public endpoint ports. - // note that if using a different transport other than (ssl)servlet, we'll - // take the connector's bind port and use it for both ports. This is to support a special deployment - // use-case - 99% of the time, the agents will go through the web/tomcat connector and thus we'll use - // the http/https ports for the public endpoints. - String connectorTransport = serverProperties.get(ServerProperties.PROP_CONNECTOR_TRANSPORT); - if (connectorTransport != null && connectorTransport.contains("socket")) { - // we aren't using the (ssl)servlet protocol, take the connector bind port and use it for the public endpoint ports - String connectorBindPort = serverProperties.get(ServerProperties.PROP_CONNECTOR_BIND_PORT); - if (ServerInstallUtil.isEmpty(connectorBindPort) || "0".equals(connectorBindPort.trim())) { - throw new Exception("Using non-servlet transport [" + connectorTransport + "] but didn't define a port"); - } - port = Integer.parseInt(connectorBindPort); - securePort = Integer.parseInt(connectorBindPort); - } else { - // this is the typical use-case - the transport is probably (ssl)servlet so use the web http/https ports - try { - port = Integer.parseInt(serverProperties.get(ServerProperties.PROP_WEB_HTTP_PORT)); - } catch (Exception e) { - log("Could not determine port, will use default: " + e); - port = ServerDetails.DEFAULT_ENDPOINT_PORT; - } - try { - securePort = Integer.parseInt(serverProperties.get(ServerProperties.PROP_WEB_HTTPS_PORT)); - } catch (Exception e) { - log("Could not determine secure port, will use default: " + e); - securePort = ServerDetails.DEFAULT_ENDPOINT_SECURE_PORT; - } - } - - // everything looks good - ServerDetails serverDetails = new ServerDetails(highAvailabilityName, publicEndpoint, port, securePort); - return serverDetails; - } - - private ModelControllerClient getModelControllerClient() { - final ModelControllerClient client = ManagementService.getClient(); - return client; - } - - private void deployServices(HashMap<String, String> serverProperties) throws Exception { - - ModelControllerClient mcc = null; - try { - mcc = getModelControllerClient(); - - // create the security domain needed by the datasources - ServerInstallUtil.createDatasourceSecurityDomain(mcc, serverProperties); - - // create the security domain needed by REST - ServerInstallUtil.createRESTSecurityDomain(mcc, serverProperties); - - // set up REST cache - ServerInstallUtil.createNewCaches(mcc, serverProperties); - - // create the JDBC driver configurations for use by datasources - ServerInstallUtil.createNewJdbcDrivers(mcc, serverProperties); - - // create the datasources - ServerInstallUtil.createNewDatasources(mcc, serverProperties); - - // create the JMS queues - ServerInstallUtil.createNewJMSQueues(mcc, serverProperties); - - // setup the email service - ServerInstallUtil.setupMailService(mcc, serverProperties); - - // we don't want to the JBossAS welcome screen; turn it off - new WebJBossASClient(mcc).setEnableWelcomeRoot(false); - - } catch (Exception e) { - log("deployServices failed", e); - throw new Exception("Failed to deploy services: " + ThrowableUtil.getAllMessages(e)); - } finally { - safeClose(mcc); - } - } - - private static void safeClose(final ModelControllerClient mcc) { - if (null != mcc) { - try { - mcc.close(); - } catch (Exception e) { - } - } - } - - private void deployApp() throws Exception { - ModelControllerClient mcc = null; - try { - mcc = getModelControllerClient(); - final CoreJBossASClient client = new CoreJBossASClient(mcc); - final String deployDir = client.getAppServerDefaultDeploymentDir(); - if (deployDir == null) { - throw new IllegalStateException("Missing the deployment scanner - cannot finish install"); - } - - // set up our marker files so the app server deploys the ear - ServerInstallUtil.deleteMarkerFile(deployDir, EAR_NAME, Marker.FAILED); - ServerInstallUtil.deleteMarkerFile(deployDir, EAR_NAME, Marker.SKIP_DEPLOY); - ServerInstallUtil.touchMarkerFile(deployDir, EAR_NAME, Marker.DO_DEPLOY); - - // We can leave the installer always deployed. It won't do anything if main EAR is deployed. - // Leaving it deployed will allow the installer URL to be live, so people who mistakenly go - // to the installer will be told (by the installer) that things are installed and it will give - // the real URL to the user as a help to get them started. - // In case we do want to undeploy the installer, I left the code intact here. Just uncomment this line below: - // undeployInstaller(); - } catch (Exception e) { - log("deployApp failed", e); - throw new Exception("Failed to deploy the app: " + ThrowableUtil.getAllMessages(e)); - } finally { - safeClose(mcc); - } - } - - private void reloadConfiguration() throws Exception { - log("Will now ask the app server to reload its configuration"); - ModelControllerClient mcc = null; - try { - mcc = getModelControllerClient(); - final CoreJBossASClient client = new CoreJBossASClient(mcc); - client.reload(); - log("App server has been successfully asked to reload its configuration"); - } catch (Exception e) { - log("reloadConfiguration failed - restart the server to complete the installation", e); - } finally { - safeClose(mcc); - } - } - - // left this here in case we want to undeploy the installer in the future; for now, we don't use this - private void undeployInstaller() throws Exception { - ModelControllerClient mcc = null; - try { - mcc = getModelControllerClient(); - final CoreJBossASClient client = new CoreJBossASClient(mcc); - final String deployDir = client.getAppServerDefaultDeploymentDir(); - if (deployDir == null) { - throw new IllegalStateException("Missing the deployment scanner - cannot undeploy installer"); - } - - ServerInstallUtil.touchMarkerFile(deployDir, INSTALLER_NAME, Marker.SKIP_DEPLOY); - - // This will shut the installer down and undeploy it. - // We do it in a separate thread to let this current request thread be able to return and finish. - new Thread(new Runnable() { - public void run() { - try { - Thread.sleep(3000L); // gives the calling thread time to finish - } catch (InterruptedException e) { - } - try { - log("Installer has completed its work and is no longer needed. It is being undeployed..."); - ServerInstallUtil.deleteMarkerFile(deployDir, INSTALLER_NAME, Marker.DEPLOYED); - log("Installer has been undeployed"); - } catch (Exception e) { - e.printStackTrace(); - } - } - }, "RHQ Installer Undeploy Thread").start(); - } catch (Exception e) { - log("undeployInstaller failed", e); - throw new Exception("Failed to undeploy the installer: " + ThrowableUtil.getAllMessages(e)); - } finally { - safeClose(mcc); - } - } - - private String slurpFile(File theFile) { - FileInputStream fis = null; - try { - byte[] buffer = new byte[32768]; - fis = new FileInputStream(theFile); - BufferedInputStream input = new BufferedInputStream(fis, buffer.length); - ByteArrayOutputStream out = new ByteArrayOutputStream(); - - for (int bytesRead = input.read(buffer); bytesRead != -1; bytesRead = input.read(buffer)) { - out.write(buffer, 0, bytesRead); - } - return out.toString(); - } catch (Exception ioe) { - throw new RuntimeException("Cannot slurp file: " + theFile, ioe); - } finally { - try { - fis.close(); - } catch (IOException e) { - } - } - } -} diff --git a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/LoggerAntBuildListener.java b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/LoggerAntBuildListener.java deleted file mode 100644 index 822eb34..0000000 --- a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/LoggerAntBuildListener.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.installer.server.servlet; - -import java.io.PrintWriter; -import java.util.Date; - -import org.apache.tools.ant.BuildEvent; -import org.apache.tools.ant.BuildListener; -import org.apache.tools.ant.Target; -import org.apache.tools.ant.Task; - -/** - * Listens for ANT build events and logs them to a log stream. - * - * @author John Mazzitelli - */ -public class LoggerAntBuildListener implements BuildListener { - private PrintWriter output; - - public LoggerAntBuildListener(PrintWriter logFile) { - output = logFile; - - // just output our first line with the date this was started - output.println(new Date().toString()); - } - - public void buildFinished(BuildEvent event) { - logEvent(event, "FINISHED!"); - } - - public void buildStarted(BuildEvent event) { - logEvent(event, "STARTED!"); - } - - public void messageLogged(BuildEvent event) { - logEvent(event, null); - } - - public void targetFinished(BuildEvent event) { - logEvent(event, null); - } - - public void targetStarted(BuildEvent event) { - logEvent(event, null); - } - - public void taskFinished(BuildEvent event) { - logEvent(event, null); - } - - public void taskStarted(BuildEvent event) { - logEvent(event, null); - } - - private void logEvent(BuildEvent event, String additionalMessage) { - String message = event.getMessage(); - Throwable exception = event.getException(); - Target target = event.getTarget(); - Task task = event.getTask(); - - if (additionalMessage != null) { - output.println(additionalMessage); - } - - if (target != null) { - output.print("[" + target.getName() + "] "); - } - - if (task != null) { - output.print("[" + task.getTaskName() + "] "); - } - - if (message != null) { - output.print(message); - } - - if (exception != null) { - output.println(); - exception.printStackTrace(output); - } - - output.println(); - - return; - } -} \ No newline at end of file diff --git a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/ServerInstallUtil.java b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/ServerInstallUtil.java deleted file mode 100644 index 6d002de..0000000 --- a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/ServerInstallUtil.java +++ /dev/null @@ -1,1303 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.installer.server.servlet; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.PrintWriter; -import java.lang.reflect.Method; -import java.net.InetAddress; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Properties; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.helper.ProjectHelper2; - -import org.jboss.as.controller.client.ModelControllerClient; -import org.jboss.dmr.ModelNode; - -import org.rhq.common.jbossas.client.controller.Address; -import org.rhq.common.jbossas.client.controller.CoreJBossASClient; -import org.rhq.common.jbossas.client.controller.DatasourceJBossASClient; -import org.rhq.common.jbossas.client.controller.FailureException; -import org.rhq.common.jbossas.client.controller.InfinispanJBossASClient; -import org.rhq.common.jbossas.client.controller.JBossASClient; -import org.rhq.common.jbossas.client.controller.MessagingJBossASClient; -import org.rhq.common.jbossas.client.controller.SecurityDomainJBossASClient; -import org.rhq.common.jbossas.client.controller.SocketBindingJBossASClient; -import org.rhq.core.db.DatabaseType; -import org.rhq.core.db.DatabaseTypeFactory; -import org.rhq.core.db.DbUtil; -import org.rhq.core.db.OracleDatabaseType; -import org.rhq.core.db.PostgresqlDatabaseType; -import org.rhq.core.db.setup.DBSetup; -import org.rhq.core.util.exception.ThrowableUtil; -import org.rhq.core.util.stream.StreamUtil; -import org.rhq.enterprise.communications.util.SecurityUtil; -import org.rhq.enterprise.gui.installer.client.shared.ServerDetails; -import org.rhq.enterprise.gui.installer.client.shared.ServerProperties; - -/** - * Provides utility methods necessary to complete the server installation. - * - * @author John Mazzitelli - */ -public class ServerInstallUtil { - private static final Log LOG = LogFactory.getLog(ServerInstallUtil.class); - - public enum ExistingSchemaOption { - OVERWRITE, KEEP, SKIP - }; - - public enum SupportedDatabaseType { - POSTGRES, ORACLE - }; - - public enum Marker { - DO_DEPLOY(".dodeploy"), SKIP_DEPLOY(".skipdeploy"), DEPLOYED(".deployed"), FAILED(".failed"), ISDEPLOYING( - ".isdeploying"); - - private String extension; - - private Marker(String ext) { - extension = ext; - } - - public String getExtenstion() { - return extension; - } - } - - private static class SocketBindingInfo { - public String name; - public String sysprop; - public int port; - - public SocketBindingInfo(String n, String s, int p) { - name = n; - sysprop = s; - port = p; - } - } - - private static final ArrayList<SocketBindingInfo> defaultSocketBindings; - static { - // all ports are -1000 from out-of-box AS7 defaults - // except for the jboss.management ones - those are -3000 from their out-of-box defaults - defaultSocketBindings = new ArrayList<SocketBindingInfo>(); - defaultSocketBindings.add(new SocketBindingInfo(SocketBindingJBossASClient.DEFAULT_BINDING_AJP, - "rhq.server.socket.binding.port.ajp", 7009)); - defaultSocketBindings.add(new SocketBindingInfo(SocketBindingJBossASClient.DEFAULT_BINDING_HTTP, - "rhq.server.socket.binding.port.http", 7080)); - defaultSocketBindings.add(new SocketBindingInfo(SocketBindingJBossASClient.DEFAULT_BINDING_HTTPS, - "rhq.server.socket.binding.port.https", 7443)); - defaultSocketBindings.add(new SocketBindingInfo(SocketBindingJBossASClient.DEFAULT_BINDING_JACORB, - "rhq.server.socket.binding.port.jacorb", 2528)); - defaultSocketBindings.add(new SocketBindingInfo(SocketBindingJBossASClient.DEFAULT_BINDING_JACORB_SSL, - "rhq.server.socket.binding.port.jacorb-ssl", 2529)); - defaultSocketBindings.add(new SocketBindingInfo(SocketBindingJBossASClient.DEFAULT_BINDING_MESSAGING, - "rhq.server.socket.binding.port.messaging", 4445)); - defaultSocketBindings.add(new SocketBindingInfo(SocketBindingJBossASClient.DEFAULT_BINDING_MESSAGING_THRUPUT, - "rhq.server.socket.binding.port.messaging-throughput", 4455)); - defaultSocketBindings.add(new SocketBindingInfo(SocketBindingJBossASClient.DEFAULT_BINDING_MGMT_HTTP, - "jboss.management.http.port", 6990)); - defaultSocketBindings.add(new SocketBindingInfo(SocketBindingJBossASClient.DEFAULT_BINDING_MGMT_HTTPS, - "jboss.management.https.port", 6443)); - defaultSocketBindings.add(new SocketBindingInfo(SocketBindingJBossASClient.DEFAULT_BINDING_MGMT_NATIVE, - "jboss.management.native.port", 6999)); - defaultSocketBindings.add(new SocketBindingInfo(SocketBindingJBossASClient.DEFAULT_BINDING_OSGI_HTTP, - "rhq.server.socket.binding.port.osgi-http", 7090)); - defaultSocketBindings.add(new SocketBindingInfo(SocketBindingJBossASClient.DEFAULT_BINDING_REMOTING, - "rhq.server.socket.binding.port.remoting", 3447)); - defaultSocketBindings.add(new SocketBindingInfo(SocketBindingJBossASClient.DEFAULT_BINDING_TXN_RECOVERY_ENV, - "rhq.server.socket.binding.port.txn-recovery-environment", 3712)); - defaultSocketBindings.add(new SocketBindingInfo(SocketBindingJBossASClient.DEFAULT_BINDING_TXN_STATUS_MGR, - "rhq.server.socket.binding.port.txn-status-manager", 3713)); - } - - private static final String RHQ_DATASOURCE_NAME_NOTX = "NoTxRHQDS"; - private static final String RHQ_DATASOURCE_NAME_XA = "RHQDS"; - private static final String RHQ_DS_SECURITY_DOMAIN = "RHQDSSecurityDomain"; - private static final String RHQ_REST_SECURITY_DOMAIN = "RHQRESTSecurityDomain"; - private static final String JDBC_DRIVER_POSTGRES = "postgres"; - private static final String JDBC_DRIVER_ORACLE = "oracle"; - private static final String JMS_ALERT_CONDITION_QUEUE = "AlertConditionQueue"; - private static final String JMS_DRIFT_CHANGESET_QUEUE = "DriftChangesetQueue"; - private static final String JMS_DRIFT_FILE_QUEUE = "DriftFileQueue"; - private static final String RHQ_CACHE_CONTAINER = "rhq"; - private static final String RHQ_CACHE = "rhqCache"; - - /** - * Configure the deployment scanner to get ready to deploy the application. - * @param mcc JBossAS management client - * @throws Exception - */ - public static void configureDeploymentScanner(ModelControllerClient mcc) throws Exception { - CoreJBossASClient client = new CoreJBossASClient(mcc); - - // the EAR could take a long time to deploy, increase the deployment timeout - client.setAppServerDefaultDeploymentTimeout(1800); // 30 minutes should be plenty of time - - // We don't need to scan the deployment directory after everything is installed. - // TODO: We would like this to be 0, so it only scans at startup, but the installer - // will need the scanner to deploy the ear after the .dodeploy is created. - //client.setAppServerDefaultDeploymentScanInterval(0); - } - - /** - * Prepares the mail service by configuring the SMTP settings. - * - * @param mcc JBossAS management client - * @param serverProperties the server's properties - * @throws Exception - */ - public static void setupMailService(ModelControllerClient mcc, HashMap<String, String> serverProperties) - throws Exception { - - String fromAddressExpr = "${" + ServerProperties.PROP_EMAIL_FROM_ADDRESS + ":rhqadmin@localhost.com}"; - //String smtpHostExpr = "${" + ServerProperties.PROP_EMAIL_SMTP_HOST + ":localhost}"; - String smtpPortExpr = "${" + ServerProperties.PROP_EMAIL_SMTP_PORT + ":25}"; - - // Tweek the mail configuration that comes out of box. Setup a batch request to write the proper attributes. - - // First, the from address (TODO: there is also a "ssl", "username" and "password" attribute we could set for authz) - Address addr = Address.root().add(JBossASClient.SUBSYSTEM, "mail", "mail-session", "java:jboss/mail/Default"); - ModelNode writeFromAddr = JBossASClient.createRequest(JBossASClient.WRITE_ATTRIBUTE, addr); - writeFromAddr.get(JBossASClient.NAME).set("from"); - writeFromAddr.get(JBossASClient.VALUE).setExpression(fromAddressExpr); - - // now the SMTP host - addr = Address.root().add("socket-binding-group", "standard-sockets", - "remote-destination-outbound-socket-binding", "mail-smtp"); - ModelNode writeHost = JBossASClient.createRequest(JBossASClient.WRITE_ATTRIBUTE, addr); - writeHost.get(JBossASClient.NAME).set("host"); - // TODO: see https://issues.jboss.org/browse/AS7-5321 - that must be fixed before supporting expressions - //writeHost.get(JBossASClient.VALUE).setExpression(smtpHostExpr); - writeHost.get(JBossASClient.VALUE).set(serverProperties.get(ServerProperties.PROP_EMAIL_SMTP_HOST)); // remove when AS7-5321 is fixed - - // now the SMTP port - addr = Address.root().add("socket-binding-group", "standard-sockets", - "remote-destination-outbound-socket-binding", "mail-smtp"); - ModelNode writePort = JBossASClient.createRequest(JBossASClient.WRITE_ATTRIBUTE, addr); - writePort.get(JBossASClient.NAME).set("port"); - writePort.get(JBossASClient.VALUE).setExpression(smtpPortExpr); - - ModelNode batch = JBossASClient.createBatchRequest(writeFromAddr, writeHost, writePort); - JBossASClient client = new JBossASClient(mcc); - ModelNode response = client.execute(batch); - if (!JBossASClient.isSuccess(response)) { - throw new FailureException(response, "Failed to setup mail service"); - } - LOG.info("Mail service has been configured."); - return; - } - - /** - * Give the server properties, this returns the type of database that will be connected to. - * - * @param serverProperties - * @return the type of DB - */ - public static SupportedDatabaseType getSupportedDatabaseType(HashMap<String, String> serverProperties) { - return getSupportedDatabaseType(serverProperties.get(ServerProperties.PROP_DATABASE_TYPE)); - } - - /** - * Give the database type string, this returns the type of database that it refers to. - * - * @param dbType the database type string - * @return the type of DB - */ - public static SupportedDatabaseType getSupportedDatabaseType(String dbType) { - if (dbType == null) { - return null; - } - if (dbType.toLowerCase().indexOf("postgres") > -1) { - return SupportedDatabaseType.POSTGRES; - } else if (dbType.toLowerCase().indexOf("oracle") > -1) { - return SupportedDatabaseType.ORACLE; - } - return null; - } - - /** - * Creates the security domain for the datasources. This is needed to support - * obfuscation of the password in the configuration file. - * - * @param mcc the JBossAS management client - * @param serverProperties contains the obfuscated password to store in the security domain - * @throws Exception - */ - public static void createDatasourceSecurityDomain(ModelControllerClient mcc, - HashMap<String, String> serverProperties) throws Exception { - - final String dbUsername = serverProperties.get(ServerProperties.PROP_DATABASE_USERNAME); - final String obfuscatedPassword = serverProperties.get(ServerProperties.PROP_DATABASE_PASSWORD); - final SecurityDomainJBossASClient client = new SecurityDomainJBossASClient(mcc); - final String securityDomain = RHQ_DS_SECURITY_DOMAIN; - if (!client.isSecurityDomain(securityDomain)) { - client.createNewSecureIdentitySecurityDomainRequest(securityDomain, dbUsername, obfuscatedPassword); - LOG.info("Security domain [" + securityDomain + "] created"); - } else { - LOG.info("Security domain [" + securityDomain + "] already exists, skipping the creation request"); - } - } - - /** - * Creates the JMS Queues required for Drift and Alerting. - * - * @param mcc the JBossAS management client - * @param serverProperties contains the obfuscated password to store in the security domain - * @throws Exception - */ - public static void createNewJMSQueues(ModelControllerClient mcc, HashMap<String, String> serverProperties) - throws Exception { - - final MessagingJBossASClient client = new MessagingJBossASClient(mcc); - final List<String> entryNames = new ArrayList<String>(); - - // TODO (jshaughn): Prior to HornetQ we set recoveryRetries to 0: "don't redeliver messages on failure. It - // just causes more failures. just go straight to the dead messages by setting recoveryRetries to 0. - // This is equivalent to setting the dLQMaxResent property to 0 in the MessageDriven annotation in - // the class definition." - // HornetQ has different semantics, and may behave well with default settings. If not, we'll - // likely need to add specific <address-setting> elements for our queues, which set - // max-delivery-attempts to 0. The documented default is 10. - - String queueName = JMS_ALERT_CONDITION_QUEUE; - if (!client.isQueue(queueName)) { - entryNames.clear(); - entryNames.add("queue/" + queueName); - ModelNode request = client.createNewQueueRequest(queueName, true, entryNames); - ModelNode results = client.execute(request); - if (!MessagingJBossASClient.isSuccess(results)) { - throw new FailureException(results, "Failed to create JMS Queue [" + queueName + "]"); - } else { - LOG.info("JMS queue [" + queueName + "] created"); - } - } else { - LOG.info("JMS Queue [" + queueName + "] already exists, skipping the creation request"); - } - - queueName = JMS_DRIFT_CHANGESET_QUEUE; - if (!client.isQueue(queueName)) { - entryNames.clear(); - entryNames.add("queue/" + queueName); - ModelNode request = client.createNewQueueRequest(queueName, true, entryNames); - ModelNode results = client.execute(request); - if (!MessagingJBossASClient.isSuccess(results)) { - throw new FailureException(results, "Failed to create JMS Queue [" + queueName + "]"); - } else { - LOG.info("JMS queue [" + queueName + "] created"); - } - } else { - LOG.info("JMS Queue [" + queueName + "] already exists, skipping the creation request"); - } - - queueName = JMS_DRIFT_FILE_QUEUE; - if (!client.isQueue(queueName)) { - entryNames.clear(); - entryNames.add("queue/" + queueName); - ModelNode request = client.createNewQueueRequest(queueName, true, entryNames); - ModelNode results = client.execute(request); - if (!MessagingJBossASClient.isSuccess(results)) { - throw new FailureException(results, "Failed to create JMS Queue [" + queueName + "]"); - } else { - LOG.info("JMS queue [" + queueName + "] created"); - } - } else { - LOG.info("JMS Queue [" + queueName + "] already exists, skipping the creation request"); - } - - } - - /** - * Creates the security domain for REST. - * - * @param mcc the JBossAS management client - * @param serverProperties contains the obfuscated password to store in the security domain - * @throws Exception - */ - public static void createRESTSecurityDomain(ModelControllerClient mcc, HashMap<String, String> serverProperties) - throws Exception { - - final SecurityDomainJBossASClient client = new SecurityDomainJBossASClient(mcc); - final String securityDomain = RHQ_REST_SECURITY_DOMAIN; - if (!client.isSecurityDomain(securityDomain)) { - client.createNewDatabaseServerSecurityDomainRequest(securityDomain, "java:jboss/datasources/RHQDS", - "SELECT PASSWORD FROM RHQ_PRINCIPAL WHERE principal=?", - "SELECT 'all', 'Roles' FROM RHQ_PRINCIPAL WHERE principal=?", null, null); - LOG.info("Security domain [" + securityDomain + "] created"); - } else { - LOG.info("Security domain [" + securityDomain + "] already exists, skipping the creation request"); - } - } - - /** - * Creates the Infinispan caches for RHQ. - * - * @param mcc the JBossAS management client - * @param serverProperties contains the obfuscated password to store in the security domain - * @throws Exception - */ - public static void createNewCaches(ModelControllerClient mcc, HashMap<String, String> serverProperties) - throws Exception { - - final InfinispanJBossASClient client = new InfinispanJBossASClient(mcc); - final String cacheContainerName = RHQ_CACHE_CONTAINER; - final String localCacheName = RHQ_CACHE; - if (!client.isCacheContainer(cacheContainerName)) { - ModelNode request = client.createNewCacheContainerRequest(cacheContainerName, localCacheName); - ModelNode results = client.execute(request); - if (!MessagingJBossASClient.isSuccess(results)) { - throw new FailureException(results, "Failed to create Cache container [" + cacheContainerName + "]"); - } else { - LOG.info("Cache container [" + cacheContainerName + "] created"); - } - - } else { - LOG.info("Cache container [" + cacheContainerName + "] already exists, skipping the creation request"); - } - - if (!client.isLocalCache(cacheContainerName, localCacheName)) { - ModelNode request = client.createNewLocalCacheRequest(cacheContainerName, localCacheName, null, null, null, - null, null); - ModelNode results = client.execute(request); - if (!MessagingJBossASClient.isSuccess(results)) { - throw new FailureException(results, "Failed to create Local Cache [" + localCacheName + "]"); - } else { - LOG.info("Local Cache [" + localCacheName + "] created"); - } - - } else { - LOG.info("Local Cache [" + localCacheName + "] already exists, skipping the creation request"); - } - } - - /** - * Creates JDBC driver configurations so the datasources can properly connect to the backend databases. - * This will attempt to create drivers for all supported databases, not just for the database type that - * is currently configured. - * - * @param mcc - * @param serverProperties - * @throws Exception - */ - public static void createNewJdbcDrivers(ModelControllerClient mcc, HashMap<String, String> serverProperties) - throws Exception { - - final DatasourceJBossASClient client = new DatasourceJBossASClient(mcc); - - final ModelNode postgresDriverRequest = client.createNewJdbcDriverRequest(JDBC_DRIVER_POSTGRES, - "org.rhq.postgres", "org.postgresql.xa.PGXADataSource"); - final ModelNode oracleDriverRequest = client.createNewJdbcDriverRequest(JDBC_DRIVER_ORACLE, "org.rhq.oracle", - "oracle.jdbc.xa.client.OracleXADataSource"); - - // if we are to use Oracle, we throw an exception if we can't create the Oracle datasource. We also try to - // create the Postgres datasource but because it isn't needed, we don't throw exceptions if that fails, we - // just log a warning. - // The reverse is true if we are to use Postgres (that is, we ensure Postgres driver is created, but not Oracle). - ModelNode results; - final SupportedDatabaseType supportedDbType = getSupportedDatabaseType(serverProperties); - switch (supportedDbType) { - case POSTGRES: { - if (client.isJDBCDriver(JDBC_DRIVER_POSTGRES)) { - LOG.info("Postgres JDBC driver is already deployed"); - } else { - results = client.execute(postgresDriverRequest); - if (!DatasourceJBossASClient.isSuccess(results)) { - throw new FailureException(results, "Failed to create postgres database driver"); - } else { - LOG.info("Deployed Postgres JDBC driver"); - } - } - - if (client.isJDBCDriver(JDBC_DRIVER_ORACLE)) { - LOG.info("Oracle JDBC driver is already deployed"); - } else { - results = client.execute(oracleDriverRequest); - if (!DatasourceJBossASClient.isSuccess(results)) { - LOG.warn("Could not create Oracle JDBC Driver - you will not be able to switch to an Oracle DB later: " - + JBossASClient.getFailureDescription(results)); - } else { - LOG.info("Deployed Oracle JDBC driver for future use"); - } - } - break; - } - case ORACLE: { - if (client.isJDBCDriver(JDBC_DRIVER_ORACLE)) { - LOG.info("Oracle JDBC driver is already deployed"); - } else { - results = client.execute(oracleDriverRequest); - if (!DatasourceJBossASClient.isSuccess(results)) { - throw new FailureException(results, "Failed to create oracle database driver"); - } else { - LOG.info("Deployed Oracle JDBC driver"); - } - } - if (client.isJDBCDriver(JDBC_DRIVER_POSTGRES)) { - LOG.info("Postgres JDBC driver is already deployed"); - } else { - results = client.execute(postgresDriverRequest); - if (!DatasourceJBossASClient.isSuccess(results)) { - LOG.warn("Could not create Postgres JDBC Driver - you will not be able to switch to a Postgres DB later: " - + JBossASClient.getFailureDescription(results)); - } else { - LOG.info("Deployed Postgres JDBC driver for future use"); - } - } - break; - } - default: - throw new RuntimeException("bad db type"); // this should never happen; should have never gotten to this point with a bad type - } - - } - - /** - * Creates the datasources needed by the RHQ Server. - * - * @param mcc the JBossAS management client - * @param serverProperties properties to help determine the properties of the datasources to be created - * @throws Exception - */ - public static void createNewDatasources(ModelControllerClient mcc, HashMap<String, String> serverProperties) - throws Exception { - - final SupportedDatabaseType supportedDbType = getSupportedDatabaseType(serverProperties); - switch (supportedDbType) { - case POSTGRES: { - createNewDatasources_Postgres(mcc); - break; - } - case ORACLE: { - createNewDatasources_Oracle(mcc); - break; - } - default: - throw new RuntimeException("bad db type"); // this should never happen; should have never gotten to this point with a bad type - } - - LOG.info("Created datasources"); - - final DatasourceJBossASClient client = new DatasourceJBossASClient(mcc); - client.enableDatasource(RHQ_DATASOURCE_NAME_NOTX); - client.enableXADatasource(RHQ_DATASOURCE_NAME_XA); - LOG.info("Enabled datasources"); - - } - - private static void createNewDatasources_Postgres(ModelControllerClient mcc) throws Exception { - final HashMap<String, String> props = new HashMap<String, String>(4); - final DatasourceJBossASClient client = new DatasourceJBossASClient(mcc); - - ModelNode noTxDsRequest = null; - ModelNode xaDsRequest = null; - - if (!client.isDatasource(RHQ_DATASOURCE_NAME_NOTX)) { - props.put("char.encoding", "UTF-8"); - - noTxDsRequest = client.createNewDatasourceRequest(RHQ_DATASOURCE_NAME_NOTX, 30000, - "${rhq.server.database.connection-url:jdbc:postgres://127.0.0.1:5432/rhq}", JDBC_DRIVER_POSTGRES, - "org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter", 15, false, 2, 5, 75, - RHQ_DS_SECURITY_DOMAIN, "-unused-stale-conn-checker-", "TRANSACTION_READ_COMMITTED", - "org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker", props); - noTxDsRequest.get("steps").get(0).remove("stale-connection-checker-class-name"); // we don't have one of these for postgres - } else { - LOG.info("Postgres datasource [" + RHQ_DATASOURCE_NAME_NOTX + "] already exists"); - } - - if (!client.isXADatasource(RHQ_DATASOURCE_NAME_XA)) { - props.clear(); - props.put("ServerName", "${rhq.server.database.server-name:127.0.0.1}"); - props.put("PortNumber", "${rhq.server.database.port:5432}"); - props.put("DatabaseName", "${rhq.server.database.db-name:rhq}"); - - xaDsRequest = client.createNewXADatasourceRequest(RHQ_DATASOURCE_NAME_XA, 30000, JDBC_DRIVER_POSTGRES, - "org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter", 15, 5, 50, 75, - RHQ_DS_SECURITY_DOMAIN, "-unused-stale-conn-checker-", "TRANSACTION_READ_COMMITTED", - "org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker", props); - xaDsRequest.get("steps").get(0).remove("stale-connection-checker-class-name"); // we don't have one of these for postgres - } else { - LOG.info("Postgres XA datasource [" + RHQ_DATASOURCE_NAME_XA + "] already exists"); - } - - if (noTxDsRequest != null || xaDsRequest != null) { - ModelNode batch = DatasourceJBossASClient.createBatchRequest(noTxDsRequest, xaDsRequest); - ModelNode results = client.execute(batch); - if (!DatasourceJBossASClient.isSuccess(results)) { - throw new FailureException(results, "Failed to create Postgres datasources"); - } - } - } - - private static void createNewDatasources_Oracle(ModelControllerClient mcc) throws Exception { - final HashMap<String, String> props = new HashMap<String, String>(2); - final DatasourceJBossASClient client = new DatasourceJBossASClient(mcc); - - ModelNode noTxDsRequest = null; - ModelNode xaDsRequest = null; - - if (!client.isDatasource(RHQ_DATASOURCE_NAME_NOTX)) { - props.put("char.encoding", "UTF-8"); - props.put("SetBigStringTryClob", "true"); - - noTxDsRequest = client.createNewDatasourceRequest(RHQ_DATASOURCE_NAME_NOTX, 30000, - "${rhq.server.database.connection-url:jdbc:oracle:thin:@127.0.0.1:1521:rhq}", JDBC_DRIVER_ORACLE, - "org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter", 15, false, 2, 5, 75, - RHQ_DS_SECURITY_DOMAIN, "org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker", - "TRANSACTION_READ_COMMITTED", - "org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker", props); - } else { - LOG.info("Oracle datasource [" + RHQ_DATASOURCE_NAME_NOTX + "] already exists"); - } - - if (!client.isDatasource(RHQ_DATASOURCE_NAME_XA)) { - props.clear(); - props.put("URL", "${rhq.server.database.connection-url:jdbc:oracle:thin:@127.0.0.1:1521:rhq}"); - props.put("ConnectionProperties", "SetBigStringTryClob=true"); - - xaDsRequest = client.createNewXADatasourceRequest(RHQ_DATASOURCE_NAME_XA, 30000, JDBC_DRIVER_ORACLE, - "org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter", 15, 5, 50, 75, - RHQ_DS_SECURITY_DOMAIN, "org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker", - "TRANSACTION_READ_COMMITTED", - "org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker", props); - } else { - LOG.info("Oracle XA datasource [" + RHQ_DATASOURCE_NAME_XA + "] already exists"); - } - - if (noTxDsRequest != null || xaDsRequest != null) { - ModelNode batch = DatasourceJBossASClient.createBatchRequest(noTxDsRequest, xaDsRequest); - ModelNode results = client.execute(batch); - if (!DatasourceJBossASClient.isSuccess(results)) { - throw new FailureException(results, "Failed to create Oracle datasources"); - } - } - } - - /** - * Determines if we are in auto-install mode. This means the properties file is - * fully configured and the installation can begin without asking the user - * for more input. - * - * @param serverProperties the full set of server properties - * - * @return true if we are in auto-install mode; false if the user must give us more - * information before we can complete the installation. - */ - public static boolean isAutoinstallEnabled(HashMap<String, String> serverProperties) { - String enableProp = serverProperties.get(ServerProperties.PROP_AUTOINSTALL_ENABLE); - if (enableProp != null) { - return Boolean.parseBoolean(enableProp); - } - return false; - } - - /** - * Returns <code>true</code> if the database already has the database schema created for it. It will not be known - * what version of schema or if its the latest, all this method tells you is that some RHQ database schema exists. - * - * @param connectionUrl - * @param username - * @param password - * @return <code>true</code> if the database can be connected to - * - * @throws Exception if failed to communicate with the database - */ - public static boolean isDatabaseSchemaExist(String connectionUrl, String username, String password) - throws Exception { - - Connection conn = getDatabaseConnection(connectionUrl, username, password); - DatabaseType db = DatabaseTypeFactory.getDatabaseType(conn); - - try { - return db.checkTableExists(conn, "RHQ_PRINCIPAL"); - } catch (IllegalStateException e) { - return false; - } finally { - db.closeConnection(conn); - } - } - - /** - * Get the list of existing servers from an existing schema. - * - * @param connectionUrl - * @param username - * @param password - * @return List of server names registered in the database. Empty list if the table does not exist or there are no entries in the table. - * - * @throws Exception if failed to communicate with the database - */ - public static ArrayList<String> getServerNames(String connectionUrl, String username, String password) - throws Exception { - DatabaseType db = null; - Connection conn = null; - Statement stm = null; - ResultSet rs = null; - ArrayList<String> result = new ArrayList<String>(); - - try { - conn = getDatabaseConnection(connectionUrl, username, password); - db = DatabaseTypeFactory.getDatabaseType(conn); - - if (db.checkTableExists(conn, "rhq_server")) { - - stm = conn.createStatement(); - rs = stm.executeQuery("SELECT name FROM rhq_server ORDER BY name asc"); - - while (rs.next()) { - result.add(rs.getString(1)); - } - } - } catch (IllegalStateException e) { - // table does not exist - } catch (SQLException e) { - LOG.info("Unable to fetch existing server info: " + e.getMessage()); - } finally { - if (null != db) { - db.closeJDBCObjects(conn, stm, rs); - } - } - - return result; - } - - /** - * Returns information on the server as found in the database (port numbers, affinity group, etc). - * - * @param connectionUrl - * @param username - * @param password - * @param serverName the server whose details are to be returned - * @return the information on the named server - */ - public static ServerDetails getServerDetails(String connectionUrl, String username, String password, - String serverName) { - - DatabaseType db = null; - Connection conn = null; - ServerDetails result = null; - - try { - conn = getDatabaseConnection(connectionUrl, username, password); - db = DatabaseTypeFactory.getDatabaseType(conn); - - result = getServerDetails(db, conn, serverName); - - } catch (Exception e) { - LOG.info("Unable to get server detail: " + e.getMessage()); - } finally { - if (null != db) { - db.closeConnection(conn); - } - } - - return result; - } - - private static ServerDetails getServerDetails(DatabaseType db, Connection conn, String serverName) { - PreparedStatement stm = null; - ResultSet rs = null; - ServerDetails result = null; - - if (null == serverName) { - return result; - } - - try { - stm = conn.prepareStatement("" // - + "SELECT s.address, s.port, s.secure_port " // - + " FROM rhq_server s " // - + " WHERE s.name = ?"); - stm.setString(1, serverName.trim()); - - rs = stm.executeQuery(); - - if (rs.next()) { - result = new ServerDetails(serverName, rs.getString(1), rs.getInt(2), rs.getInt(3)); - } - } catch (SQLException e) { - LOG.info("Unable to get server details for server [" + serverName + "]: " + e.getMessage()); - } finally { - if (null != db) { - db.closeResultSet(rs); - db.closeStatement(stm); - } - } - - return result; - } - - /** - * Tests to make sure the server can be connected to with the given settings. - * If the test is successful, <code>null</code>. If the test fails, the returned string - * will be the error message to indicate the problem. - * - * @param connectionUrl - * @param username - * @param password - * @return error message if test failed; <code>null</code> if test succeeded - */ - public static String testConnection(String connectionUrl, String username, String password) { - - // its possible the JDBC URL was changed, clear the factory cache in case the DB version is different now - DatabaseTypeFactory.clearDatabaseTypeCache(); - - try { - ensureDatabaseIsSupported(connectionUrl, username, password); - return null; - } catch (Exception e) { - LOG.warn("Installer failed to test connection", e); - return ThrowableUtil.getAllMessages(e); - } - } - - /** - * Call this when you need to confirm that the database is supported. - * - * @param connectionUrl - * @param username - * @param password - * - * @throws Exception if the database is not supported - */ - public static void ensureDatabaseIsSupported(String connectionUrl, String username, String password) - throws Exception { - Connection conn = null; - DatabaseType db = null; - - try { - conn = getDatabaseConnection(connectionUrl, username, password); - db = DatabaseTypeFactory.getDatabaseType(conn); - - String version = db.getVersion(); - - if (DatabaseTypeFactory.isPostgres(db)) { - if (version.startsWith("7") || version.equals("8") || version.startsWith("8.0") - || version.startsWith("8.1")) { - throw new Exception("Unsupported PostgreSQL [" + db + "]"); - } - } else if (DatabaseTypeFactory.isOracle(db)) { - if (version.startsWith("8") || version.startsWith("9")) { - throw new Exception("Unsupported Oracle [" + db + "]"); - } - } else { - throw new Exception("Unsupported DB [" + db + "]"); - } - - LOG.info("Database is supported: " + db); - } finally { - if (db != null) { - db.closeConnection(conn); - } - } - - return; - } - - /** - * Returns a database connection with the given set of properties providing the settings that allow for a successful - * database connection. If <code>props</code> is <code>null</code>, it will use the server properties from - * {@link #getServerProperties()}. - * - * @param connectionUrl - * @param userName - * @param password - * @return the database connection - * - * @throws SQLException if cannot successfully connect to the database - */ - public static Connection getDatabaseConnection(String connectionUrl, String userName, String password) - throws SQLException { - return DbUtil.getConnection(connectionUrl, userName, password); - } - - /** - * Use the internal JBossAS mechanism to obfuscate a password. This is not true encryption. - * - * @param password the clear text of the password to obfuscate - * @return the obfuscated password - */ - public static String obfuscatePassword(String password) { - - // We need to do some mumbo jumbo, as the interesting method is private - // in SecureIdentityLoginModule - - try { - String className = "org.picketbox.datasource.security.SecureIdentityLoginModule"; - Class<?> clazz = Class.forName(className); - Object object = clazz.newInstance(); - Method method = clazz.getDeclaredMethod("encode", String.class); - method.setAccessible(true); - String result = method.invoke(object, password).toString(); - return result; - } catch (Exception e) { - throw new RuntimeException("obfuscating db password failed: ", e); - } - } - - /** - * Use the internal JBossAS mechanism to de-obfuscate a password back to its - * clear text form. This is not true encryption. - * - * @param obfuscatedPasswordd the obfuscated password - * @return the clear-text password - */ - public static String deobfuscatePassword(String obfuscatedPassword) { - - // We need to do some mumbo jumbo, as the interesting method is private - // in SecureIdentityLoginModule - - try { - String className = "org.picketbox.datasource.security.SecureIdentityLoginModule"; - Class<?> clazz = Class.forName(className); - Object object = clazz.newInstance(); - Method method = clazz.getDeclaredMethod("decode", String.class); - method.setAccessible(true); - char[] result = (char[]) method.invoke(object, obfuscatedPassword); - return new String(result); - } catch (Exception e) { - throw new RuntimeException("de-obfuscating db password failed: ", e); - } - } - - /** - * Stores the server details (such as the public endpoint) in the database. If the server definition already - * exists, it will be updated; otherwise, a new server will be added to the HA cloud. - * - * @param serverProperties the server properties - * @param password clear text password to connect to the database - * @param serverDetails the details of the server to put into the database - * @throws Exception - */ - public static void storeServerDetails(HashMap<String, String> serverProperties, String password, - ServerDetails serverDetails) throws Exception { - - DatabaseType db = null; - Connection conn = null; - - try { - String dbUrl = serverProperties.get(ServerProperties.PROP_DATABASE_CONNECTION_URL); - String userName = serverProperties.get(ServerProperties.PROP_DATABASE_USERNAME); - conn = getDatabaseConnection(dbUrl, userName, password); - db = DatabaseTypeFactory.getDatabaseType(conn); - - updateOrInsertServer(db, conn, serverDetails); - - } catch (SQLException e) { - // TODO: should we throw an exception here? This would abort the rest of the installation - LOG.info("Unable to store server entry in the database: " + ThrowableUtil.getAllMessages(e)); - } finally { - if (null != db) { - db.closeConnection(conn); - } - } - } - - private static void updateOrInsertServer(DatabaseType db, Connection conn, ServerDetails serverDetails) { - PreparedStatement stm = null; - ResultSet rs = null; - - if (null == serverDetails || isEmpty(serverDetails.getName())) { - return; - } - - try { - stm = conn.prepareStatement("UPDATE rhq_server SET address=?, port=?, secure_port=? WHERE name=?"); - stm.setString(1, serverDetails.getEndpointAddress()); - stm.setInt(2, serverDetails.getEndpointPort()); - stm.setInt(3, serverDetails.getEndpointSecurePort()); - stm.setString(4, serverDetails.getName()); - if (0 == stm.executeUpdate()) { - stm.close(); - - // set all new servers to operation_mode=INSTALLED - int i = 1; - if (db instanceof PostgresqlDatabaseType || db instanceof OracleDatabaseType) { - stm = conn.prepareStatement("INSERT INTO rhq_server " // - + " ( id, name, address, port, secure_port, ctime, mtime, operation_mode, compute_power ) " // - + "VALUES ( ?, ?, ?, ?, ?, ?, ?, 'INSTALLED', 1 )"); - stm.setInt(i++, db.getNextSequenceValue(conn, "rhq_server", "id")); - } else { - throw new IllegalArgumentException("Unknown database type, can't continue: " + db); - } - - stm.setString(i++, serverDetails.getName()); - stm.setString(i++, serverDetails.getEndpointAddress()); - stm.setInt(i++, serverDetails.getEndpointPort()); - stm.setInt(i++, serverDetails.getEndpointSecurePort()); - long now = System.currentTimeMillis(); - stm.setLong(i++, now); - stm.setLong(i++, now); - stm.executeUpdate(); - } - - } catch (SQLException e) { - LOG.info("Unable to put the server details in the database: " + ThrowableUtil.getAllMessages(e)); - } finally { - if (null != db) { - db.closeResultSet(rs); - db.closeStatement(stm); - } - } - } - - /** - * This will create the database schema in the database. <code>props</code> define the connection to the database - - * - * <p>Note that if the {@link #isDatabaseSchemaExist(Properties) schema already exists}, it will be purged of all - * data/tables and recreated.</p> - * - * @param props the full set of server properties - * @param serverDetails additional information about the server being installed - * @param password the database password in clear text - * @param logDir a directory where the db schema upgrade logs can be written - * - * @throws Exception if failed to create the new schema for some reason - */ - public static void createNewDatabaseSchema(HashMap<String, String> props, ServerDetails serverDetails, - String password, String logDir) throws Exception { - String dbUrl = props.get(ServerProperties.PROP_DATABASE_CONNECTION_URL); - String userName = props.get(ServerProperties.PROP_DATABASE_USERNAME); - - try { - // extract the dbsetup files which are located in the dbutils jar - String dbsetupSchemaXmlFile = extractDatabaseXmlFile("db-schema-combined.xml", props, serverDetails, logDir); - String dbsetupDataXmlFile = extractDatabaseXmlFile("db-data-combined.xml", props, serverDetails, logDir); - - // first uninstall any old existing schema, then create the tables then insert the data - DBSetup dbsetup = new DBSetup(dbUrl, userName, password); - dbsetup.uninstall(dbsetupSchemaXmlFile); - dbsetup.setup(dbsetupSchemaXmlFile); - dbsetup.setup(dbsetupDataXmlFile, null, true, false); - } catch (Exception e) { - LOG.fatal("Cannot install the database schema - the server will not run properly.", e); - throw e; - } - - return; - } - - /** - * This will update an existing database schema so it can be upgraded to the latest schema version. - * - * <p>Note that if the {@link #isDatabaseSchemaExist(Properties) schema does not already exist}, errors will - * occur.</p> - * - * @param props the full set of server properties - * @param serverDetails additional information about the server being installed - * @param password the database password in clear text - * @param logDir a directory where the db schema upgrade logs can be written - * - * @throws Exception if the upgrade failed for some reason - */ - public static void upgradeExistingDatabaseSchema(HashMap<String, String> props, ServerDetails serverDetails, - String password, String logDir) throws Exception { - String dbUrl = props.get(ServerProperties.PROP_DATABASE_CONNECTION_URL); - String userName = props.get(ServerProperties.PROP_DATABASE_USERNAME); - - File logfile = new File(logDir, "rhq-installer-dbupgrade.log"); - - logfile.delete(); // do not keep logs from previous dbupgrade runs - - try { - // extract the dbupgrade ANT script which is located in the dbutils jar - String dbupgradeXmlFile = extractDatabaseXmlFile("db-upgrade.xml", props, serverDetails, logDir); - - Properties antProps = new Properties(); - antProps.setProperty("jdbc.url", dbUrl); - antProps.setProperty("jdbc.user", userName); - antProps.setProperty("jdbc.password", password); - antProps.setProperty("target.schema.version", "LATEST"); - - startAnt(new File(dbupgradeXmlFile), "db-ant-tasks.properties", antProps, logfile); - } catch (Exception e) { - LOG.fatal("Cannot upgrade the database schema - the server will not run properly.", e); - throw e; - } - - return; - } - - /** - * Given a server property value string, returns true if it is not specified. - * - * @param s the property string value - * - * @return true if it is null or empty - */ - public static boolean isEmpty(String s) { - return s == null || s.trim().length() == 0; - } - - /** - * Takes the named XML file from the classloader and writes the file to the log directory. This is meant to extract - * the schema/data xml files from the dbutils jar file. It can also be used to extract the db upgrade XML file. - * - * @param xmlFileName the name of the XML file, as found in the classloader - * @param props properties whose values are used to replace the replacement strings found in the XML file - * @param serverDetails additional information about the server being installed - * @param logDir a directory where the db schema upgrade logs can be written - * - * @return the absolute path to the extracted file - * - * @throws IOException if failed to extract the file to the log directory - */ - private static String extractDatabaseXmlFile(String xmlFileName, HashMap<String, String> props, - ServerDetails serverDetails, String logDir) throws IOException { - - // first slurp the file contents in memory - InputStream resourceInStream = ServerInstallUtil.class.getClassLoader().getResourceAsStream(xmlFileName); - ByteArrayOutputStream contentOutStream = new ByteArrayOutputStream(); - StreamUtil.copy(resourceInStream, contentOutStream); - - // now replace their replacement strings with values from the properties - String emailFromAddress = props.get(ServerProperties.PROP_EMAIL_FROM_ADDRESS); - if (isEmpty(emailFromAddress)) { - emailFromAddress = "rhqadmin@localhost"; - } - - String httpPort = props.get(ServerProperties.PROP_WEB_HTTP_PORT); - if (isEmpty(httpPort)) { - httpPort = String.valueOf(ServerDetails.DEFAULT_ENDPOINT_PORT); - } - - String publicEndpoint = serverDetails.getEndpointAddress(); - if (isEmpty(publicEndpoint)) { - try { - publicEndpoint = props.get(ServerProperties.PROP_JBOSS_BIND_ADDRESS); - if (isEmpty(publicEndpoint) || ("0.0.0.0".equals(publicEndpoint))) { - publicEndpoint = InetAddress.getLocalHost().getHostAddress(); - } - } catch (Exception e) { - publicEndpoint = "127.0.0.1"; - } - } - - String content = contentOutStream.toString(); - content = content.replaceAll("@@@LARGE_TABLESPACE_FOR_DATA@@@", "DEFAULT"); - content = content.replaceAll("@@@LARGE_TABLESPACE_FOR_INDEX@@@", "DEFAULT"); - content = content.replaceAll("@@@ADMINUSERNAME@@@", "rhqadmin"); - content = content.replaceAll("@@@ADMINPASSWORD@@@", "x1XwrxKuPvYUILiOnOZTLg=="); // rhqadmin - content = content.replaceAll("@@@ADMINEMAIL@@@", emailFromAddress); - content = content.replaceAll("@@@BASEURL@@@", "http://" + publicEndpoint + ":" + httpPort + "/"); - content = content.replaceAll("@@@JAASPROVIDER@@@", "JDBC"); - content = content.replaceAll("@@@LDAPURL@@@", "ldap://localhost/"); - content = content.replaceAll("@@@LDAPPROTOCOL@@@", ""); - content = content.replaceAll("@@@LDAPLOGINPROP@@@", "cn"); - content = content.replaceAll("@@@LDAPBASEDN@@@", "o=JBoss,c=US"); - content = content.replaceAll("@@@LDAPSEARCHFILTER@@@", ""); - content = content.replaceAll("@@@LDAPBINDDN@@@", ""); - content = content.replaceAll("@@@LDAPBINDPW@@@", ""); - content = content.replaceAll("@@@MULTICAST_ADDR@@@", ""); - content = content.replaceAll("@@@MULTICAST_PORT@@@", ""); - - // we now have the finished XML content - write out the file to the log directory - File xmlFile = new File(logDir, xmlFileName); - FileOutputStream xmlFileOutStream = new FileOutputStream(xmlFile); - ByteArrayInputStream contentInStream = new ByteArrayInputStream(content.getBytes()); - StreamUtil.copy(contentInStream, xmlFileOutStream); - - return xmlFile.getAbsolutePath(); - } - - /** - * Launches ANT and runs the default target in the given build file. - * - * @param buildFile the build file that ANT will run - * @param customTaskDefs the properties file found in classloader that contains all the taskdef definitions - * @param properties set of properties to set for the ANT task to access - * @param logFile where ANT messages will be logged (in addition to the app server's log file) - * - * @throws RuntimeException - */ - private static void startAnt(File buildFile, String customTaskDefs, Properties properties, File logFile) { - PrintWriter logFileOutput = null; - - try { - logFileOutput = new PrintWriter(new FileOutputStream(logFile)); - - ClassLoader classLoader = ServerInstallUtil.class.getClassLoader(); - - Properties taskDefs = new Properties(); - InputStream taskDefsStream = classLoader.getResourceAsStream(customTaskDefs); - try { - taskDefs.load(taskDefsStream); - } finally { - taskDefsStream.close(); - } - - Project project = new Project(); - project.setCoreLoader(classLoader); - project.init(); - - for (Map.Entry<Object, Object> property : properties.entrySet()) { - project.setProperty(property.getKey().toString(), property.getValue().toString()); - } - - // notice we add our listener after we set the properties - we do not want the password to be in the log file - // our dbupgrade script will echo the property settings, so we can still get the other values - project.addBuildListener(new LoggerAntBuildListener(logFileOutput)); - - for (Map.Entry<Object, Object> taskDef : taskDefs.entrySet()) { - project.addTaskDefinition(taskDef.getKey().toString(), - Class.forName(taskDef.getValue().toString(), true, classLoader)); - } - - new ProjectHelper2().parse(project, buildFile); - project.executeTarget(project.getDefaultTarget()); - - } catch (Exception e) { - throw new RuntimeException("Cannot run ANT on script [" + buildFile + "]. Cause: " + e, e); - } finally { - if (logFileOutput != null) { - logFileOutput.close(); - } - } - } - - /** - * Creates a keystore whose cert has a CN of this server's public endpoint address. - * - * @param serverDetails details of the server being installed - * @param configDirStr location of a configuration directory where the keystore is to be stored - */ - public static void createKeystore(ServerDetails serverDetails, String configDirStr) { - File confDir = new File(configDirStr); - 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=" + serverDetails.getEndpointAddress() + ", 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 + "]"); - } - } - } - - /** - * Create an rhqadmin/rhqadmin management user so when discovered, the AS7 plugin can immediately - * connect to the RHQ Server. - * - * @param serverDetails details of the server being installed - * @param configDirStr location of a configuration directory where the mgmt-users.properties file lives - */ - public static void createDefaultManagementUser(ServerDetails serverDetails, String configDirStr) { - File confDir = new File(configDirStr); - File mgmtUsers = new File(confDir, "mgmt-users.properties"); - - // Add the default admin user, or if for some reason this file does not exist, just log the issue - if (mgmtUsers.exists()) { - FileOutputStream fos = null; - - try { - fos = new FileOutputStream(mgmtUsers, true); - fos.write("\nrhqadmin=35c160c1f841a889d4cda53f0bfc94b6\n".getBytes()); - - } catch (Exception e) { - LOG.warn("Could not create default management user in file: [" + mgmtUsers.getPath() + "] : ", e); - - } finally { - StreamUtil.safeClose(fos); - } - } else { - LOG.warn("Could not create default management user. Could not find file: [" + mgmtUsers.getPath() + "]"); - } - } - - public static File getMarkerFile(String dir, String artifact, Marker marker) { - File markerFile = new File(dir, artifact + marker.getExtenstion()); - return markerFile; - } - - public static void touchMarkerFile(String dir, String artifact, Marker marker) throws Exception { - File markerFile = getMarkerFile(dir, artifact, marker); - markerFile.createNewFile(); - markerFile.setLastModified(System.currentTimeMillis()); - } - - public static void deleteMarkerFile(String dir, String artifact, Marker marker) throws Exception { - File markerFile = getMarkerFile(dir, artifact, marker); - markerFile.delete(); - } - - public static boolean markerFileExists(String dir, String artifact, Marker marker) { - File markerFile = getMarkerFile(dir, artifact, marker); - return markerFile.exists(); - } - - public static void setSocketBindings(ModelControllerClient mcc, HashMap<String, String> serverProperties) - throws Exception { - final SocketBindingJBossASClient client = new SocketBindingJBossASClient(mcc); - for (SocketBindingInfo binding : defaultSocketBindings) { - // use the port defined by the server's properties if set, otherwise, just use our hardcoded default - int newPort = binding.port; - String overrideValue = serverProperties.get(binding.sysprop); - if (overrideValue != null) { - try { - newPort = Integer.parseInt(overrideValue); - } catch (Exception e) { - LOG.warn("Invalid port in system property [" + binding.sysprop + "]: " + overrideValue); - } - } - LOG.info(String.format("Setting socket binding [%s] to [${%s:%d}]", binding.name, binding.sysprop, newPort)); - client.setStandardSocketBindingPortExpression(binding.name, binding.sysprop, newPort); - } - } - -} diff --git a/modules/enterprise/gui/installer/src/main/resources/org/rhq/enterprise/gui/installer/Installer.gwt.xml b/modules/enterprise/gui/installer/src/main/resources/org/rhq/enterprise/gui/installer/Installer.gwt.xml deleted file mode 100644 index 164e94a..0000000 --- a/modules/enterprise/gui/installer/src/main/resources/org/rhq/enterprise/gui/installer/Installer.gwt.xml +++ /dev/null @@ -1,35 +0,0 @@ -<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN" - "http://google-web-toolkit.googlecode.com/svn/tags/2.4.0/distro-source/core/src/gwt-module.dtd"> - -<module> - - <inherits name='com.google.gwt.user.User'/> - <inherits name='com.google.gwt.i18n.I18N'/> - <inherits name="com.google.gwt.logging.Logging"/> - - <inherits name='com.smartgwt.SmartGwt' /> - <inherits name="com.smartgwt.tools.SmartGwtTools"/> - - <!-- ============================ gwt logging ============================= --> - <set-property name="gwt.logging.enabled" value="TRUE"/> - <!-- FINE ~= DEBUG in gwt-log --> - <set-property name="gwt.logging.logLevel" value="FINE"/> - <set-property name="gwt.logging.consoleHandler" value="ENABLED" /> - <set-property name="gwt.logging.developmentModeHandler" value="ENABLED" /> - <set-property name="gwt.logging.firebugHandler" value="ENABLED" /> - <set-property name="gwt.logging.hasWidgetsHandler" value="DISABLED" /> - <set-property name="gwt.logging.popupHandler" value="DISABLED" /> - <set-property name="gwt.logging.systemHandler" value="ENABLED" /> - <set-property name="gwt.logging.simpleRemoteHandler" value="DISABLED" /> - - <set-property name="user.agent" value="${gwt.userAgent}"/> - <extend-property name="locale" values="${gwt.locale}" /> - - <set-configuration-property name="locale.usemeta" value="Y"/> - <set-configuration-property name="locale.useragent" value="Y"/> - <set-configuration-property name="locale.searchorder" value="queryparam,meta,useragent,cookie"/> - <set-property-fallback name="locale" value="${gwt.fallback.locale}"/> - - <entry-point class='org.rhq.enterprise.gui.installer.client.Installer'/> - -</module> diff --git a/modules/enterprise/gui/installer/src/main/resources/org/rhq/enterprise/gui/installer/client/Messages.properties b/modules/enterprise/gui/installer/src/main/resources/org/rhq/enterprise/gui/installer/client/Messages.properties deleted file mode 100644 index 6ec5832..0000000 --- a/modules/enterprise/gui/installer/src/main/resources/org/rhq/enterprise/gui/installer/client/Messages.properties +++ /dev/null @@ -1,40 +0,0 @@ -button_reset = Reset -button_save = Save -button_startInstallation = Press To Start The Installation Now -button_testConnection = Test Connection -help_dbConnectionUrl = This is the JDBC connection URL that will be used to determine where your database server is and how to connect to it. -help_dbExistingSchemaOption = Your database already has a schema installed. This option tells the installer what you want to do with this existing schema. You can either:<br/>\n<ul>\n<li>Keep the existing schema. This will upgrade the schema to support the new server being installed but all of your resource inventory and related data will be saved.</li>\n<li>Overwrite the existing schema. This will delete all of your previous data and create a new, empty set of tables. When you do this, you will lose all of your resource inventory and related data.</li>\n<li>Skip the database schema setup. If, for some reason, you do not want the installer to do anything to your database (even to check to see if it needs to be updated), select this option. You rarely will want to use this option unless you know your database schema is completely up to date and can support the new server you are installing.</li>\n</ul> -help_dbPassword = This is the credentials that will be used to connect to the database. This is the actual password for your user, not the encrypted password. The installer will encrypt this password for you before storing it in the properties file. -help_dbType = Select the type of database that is to be used by the server. The server only supports these types of databases. -help_dbUsername = The server will connect to the database as this user. -help_registeredServers = If you are performing an upgrade or a re-installation then you should select a server from this list of registered servers. If you want to install a new server into the system, select the *New Server* option. (Note that if you are going to overwrite your existing schema, you cannot select an existing registered server since they will be deleted when the overwrite is performed.) -help_ssEmailFromAddress = When the server sends emails (e.g. via alert email notifications), this will be the address that will be in the email From: line. -help_ssEmailHostname = This is the SMTP server hostname that will be used to send emails by this server. -help_ssHttpPort = This is the HTTP port that users can use to access the web GUI for this server. This is also the same port that agents will use to talk to this server if the agents send messages over the servlet protocol (which is the default protocol). -help_ssHttpsPort = This is the secure HTTPS port that users can use to access the web GUI for this server. This is also the same port that agents will use to talk to this server if the agents send messages over the sslservlet protocol. -help_ssPublicAddress = This is the IP address or hostname that agents will use to connect to this server. This value is not stored in server properties file; rather, it is stored in the database. You can later modify this value in the Administration (Topology) > Servers section of the GUI. -help_ssServerName = This is a unique name to be assigned to this server. All servers must be assigned unique server names, however, they do not have to match the IP address or hostname of the server. -help_testConnectionButton = You must confirm that your database settings are correct by pushing this button which tests the connection settings. -message_formDidNotValidate = Please fix the errors before continuing. -message_install_doNotKnowIfInstalled = <p>A failure occurred when trying to determine if the server is already installed. The installer may not work properly. You should refresh this page to try again.</p>\nError: {0}\n -message_install_failed = The installation failed. -message_install_loginHere = <p><b>The server has been installed!</b></p>\n<p><a href="{0}">Click here to login to the server.</a></p> -message_install_started = The installation has started . . . please wait. -message_notValidBoolean = That is not a valid boolean (must be "true" or "false"). -message_notValidInteger = That is not a valid number. -property_name_label = Property -property_value_label = Value -schema_update_keep = Keep (Maintain Existing Data) -schema_update_overwrite = Overwrite (Lose Existing Data!) -schema_update_question = A database schema already exists. What do you want to do? -schema_update_skip = Skip (Leave Database As-Is) -tab_advancedView = Advanced View -tab_simpleView = Simple View -tab_simpleView_database = Database Settings -tab_simpleView_serverSettings = Server Settings -tab_simpleView_serverSettings_publicAddress = Server Public Address -tab_simpleView_serverSettings_registeredServers = Registered Server Names -tab_simpleView_serverSettings_registeredServers_newServer = *New Server* -tab_welcome = Welcome -tab_welcome_content = <h1>Welcome to the new GWT Installer</h1>\nThis is the <b>new</b> installer.\nAny HTML can go in here. -welcome_title = Installing the Server diff --git a/modules/enterprise/gui/installer/src/main/resources/org/rhq/enterprise/gui/installer/client/ServerPropertiesMessages.properties b/modules/enterprise/gui/installer/src/main/resources/org/rhq/enterprise/gui/installer/client/ServerPropertiesMessages.properties deleted file mode 100644 index 6c53445..0000000 --- a/modules/enterprise/gui/installer/src/main/resources/org/rhq/enterprise/gui/installer/client/ServerPropertiesMessages.properties +++ /dev/null @@ -1,23 +0,0 @@ -### RHQ Server Configuration Properties -### These should match the actual property names in rhq-server.properties. - -# Database -rhq.server.database.connection-url=Database Connection URL -rhq.server.database.user-name=Database Username -rhq.server.database.password=Database Password -rhq.server.database.type-mapping=Database Type - -# High Availability (HA) -rhq.server.high-availability.name=Server Name -rhq.server.maintenance-mode-at-startup=Maintenance Mode At Startup - -# General Properties -rhq.server.startup.web.http.port=HTTP Port -rhq.server.startup.web.https.port=Secure HTTP Port - -# Embedded RHQ Agent -rhq.server.embedded-agent.enabled=Embedded Agent Enabled - -# Email -rhq.server.email.smtp-host=Email SMTP Host -rhq.server.email.from-address=Email From Address \ No newline at end of file diff --git a/modules/enterprise/gui/installer/src/main/webapp/WEB-INF/classes/META-INF/services/org.jboss.msc.service.ServiceActivator b/modules/enterprise/gui/installer/src/main/webapp/WEB-INF/classes/META-INF/services/org.jboss.msc.service.ServiceActivator deleted file mode 100644 index c64cc21..0000000 --- a/modules/enterprise/gui/installer/src/main/webapp/WEB-INF/classes/META-INF/services/org.jboss.msc.service.ServiceActivator +++ /dev/null @@ -1 +0,0 @@ -org.rhq.enterprise.gui.installer.server.service.ManagementService \ No newline at end of file diff --git a/modules/enterprise/gui/installer/src/main/webapp/WEB-INF/web.xml b/modules/enterprise/gui/installer/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index b970eb3..0000000 --- a/modules/enterprise/gui/installer/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,9 +0,0 @@ -<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd%22%3E - - <welcome-file-list> - <welcome-file>index.html</welcome-file> - </welcome-file-list> - -</web-app> diff --git a/modules/enterprise/gui/installer/src/main/webapp/index.html b/modules/enterprise/gui/installer/src/main/webapp/index.html deleted file mode 100644 index cb9016e..0000000 --- a/modules/enterprise/gui/installer/src/main/webapp/index.html +++ /dev/null @@ -1,45 +0,0 @@ -<html> -<head> - <!-- this forces us to emulate IE8 "quirks" mode regardless of IE browser version. It: - 1) Follows the SmartGWT recommendation of not declaring a DOCTYPE and instead using these meta elements. - http://forums.smartclient.com/showthread.php?t=15973 - 2) solves initial app load issues that we experienced on some XP and Vista/Windows7 flavors. - --> - <meta http-equiv="X-UA-Compatible" content="IE=8" /> - - <!-- support internationalized characters --> - <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /> - - <script> - var search = location.search; - // only do this if you have not specified locale as query param - if(search.indexOf("locale") == -1){ - // IE uses browserLanguage - var lang = navigator.language!=null ? navigator.language : navigator.browserLanguage; - var lang = lang.replace("-", "_"); - document.write("<meta name='gwt:property' content='locale="+lang +"'>"); - } - </script> - - <title>RHQ Installer</title> - - <script type="text/javascript"> - var isomorphicDir = "org.rhq.enterprise.gui.installer.Installer/sc/"; - </script> - -</head> -<body> - - <script type="text/javascript" language="javascript" - src="org.rhq.enterprise.gui.installer.Installer/org.rhq.enterprise.gui.installer.Installer.nocache.js"></script> - - <div id="Loading-Panel" style="width: 214px; height: 90px; margin-top: 300px; margin-left: 40%; margin-right: 40%;"> - <div style="text-align: center; border: 3px solid lightgray;"> - Loading Installer... - </div> - </div> - - <iframe src="javascript:''" id="__gwt_historyFrame" style="width:0;height:0;border:0"></iframe> - -</body> -</html> diff --git a/modules/enterprise/gui/installer/src/test/java/org/rhq/enterprise/installer/DBInstallationTest.java b/modules/enterprise/gui/installer/src/test/java/org/rhq/enterprise/installer/DBInstallationTest.java deleted file mode 100644 index d3a237e..0000000 --- a/modules/enterprise/gui/installer/src/test/java/org/rhq/enterprise/installer/DBInstallationTest.java +++ /dev/null @@ -1,225 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.installer; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.util.HashMap; - -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -import org.rhq.core.db.reset.DBReset; -import org.rhq.core.db.setup.DBSetup; -import org.rhq.core.util.stream.StreamUtil; -import org.rhq.enterprise.gui.installer.client.shared.ServerDetails; -import org.rhq.enterprise.gui.installer.client.shared.ServerProperties; -import org.rhq.enterprise.gui.installer.server.servlet.ServerInstallUtil; - -/** - * The tests in this class exercise the dbsetup/dbupgrade code that is run in the installer. The tests currently only - * run against postgresql. Support needs to be added for oracle. The tests do not do any post-install/upgrade - * verification at the time of this writing. They just simply exercise the dbsetup/dbupgrade scripts to ensure that - * they do not contain any errors. - * - * @author John Sanda - */ -public class DBInstallationTest { - - private final String LOG_DIRECTORY = System.getProperty("java.io.tmpdir", "rhq/installer-test"); - private final String DB_NAME = System.getProperty("rhq.test.ds.db-name", "rhq_installer_test_db"); - private final String USERNAME = System.getProperty("rhq.test.ds.user-name", "rhqadmin"); - private final String PASSWORD = System.getProperty("rhq.test.ds.password", "rhqadmin"); - private final String SERVER = System.getProperty("rhq.test.ds.server-name", "127.0.0.1"); - private final String DB_URL = System.getProperty("rhq.test.ds.connection-url", "jdbc:postgresql://" + SERVER - + ":5432/" + DB_NAME); - private final String ADMIN_USERNAME = System.getProperty("rhq.db.admin.username", "postgres"); - private final String ADMIN_PASSWORD = System.getProperty("rhq.db.admin.password", "postgres"); - private static final String DB_TYPE_MAPPING = System.getProperty("rhq.test.ds.type-mapping", "PostgreSQL"); - - private String logDir; - private ServerDetails serverDetails; - - @BeforeMethod - public void prepareForInstallation() throws Exception { - serverDetails = new ServerDetails("testserver", "127.0.0.1", 7080, 7443); - initLogDirectory(); - recreateTestDatabase(); - } - - @AfterMethod - public void afterInstallation() throws Exception { - recreateTestDatabase(); - ServerInstallUtil.createNewDatabaseSchema(getInstallProperties(), serverDetails, PASSWORD, logDir); - } - - @Test - public void overwriteJON240Schema() throws Exception { - installSchemaAndData("2.4.0"); - ServerInstallUtil.createNewDatabaseSchema(getInstallProperties(), serverDetails, PASSWORD, logDir); - } - - @Test - public void upgradeJON240Schema() throws Exception { - installSchemaAndData("2.4.0"); - ServerInstallUtil.upgradeExistingDatabaseSchema(getInstallProperties(), serverDetails, PASSWORD, logDir); - } - - @Test - public void overwriteJON300Schema() throws Exception { - installSchemaAndData("3.0.0"); - ServerInstallUtil.createNewDatabaseSchema(getInstallProperties(), serverDetails, PASSWORD, logDir); - } - - @Test - public void upgradeJON300Schema() throws Exception { - installSchemaAndData("3.0.0"); - ServerInstallUtil.upgradeExistingDatabaseSchema(getInstallProperties(), serverDetails, PASSWORD, logDir); - } - - @Test - public void upgradeRHQ420Schema() throws Exception { - installSchemaAndData("rhq-4.2.0"); - ServerInstallUtil.upgradeExistingDatabaseSchema(getInstallProperties(), serverDetails, PASSWORD, logDir); - } - - @Test - public void upgradeRHQ430Schema() throws Exception { - installSchemaAndData("rhq-4.3.0"); - ServerInstallUtil.upgradeExistingDatabaseSchema(getInstallProperties(), serverDetails, PASSWORD, logDir); - } - - @Test - public void upgradeRHQ440Schema() throws Exception { - installSchemaAndData("rhq-4.4.0"); - ServerInstallUtil.upgradeExistingDatabaseSchema(getInstallProperties(), serverDetails, PASSWORD, logDir); - } - - private void initLogDirectory() { - File logDirFile = new File(LOG_DIRECTORY); - if (logDirFile.exists()) { - logDirFile.delete(); - } - logDirFile.mkdirs(); - this.logDir = logDirFile.getAbsolutePath(); - } - - private void recreateTestDatabase() throws Exception { - DBReset dbReset = new DBReset(); - - System.out.println("DBInstallationTest.recreateTestDatabase asking for DBReset for [" // - + DB_TYPE_MAPPING + "," // - + DB_URL + "," // - + DB_NAME + "," // - + USERNAME + "," // - + ADMIN_USERNAME + "," // - + ADMIN_PASSWORD + "]"); - - dbReset.performDBReset(DB_TYPE_MAPPING, DB_URL, DB_NAME, USERNAME, ADMIN_USERNAME, ADMIN_PASSWORD); - } - - private void installSchemaAndData(String jonVersion) throws Exception { - DBSetup dbsetup = new DBSetup(DB_URL, USERNAME, PASSWORD); - File schemaFile = getSchemaFile(jonVersion); - dbsetup.setup(schemaFile.getAbsolutePath()); - File dataFile = getDataFile(jonVersion); - dbsetup.setup(dataFile.getAbsolutePath()); - } - - private File getSchemaFile(String version) throws Exception { - URL url = getClass().getResource("db-schema-combined-" + version + ".xml"); - - if (url == null) { - throw new RuntimeException("Failed to find schema file for version " + version); - } - - File file = new File(url.toURI().getPath()); - File filteredFile = filterXmlFile(file, getInstallProperties()); - - return filteredFile; - } - - private File getDataFile(String version) throws Exception { - URL url = getClass().getResource("db-data-combined-" + version + ".xml"); - - if (url == null) { - throw new RuntimeException("Failed to find data file for version " + version); - } - - File file = new File(url.toURI().getPath()); - File filteredFile = filterXmlFile(file, getInstallProperties()); - - return filteredFile; - } - - private HashMap<String, String> getInstallProperties() { - HashMap<String, String> dbProperties = new HashMap<String, String>(); - dbProperties.put(ServerProperties.PROP_DATABASE_CONNECTION_URL, DB_URL); - dbProperties.put(ServerProperties.PROP_DATABASE_USERNAME, USERNAME); - dbProperties.put(ServerProperties.PROP_DATABASE_PASSWORD, PASSWORD); - dbProperties.put(ServerProperties.PROP_EMAIL_FROM_ADDRESS, "rhqadmin@localhost.com"); - return dbProperties; - } - - private static File filterXmlFile(File xmlFile, HashMap<String, String> props) throws IOException { - // first slurp the file contents in memory - InputStream fileInStream = new FileInputStream(xmlFile); - ByteArrayOutputStream contentOutStream = new ByteArrayOutputStream(); - StreamUtil.copy(fileInStream, contentOutStream); - - // now replace their replacement strings with values from the properties - String content = contentOutStream.toString(); - content = content.replaceAll("@@@LARGE_TABLESPACE_FOR_DATA@@@", "DEFAULT"); - content = content.replaceAll("@@@LARGE_TABLESPACE_FOR_INDEX@@@", "DEFAULT"); - content = content.replaceAll("@@@ADMINUSERNAME@@@", "rhqadmin"); - content = content.replaceAll("@@@ADMINPASSWORD@@@", "x1XwrxKuPvYUILiOnOZTLg=="); // rhqadmin - content = content.replaceAll("@@@ADMINEMAIL@@@", "rhqadmin@localhost"); - content = content.replaceAll("@@@BASEURL@@@", "http://localhost:7080/"); - content = content.replaceAll("@@@JAASPROVIDER@@@", "JDBC"); - content = content.replaceAll("@@@LDAPURL@@@", "ldap://localhost/"); - content = content.replaceAll("@@@LDAPPROTOCOL@@@", ""); - content = content.replaceAll("@@@LDAPLOGINPROP@@@", "cn"); - content = content.replaceAll("@@@LDAPBASEDN@@@", "o=JBoss,c=US"); - content = content.replaceAll("@@@LDAPSEARCHFILTER@@@", ""); - content = content.replaceAll("@@@LDAPBINDDN@@@", ""); - content = content.replaceAll("@@@LDAPBINDPW@@@", ""); - content = content.replaceAll("@@@MULTICAST_ADDR@@@", ""); - content = content.replaceAll("@@@MULTICAST_PORT@@@", ""); - - // we now have the finished XML content - write out the file to the tmp directory - File filteredXmlFile = File.createTempFile("rhq", xmlFile.getName()); - FileOutputStream xmlFileOutStream = new FileOutputStream(filteredXmlFile); - ByteArrayInputStream contentInStream = new ByteArrayInputStream(content.getBytes()); - StreamUtil.copy(contentInStream, xmlFileOutStream); - - return filteredXmlFile.getAbsoluteFile(); - } - -} diff --git a/modules/enterprise/gui/installer/src/test/java/org/rhq/enterprise/installer/client/controller/DatasourceJBossASClientTest.java b/modules/enterprise/gui/installer/src/test/java/org/rhq/enterprise/installer/client/controller/DatasourceJBossASClientTest.java deleted file mode 100644 index f5e0ec6..0000000 --- a/modules/enterprise/gui/installer/src/test/java/org/rhq/enterprise/installer/client/controller/DatasourceJBossASClientTest.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2012 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.installer.client.controller; - -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.util.HashMap; - -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; -import org.testng.annotations.Test; - -import org.jboss.as.controller.client.ModelControllerClient; -import org.jboss.as.controller.client.OperationMessageHandler; -import org.jboss.dmr.ModelNode; - -import org.rhq.common.jbossas.client.controller.DatasourceJBossASClient; -import org.rhq.common.jbossas.client.controller.JBossASClient; -import org.rhq.enterprise.gui.installer.client.shared.ServerProperties; -import org.rhq.enterprise.gui.installer.server.servlet.ServerInstallUtil; - -@Test -public class DatasourceJBossASClientTest { - private static final ModelNode mockSuccess; - static { - mockSuccess = new ModelNode(); - mockSuccess.get(JBossASClient.OUTCOME).set(JBossASClient.OUTCOME_SUCCESS); - } - - public void testCreateDatasourcesDMR() throws Exception { - ModelControllerClient mcc = mock(ModelControllerClient.class); - - // note that this doesn't test actually creating anything - it just tests the DMR can be parsed successfully - when(mcc.execute(any(ModelNode.class), any(OperationMessageHandler.class))).thenAnswer(new Answer<ModelNode>() { - public ModelNode answer(InvocationOnMock invocation) throws Throwable { - System.out.println("~~~~~~~\n" + invocation.getArguments()[0]); - ModelNode retNode = mockSuccess.clone(); - ModelNode resultNode = retNode.get(JBossASClient.RESULT); - resultNode.get(DatasourceJBossASClient.DATA_SOURCE).setEmptyList(); - resultNode.get(DatasourceJBossASClient.XA_DATA_SOURCE).setEmptyList(); - return retNode; - } - }); - - HashMap<String, String> serverProperties = new HashMap<String, String>(); - serverProperties.put(ServerProperties.PROP_DATABASE_TYPE, "Oracle"); - ServerInstallUtil.createNewDatasources(mcc, serverProperties); - - serverProperties.put(ServerProperties.PROP_DATABASE_TYPE, "PostgreSQL"); - ServerInstallUtil.createNewDatasources(mcc, serverProperties); - } - - public void testCreateNewDatasourceDMR() throws Exception { - ModelControllerClient mcc = mock(ModelControllerClient.class); - - // note that this doesn't test actually creating anything - it just tests the DMR can be parsed successfully - when(mcc.execute(any(ModelNode.class), any(OperationMessageHandler.class))).thenReturn(mockSuccess); - - DatasourceJBossASClient client = new DatasourceJBossASClient(mcc); - - HashMap<String, String> connProps = new HashMap<String, String>(2); - connProps.put("char.encoding", "UTF-8"); - connProps.put("SetBigStringTryClob", "true"); - - ModelNode request = client.createNewDatasourceRequest("NoTxRHQDS", 30000, - "${rhq.server.database.connection-url:jdbc:oracle:thin:@127.0.0.1:1521:rhq}", "oracle", - "org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter", 15, false, 2, 5, 75, - "RHQDSSecurityDomain", "org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker", - "TRANSACTION_READ_COMMITTED", "org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker", - connProps); - - System.out.println("==============\n" + request); - - ModelNode results = client.execute(request); - assert JBossASClient.isSuccess(results); - } - - public void testCreateNewXADatasourceDMR() throws Exception { - ModelControllerClient mcc = mock(ModelControllerClient.class); - - // note that this doesn't test actually creating anything - it just tests the DMR can be parsed successfully - when(mcc.execute(any(ModelNode.class), any(OperationMessageHandler.class))).thenReturn(mockSuccess); - - DatasourceJBossASClient client = new DatasourceJBossASClient(mcc); - - HashMap<String, String> xaDSProps = new HashMap<String, String>(2); - xaDSProps.put("URL", "${rhq.server.database.connection-url:jdbc:oracle:thin:@127.0.0.1:1521:rhq}"); - xaDSProps.put("ConnectionProperties", "SetBigStringTryClob=true"); - - ModelNode request = client.createNewXADatasourceRequest("RHQDS", 30000, "oracle", - "org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter", 15, 2, 5, 75, "RHQDSSecurityDomain", - "org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker", "TRANSACTION_READ_COMMITTED", - "org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker", xaDSProps); - - System.out.println("==============\n" + request); - - ModelNode results = client.execute(request); - assert JBossASClient.isSuccess(results); - } -} diff --git a/modules/enterprise/gui/installer/src/test/resources/org/rhq/enterprise/installer/db-data-combined-2.4.0.xml b/modules/enterprise/gui/installer/src/test/resources/org/rhq/enterprise/installer/db-data-combined-2.4.0.xml deleted file mode 100644 index 15978a6..0000000 --- a/modules/enterprise/gui/installer/src/test/resources/org/rhq/enterprise/installer/db-data-combined-2.4.0.xml +++ /dev/null @@ -1,669 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<dbsetup name="data.xml"> -<!-- BEGIN: rhq-data.xml --> -<!-- BEGIN: auth-data.xml --> - - - <table name="RHQ_PRINCIPAL"> - <data id="2" PRINCIPAL="rhqadmin" PASSWORD="x1XwrxKuPvYUILiOnOZTLg=="/> - </table> - -<!-- END: auth-data.xml --> -<!-- BEGIN: authz-data.xml --> - - - <!-- the overlord user --> - <table name="RHQ_SUBJECT"> - <data ID="1" - NAME="admin" - FIRST_NAME="Super" - LAST_NAME="User" - FSYSTEM="TRUE"/> - </table> - - <!-- the initial rhqadmin user --> - <table name="RHQ_SUBJECT"> - <data ID="2" - NAME="rhqadmin" - FIRST_NAME="RHQ" - LAST_NAME="Administrator" - EMAIL_ADDRESS="rhqadmin@localhost" - FSYSTEM="FALSE"/> - </table> - - <!-- Define the system root role which includes our overlord and rhqadmin users --> - <table name="RHQ_ROLE"> - <data ID="1" - NAME="Super User Role" - FSYSTEM="TRUE" - DESCRIPTION="System superuser role that provides full access to everything. This role cannot be modified."/> - <data ID="2" - NAME="All Resources Role" - FSYSTEM="FALSE" - DESCRIPTION="Provides full access to all resources in inventory. Cannot modify users, roles or server settings."/> - </table> - - <!-- associate the root users with all security permissions --> - <table name="RHQ_SUBJECT_ROLE_MAP"> - <data SUBJECT_ID="1" ROLE_ID="1"/> - <!-- overlord user --> - <data SUBJECT_ID="2" ROLE_ID="1"/> - <!-- rhqadmin user --> - </table> - - <table name="RHQ_PERMISSION"> - <!-- give super-user-role all permissions (resource perms is mainly just to show on view-role page) --> - <data ROLE_ID="1" OPERATION="0"/> <!-- Permission.MANAGE_SECURITY --> - <data ROLE_ID="1" OPERATION="1"/> <!-- Permission.MANAGE_INVENTORY --> - <data ROLE_ID="1" OPERATION="2"/> <!-- Permission.MANAGE_SETTINGS --> - <data ROLE_ID="1" OPERATION="12"/> <!-- Permission.MANAGE_BUNDLE --> - <!-- resource permissions start here--> - <data ROLE_ID="1" OPERATION="3"/> <!-- Permission.VIEW_RESOURCE --> - <data ROLE_ID="1" OPERATION="4"/> <!-- Permission.MODIFY_RESOURCE --> - <data ROLE_ID="1" OPERATION="5"/> <!-- Permission.DELETE_RESOURCE --> - <data ROLE_ID="1" OPERATION="6"/> <!-- Permission.CREATE_CHILD_RESOURCES --> - <data ROLE_ID="1" OPERATION="7"/> <!-- Permission.MANAGE_ALERTS --> - <data ROLE_ID="1" OPERATION="8"/> <!-- Permission.MANAGE_MEASUREMENTS --> - <data ROLE_ID="1" OPERATION="9"/> <!-- Permission.MANAGE_CONTENT --> - <data ROLE_ID="1" OPERATION="10"/> <!-- Permission.CONTROL --> - <data ROLE_ID="1" OPERATION="11"/> <!-- Permission.CONFIGURE --> - - <!-- give all-resources-role all permissions (resource perms is mainly just to show on view-role page) --> - <data ROLE_ID="2" OPERATION="1"/> <!-- Permission.MANAGE_INVENTORY --> - <data ROLE_ID="2" OPERATION="12"/> <!-- Permission.MANAGE_BUNDLE --> - <!-- resource permissions start here--> - <data ROLE_ID="2" OPERATION="3"/> <!-- Permission.VIEW_RESOURCE --> - <data ROLE_ID="2" OPERATION="4"/> <!-- Permission.MODIFY_RESOURCE --> - <data ROLE_ID="2" OPERATION="5"/> <!-- Permission.DELETE_RESOURCE --> - <data ROLE_ID="2" OPERATION="6"/> <!-- Permission.CREATE_CHILD_RESOURCES --> - <data ROLE_ID="2" OPERATION="7"/> <!-- Permission.MANAGE_ALERTS --> - <data ROLE_ID="2" OPERATION="8"/> <!-- Permission.MANAGE_MEASUREMENTS --> - <data ROLE_ID="2" OPERATION="9"/> <!-- Permission.MANAGE_CONTENT --> - <data ROLE_ID="2" OPERATION="10"/> <!-- Permission.CONTROL --> - <data ROLE_ID="2" OPERATION="11"/> <!-- Permission.CONFIGURE --> - </table> - -<!-- END: authz-data.xml --> -<!-- BEGIN: 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="availability=down category=platform" - LAST_COMPUTE_TIME="0" - SUBJECT_ID="1" - GLOBAL="TRUE" /> - <data ID="2" - CONTEXT="RESOURCE" - NAME="Downed Servers" - DESCRIPTION="All downed servers across the entire enterprise" - PATTERN="availability=down category=server" - LAST_COMPUTE_TIME="0" - SUBJECT_ID="1" - GLOBAL="TRUE" /> - </table> - -<!-- END: search-data.xml --> -<!-- BEGIN: sysconfig-data.xml --> - - - <!-- - This file contains the seed data for the configuration table. - All keys mentioned here should be referenced via the RHQConstants class - --> - <table name="RHQ_SYSTEM_CONFIG"> - <data ID="1" PROPERTY_KEY="SERVER_VERSION" PROPERTY_VALUE="3.0.0.GA" - DEFAULT_PROPERTY_VALUE="3.0.0.GA" FREAD_ONLY="TRUE"/> - <data ID="2" PROPERTY_KEY="DB_SCHEMA_VERSION" PROPERTY_VALUE="2.91" - DEFAULT_PROPERTY_VALUE="2.91" FREAD_ONLY="TRUE"/> - <data ID="3" PROPERTY_KEY="CAM_JAAS_PROVIDER" PROPERTY_VALUE="JDBC" - DEFAULT_PROPERTY_VALUE="JDBC" FREAD_ONLY="FALSE"/> - <data ID="4" PROPERTY_KEY="CAM_BASE_URL" PROPERTY_VALUE="http://127.0.0.1:7080/" - DEFAULT_PROPERTY_VALUE="http://127.0.0.1:7080/" FREAD_ONLY="FALSE"/> - <data ID="9" PROPERTY_KEY="CAM_HELP_USER" PROPERTY_VALUE="web" - DEFAULT_PROPERTY_VALUE="web" FREAD_ONLY="FALSE"/> - <data ID="10" PROPERTY_KEY="CAM_HELP_PASSWORD" PROPERTY_VALUE="user" - DEFAULT_PROPERTY_VALUE="user" FREAD_ONLY="FALSE"/> - - <!-- default LDAP configuration options --> - <data ID="11" PROPERTY_KEY="CAM_LDAP_NAMING_FACTORY_INITIAL" - PROPERTY_VALUE="com.sun.jndi.ldap.LdapCtxFactory" - DEFAULT_PROPERTY_VALUE="com.sun.jndi.ldap.LdapCtxFactory" - FREAD_ONLY="FALSE"/> - <data ID="12" PROPERTY_KEY="CAM_LDAP_NAMING_PROVIDER_URL" - PROPERTY_VALUE="ldap://localhost/" - DEFAULT_PROPERTY_VALUE="ldap://localhost/" - FREAD_ONLY="FALSE"/> - <data ID="13" PROPERTY_KEY="CAM_LDAP_LOGIN_PROPERTY" - PROPERTY_VALUE="cn" - DEFAULT_PROPERTY_VALUE="cn" FREAD_ONLY="FALSE"/> - <data ID="14" PROPERTY_KEY="CAM_LDAP_BASE_DN" - PROPERTY_VALUE="o=JBoss,c=US" - DEFAULT_PROPERTY_VALUE="o=JBoss,c=US" - FREAD_ONLY="FALSE"/> - <data ID="15" PROPERTY_KEY="CAM_LDAP_BIND_DN" - PROPERTY_VALUE="" - DEFAULT_PROPERTY_VALUE="" FREAD_ONLY="FALSE"/> - <data ID="16" PROPERTY_KEY="CAM_LDAP_BIND_PW" - PROPERTY_VALUE="" - DEFAULT_PROPERTY_VALUE="" FREAD_ONLY="FALSE"/> - <data ID="17" PROPERTY_KEY="CAM_LDAP_PROTOCOL" - PROPERTY_VALUE="" DEFAULT_PROPERTY_VALUE="" - FREAD_ONLY="FALSE"/> - <data ID="18" PROPERTY_KEY="CAM_LDAP_FILTER" - PROPERTY_VALUE="" DEFAULT_PROPERTY_VALUE="" - FREAD_ONLY="FALSE"/> - - <!-- Does this build support Syslog actions? --> - <data ID="21" PROPERTY_KEY="CAM_SYSLOG_ACTIONS_ENABLED" - PROPERTY_VALUE="false" DEFAULT_PROPERTY_VALUE="false" - FREAD_ONLY="FALSE"/> - <data ID="23" PROPERTY_KEY="CAM_GUIDE_ENABLED" - PROPERTY_VALUE="true" - DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> - <data ID="24" PROPERTY_KEY="CAM_RT_COLLECT_IP_ADDRS" - PROPERTY_VALUE="true" - DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> - - <!-- Default data storage options --> - <!-- Default 14 days --> - <data ID="26" PROPERTY_KEY="CAM_DATA_PURGE_1H" - PROPERTY_VALUE="1209600000" DEFAULT_PROPERTY_VALUE="1209600000" - FREAD_ONLY="FALSE"/> - <!-- Default 31 days --> - <data ID="27" PROPERTY_KEY="CAM_DATA_PURGE_6H" - PROPERTY_VALUE="2678400000" DEFAULT_PROPERTY_VALUE="2678400000" - FREAD_ONLY="FALSE"/> - <!-- Default 1 year --> - <data ID="28" PROPERTY_KEY="CAM_DATA_PURGE_1D" - PROPERTY_VALUE="31536000000" DEFAULT_PROPERTY_VALUE="31536000000" - FREAD_ONLY="FALSE"/> - - <!-- Baseline options --> - <!-- How often to calculate, default 3 days; if 0, never calculate them automatically --> - <data ID="29" PROPERTY_KEY="CAM_BASELINE_FREQUENCY" - PROPERTY_VALUE="259200000" DEFAULT_PROPERTY_VALUE="259200000" - FREAD_ONLY="FALSE"/> - <!-- How much data to include in the calulation, default 7 days --> - <data ID="30" PROPERTY_KEY="CAM_BASELINE_DATASET" - PROPERTY_VALUE="604800000" DEFAULT_PROPERTY_VALUE="604800000" - FREAD_ONLY="FALSE"/> - - <!-- ID 31 has been deleted --> - - <!-- How often to run database maintainence routines --> - <data ID="32" PROPERTY_KEY="CAM_DATA_MAINTENANCE" - PROPERTY_VALUE="3600000" DEFAULT_PROPERTY_VALUE="3600000" FREAD_ONLY="FALSE"/> - - <!-- How long to keep RT data around --> - <data ID="34" PROPERTY_KEY="RT_DATA_PURGE" PROPERTY_VALUE="2678400000" - DEFAULT_PROPERTY_VALUE="2678400000" FREAD_ONLY="FALSE"/> - - <!-- Whether to reindex the data tables nightly --> - <data ID="35" PROPERTY_KEY="DATA_REINDEX_NIGHTLY" PROPERTY_VALUE="true" - DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> - - <!-- How long to keep alerts around --> - <data ID="36" PROPERTY_KEY="ALERT_PURGE" PROPERTY_VALUE="2678400000" - DEFAULT_PROPERTY_VALUE="2678400000" FREAD_ONLY="FALSE"/> - - <!-- How long to keep events around (1209600000 millis == 14 days) --> - <data ID="51" PROPERTY_KEY="EVENT_PURGE" PROPERTY_VALUE="1209600000" - DEFAULT_PROPERTY_VALUE="1209600000" FREAD_ONLY="FALSE"/> - - <!-- How long an agent is allowed to be quiet before we consider it down and backfill it --> - <data ID="52" PROPERTY_KEY="AGENT_MAX_QUIET_TIME_ALLOWED" PROPERTY_VALUE="900000" - DEFAULT_PROPERTY_VALUE="900000" FREAD_ONLY="FALSE"/> - - <!-- Will our server-cloud support agents auto-updating themselves? --> - <data ID="53" PROPERTY_KEY="ENABLE_AGENT_AUTO_UPDATE" PROPERTY_VALUE="true" - DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> - - <!-- How old does a trait have to be in order to get purged --> - <data ID="54" PROPERTY_KEY="TRAIT_PURGE" PROPERTY_VALUE="31536000000" - DEFAULT_PROPERTY_VALUE="31536000000" FREAD_ONLY="FALSE"/> - - <!-- How old does availability have to be in order to get purged --> - <data ID="55" PROPERTY_KEY="AVAILABILITY_PURGE" PROPERTY_VALUE="31536000000" - DEFAULT_PROPERTY_VALUE="31536000000" FREAD_ONLY="FALSE"/> - - </table> - -<!-- END: sysconfig-data.xml --> -<!-- BEGIN: measurement-data.xml --> - - <table name="RHQ_NUMBERS"> - <data i="0"/> - <data i="1"/> - <data i="2"/> - <data i="3"/> - <data i="4"/> - <data i="5"/> - <data i="6"/> - <data i="7"/> - <data i="8"/> - <data i="9"/> - <data i="10"/> - <data i="11"/> - <data i="12"/> - <data i="13"/> - <data i="14"/> - <data i="15"/> - <data i="16"/> - <data i="17"/> - <data i="18"/> - <data i="19"/> - <data i="20"/> - <data i="21"/> - <data i="22"/> - <data i="23"/> - <data i="24"/> - <data i="25"/> - <data i="26"/> - <data i="27"/> - <data i="28"/> - <data i="29"/> - <data i="30"/> - <data i="31"/> - <data i="32"/> - <data i="33"/> - <data i="34"/> - <data i="35"/> - <data i="36"/> - <data i="37"/> - <data i="38"/> - <data i="39"/> - <data i="40"/> - <data i="41"/> - <data i="42"/> - <data i="43"/> - <data i="44"/> - <data i="45"/> - <data i="46"/> - <data i="47"/> - <data i="48"/> - <data i="49"/> - <data i="50"/> - <data i="51"/> - <data i="52"/> - <data i="53"/> - <data i="54"/> - <data i="55"/> - <data i="56"/> - <data i="57"/> - <data i="58"/> - <data i="59"/> - </table> - -<!-- END: measurement-data.xml --> -<!-- BEGIN: content-data.xml --> - - <table name="RHQ_ARCHITECTURE"> - <data id="1" name="noarch"/> - <data id="2" name="i386"/> - <data id="3" name="i486"/> - <data id="4" name="i586"/> - <data id="5" name="i686"/> - <data id="6" name="alpha"/> - <data id="7" name="alphaev6"/> - <data id="8" name="ia64"/> - <data id="9" name="sparc"/> - <data id="10" name="sparcv9"/> - <data id="11" name="sparc64"/> - <data id="12" name="src"/> - <data id="13" name="s390"/> - <data id="14" name="athlon"/> - <data id="15" name="s390x"/> - <data id="16" name="ppc"/> - <data id="17" name="ppc64"/> - <data id="18" name="pSeries"/> - <data id="19" name="iSeries"/> - <data id="20" name="x86_64"/> - <data id="21" name="ppc64iseries"/> - <data id="22" name="ppc64pseries"/> - <data id="23" name="sparc-solaris"/> - <data id="24" name="sparc.sun4u-solaris"/> - <data id="25" name="tar"/> - <data id="26" name="ia32e"/> - <data id="27" name="amd64"/> - <data id="28" name="i386-solaris"/> - <data id="29" name="nosrc"/> - <data id="30" name="sparc-solaris-patch"/> - <data id="31" name="i386-solaris-patch"/> - <data id="32" name="sparc-solaris-patch-cluster"/> - <data id="33" name="i386-solaris-patch-cluster"/> - <data id="34" name="noarch-solaris"/> - <data id="35" name="noarch-solaris-patch"/> - <data id="36" name="noarch-solaris-patch-cluster"/> - <data id="37" name="solaris-patch"/> - <data id="38" name="solaris-patch-cluster"/> - </table> - - <table name="RHQ_REPO_GROUP_TYPE"> - <data id="1" name="family"/> - </table> - - <table name="RHQ_REPO_RELATION_TYPE"> - <data id="1" name="parent"/> - <data id="2" name="clone"/> - </table> - - <table name="RHQ_DISTRIBUTION_TYPE"> - <data id="1" name="kickstart" description="Linux kickstart distribution"/> - <data id="2" name="jumpstart" description="solaris jumpstart distribution"/> - </table> - -<!-- END: content-data.xml --> -<!-- BEGIN: jms-data.xml --> - -<!-- the schema matches that which would be automatically created by the JMS subsystem --> -<!-- see deploy/jms/rhq-jdbc-state-service.xml and rhq-jdbc2-service.xml --> -<!-- the data must match that which is expected in conf/login-config.xml --> - - - <table name="JMS_USERS"> - <data USERID="guest" PASSWD="guest" /> - </table> - - <table name="JMS_ROLES"> - <data ROLEID="guest" USERID="guest" /> - </table> - -<!-- END: jms-data.xml --> -<!-- END: rhq-data.xml --> -<!-- BEGIN: jon-data.xml --> - -<!-- This dbsetup config file defines a content source and - associated repo for the JBoss CSP RSS patch feed. --> - - - <!-- ********* metadata (the content source type and its config def) ********* --> - - <table name="RHQ_CONFIG_DEF"> - <data ID="101" - NAME="JBoss CSP Patch Feed Content Source"/> - </table> - - <table name="RHQ_CONFIG_PROP_DEF"> - <data ID="101" - NAME="url" - DISPLAY_NAME="Feed URL" - DESCRIPTION="URL of the feed (e.g. https://support.redhat.com/jbossnetwork/restricted/feed/software.html?produc...)." - REQUIRED="1" - READONLY="0" - SUMMARY="0" - ACTIVATION_POLICY="IMMEDIATE" - ORDER_INDEX="0" - SIMPLE_TYPE="STRING" - ALLOW_CUSTOM_ENUM_VALUE="0" - DTYPE="property" - CONFIG_DEF_ID="101" - UNITS="0"/> - <data ID="102" - NAME="username" - DISPLAY_NAME="Username" - DESCRIPTION="Username used to access the feed URL." - REQUIRED="1" - READONLY="0" - SUMMARY="0" - ACTIVATION_POLICY="IMMEDIATE" - ORDER_INDEX="1" - SIMPLE_TYPE="STRING" - ALLOW_CUSTOM_ENUM_VALUE="0" - DTYPE="property" - CONFIG_DEF_ID="101" - UNITS="0"/> - <data ID="103" - NAME="password" - DISPLAY_NAME="Password" - DESCRIPTION="Password used to access the feed URL." - REQUIRED="1" - READONLY="0" - SUMMARY="0" - ACTIVATION_POLICY="IMMEDIATE" - ORDER_INDEX="2" - SIMPLE_TYPE="PASSWORD" - ALLOW_CUSTOM_ENUM_VALUE="0" - DTYPE="property" - CONFIG_DEF_ID="101" - UNITS="0"/> - <data ID="104" - NAME="active" - DISPLAY_NAME="Active" - DESCRIPTION="Indicates if the feed should be checked for new patches." - REQUIRED="1" - READONLY="0" - SUMMARY="0" - ACTIVATION_POLICY="IMMEDIATE" - ORDER_INDEX="3" - SIMPLE_TYPE="BOOLEAN" - ALLOW_CUSTOM_ENUM_VALUE="0" - DTYPE="property" - CONFIG_DEF_ID="101" - UNITS="0"/> - <data ID="105" - NAME="proxyUrl" - DISPLAY_NAME="Proxy URL" - REQUIRED="0" - READONLY="0" - SUMMARY="0" - ACTIVATION_POLICY="IMMEDIATE" - ORDER_INDEX="4" - SIMPLE_TYPE="STRING" - ALLOW_CUSTOM_ENUM_VALUE="0" - DTYPE="property" - CONFIG_DEF_ID="101" - UNITS="0"/> - <data ID="106" - NAME="proxyPort" - DISPLAY_NAME="Proxy Port" - REQUIRED="0" - READONLY="0" - SUMMARY="0" - ACTIVATION_POLICY="IMMEDIATE" - ORDER_INDEX="5" - SIMPLE_TYPE="STRING" - ALLOW_CUSTOM_ENUM_VALUE="0" - DTYPE="property" - CONFIG_DEF_ID="101" - UNITS="0"/> - <data ID="107" - NAME="proxyUsername" - DISPLAY_NAME="Proxy Username" - REQUIRED="0" - READONLY="0" - SUMMARY="0" - ACTIVATION_POLICY="IMMEDIATE" - ORDER_INDEX="6" - SIMPLE_TYPE="STRING" - ALLOW_CUSTOM_ENUM_VALUE="0" - DTYPE="property" - CONFIG_DEF_ID="101" - UNITS="0"/> - <data ID="108" - NAME="proxyPassword" - DISPLAY_NAME="Proxy Password" - REQUIRED="0" - READONLY="0" - SUMMARY="0" - ACTIVATION_POLICY="IMMEDIATE" - ORDER_INDEX="7" - SIMPLE_TYPE="STRING" - ALLOW_CUSTOM_ENUM_VALUE="0" - DTYPE="property" - CONFIG_DEF_ID="101" - UNITS="0"/> - </table> - - <!-- NOTE: The values of the NAME, PLUGIN_NAME, and API_CLASS columns must match what is - defined in RHQ/modules/enterprise/server/plugins/jboss-software/src/main/resources/META-INF/rhq-serverplugin.xml. --> - <!-- default sync chedule: 1st of every month at 12am --> - <table name="RHQ_CONTENT_SOURCE_TYPE"> - <data ID="101" - NAME="JBossASPatchSource" - DISPLAY_NAME="JBoss Patch Content Source" - DESCRIPTION="a content source that retrieves package metadata from an RSS feed; the feed must be in the format used by the JBoss CSP" - PLUGIN_NAME="JBossASPatchContentSourcePlugin" - DEFAULT_LAZY_LOAD="1" - DEFAULT_DOWNLOAD_MODE="DATABASE" - DEFAULT_SYNC_SCHEDULE="0 0 0 1 * ?" - API_CLASS="org.rhq.enterprise.server.plugins.jboss.software.JBossSoftwareContentSourceAdapter" - SOURCE_CONFIG_DEF_ID="101"/> - </table> - - - <!-- the default template --> - <table name="RHQ_CONFIG"> - <data ID="101" - VERSION="0" - CTIME="1270066600000" - MTIME="1270066600000"/> - </table> - - <table name="RHQ_CONFIG_PROPERTY"> - <data ID="101" - NAME="url" - CONFIGURATION_ID="101" - STRING_VALUE="" - OVERRIDE="0" - DTYPE="property"/> - <data ID="102" - NAME="username" - CONFIGURATION_ID="101" - OVERRIDE="0" - DTYPE="property"/> - <data ID="103" - NAME="password" - CONFIGURATION_ID="101" - OVERRIDE="0" - DTYPE="property"/> - <data ID="104" - NAME="proxyUrl" - CONFIGURATION_ID="101" - OVERRIDE="0" - DTYPE="property"/> - <data ID="105" - NAME="proxyPort" - CONFIGURATION_ID="101" - OVERRIDE="0" - DTYPE="property"/> - <data ID="106" - NAME="active" - CONFIGURATION_ID="101" - STRING_VALUE="true" - OVERRIDE="0" - DTYPE="property"/> - <data ID="107" - NAME="proxyUsername" - CONFIGURATION_ID="101" - OVERRIDE="0" - DTYPE="property"/> - <data ID="108" - NAME="proxyPassword" - CONFIGURATION_ID="101" - OVERRIDE="0" - DTYPE="property"/> - </table> - - <table name="RHQ_CONFIG_TEMPLATE"> - <data ID="101" - NAME="default" - DESCRIPTION="the default initial values for the configuration of a JBossASPatchSource content source" - CONFIG_ID="101" - CONFIG_DEF_ID="101" - IS_DEFAULT="1"/> - </table> - - - <!-- ********* data (the content source and its config) ********* --> - - <table name="RHQ_CONFIG"> - <data ID="102" - VERSION="0" - CTIME="1270066600000" - MTIME="1270066600000"/> - </table> - - <table name="RHQ_CONFIG_PROPERTY"> - <data ID="111" - NAME="url" - CONFIGURATION_ID="102" - STRING_VALUE="https://support.redhat.com/jbossnetwork/restricted/feed/software.html?produc..." - OVERRIDE="0" - DTYPE="property"/> - <data ID="112" - NAME="username" - CONFIGURATION_ID="102" - OVERRIDE="0" - DTYPE="property"/> - <data ID="113" - NAME="password" - CONFIGURATION_ID="102" - OVERRIDE="0" - DTYPE="property"/> - <data ID="114" - NAME="proxyUrl" - CONFIGURATION_ID="102" - OVERRIDE="0" - DTYPE="property"/> - <data ID="115" - NAME="proxyPort" - CONFIGURATION_ID="102" - OVERRIDE="0" - DTYPE="property"/> - <data ID="116" - NAME="active" - CONFIGURATION_ID="102" - STRING_VALUE="false" - OVERRIDE="0" - DTYPE="property"/> - <data ID="117" - NAME="proxyUsername" - CONFIGURATION_ID="102" - OVERRIDE="0" - DTYPE="property"/> - <data ID="118" - NAME="proxyPassword" - CONFIGURATION_ID="102" - OVERRIDE="0" - DTYPE="property"/> - </table> - - <!-- sync chedule: 1st of every month at 12am --> - <table name="RHQ_CONTENT_SOURCE"> - <data ID="101" - NAME="JBoss CSP Patch Feed" - DESCRIPTION="an RSS feed published by the JBoss Customer Service Portal (CSP) website which provides a list of all JBoss product patches available for the subscription of a given CSP user; the feed entries for most cumulative patches (CPs) include automated install instructions that can be used by JON to install those CPs to inventoried server Resources (e.g. JBoss EAP servers)" - LAZY_LOAD="1" - DOWNLOAD_MODE="DATABASE" - SYNC_SCHEDULE="0 0 0 1 * ?" - CREATION_TIME="1270066600000" - LAST_MODIFIED_TIME="1270066600000" - CONTENT_SOURCE_TYPE_ID="101" - CONFIGURATION_ID="102"/> - </table> - - <!-- sync chedule: every Mon at 1am --> - <table name="RHQ_REPO"> - <data ID="101" - NAME="JBoss Patches" - DESCRIPTION="the patches obtained from the JBoss CSP patch feed" - SYNC_SCHEDULE="0 0 1 ? * 1" - CREATION_TIME="1270066600000" - LAST_MODIFIED_TIME="1270066600000" - IS_CANDIDATE="0"/> - </table> - - <table name="RHQ_REPO_CONTENT_SRC_MAP"> - <data REPO_ID="101" - CONTENT_SRC_ID="101" - CTIME="1270066600000"/> - </table> - - -<!-- END: jon-data.xml --> -</dbsetup> diff --git a/modules/enterprise/gui/installer/src/test/resources/org/rhq/enterprise/installer/db-data-combined-3.0.0.xml b/modules/enterprise/gui/installer/src/test/resources/org/rhq/enterprise/installer/db-data-combined-3.0.0.xml deleted file mode 100644 index 060f241..0000000 --- a/modules/enterprise/gui/installer/src/test/resources/org/rhq/enterprise/installer/db-data-combined-3.0.0.xml +++ /dev/null @@ -1,690 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<dbsetup name="data.xml"> -<!-- BEGIN: rhq-data.xml --> -<!-- BEGIN: auth-data.xml --> - - - <table name="RHQ_PRINCIPAL"> - <data id="2" PRINCIPAL="@@@ADMINUSERNAME@@@" PASSWORD="@@@ADMINPASSWORD@@@"/> - </table> - -<!-- END: auth-data.xml --> -<!-- BEGIN: authz-data.xml --> - - - <!-- the overlord user --> - <table name="RHQ_SUBJECT"> - <data ID="1" - NAME="admin" - FIRST_NAME="Super" - LAST_NAME="User" - FSYSTEM="TRUE"/> - </table> - - <!-- the initial rhqadmin user --> - <table name="RHQ_SUBJECT"> - <data ID="2" - NAME="@@@ADMINUSERNAME@@@" - FIRST_NAME="RHQ" - LAST_NAME="Administrator" - EMAIL_ADDRESS="@@@ADMINEMAIL@@@" - FSYSTEM="FALSE"/> - </table> - - <!-- Define the system root role which includes our overlord and rhqadmin users --> - <table name="RHQ_ROLE"> - <data ID="1" - NAME="Super User Role" - FSYSTEM="TRUE" - DESCRIPTION="System superuser role that provides full access to everything. This role cannot be modified."/> - <data ID="2" - NAME="All Resources Role" - FSYSTEM="FALSE" - DESCRIPTION="Provides full access to all resources in inventory. Cannot modify users, roles or server settings."/> - </table> - - <!-- associate the root users with all security permissions --> - <table name="RHQ_SUBJECT_ROLE_MAP"> - <!-- overlord user --> - <data SUBJECT_ID="1" ROLE_ID="1"/> - <!-- rhqadmin user --> - <data SUBJECT_ID="2" ROLE_ID="1"/> - </table> - - <table name="RHQ_PERMISSION"> - <!-- give super-user-role all permissions - (explicitly add resource perms, even though they are implied by MANAGE_INVENTORY) --> - <data ROLE_ID="1" OPERATION="0"/> <!-- Permission.MANAGE_SECURITY --> - <data ROLE_ID="1" OPERATION="1"/> <!-- Permission.MANAGE_INVENTORY --> - <data ROLE_ID="1" OPERATION="2"/> <!-- Permission.MANAGE_SETTINGS --> - <data ROLE_ID="1" OPERATION="12"/> <!-- Permission.MANAGE_BUNDLE --> - <data ROLE_ID="1" OPERATION="15"/> <!-- Permission.MANAGE_REPOSITORIES --> - <!-- resource permissions start here--> - <data ROLE_ID="1" OPERATION="3"/> <!-- Permission.VIEW_RESOURCE --> - <data ROLE_ID="1" OPERATION="4"/> <!-- Permission.MODIFY_RESOURCE --> - <data ROLE_ID="1" OPERATION="5"/> <!-- Permission.DELETE_RESOURCE --> - <data ROLE_ID="1" OPERATION="6"/> <!-- Permission.CREATE_CHILD_RESOURCES --> - <data ROLE_ID="1" OPERATION="7"/> <!-- Permission.MANAGE_ALERTS --> - <data ROLE_ID="1" OPERATION="8"/> <!-- Permission.MANAGE_MEASUREMENTS --> - <data ROLE_ID="1" OPERATION="9"/> <!-- Permission.MANAGE_CONTENT --> - <data ROLE_ID="1" OPERATION="10"/> <!-- Permission.CONTROL --> - <data ROLE_ID="1" OPERATION="11"/> <!-- Permission.CONFIGURE_WRITE --> - <data ROLE_ID="1" OPERATION="13"/> <!-- Permission.CONFIGURE_READ --> - <data ROLE_ID="1" OPERATION="14"/> <!-- Permission.MANAGE_EVENTS --> - <data ROLE_ID="1" OPERATION="16"/> <!-- Permission.MANAGE_DRIFT --> - - <!-- give all-resources-role MANAGE_INVENTORY and MANAGE_BUNDLE permissions - (explicitly add resource perms as well, even though they are implied by MANAGE_INVENTORY) --> - <data ROLE_ID="2" OPERATION="1"/> <!-- Permission.MANAGE_INVENTORY --> - <data ROLE_ID="2" OPERATION="12"/> <!-- Permission.MANAGE_BUNDLE --> - <!-- resource permissions start here--> - <data ROLE_ID="2" OPERATION="3"/> <!-- Permission.VIEW_RESOURCE --> - <data ROLE_ID="2" OPERATION="4"/> <!-- Permission.MODIFY_RESOURCE --> - <data ROLE_ID="2" OPERATION="5"/> <!-- Permission.DELETE_RESOURCE --> - <data ROLE_ID="2" OPERATION="6"/> <!-- Permission.CREATE_CHILD_RESOURCES --> - <data ROLE_ID="2" OPERATION="7"/> <!-- Permission.MANAGE_ALERTS --> - <data ROLE_ID="2" OPERATION="8"/> <!-- Permission.MANAGE_MEASUREMENTS --> - <data ROLE_ID="2" OPERATION="9"/> <!-- Permission.MANAGE_CONTENT --> - <data ROLE_ID="2" OPERATION="10"/> <!-- Permission.CONTROL --> - <data ROLE_ID="2" OPERATION="11"/> <!-- Permission.CONFIGURE_WRITE --> - <data ROLE_ID="2" OPERATION="13"/> <!-- Permission.CONFIGURE_READ --> - <data ROLE_ID="2" OPERATION="14"/> <!-- Permission.MANAGE_EVENTS --> - <data ROLE_ID="2" OPERATION="16"/> <!-- Permission.MANAGE_DRIFT --> - </table> - -<!-- END: authz-data.xml --> -<!-- BEGIN: 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="availability=down category=platform" - LAST_COMPUTE_TIME="0" - SUBJECT_ID="1" - GLOBAL="TRUE" /> - <data ID="2" - CONTEXT="RESOURCE" - NAME="Downed Servers" - DESCRIPTION="All downed servers across the entire enterprise" - PATTERN="availability=down category=server" - LAST_COMPUTE_TIME="0" - SUBJECT_ID="1" - GLOBAL="TRUE" /> - </table> - -<!-- END: search-data.xml --> -<!-- BEGIN: sysconfig-data.xml --> - - - <!-- - This file contains the seed data for the configuration table. - All keys mentioned here should be referenced via the RHQConstants class - --> - <table name="RHQ_SYSTEM_CONFIG"> - <data ID="1" PROPERTY_KEY="SERVER_VERSION" PROPERTY_VALUE="4.2.0.JON300.GA" - DEFAULT_PROPERTY_VALUE="4.2.0.JON300.GA" FREAD_ONLY="TRUE"/> - <data ID="2" PROPERTY_KEY="DB_SCHEMA_VERSION" PROPERTY_VALUE="2.116" - DEFAULT_PROPERTY_VALUE="2.116" FREAD_ONLY="TRUE"/> - <data ID="3" PROPERTY_KEY="CAM_JAAS_PROVIDER" PROPERTY_VALUE="@@@JAASPROVIDER@@@" - DEFAULT_PROPERTY_VALUE="JDBC" FREAD_ONLY="FALSE"/> - <data ID="4" PROPERTY_KEY="CAM_BASE_URL" PROPERTY_VALUE="@@@BASEURL@@@" - DEFAULT_PROPERTY_VALUE="@@@BASEURL@@@" FREAD_ONLY="FALSE"/> - <data ID="9" PROPERTY_KEY="CAM_HELP_USER" PROPERTY_VALUE="web" - DEFAULT_PROPERTY_VALUE="web" FREAD_ONLY="FALSE"/> - <data ID="10" PROPERTY_KEY="CAM_HELP_PASSWORD" PROPERTY_VALUE="user" - DEFAULT_PROPERTY_VALUE="user" FREAD_ONLY="FALSE"/> - - <!-- default LDAP configuration options --> - <data ID="11" PROPERTY_KEY="CAM_LDAP_NAMING_FACTORY_INITIAL" - PROPERTY_VALUE="com.sun.jndi.ldap.LdapCtxFactory" - DEFAULT_PROPERTY_VALUE="com.sun.jndi.ldap.LdapCtxFactory" - FREAD_ONLY="FALSE"/> - <data ID="12" PROPERTY_KEY="CAM_LDAP_NAMING_PROVIDER_URL" - PROPERTY_VALUE="@@@LDAPURL@@@" - DEFAULT_PROPERTY_VALUE="ldap://localhost/" - FREAD_ONLY="FALSE"/> - <data ID="13" PROPERTY_KEY="CAM_LDAP_LOGIN_PROPERTY" - PROPERTY_VALUE="@@@LDAPLOGINPROP@@@" - DEFAULT_PROPERTY_VALUE="cn" FREAD_ONLY="FALSE"/> - <data ID="14" PROPERTY_KEY="CAM_LDAP_BASE_DN" - PROPERTY_VALUE="@@@LDAPBASEDN@@@" - DEFAULT_PROPERTY_VALUE="o=JBoss,c=US" - FREAD_ONLY="FALSE"/> - <data ID="15" PROPERTY_KEY="CAM_LDAP_BIND_DN" - PROPERTY_VALUE="@@@LDAPBINDDN@@@" - DEFAULT_PROPERTY_VALUE="" FREAD_ONLY="FALSE"/> - <data ID="16" PROPERTY_KEY="CAM_LDAP_BIND_PW" - PROPERTY_VALUE="@@@LDAPBINDPW@@@" - DEFAULT_PROPERTY_VALUE="" FREAD_ONLY="FALSE"/> - <data ID="17" PROPERTY_KEY="CAM_LDAP_PROTOCOL" - PROPERTY_VALUE="@@@LDAPPROTOCOL@@@" DEFAULT_PROPERTY_VALUE="" - FREAD_ONLY="FALSE"/> - <data ID="18" PROPERTY_KEY="CAM_LDAP_FILTER" - PROPERTY_VALUE="@@@LDAPSEARCHFILTER@@@" DEFAULT_PROPERTY_VALUE="" - FREAD_ONLY="FALSE"/> - - <!-- Does this build support Syslog actions? --> - <data ID="21" PROPERTY_KEY="CAM_SYSLOG_ACTIONS_ENABLED" - PROPERTY_VALUE="false" DEFAULT_PROPERTY_VALUE="false" - FREAD_ONLY="FALSE"/> - <data ID="23" PROPERTY_KEY="CAM_GUIDE_ENABLED" - PROPERTY_VALUE="true" - DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> - <data ID="24" PROPERTY_KEY="CAM_RT_COLLECT_IP_ADDRS" - PROPERTY_VALUE="true" - DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> - - <!-- Default data storage options --> - <!-- Default 14 days --> - <data ID="26" PROPERTY_KEY="CAM_DATA_PURGE_1H" - PROPERTY_VALUE="1209600000" DEFAULT_PROPERTY_VALUE="1209600000" - FREAD_ONLY="FALSE"/> - <!-- Default 31 days --> - <data ID="27" PROPERTY_KEY="CAM_DATA_PURGE_6H" - PROPERTY_VALUE="2678400000" DEFAULT_PROPERTY_VALUE="2678400000" - FREAD_ONLY="FALSE"/> - <!-- Default 1 year --> - <data ID="28" PROPERTY_KEY="CAM_DATA_PURGE_1D" - PROPERTY_VALUE="31536000000" DEFAULT_PROPERTY_VALUE="31536000000" - FREAD_ONLY="FALSE"/> - - <!-- Baseline options --> - <!-- How often to calculate, default 3 days; if 0, never calculate them automatically --> - <data ID="29" PROPERTY_KEY="CAM_BASELINE_FREQUENCY" - PROPERTY_VALUE="259200000" DEFAULT_PROPERTY_VALUE="259200000" - FREAD_ONLY="FALSE"/> - <!-- How much data to include in the calulation, default 7 days --> - <data ID="30" PROPERTY_KEY="CAM_BASELINE_DATASET" - PROPERTY_VALUE="604800000" DEFAULT_PROPERTY_VALUE="604800000" - FREAD_ONLY="FALSE"/> - - <!-- ID 31 has been deleted --> - - <!-- How often to run database maintainence routines --> - <data ID="32" PROPERTY_KEY="CAM_DATA_MAINTENANCE" - PROPERTY_VALUE="3600000" DEFAULT_PROPERTY_VALUE="3600000" FREAD_ONLY="FALSE"/> - - <!-- How long to keep RT data around --> - <data ID="34" PROPERTY_KEY="RT_DATA_PURGE" PROPERTY_VALUE="2678400000" - DEFAULT_PROPERTY_VALUE="2678400000" FREAD_ONLY="FALSE"/> - - <!-- Whether to reindex the data tables nightly --> - <data ID="35" PROPERTY_KEY="DATA_REINDEX_NIGHTLY" PROPERTY_VALUE="true" - DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> - - <!-- How long to keep alerts around --> - <data ID="36" PROPERTY_KEY="ALERT_PURGE" PROPERTY_VALUE="2678400000" - DEFAULT_PROPERTY_VALUE="2678400000" FREAD_ONLY="FALSE"/> - - <!-- How long to keep events around (1209600000 millis == 14 days) --> - <data ID="51" PROPERTY_KEY="EVENT_PURGE" PROPERTY_VALUE="1209600000" - DEFAULT_PROPERTY_VALUE="1209600000" FREAD_ONLY="FALSE"/> - - <!-- How long an agent is allowed to be quiet before we consider it down and backfill it --> - <data ID="52" PROPERTY_KEY="AGENT_MAX_QUIET_TIME_ALLOWED" PROPERTY_VALUE="900000" - DEFAULT_PROPERTY_VALUE="900000" FREAD_ONLY="FALSE"/> - - <!-- Will our server-cloud support agents auto-updating themselves? --> - <data ID="53" PROPERTY_KEY="ENABLE_AGENT_AUTO_UPDATE" PROPERTY_VALUE="true" - DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> - - <!-- How old does a trait have to be in order to get purged --> - <data ID="54" PROPERTY_KEY="TRAIT_PURGE" PROPERTY_VALUE="31536000000" - DEFAULT_PROPERTY_VALUE="31536000000" FREAD_ONLY="FALSE"/> - - <!-- How old does availability have to be in order to get purged --> - <data ID="55" PROPERTY_KEY="AVAILABILITY_PURGE" PROPERTY_VALUE="31536000000" - DEFAULT_PROPERTY_VALUE="31536000000" FREAD_ONLY="FALSE"/> - - <data ID="56" PROPERTY_KEY="RESOURCE_GENERIC_PROPERTIES_UPGRADE" PROPERTY_VALUE="false" - DEFAULT_PROPERTY_VALUE="false" FREAD_ONLY="FALSE"/> - - <!-- default drift server plugin settings --> - <data ID="57" PROPERTY_KEY="ACTIVE_DRIFT_PLUGIN" PROPERTY_VALUE="drift-jpa" - DEFAULT_PROPERTY_VALUE="drift-jpa" FREAD_ONLY="FALSE"/> - - <!-- purge drift files older than 31 days by default --> - <data ID="58" PROPERTY_KEY="DRIFT_FILE_PURGE" PROPERTY_VALUE="2678400000" - DEFAULT_PROPERTY_VALUE="2678400000" FREAD_ONLY="FALSE"/> - - </table> - -<!-- END: sysconfig-data.xml --> -<!-- BEGIN: measurement-data.xml --> - - <table name="RHQ_NUMBERS"> - <data i="0"/> - <data i="1"/> - <data i="2"/> - <data i="3"/> - <data i="4"/> - <data i="5"/> - <data i="6"/> - <data i="7"/> - <data i="8"/> - <data i="9"/> - <data i="10"/> - <data i="11"/> - <data i="12"/> - <data i="13"/> - <data i="14"/> - <data i="15"/> - <data i="16"/> - <data i="17"/> - <data i="18"/> - <data i="19"/> - <data i="20"/> - <data i="21"/> - <data i="22"/> - <data i="23"/> - <data i="24"/> - <data i="25"/> - <data i="26"/> - <data i="27"/> - <data i="28"/> - <data i="29"/> - <data i="30"/> - <data i="31"/> - <data i="32"/> - <data i="33"/> - <data i="34"/> - <data i="35"/> - <data i="36"/> - <data i="37"/> - <data i="38"/> - <data i="39"/> - <data i="40"/> - <data i="41"/> - <data i="42"/> - <data i="43"/> - <data i="44"/> - <data i="45"/> - <data i="46"/> - <data i="47"/> - <data i="48"/> - <data i="49"/> - <data i="50"/> - <data i="51"/> - <data i="52"/> - <data i="53"/> - <data i="54"/> - <data i="55"/> - <data i="56"/> - <data i="57"/> - <data i="58"/> - <data i="59"/> - </table> - -<!-- END: measurement-data.xml --> -<!-- BEGIN: content-data.xml --> - - <table name="RHQ_ARCHITECTURE"> - <data id="1" name="noarch"/> - <data id="2" name="i386"/> - <data id="3" name="i486"/> - <data id="4" name="i586"/> - <data id="5" name="i686"/> - <data id="6" name="alpha"/> - <data id="7" name="alphaev6"/> - <data id="8" name="ia64"/> - <data id="9" name="sparc"/> - <data id="10" name="sparcv9"/> - <data id="11" name="sparc64"/> - <data id="12" name="src"/> - <data id="13" name="s390"/> - <data id="14" name="athlon"/> - <data id="15" name="s390x"/> - <data id="16" name="ppc"/> - <data id="17" name="ppc64"/> - <data id="18" name="pSeries"/> - <data id="19" name="iSeries"/> - <data id="20" name="x86_64"/> - <data id="21" name="ppc64iseries"/> - <data id="22" name="ppc64pseries"/> - <data id="23" name="sparc-solaris"/> - <data id="24" name="sparc.sun4u-solaris"/> - <data id="25" name="tar"/> - <data id="26" name="ia32e"/> - <data id="27" name="amd64"/> - <data id="28" name="i386-solaris"/> - <data id="29" name="nosrc"/> - <data id="30" name="sparc-solaris-patch"/> - <data id="31" name="i386-solaris-patch"/> - <data id="32" name="sparc-solaris-patch-cluster"/> - <data id="33" name="i386-solaris-patch-cluster"/> - <data id="34" name="noarch-solaris"/> - <data id="35" name="noarch-solaris-patch"/> - <data id="36" name="noarch-solaris-patch-cluster"/> - <data id="37" name="solaris-patch"/> - <data id="38" name="solaris-patch-cluster"/> - </table> - - <table name="RHQ_REPO_GROUP_TYPE"> - <data id="1" name="family"/> - </table> - - <table name="RHQ_REPO_RELATION_TYPE"> - <data id="1" name="parent"/> - <data id="2" name="clone"/> - </table> - - <table name="RHQ_DISTRIBUTION_TYPE"> - <data id="1" name="kickstart" description="Linux kickstart distribution"/> - <data id="2" name="jumpstart" description="solaris jumpstart distribution"/> - </table> - -<!-- END: content-data.xml --> -<!-- BEGIN: jms-data.xml --> - -<!-- the schema matches that which would be automatically created by the JMS subsystem --> -<!-- see deploy/jms/rhq-jdbc-state-service.xml and rhq-jdbc2-service.xml --> -<!-- the data must match that which is expected in conf/login-config.xml --> - - - <table name="JMS_USERS"> - <data USERID="guest" PASSWD="guest" /> - </table> - - <table name="JMS_ROLES"> - <data ROLEID="guest" USERID="guest" /> - </table> - -<!-- END: jms-data.xml --> -<!-- END: rhq-data.xml --> -<!-- BEGIN: jon-data.xml --> - -<!-- This dbsetup config file defines a content source and - associated repo for the JBoss CP RSS patch feed. --> - - - <!-- ********* metadata (the content source type and its config def) ********* --> - - <table name="RHQ_CONFIG_DEF"> - <data ID="101" - NAME="JBoss CP Patch Feed Content Source"/> - </table> - - <table name="RHQ_CONFIG_PROP_DEF"> - <data ID="101" - NAME="url" - DISPLAY_NAME="Feed URL" - DESCRIPTION="URL of the feed (e.g. https://access.redhat.com/jbossnetwork/restricted/feed/software.html?product...)." - REQUIRED="1" - READONLY="0" - SUMMARY="0" - ACTIVATION_POLICY="IMMEDIATE" - ORDER_INDEX="0" - SIMPLE_TYPE="STRING" - ALLOW_CUSTOM_ENUM_VALUE="0" - DTYPE="property" - CONFIG_DEF_ID="101" - UNITS="0"/> - <data ID="102" - NAME="username" - DISPLAY_NAME="Username" - DESCRIPTION="Username used to access the feed URL." - REQUIRED="1" - READONLY="0" - SUMMARY="0" - ACTIVATION_POLICY="IMMEDIATE" - ORDER_INDEX="1" - SIMPLE_TYPE="STRING" - ALLOW_CUSTOM_ENUM_VALUE="0" - DTYPE="property" - CONFIG_DEF_ID="101" - UNITS="0"/> - <data ID="103" - NAME="password" - DISPLAY_NAME="Password" - DESCRIPTION="Password used to access the feed URL." - REQUIRED="1" - READONLY="0" - SUMMARY="0" - ACTIVATION_POLICY="IMMEDIATE" - ORDER_INDEX="2" - SIMPLE_TYPE="PASSWORD" - ALLOW_CUSTOM_ENUM_VALUE="0" - DTYPE="property" - CONFIG_DEF_ID="101" - UNITS="0"/> - <data ID="104" - NAME="active" - DISPLAY_NAME="Active" - DESCRIPTION="Indicates if the feed should be checked for new patches." - REQUIRED="1" - READONLY="0" - SUMMARY="0" - ACTIVATION_POLICY="IMMEDIATE" - ORDER_INDEX="3" - SIMPLE_TYPE="BOOLEAN" - ALLOW_CUSTOM_ENUM_VALUE="0" - DTYPE="property" - CONFIG_DEF_ID="101" - UNITS="0"/> - <data ID="105" - NAME="proxyUrl" - DISPLAY_NAME="Proxy URL" - REQUIRED="0" - READONLY="0" - SUMMARY="0" - ACTIVATION_POLICY="IMMEDIATE" - ORDER_INDEX="4" - SIMPLE_TYPE="STRING" - ALLOW_CUSTOM_ENUM_VALUE="0" - DTYPE="property" - CONFIG_DEF_ID="101" - UNITS="0"/> - <data ID="106" - NAME="proxyPort" - DISPLAY_NAME="Proxy Port" - REQUIRED="0" - READONLY="0" - SUMMARY="0" - ACTIVATION_POLICY="IMMEDIATE" - ORDER_INDEX="5" - SIMPLE_TYPE="STRING" - ALLOW_CUSTOM_ENUM_VALUE="0" - DTYPE="property" - CONFIG_DEF_ID="101" - UNITS="0"/> - <data ID="107" - NAME="proxyUsername" - DISPLAY_NAME="Proxy Username" - REQUIRED="0" - READONLY="0" - SUMMARY="0" - ACTIVATION_POLICY="IMMEDIATE" - ORDER_INDEX="6" - SIMPLE_TYPE="STRING" - ALLOW_CUSTOM_ENUM_VALUE="0" - DTYPE="property" - CONFIG_DEF_ID="101" - UNITS="0"/> - <data ID="108" - NAME="proxyPassword" - DISPLAY_NAME="Proxy Password" - REQUIRED="0" - READONLY="0" - SUMMARY="0" - ACTIVATION_POLICY="IMMEDIATE" - ORDER_INDEX="7" - SIMPLE_TYPE="STRING" - ALLOW_CUSTOM_ENUM_VALUE="0" - DTYPE="property" - CONFIG_DEF_ID="101" - UNITS="0"/> - </table> - - <!-- NOTE: The values of the NAME, PLUGIN_NAME, and API_CLASS columns must match what is - defined in RHQ/modules/enterprise/server/plugins/jboss-software/src/main/resources/META-INF/rhq-serverplugin.xml. --> - <!-- default sync chedule: 1st of every month at 12am --> - <table name="RHQ_CONTENT_SOURCE_TYPE"> - <data ID="101" - NAME="JBossASPatchSource" - DISPLAY_NAME="JBoss Patch Content Source" - DESCRIPTION="a content source that retrieves package metadata from an RSS feed; the feed must be in the format used by the JBoss CP" - PLUGIN_NAME="JBossASPatchContentSourcePlugin" - DEFAULT_LAZY_LOAD="1" - DEFAULT_DOWNLOAD_MODE="DATABASE" - DEFAULT_SYNC_SCHEDULE="0 0 0 1 * ?" - API_CLASS="org.rhq.enterprise.server.plugins.jboss.software.JBossSoftwareContentSourceAdapter" - SOURCE_CONFIG_DEF_ID="101"/> - </table> - - - <!-- the default template --> - <table name="RHQ_CONFIG"> - <data ID="101" - VERSION="0" - CTIME="1270066600000" - MTIME="1270066600000"/> - </table> - - <table name="RHQ_CONFIG_PROPERTY"> - <data ID="101" - NAME="url" - CONFIGURATION_ID="101" - STRING_VALUE="" - OVERRIDE="0" - DTYPE="property"/> - <data ID="102" - NAME="username" - CONFIGURATION_ID="101" - OVERRIDE="0" - DTYPE="property"/> - <data ID="103" - NAME="password" - CONFIGURATION_ID="101" - OVERRIDE="0" - DTYPE="property"/> - <data ID="104" - NAME="proxyUrl" - CONFIGURATION_ID="101" - OVERRIDE="0" - DTYPE="property"/> - <data ID="105" - NAME="proxyPort" - CONFIGURATION_ID="101" - OVERRIDE="0" - DTYPE="property"/> - <data ID="106" - NAME="active" - CONFIGURATION_ID="101" - STRING_VALUE="true" - OVERRIDE="0" - DTYPE="property"/> - <data ID="107" - NAME="proxyUsername" - CONFIGURATION_ID="101" - OVERRIDE="0" - DTYPE="property"/> - <data ID="108" - NAME="proxyPassword" - CONFIGURATION_ID="101" - OVERRIDE="0" - DTYPE="property"/> - </table> - - <table name="RHQ_CONFIG_TEMPLATE"> - <data ID="101" - NAME="default" - DESCRIPTION="the default initial values for the configuration of a JBossASPatchSource content source" - CONFIG_ID="101" - CONFIG_DEF_ID="101" - IS_DEFAULT="1"/> - </table> - - - <!-- ********* data (the content source and its config) ********* --> - - <table name="RHQ_CONFIG"> - <data ID="102" - VERSION="0" - CTIME="1270066600000" - MTIME="1270066600000"/> - </table> - - <table name="RHQ_CONFIG_PROPERTY"> - <data ID="111" - NAME="url" - CONFIGURATION_ID="102" - STRING_VALUE="https://access.redhat.com/jbossnetwork/restricted/feed/software.html?product..." - OVERRIDE="0" - DTYPE="property"/> - <data ID="112" - NAME="username" - CONFIGURATION_ID="102" - OVERRIDE="0" - DTYPE="property"/> - <data ID="113" - NAME="password" - CONFIGURATION_ID="102" - OVERRIDE="0" - DTYPE="property"/> - <data ID="114" - NAME="proxyUrl" - CONFIGURATION_ID="102" - OVERRIDE="0" - DTYPE="property"/> - <data ID="115" - NAME="proxyPort" - CONFIGURATION_ID="102" - OVERRIDE="0" - DTYPE="property"/> - <data ID="116" - NAME="active" - CONFIGURATION_ID="102" - STRING_VALUE="false" - OVERRIDE="0" - DTYPE="property"/> - <data ID="117" - NAME="proxyUsername" - CONFIGURATION_ID="102" - OVERRIDE="0" - DTYPE="property"/> - <data ID="118" - NAME="proxyPassword" - CONFIGURATION_ID="102" - OVERRIDE="0" - DTYPE="property"/> - </table> - - <!-- sync chedule: 1st of every month at 12am --> - <table name="RHQ_CONTENT_SOURCE"> - <data ID="101" - NAME="JBoss CP Patch Feed" - DESCRIPTION="an RSS feed published by the JBoss Customer Portal (CP) website which provides a list of all JBoss product patches available for the subscription of a given CP user; the feed entries for most cumulative patches (CPs) include automated install instructions that can be used by JON to install those CPs to inventoried server Resources (e.g. JBoss EAP servers)" - LAZY_LOAD="1" - DOWNLOAD_MODE="DATABASE" - SYNC_SCHEDULE="0 0 0 1 * ?" - CREATION_TIME="1270066600000" - LAST_MODIFIED_TIME="1270066600000" - CONTENT_SOURCE_TYPE_ID="101" - CONFIGURATION_ID="102"/> - </table> - - <!-- sync chedule: every Mon at 1am --> - <table name="RHQ_REPO"> - <data ID="101" - NAME="JBoss Patches" - DESCRIPTION="the patches obtained from the JBoss CP patch feed" - SYNC_SCHEDULE="0 0 1 ? * 1" - CREATION_TIME="1270066600000" - LAST_MODIFIED_TIME="1270066600000" - IS_PRIVATE="0" - IS_CANDIDATE="0"/> - </table> - - <table name="RHQ_REPO_CONTENT_SRC_MAP"> - <data REPO_ID="101" - CONTENT_SRC_ID="101" - CTIME="1270066600000"/> - </table> - - -<!-- END: jon-data.xml --> -</dbsetup> diff --git a/modules/enterprise/gui/installer/src/test/resources/org/rhq/enterprise/installer/db-data-combined-rhq-4.2.0.xml b/modules/enterprise/gui/installer/src/test/resources/org/rhq/enterprise/installer/db-data-combined-rhq-4.2.0.xml deleted file mode 100644 index 7e5c38b..0000000 --- a/modules/enterprise/gui/installer/src/test/resources/org/rhq/enterprise/installer/db-data-combined-rhq-4.2.0.xml +++ /dev/null @@ -1,396 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<dbsetup name="data.xml"> -<!-- BEGIN: auth-data.xml --> - - - <table name="RHQ_PRINCIPAL"> - <data id="2" PRINCIPAL="rhqadmin" PASSWORD="x1XwrxKuPvYUILiOnOZTLg=="/> - </table> - -<!-- END: auth-data.xml --> -<!-- BEGIN: authz-data.xml --> - - - <!-- the overlord user --> - <table name="RHQ_SUBJECT"> - <data ID="1" - NAME="admin" - FIRST_NAME="Super" - LAST_NAME="User" - FSYSTEM="TRUE"/> - </table> - - <!-- the initial rhqadmin user --> - <table name="RHQ_SUBJECT"> - <data ID="2" - NAME="rhqadmin" - FIRST_NAME="RHQ" - LAST_NAME="Administrator" - EMAIL_ADDRESS="rhqadmin@localhost" - FSYSTEM="FALSE"/> - </table> - - <!-- Define the system root role which includes our overlord and rhqadmin users --> - <table name="RHQ_ROLE"> - <data ID="1" - NAME="Super User Role" - FSYSTEM="TRUE" - DESCRIPTION="System superuser role that provides full access to everything. This role cannot be modified."/> - <data ID="2" - NAME="All Resources Role" - FSYSTEM="FALSE" - DESCRIPTION="Provides full access to all resources in inventory. Cannot modify users, roles or server settings."/> - </table> - - <!-- associate the root users with all security permissions --> - <table name="RHQ_SUBJECT_ROLE_MAP"> - <!-- overlord user --> - <data SUBJECT_ID="1" ROLE_ID="1"/> - <!-- rhqadmin user --> - <data SUBJECT_ID="2" ROLE_ID="1"/> - </table> - - <table name="RHQ_PERMISSION"> - <!-- give super-user-role all permissions - (explicitly add resource perms, even though they are implied by MANAGE_INVENTORY) --> - <data ROLE_ID="1" OPERATION="0"/> <!-- Permission.MANAGE_SECURITY --> - <data ROLE_ID="1" OPERATION="1"/> <!-- Permission.MANAGE_INVENTORY --> - <data ROLE_ID="1" OPERATION="2"/> <!-- Permission.MANAGE_SETTINGS --> - <data ROLE_ID="1" OPERATION="12"/> <!-- Permission.MANAGE_BUNDLE --> - <data ROLE_ID="1" OPERATION="15"/> <!-- Permission.MANAGE_REPOSITORIES --> - <!-- resource permissions start here--> - <data ROLE_ID="1" OPERATION="3"/> <!-- Permission.VIEW_RESOURCE --> - <data ROLE_ID="1" OPERATION="4"/> <!-- Permission.MODIFY_RESOURCE --> - <data ROLE_ID="1" OPERATION="5"/> <!-- Permission.DELETE_RESOURCE --> - <data ROLE_ID="1" OPERATION="6"/> <!-- Permission.CREATE_CHILD_RESOURCES --> - <data ROLE_ID="1" OPERATION="7"/> <!-- Permission.MANAGE_ALERTS --> - <data ROLE_ID="1" OPERATION="8"/> <!-- Permission.MANAGE_MEASUREMENTS --> - <data ROLE_ID="1" OPERATION="9"/> <!-- Permission.MANAGE_CONTENT --> - <data ROLE_ID="1" OPERATION="10"/> <!-- Permission.CONTROL --> - <data ROLE_ID="1" OPERATION="11"/> <!-- Permission.CONFIGURE_WRITE --> - <data ROLE_ID="1" OPERATION="13"/> <!-- Permission.CONFIGURE_READ --> - <data ROLE_ID="1" OPERATION="14"/> <!-- Permission.MANAGE_EVENTS --> - <data ROLE_ID="1" OPERATION="16"/> <!-- Permission.MANAGE_DRIFT --> - - <!-- give all-resources-role MANAGE_INVENTORY and MANAGE_BUNDLE permissions - (explicitly add resource perms as well, even though they are implied by MANAGE_INVENTORY) --> - <data ROLE_ID="2" OPERATION="1"/> <!-- Permission.MANAGE_INVENTORY --> - <data ROLE_ID="2" OPERATION="12"/> <!-- Permission.MANAGE_BUNDLE --> - <!-- resource permissions start here--> - <data ROLE_ID="2" OPERATION="3"/> <!-- Permission.VIEW_RESOURCE --> - <data ROLE_ID="2" OPERATION="4"/> <!-- Permission.MODIFY_RESOURCE --> - <data ROLE_ID="2" OPERATION="5"/> <!-- Permission.DELETE_RESOURCE --> - <data ROLE_ID="2" OPERATION="6"/> <!-- Permission.CREATE_CHILD_RESOURCES --> - <data ROLE_ID="2" OPERATION="7"/> <!-- Permission.MANAGE_ALERTS --> - <data ROLE_ID="2" OPERATION="8"/> <!-- Permission.MANAGE_MEASUREMENTS --> - <data ROLE_ID="2" OPERATION="9"/> <!-- Permission.MANAGE_CONTENT --> - <data ROLE_ID="2" OPERATION="10"/> <!-- Permission.CONTROL --> - <data ROLE_ID="2" OPERATION="11"/> <!-- Permission.CONFIGURE_WRITE --> - <data ROLE_ID="2" OPERATION="13"/> <!-- Permission.CONFIGURE_READ --> - <data ROLE_ID="2" OPERATION="14"/> <!-- Permission.MANAGE_EVENTS --> - <data ROLE_ID="2" OPERATION="16"/> <!-- Permission.MANAGE_DRIFT --> - </table> - -<!-- END: authz-data.xml --> -<!-- BEGIN: 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="availability=down category=platform" - LAST_COMPUTE_TIME="0" - SUBJECT_ID="1" - GLOBAL="TRUE" /> - <data ID="2" - CONTEXT="RESOURCE" - NAME="Downed Servers" - DESCRIPTION="All downed servers across the entire enterprise" - PATTERN="availability=down category=server" - LAST_COMPUTE_TIME="0" - SUBJECT_ID="1" - GLOBAL="TRUE" /> - </table> - -<!-- END: search-data.xml --> -<!-- BEGIN: sysconfig-data.xml --> - - - <!-- - This file contains the seed data for the configuration table. - All keys mentioned here should be referenced via the RHQConstants class - --> - <table name="RHQ_SYSTEM_CONFIG"> - <data ID="1" PROPERTY_KEY="SERVER_VERSION" PROPERTY_VALUE="4.2.0" - DEFAULT_PROPERTY_VALUE="4.2.0" FREAD_ONLY="TRUE"/> - <data ID="2" PROPERTY_KEY="DB_SCHEMA_VERSION" PROPERTY_VALUE="2.115" - DEFAULT_PROPERTY_VALUE="2.115" FREAD_ONLY="TRUE"/> - <data ID="3" PROPERTY_KEY="CAM_JAAS_PROVIDER" PROPERTY_VALUE="JDBC" - DEFAULT_PROPERTY_VALUE="JDBC" FREAD_ONLY="FALSE"/> - <data ID="4" PROPERTY_KEY="CAM_BASE_URL" PROPERTY_VALUE="http://10.16.88.220:7080/" - DEFAULT_PROPERTY_VALUE="http://10.16.88.220:7080/" FREAD_ONLY="FALSE"/> - <data ID="9" PROPERTY_KEY="CAM_HELP_USER" PROPERTY_VALUE="web" - DEFAULT_PROPERTY_VALUE="web" FREAD_ONLY="FALSE"/> - <data ID="10" PROPERTY_KEY="CAM_HELP_PASSWORD" PROPERTY_VALUE="user" - DEFAULT_PROPERTY_VALUE="user" FREAD_ONLY="FALSE"/> - - <!-- default LDAP configuration options --> - <data ID="11" PROPERTY_KEY="CAM_LDAP_NAMING_FACTORY_INITIAL" - PROPERTY_VALUE="com.sun.jndi.ldap.LdapCtxFactory" - DEFAULT_PROPERTY_VALUE="com.sun.jndi.ldap.LdapCtxFactory" - FREAD_ONLY="FALSE"/> - <data ID="12" PROPERTY_KEY="CAM_LDAP_NAMING_PROVIDER_URL" - PROPERTY_VALUE="ldap://localhost/" - DEFAULT_PROPERTY_VALUE="ldap://localhost/" - FREAD_ONLY="FALSE"/> - <data ID="13" PROPERTY_KEY="CAM_LDAP_LOGIN_PROPERTY" - PROPERTY_VALUE="cn" - DEFAULT_PROPERTY_VALUE="cn" FREAD_ONLY="FALSE"/> - <data ID="14" PROPERTY_KEY="CAM_LDAP_BASE_DN" - PROPERTY_VALUE="o=JBoss,c=US" - DEFAULT_PROPERTY_VALUE="o=JBoss,c=US" - FREAD_ONLY="FALSE"/> - <data ID="15" PROPERTY_KEY="CAM_LDAP_BIND_DN" - PROPERTY_VALUE="" - DEFAULT_PROPERTY_VALUE="" FREAD_ONLY="FALSE"/> - <data ID="16" PROPERTY_KEY="CAM_LDAP_BIND_PW" - PROPERTY_VALUE="" - DEFAULT_PROPERTY_VALUE="" FREAD_ONLY="FALSE"/> - <data ID="17" PROPERTY_KEY="CAM_LDAP_PROTOCOL" - PROPERTY_VALUE="" DEFAULT_PROPERTY_VALUE="" - FREAD_ONLY="FALSE"/> - <data ID="18" PROPERTY_KEY="CAM_LDAP_FILTER" - PROPERTY_VALUE="" DEFAULT_PROPERTY_VALUE="" - FREAD_ONLY="FALSE"/> - - <!-- Does this build support Syslog actions? --> - <data ID="21" PROPERTY_KEY="CAM_SYSLOG_ACTIONS_ENABLED" - PROPERTY_VALUE="false" DEFAULT_PROPERTY_VALUE="false" - FREAD_ONLY="FALSE"/> - <data ID="23" PROPERTY_KEY="CAM_GUIDE_ENABLED" - PROPERTY_VALUE="true" - DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> - <data ID="24" PROPERTY_KEY="CAM_RT_COLLECT_IP_ADDRS" - PROPERTY_VALUE="true" - DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> - - <!-- Default data storage options --> - <!-- Default 14 days --> - <data ID="26" PROPERTY_KEY="CAM_DATA_PURGE_1H" - PROPERTY_VALUE="1209600000" DEFAULT_PROPERTY_VALUE="1209600000" - FREAD_ONLY="FALSE"/> - <!-- Default 31 days --> - <data ID="27" PROPERTY_KEY="CAM_DATA_PURGE_6H" - PROPERTY_VALUE="2678400000" DEFAULT_PROPERTY_VALUE="2678400000" - FREAD_ONLY="FALSE"/> - <!-- Default 1 year --> - <data ID="28" PROPERTY_KEY="CAM_DATA_PURGE_1D" - PROPERTY_VALUE="31536000000" DEFAULT_PROPERTY_VALUE="31536000000" - FREAD_ONLY="FALSE"/> - - <!-- Baseline options --> - <!-- How often to calculate, default 3 days; if 0, never calculate them automatically --> - <data ID="29" PROPERTY_KEY="CAM_BASELINE_FREQUENCY" - PROPERTY_VALUE="259200000" DEFAULT_PROPERTY_VALUE="259200000" - FREAD_ONLY="FALSE"/> - <!-- How much data to include in the calulation, default 7 days --> - <data ID="30" PROPERTY_KEY="CAM_BASELINE_DATASET" - PROPERTY_VALUE="604800000" DEFAULT_PROPERTY_VALUE="604800000" - FREAD_ONLY="FALSE"/> - - <!-- ID 31 has been deleted --> - - <!-- How often to run database maintainence routines --> - <data ID="32" PROPERTY_KEY="CAM_DATA_MAINTENANCE" - PROPERTY_VALUE="3600000" DEFAULT_PROPERTY_VALUE="3600000" FREAD_ONLY="FALSE"/> - - <!-- How long to keep RT data around --> - <data ID="34" PROPERTY_KEY="RT_DATA_PURGE" PROPERTY_VALUE="2678400000" - DEFAULT_PROPERTY_VALUE="2678400000" FREAD_ONLY="FALSE"/> - - <!-- Whether to reindex the data tables nightly --> - <data ID="35" PROPERTY_KEY="DATA_REINDEX_NIGHTLY" PROPERTY_VALUE="true" - DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> - - <!-- How long to keep alerts around --> - <data ID="36" PROPERTY_KEY="ALERT_PURGE" PROPERTY_VALUE="2678400000" - DEFAULT_PROPERTY_VALUE="2678400000" FREAD_ONLY="FALSE"/> - - <!-- How long to keep events around (1209600000 millis == 14 days) --> - <data ID="51" PROPERTY_KEY="EVENT_PURGE" PROPERTY_VALUE="1209600000" - DEFAULT_PROPERTY_VALUE="1209600000" FREAD_ONLY="FALSE"/> - - <!-- How long an agent is allowed to be quiet before we consider it down and backfill it --> - <data ID="52" PROPERTY_KEY="AGENT_MAX_QUIET_TIME_ALLOWED" PROPERTY_VALUE="900000" - DEFAULT_PROPERTY_VALUE="900000" FREAD_ONLY="FALSE"/> - - <!-- Will our server-cloud support agents auto-updating themselves? --> - <data ID="53" PROPERTY_KEY="ENABLE_AGENT_AUTO_UPDATE" PROPERTY_VALUE="true" - DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> - - <!-- How old does a trait have to be in order to get purged --> - <data ID="54" PROPERTY_KEY="TRAIT_PURGE" PROPERTY_VALUE="31536000000" - DEFAULT_PROPERTY_VALUE="31536000000" FREAD_ONLY="FALSE"/> - - <!-- How old does availability have to be in order to get purged --> - <data ID="55" PROPERTY_KEY="AVAILABILITY_PURGE" PROPERTY_VALUE="31536000000" - DEFAULT_PROPERTY_VALUE="31536000000" FREAD_ONLY="FALSE"/> - - <data ID="56" PROPERTY_KEY="RESOURCE_GENERIC_PROPERTIES_UPGRADE" PROPERTY_VALUE="false" - DEFAULT_PROPERTY_VALUE="false" FREAD_ONLY="FALSE"/> - - <!-- default drift server plugin settings --> - <data ID="57" PROPERTY_KEY="ACTIVE_DRIFT_PLUGIN" PROPERTY_VALUE="drift-jpa" - DEFAULT_PROPERTY_VALUE="drift-jpa" FREAD_ONLY="FALSE"/> - - <!-- purge drift files older than 31 days by default --> - <data ID="58" PROPERTY_KEY="DRIFT_FILE_PURGE" PROPERTY_VALUE="2678400000" - DEFAULT_PROPERTY_VALUE="2678400000" FREAD_ONLY="FALSE"/> - - </table> - -<!-- END: sysconfig-data.xml --> -<!-- BEGIN: measurement-data.xml --> - - <table name="RHQ_NUMBERS"> - <data i="0"/> - <data i="1"/> - <data i="2"/> - <data i="3"/> - <data i="4"/> - <data i="5"/> - <data i="6"/> - <data i="7"/> - <data i="8"/> - <data i="9"/> - <data i="10"/> - <data i="11"/> - <data i="12"/> - <data i="13"/> - <data i="14"/> - <data i="15"/> - <data i="16"/> - <data i="17"/> - <data i="18"/> - <data i="19"/> - <data i="20"/> - <data i="21"/> - <data i="22"/> - <data i="23"/> - <data i="24"/> - <data i="25"/> - <data i="26"/> - <data i="27"/> - <data i="28"/> - <data i="29"/> - <data i="30"/> - <data i="31"/> - <data i="32"/> - <data i="33"/> - <data i="34"/> - <data i="35"/> - <data i="36"/> - <data i="37"/> - <data i="38"/> - <data i="39"/> - <data i="40"/> - <data i="41"/> - <data i="42"/> - <data i="43"/> - <data i="44"/> - <data i="45"/> - <data i="46"/> - <data i="47"/> - <data i="48"/> - <data i="49"/> - <data i="50"/> - <data i="51"/> - <data i="52"/> - <data i="53"/> - <data i="54"/> - <data i="55"/> - <data i="56"/> - <data i="57"/> - <data i="58"/> - <data i="59"/> - </table> - -<!-- END: measurement-data.xml --> -<!-- BEGIN: content-data.xml --> - - <table name="RHQ_ARCHITECTURE"> - <data id="1" name="noarch"/> - <data id="2" name="i386"/> - <data id="3" name="i486"/> - <data id="4" name="i586"/> - <data id="5" name="i686"/> - <data id="6" name="alpha"/> - <data id="7" name="alphaev6"/> - <data id="8" name="ia64"/> - <data id="9" name="sparc"/> - <data id="10" name="sparcv9"/> - <data id="11" name="sparc64"/> - <data id="12" name="src"/> - <data id="13" name="s390"/> - <data id="14" name="athlon"/> - <data id="15" name="s390x"/> - <data id="16" name="ppc"/> - <data id="17" name="ppc64"/> - <data id="18" name="pSeries"/> - <data id="19" name="iSeries"/> - <data id="20" name="x86_64"/> - <data id="21" name="ppc64iseries"/> - <data id="22" name="ppc64pseries"/> - <data id="23" name="sparc-solaris"/> - <data id="24" name="sparc.sun4u-solaris"/> - <data id="25" name="tar"/> - <data id="26" name="ia32e"/> - <data id="27" name="amd64"/> - <data id="28" name="i386-solaris"/> - <data id="29" name="nosrc"/> - <data id="30" name="sparc-solaris-patch"/> - <data id="31" name="i386-solaris-patch"/> - <data id="32" name="sparc-solaris-patch-cluster"/> - <data id="33" name="i386-solaris-patch-cluster"/> - <data id="34" name="noarch-solaris"/> - <data id="35" name="noarch-solaris-patch"/> - <data id="36" name="noarch-solaris-patch-cluster"/> - <data id="37" name="solaris-patch"/> - <data id="38" name="solaris-patch-cluster"/> - </table> - - <table name="RHQ_REPO_GROUP_TYPE"> - <data id="1" name="family"/> - </table> - - <table name="RHQ_REPO_RELATION_TYPE"> - <data id="1" name="parent"/> - <data id="2" name="clone"/> - </table> - - <table name="RHQ_DISTRIBUTION_TYPE"> - <data id="1" name="kickstart" description="Linux kickstart distribution"/> - <data id="2" name="jumpstart" description="solaris jumpstart distribution"/> - </table> - -<!-- END: content-data.xml --> -<!-- BEGIN: jms-data.xml --> - -<!-- the schema matches that which would be automatically created by the JMS subsystem --> -<!-- see deploy/jms/rhq-jdbc-state-service.xml and rhq-jdbc2-service.xml --> -<!-- the data must match that which is expected in conf/login-config.xml --> - - - <table name="JMS_USERS"> - <data USERID="guest" PASSWD="guest" /> - </table> - - <table name="JMS_ROLES"> - <data ROLEID="guest" USERID="guest" /> - </table> - -<!-- END: jms-data.xml --> -</dbsetup> diff --git a/modules/enterprise/gui/installer/src/test/resources/org/rhq/enterprise/installer/db-data-combined-rhq-4.3.0.xml b/modules/enterprise/gui/installer/src/test/resources/org/rhq/enterprise/installer/db-data-combined-rhq-4.3.0.xml deleted file mode 100644 index a927334..0000000 --- a/modules/enterprise/gui/installer/src/test/resources/org/rhq/enterprise/installer/db-data-combined-rhq-4.3.0.xml +++ /dev/null @@ -1,398 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<dbsetup name="data.xml"> -<!-- BEGIN: auth-data.xml --> - - - <table name="RHQ_PRINCIPAL"> - <data id="2" PRINCIPAL="rhqadmin" PASSWORD="x1XwrxKuPvYUILiOnOZTLg=="/> - </table> - -<!-- END: auth-data.xml --> -<!-- BEGIN: authz-data.xml --> - - - <!-- the overlord user --> - <table name="RHQ_SUBJECT"> - <data ID="1" - NAME="admin" - FIRST_NAME="Super" - LAST_NAME="User" - FSYSTEM="TRUE"/> - </table> - - <!-- the initial rhqadmin user --> - <table name="RHQ_SUBJECT"> - <data ID="2" - NAME="rhqadmin" - FIRST_NAME="RHQ" - LAST_NAME="Administrator" - EMAIL_ADDRESS="rhqadmin@localhost" - FSYSTEM="FALSE"/> - </table> - - <!-- Define the system root role which includes our overlord and rhqadmin users --> - <table name="RHQ_ROLE"> - <data ID="1" - NAME="Super User Role" - FSYSTEM="TRUE" - DESCRIPTION="System superuser role that provides full access to everything. This role cannot be modified."/> - <data ID="2" - NAME="All Resources Role" - FSYSTEM="FALSE" - DESCRIPTION="Provides full access to all resources in inventory. Cannot modify users, roles or server settings."/> - </table> - - <!-- associate the root users with all security permissions --> - <table name="RHQ_SUBJECT_ROLE_MAP"> - <!-- overlord user --> - <data SUBJECT_ID="1" ROLE_ID="1"/> - <!-- rhqadmin user --> - <data SUBJECT_ID="2" ROLE_ID="1"/> - </table> - - <table name="RHQ_PERMISSION"> - <!-- give super-user-role all permissions - (explicitly add resource perms, even though they are implied by MANAGE_INVENTORY) --> - <data ROLE_ID="1" OPERATION="0"/> <!-- Permission.MANAGE_SECURITY --> - <data ROLE_ID="1" OPERATION="1"/> <!-- Permission.MANAGE_INVENTORY --> - <data ROLE_ID="1" OPERATION="2"/> <!-- Permission.MANAGE_SETTINGS --> - <data ROLE_ID="1" OPERATION="12"/> <!-- Permission.MANAGE_BUNDLE --> - <data ROLE_ID="1" OPERATION="15"/> <!-- Permission.MANAGE_REPOSITORIES --> - <data ROLE_ID="1" OPERATION="17"/> <!-- Permission.VIEW_USERS --> - <!-- resource permissions start here--> - <data ROLE_ID="1" OPERATION="3"/> <!-- Permission.VIEW_RESOURCE --> - <data ROLE_ID="1" OPERATION="4"/> <!-- Permission.MODIFY_RESOURCE --> - <data ROLE_ID="1" OPERATION="5"/> <!-- Permission.DELETE_RESOURCE --> - <data ROLE_ID="1" OPERATION="6"/> <!-- Permission.CREATE_CHILD_RESOURCES --> - <data ROLE_ID="1" OPERATION="7"/> <!-- Permission.MANAGE_ALERTS --> - <data ROLE_ID="1" OPERATION="8"/> <!-- Permission.MANAGE_MEASUREMENTS --> - <data ROLE_ID="1" OPERATION="9"/> <!-- Permission.MANAGE_CONTENT --> - <data ROLE_ID="1" OPERATION="10"/> <!-- Permission.CONTROL --> - <data ROLE_ID="1" OPERATION="11"/> <!-- Permission.CONFIGURE_WRITE --> - <data ROLE_ID="1" OPERATION="13"/> <!-- Permission.CONFIGURE_READ --> - <data ROLE_ID="1" OPERATION="14"/> <!-- Permission.MANAGE_EVENTS --> - <data ROLE_ID="1" OPERATION="16"/> <!-- Permission.MANAGE_DRIFT --> - - <!-- give all-resources-role MANAGE_INVENTORY and MANAGE_BUNDLE permissions - (explicitly add resource perms as well, even though they are implied by MANAGE_INVENTORY) --> - <data ROLE_ID="2" OPERATION="1"/> <!-- Permission.MANAGE_INVENTORY --> - <data ROLE_ID="2" OPERATION="12"/> <!-- Permission.MANAGE_BUNDLE --> - <data ROLE_ID="2" OPERATION="17"/> <!-- Permission.VIEW_USERS --> - <!-- resource permissions start here--> - <data ROLE_ID="2" OPERATION="3"/> <!-- Permission.VIEW_RESOURCE --> - <data ROLE_ID="2" OPERATION="4"/> <!-- Permission.MODIFY_RESOURCE --> - <data ROLE_ID="2" OPERATION="5"/> <!-- Permission.DELETE_RESOURCE --> - <data ROLE_ID="2" OPERATION="6"/> <!-- Permission.CREATE_CHILD_RESOURCES --> - <data ROLE_ID="2" OPERATION="7"/> <!-- Permission.MANAGE_ALERTS --> - <data ROLE_ID="2" OPERATION="8"/> <!-- Permission.MANAGE_MEASUREMENTS --> - <data ROLE_ID="2" OPERATION="9"/> <!-- Permission.MANAGE_CONTENT --> - <data ROLE_ID="2" OPERATION="10"/> <!-- Permission.CONTROL --> - <data ROLE_ID="2" OPERATION="11"/> <!-- Permission.CONFIGURE_WRITE --> - <data ROLE_ID="2" OPERATION="13"/> <!-- Permission.CONFIGURE_READ --> - <data ROLE_ID="2" OPERATION="14"/> <!-- Permission.MANAGE_EVENTS --> - <data ROLE_ID="2" OPERATION="16"/> <!-- Permission.MANAGE_DRIFT --> - </table> - -<!-- END: authz-data.xml --> -<!-- BEGIN: 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="availability=down category=platform" - LAST_COMPUTE_TIME="0" - SUBJECT_ID="1" - GLOBAL="TRUE" /> - <data ID="2" - CONTEXT="RESOURCE" - NAME="Downed Servers" - DESCRIPTION="All downed servers across the entire enterprise" - PATTERN="availability=down category=server" - LAST_COMPUTE_TIME="0" - SUBJECT_ID="1" - GLOBAL="TRUE" /> - </table> - -<!-- END: search-data.xml --> -<!-- BEGIN: sysconfig-data.xml --> - - - <!-- - This file contains the seed data for the configuration table. - All keys mentioned here should be referenced via the RHQConstants class - --> - <table name="RHQ_SYSTEM_CONFIG"> - <data ID="1" PROPERTY_KEY="SERVER_VERSION" PROPERTY_VALUE="4.3.0" - DEFAULT_PROPERTY_VALUE="4.3.0" FREAD_ONLY="TRUE"/> - <data ID="2" PROPERTY_KEY="DB_SCHEMA_VERSION" PROPERTY_VALUE="2.119" - DEFAULT_PROPERTY_VALUE="2.119" FREAD_ONLY="TRUE"/> - <data ID="3" PROPERTY_KEY="CAM_JAAS_PROVIDER" PROPERTY_VALUE="JDBC" - DEFAULT_PROPERTY_VALUE="JDBC" FREAD_ONLY="FALSE"/> - <data ID="4" PROPERTY_KEY="CAM_BASE_URL" PROPERTY_VALUE="http://localhost:7080/" - DEFAULT_PROPERTY_VALUE="http://localhost:7080/" FREAD_ONLY="FALSE"/> - <data ID="9" PROPERTY_KEY="CAM_HELP_USER" PROPERTY_VALUE="web" - DEFAULT_PROPERTY_VALUE="web" FREAD_ONLY="FALSE"/> - <data ID="10" PROPERTY_KEY="CAM_HELP_PASSWORD" PROPERTY_VALUE="user" - DEFAULT_PROPERTY_VALUE="user" FREAD_ONLY="FALSE"/> - - <!-- default LDAP configuration options --> - <data ID="11" PROPERTY_KEY="CAM_LDAP_NAMING_FACTORY_INITIAL" - PROPERTY_VALUE="com.sun.jndi.ldap.LdapCtxFactory" - DEFAULT_PROPERTY_VALUE="com.sun.jndi.ldap.LdapCtxFactory" - FREAD_ONLY="FALSE"/> - <data ID="12" PROPERTY_KEY="CAM_LDAP_NAMING_PROVIDER_URL" - PROPERTY_VALUE="ldap://localhost/" - DEFAULT_PROPERTY_VALUE="ldap://localhost/" - FREAD_ONLY="FALSE"/> - <data ID="13" PROPERTY_KEY="CAM_LDAP_LOGIN_PROPERTY" - PROPERTY_VALUE="cn" - DEFAULT_PROPERTY_VALUE="cn" FREAD_ONLY="FALSE"/> - <data ID="14" PROPERTY_KEY="CAM_LDAP_BASE_DN" - PROPERTY_VALUE="o=JBoss,c=US" - DEFAULT_PROPERTY_VALUE="o=JBoss,c=US" - FREAD_ONLY="FALSE"/> - <data ID="15" PROPERTY_KEY="CAM_LDAP_BIND_DN" - PROPERTY_VALUE="" - DEFAULT_PROPERTY_VALUE="" FREAD_ONLY="FALSE"/> - <data ID="16" PROPERTY_KEY="CAM_LDAP_BIND_PW" - PROPERTY_VALUE="" - DEFAULT_PROPERTY_VALUE="" FREAD_ONLY="FALSE"/> - <data ID="17" PROPERTY_KEY="CAM_LDAP_PROTOCOL" - PROPERTY_VALUE="" DEFAULT_PROPERTY_VALUE="" - FREAD_ONLY="FALSE"/> - <data ID="18" PROPERTY_KEY="CAM_LDAP_FILTER" - PROPERTY_VALUE="" DEFAULT_PROPERTY_VALUE="" - FREAD_ONLY="FALSE"/> - - <!-- Does this build support Syslog actions? --> - <data ID="21" PROPERTY_KEY="CAM_SYSLOG_ACTIONS_ENABLED" - PROPERTY_VALUE="false" DEFAULT_PROPERTY_VALUE="false" - FREAD_ONLY="FALSE"/> - <data ID="23" PROPERTY_KEY="CAM_GUIDE_ENABLED" - PROPERTY_VALUE="true" - DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> - <data ID="24" PROPERTY_KEY="CAM_RT_COLLECT_IP_ADDRS" - PROPERTY_VALUE="true" - DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> - - <!-- Default data storage options --> - <!-- Default 14 days --> - <data ID="26" PROPERTY_KEY="CAM_DATA_PURGE_1H" - PROPERTY_VALUE="1209600000" DEFAULT_PROPERTY_VALUE="1209600000" - FREAD_ONLY="FALSE"/> - <!-- Default 31 days --> - <data ID="27" PROPERTY_KEY="CAM_DATA_PURGE_6H" - PROPERTY_VALUE="2678400000" DEFAULT_PROPERTY_VALUE="2678400000" - FREAD_ONLY="FALSE"/> - <!-- Default 1 year --> - <data ID="28" PROPERTY_KEY="CAM_DATA_PURGE_1D" - PROPERTY_VALUE="31536000000" DEFAULT_PROPERTY_VALUE="31536000000" - FREAD_ONLY="FALSE"/> - - <!-- Baseline options --> - <!-- How often to calculate, default 3 days; if 0, never calculate them automatically --> - <data ID="29" PROPERTY_KEY="CAM_BASELINE_FREQUENCY" - PROPERTY_VALUE="259200000" DEFAULT_PROPERTY_VALUE="259200000" - FREAD_ONLY="FALSE"/> - <!-- How much data to include in the calulation, default 7 days --> - <data ID="30" PROPERTY_KEY="CAM_BASELINE_DATASET" - PROPERTY_VALUE="604800000" DEFAULT_PROPERTY_VALUE="604800000" - FREAD_ONLY="FALSE"/> - - <!-- ID 31 has been deleted --> - - <!-- How often to run database maintainence routines --> - <data ID="32" PROPERTY_KEY="CAM_DATA_MAINTENANCE" - PROPERTY_VALUE="3600000" DEFAULT_PROPERTY_VALUE="3600000" FREAD_ONLY="FALSE"/> - - <!-- How long to keep RT data around --> - <data ID="34" PROPERTY_KEY="RT_DATA_PURGE" PROPERTY_VALUE="2678400000" - DEFAULT_PROPERTY_VALUE="2678400000" FREAD_ONLY="FALSE"/> - - <!-- Whether to reindex the data tables nightly --> - <data ID="35" PROPERTY_KEY="DATA_REINDEX_NIGHTLY" PROPERTY_VALUE="true" - DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> - - <!-- How long to keep alerts around --> - <data ID="36" PROPERTY_KEY="ALERT_PURGE" PROPERTY_VALUE="2678400000" - DEFAULT_PROPERTY_VALUE="2678400000" FREAD_ONLY="FALSE"/> - - <!-- How long to keep events around (1209600000 millis == 14 days) --> - <data ID="51" PROPERTY_KEY="EVENT_PURGE" PROPERTY_VALUE="1209600000" - DEFAULT_PROPERTY_VALUE="1209600000" FREAD_ONLY="FALSE"/> - - <!-- How long an agent is allowed to be quiet before we consider it down and backfill it --> - <data ID="52" PROPERTY_KEY="AGENT_MAX_QUIET_TIME_ALLOWED" PROPERTY_VALUE="900000" - DEFAULT_PROPERTY_VALUE="900000" FREAD_ONLY="FALSE"/> - - <!-- Will our server-cloud support agents auto-updating themselves? --> - <data ID="53" PROPERTY_KEY="ENABLE_AGENT_AUTO_UPDATE" PROPERTY_VALUE="true" - DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> - - <!-- How old does a trait have to be in order to get purged --> - <data ID="54" PROPERTY_KEY="TRAIT_PURGE" PROPERTY_VALUE="31536000000" - DEFAULT_PROPERTY_VALUE="31536000000" FREAD_ONLY="FALSE"/> - - <!-- How old does availability have to be in order to get purged --> - <data ID="55" PROPERTY_KEY="AVAILABILITY_PURGE" PROPERTY_VALUE="31536000000" - DEFAULT_PROPERTY_VALUE="31536000000" FREAD_ONLY="FALSE"/> - - <data ID="56" PROPERTY_KEY="RESOURCE_GENERIC_PROPERTIES_UPGRADE" PROPERTY_VALUE="false" - DEFAULT_PROPERTY_VALUE="false" FREAD_ONLY="FALSE"/> - - <!-- default drift server plugin settings --> - <data ID="57" PROPERTY_KEY="ACTIVE_DRIFT_PLUGIN" PROPERTY_VALUE="drift-jpa" - DEFAULT_PROPERTY_VALUE="drift-jpa" FREAD_ONLY="FALSE"/> - - <!-- purge drift files older than 31 days by default --> - <data ID="58" PROPERTY_KEY="DRIFT_FILE_PURGE" PROPERTY_VALUE="2678400000" - DEFAULT_PROPERTY_VALUE="2678400000" FREAD_ONLY="FALSE"/> - - </table> - -<!-- END: sysconfig-data.xml --> -<!-- BEGIN: measurement-data.xml --> - - <table name="RHQ_NUMBERS"> - <data i="0"/> - <data i="1"/> - <data i="2"/> - <data i="3"/> - <data i="4"/> - <data i="5"/> - <data i="6"/> - <data i="7"/> - <data i="8"/> - <data i="9"/> - <data i="10"/> - <data i="11"/> - <data i="12"/> - <data i="13"/> - <data i="14"/> - <data i="15"/> - <data i="16"/> - <data i="17"/> - <data i="18"/> - <data i="19"/> - <data i="20"/> - <data i="21"/> - <data i="22"/> - <data i="23"/> - <data i="24"/> - <data i="25"/> - <data i="26"/> - <data i="27"/> - <data i="28"/> - <data i="29"/> - <data i="30"/> - <data i="31"/> - <data i="32"/> - <data i="33"/> - <data i="34"/> - <data i="35"/> - <data i="36"/> - <data i="37"/> - <data i="38"/> - <data i="39"/> - <data i="40"/> - <data i="41"/> - <data i="42"/> - <data i="43"/> - <data i="44"/> - <data i="45"/> - <data i="46"/> - <data i="47"/> - <data i="48"/> - <data i="49"/> - <data i="50"/> - <data i="51"/> - <data i="52"/> - <data i="53"/> - <data i="54"/> - <data i="55"/> - <data i="56"/> - <data i="57"/> - <data i="58"/> - <data i="59"/> - </table> - -<!-- END: measurement-data.xml --> -<!-- BEGIN: content-data.xml --> - - <table name="RHQ_ARCHITECTURE"> - <data id="1" name="noarch"/> - <data id="2" name="i386"/> - <data id="3" name="i486"/> - <data id="4" name="i586"/> - <data id="5" name="i686"/> - <data id="6" name="alpha"/> - <data id="7" name="alphaev6"/> - <data id="8" name="ia64"/> - <data id="9" name="sparc"/> - <data id="10" name="sparcv9"/> - <data id="11" name="sparc64"/> - <data id="12" name="src"/> - <data id="13" name="s390"/> - <data id="14" name="athlon"/> - <data id="15" name="s390x"/> - <data id="16" name="ppc"/> - <data id="17" name="ppc64"/> - <data id="18" name="pSeries"/> - <data id="19" name="iSeries"/> - <data id="20" name="x86_64"/> - <data id="21" name="ppc64iseries"/> - <data id="22" name="ppc64pseries"/> - <data id="23" name="sparc-solaris"/> - <data id="24" name="sparc.sun4u-solaris"/> - <data id="25" name="tar"/> - <data id="26" name="ia32e"/> - <data id="27" name="amd64"/> - <data id="28" name="i386-solaris"/> - <data id="29" name="nosrc"/> - <data id="30" name="sparc-solaris-patch"/> - <data id="31" name="i386-solaris-patch"/> - <data id="32" name="sparc-solaris-patch-cluster"/> - <data id="33" name="i386-solaris-patch-cluster"/> - <data id="34" name="noarch-solaris"/> - <data id="35" name="noarch-solaris-patch"/> - <data id="36" name="noarch-solaris-patch-cluster"/> - <data id="37" name="solaris-patch"/> - <data id="38" name="solaris-patch-cluster"/> - </table> - - <table name="RHQ_REPO_GROUP_TYPE"> - <data id="1" name="family"/> - </table> - - <table name="RHQ_REPO_RELATION_TYPE"> - <data id="1" name="parent"/> - <data id="2" name="clone"/> - </table> - - <table name="RHQ_DISTRIBUTION_TYPE"> - <data id="1" name="kickstart" description="Linux kickstart distribution"/> - <data id="2" name="jumpstart" description="solaris jumpstart distribution"/> - </table> - -<!-- END: content-data.xml --> -<!-- BEGIN: jms-data.xml --> - -<!-- the schema matches that which would be automatically created by the JMS subsystem --> -<!-- see deploy/jms/rhq-jdbc-state-service.xml and rhq-jdbc2-service.xml --> -<!-- the data must match that which is expected in conf/login-config.xml --> - - - <table name="JMS_USERS"> - <data USERID="guest" PASSWD="guest" /> - </table> - - <table name="JMS_ROLES"> - <data ROLEID="guest" USERID="guest" /> - </table> - -<!-- END: jms-data.xml --> -</dbsetup> diff --git a/modules/enterprise/gui/installer/src/test/resources/org/rhq/enterprise/installer/db-data-combined-rhq-4.4.0.xml b/modules/enterprise/gui/installer/src/test/resources/org/rhq/enterprise/installer/db-data-combined-rhq-4.4.0.xml deleted file mode 100644 index 1c2fbb1..0000000 --- a/modules/enterprise/gui/installer/src/test/resources/org/rhq/enterprise/installer/db-data-combined-rhq-4.4.0.xml +++ /dev/null @@ -1,398 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<dbsetup name="data.xml"> -<!-- BEGIN: auth-data.xml --> - - - <table name="RHQ_PRINCIPAL"> - <data id="2" PRINCIPAL="rhqadmin" PASSWORD="x1XwrxKuPvYUILiOnOZTLg=="/> - </table> - -<!-- END: auth-data.xml --> -<!-- BEGIN: authz-data.xml --> - - - <!-- the overlord user --> - <table name="RHQ_SUBJECT"> - <data ID="1" - NAME="admin" - FIRST_NAME="Super" - LAST_NAME="User" - FSYSTEM="TRUE"/> - </table> - - <!-- the initial rhqadmin user --> - <table name="RHQ_SUBJECT"> - <data ID="2" - NAME="rhqadmin" - FIRST_NAME="RHQ" - LAST_NAME="Administrator" - EMAIL_ADDRESS="rhqadmin@localhost" - FSYSTEM="FALSE"/> - </table> - - <!-- Define the system root role which includes our overlord and rhqadmin users --> - <table name="RHQ_ROLE"> - <data ID="1" - NAME="Super User Role" - FSYSTEM="TRUE" - DESCRIPTION="System superuser role that provides full access to everything. This role cannot be modified."/> - <data ID="2" - NAME="All Resources Role" - FSYSTEM="FALSE" - DESCRIPTION="Provides full access to all resources in inventory. Cannot modify users, roles or server settings."/> - </table> - - <!-- associate the root users with all security permissions --> - <table name="RHQ_SUBJECT_ROLE_MAP"> - <!-- overlord user --> - <data SUBJECT_ID="1" ROLE_ID="1"/> - <!-- rhqadmin user --> - <data SUBJECT_ID="2" ROLE_ID="1"/> - </table> - - <table name="RHQ_PERMISSION"> - <!-- give super-user-role all permissions - (explicitly add resource perms, even though they are implied by MANAGE_INVENTORY) --> - <data ROLE_ID="1" OPERATION="0"/> <!-- Permission.MANAGE_SECURITY --> - <data ROLE_ID="1" OPERATION="1"/> <!-- Permission.MANAGE_INVENTORY --> - <data ROLE_ID="1" OPERATION="2"/> <!-- Permission.MANAGE_SETTINGS --> - <data ROLE_ID="1" OPERATION="12"/> <!-- Permission.MANAGE_BUNDLE --> - <data ROLE_ID="1" OPERATION="15"/> <!-- Permission.MANAGE_REPOSITORIES --> - <data ROLE_ID="1" OPERATION="17"/> <!-- Permission.VIEW_USERS --> - <!-- resource permissions start here--> - <data ROLE_ID="1" OPERATION="3"/> <!-- Permission.VIEW_RESOURCE --> - <data ROLE_ID="1" OPERATION="4"/> <!-- Permission.MODIFY_RESOURCE --> - <data ROLE_ID="1" OPERATION="5"/> <!-- Permission.DELETE_RESOURCE --> - <data ROLE_ID="1" OPERATION="6"/> <!-- Permission.CREATE_CHILD_RESOURCES --> - <data ROLE_ID="1" OPERATION="7"/> <!-- Permission.MANAGE_ALERTS --> - <data ROLE_ID="1" OPERATION="8"/> <!-- Permission.MANAGE_MEASUREMENTS --> - <data ROLE_ID="1" OPERATION="9"/> <!-- Permission.MANAGE_CONTENT --> - <data ROLE_ID="1" OPERATION="10"/> <!-- Permission.CONTROL --> - <data ROLE_ID="1" OPERATION="11"/> <!-- Permission.CONFIGURE_WRITE --> - <data ROLE_ID="1" OPERATION="13"/> <!-- Permission.CONFIGURE_READ --> - <data ROLE_ID="1" OPERATION="14"/> <!-- Permission.MANAGE_EVENTS --> - <data ROLE_ID="1" OPERATION="16"/> <!-- Permission.MANAGE_DRIFT --> - - <!-- give all-resources-role MANAGE_INVENTORY and MANAGE_BUNDLE permissions - (explicitly add resource perms as well, even though they are implied by MANAGE_INVENTORY) --> - <data ROLE_ID="2" OPERATION="1"/> <!-- Permission.MANAGE_INVENTORY --> - <data ROLE_ID="2" OPERATION="12"/> <!-- Permission.MANAGE_BUNDLE --> - <data ROLE_ID="2" OPERATION="17"/> <!-- Permission.VIEW_USERS --> - <!-- resource permissions start here--> - <data ROLE_ID="2" OPERATION="3"/> <!-- Permission.VIEW_RESOURCE --> - <data ROLE_ID="2" OPERATION="4"/> <!-- Permission.MODIFY_RESOURCE --> - <data ROLE_ID="2" OPERATION="5"/> <!-- Permission.DELETE_RESOURCE --> - <data ROLE_ID="2" OPERATION="6"/> <!-- Permission.CREATE_CHILD_RESOURCES --> - <data ROLE_ID="2" OPERATION="7"/> <!-- Permission.MANAGE_ALERTS --> - <data ROLE_ID="2" OPERATION="8"/> <!-- Permission.MANAGE_MEASUREMENTS --> - <data ROLE_ID="2" OPERATION="9"/> <!-- Permission.MANAGE_CONTENT --> - <data ROLE_ID="2" OPERATION="10"/> <!-- Permission.CONTROL --> - <data ROLE_ID="2" OPERATION="11"/> <!-- Permission.CONFIGURE_WRITE --> - <data ROLE_ID="2" OPERATION="13"/> <!-- Permission.CONFIGURE_READ --> - <data ROLE_ID="2" OPERATION="14"/> <!-- Permission.MANAGE_EVENTS --> - <data ROLE_ID="2" OPERATION="16"/> <!-- Permission.MANAGE_DRIFT --> - </table> - -<!-- END: authz-data.xml --> -<!-- BEGIN: 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="availability=down category=platform" - LAST_COMPUTE_TIME="0" - SUBJECT_ID="1" - GLOBAL="TRUE" /> - <data ID="2" - CONTEXT="RESOURCE" - NAME="Downed Servers" - DESCRIPTION="All downed servers across the entire enterprise" - PATTERN="availability=down category=server" - LAST_COMPUTE_TIME="0" - SUBJECT_ID="1" - GLOBAL="TRUE" /> - </table> - -<!-- END: search-data.xml --> -<!-- BEGIN: sysconfig-data.xml --> - - - <!-- - This file contains the seed data for the configuration table. - All keys mentioned here should be referenced via the RHQConstants class - --> - <table name="RHQ_SYSTEM_CONFIG"> - <data ID="1" PROPERTY_KEY="SERVER_VERSION" PROPERTY_VALUE="4.4.0" - DEFAULT_PROPERTY_VALUE="4.4.0" FREAD_ONLY="TRUE"/> - <data ID="2" PROPERTY_KEY="DB_SCHEMA_VERSION" PROPERTY_VALUE="2.121" - DEFAULT_PROPERTY_VALUE="2.121" FREAD_ONLY="TRUE"/> - <data ID="3" PROPERTY_KEY="CAM_JAAS_PROVIDER" PROPERTY_VALUE="JDBC" - DEFAULT_PROPERTY_VALUE="JDBC" FREAD_ONLY="FALSE"/> - <data ID="4" PROPERTY_KEY="CAM_BASE_URL" PROPERTY_VALUE="http://localhost:7080/" - DEFAULT_PROPERTY_VALUE="http://localhost:7080/" FREAD_ONLY="FALSE"/> - <data ID="9" PROPERTY_KEY="CAM_HELP_USER" PROPERTY_VALUE="web" - DEFAULT_PROPERTY_VALUE="web" FREAD_ONLY="FALSE"/> - <data ID="10" PROPERTY_KEY="CAM_HELP_PASSWORD" PROPERTY_VALUE="user" - DEFAULT_PROPERTY_VALUE="user" FREAD_ONLY="FALSE"/> - - <!-- default LDAP configuration options --> - <data ID="11" PROPERTY_KEY="CAM_LDAP_NAMING_FACTORY_INITIAL" - PROPERTY_VALUE="com.sun.jndi.ldap.LdapCtxFactory" - DEFAULT_PROPERTY_VALUE="com.sun.jndi.ldap.LdapCtxFactory" - FREAD_ONLY="FALSE"/> - <data ID="12" PROPERTY_KEY="CAM_LDAP_NAMING_PROVIDER_URL" - PROPERTY_VALUE="ldap://localhost/" - DEFAULT_PROPERTY_VALUE="ldap://localhost/" - FREAD_ONLY="FALSE"/> - <data ID="13" PROPERTY_KEY="CAM_LDAP_LOGIN_PROPERTY" - PROPERTY_VALUE="cn" - DEFAULT_PROPERTY_VALUE="cn" FREAD_ONLY="FALSE"/> - <data ID="14" PROPERTY_KEY="CAM_LDAP_BASE_DN" - PROPERTY_VALUE="o=JBoss,c=US" - DEFAULT_PROPERTY_VALUE="o=JBoss,c=US" - FREAD_ONLY="FALSE"/> - <data ID="15" PROPERTY_KEY="CAM_LDAP_BIND_DN" - PROPERTY_VALUE="" - DEFAULT_PROPERTY_VALUE="" FREAD_ONLY="FALSE"/> - <data ID="16" PROPERTY_KEY="CAM_LDAP_BIND_PW" - PROPERTY_VALUE="" - DEFAULT_PROPERTY_VALUE="" FREAD_ONLY="FALSE"/> - <data ID="17" PROPERTY_KEY="CAM_LDAP_PROTOCOL" - PROPERTY_VALUE="" DEFAULT_PROPERTY_VALUE="" - FREAD_ONLY="FALSE"/> - <data ID="18" PROPERTY_KEY="CAM_LDAP_FILTER" - PROPERTY_VALUE="" DEFAULT_PROPERTY_VALUE="" - FREAD_ONLY="FALSE"/> - - <!-- Does this build support Syslog actions? --> - <data ID="21" PROPERTY_KEY="CAM_SYSLOG_ACTIONS_ENABLED" - PROPERTY_VALUE="false" DEFAULT_PROPERTY_VALUE="false" - FREAD_ONLY="FALSE"/> - <data ID="23" PROPERTY_KEY="CAM_GUIDE_ENABLED" - PROPERTY_VALUE="true" - DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> - <data ID="24" PROPERTY_KEY="CAM_RT_COLLECT_IP_ADDRS" - PROPERTY_VALUE="true" - DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> - - <!-- Default data storage options --> - <!-- Default 14 days --> - <data ID="26" PROPERTY_KEY="CAM_DATA_PURGE_1H" - PROPERTY_VALUE="1209600000" DEFAULT_PROPERTY_VALUE="1209600000" - FREAD_ONLY="FALSE"/> - <!-- Default 31 days --> - <data ID="27" PROPERTY_KEY="CAM_DATA_PURGE_6H" - PROPERTY_VALUE="2678400000" DEFAULT_PROPERTY_VALUE="2678400000" - FREAD_ONLY="FALSE"/> - <!-- Default 1 year --> - <data ID="28" PROPERTY_KEY="CAM_DATA_PURGE_1D" - PROPERTY_VALUE="31536000000" DEFAULT_PROPERTY_VALUE="31536000000" - FREAD_ONLY="FALSE"/> - - <!-- Baseline options --> - <!-- How often to calculate, default 3 days; if 0, never calculate them automatically --> - <data ID="29" PROPERTY_KEY="CAM_BASELINE_FREQUENCY" - PROPERTY_VALUE="259200000" DEFAULT_PROPERTY_VALUE="259200000" - FREAD_ONLY="FALSE"/> - <!-- How much data to include in the calulation, default 7 days --> - <data ID="30" PROPERTY_KEY="CAM_BASELINE_DATASET" - PROPERTY_VALUE="604800000" DEFAULT_PROPERTY_VALUE="604800000" - FREAD_ONLY="FALSE"/> - - <!-- ID 31 has been deleted --> - - <!-- How often to run database maintainence routines --> - <data ID="32" PROPERTY_KEY="CAM_DATA_MAINTENANCE" - PROPERTY_VALUE="3600000" DEFAULT_PROPERTY_VALUE="3600000" FREAD_ONLY="FALSE"/> - - <!-- How long to keep RT data around --> - <data ID="34" PROPERTY_KEY="RT_DATA_PURGE" PROPERTY_VALUE="2678400000" - DEFAULT_PROPERTY_VALUE="2678400000" FREAD_ONLY="FALSE"/> - - <!-- Whether to reindex the data tables nightly --> - <data ID="35" PROPERTY_KEY="DATA_REINDEX_NIGHTLY" PROPERTY_VALUE="true" - DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> - - <!-- How long to keep alerts around --> - <data ID="36" PROPERTY_KEY="ALERT_PURGE" PROPERTY_VALUE="2678400000" - DEFAULT_PROPERTY_VALUE="2678400000" FREAD_ONLY="FALSE"/> - - <!-- How long to keep events around (1209600000 millis == 14 days) --> - <data ID="51" PROPERTY_KEY="EVENT_PURGE" PROPERTY_VALUE="1209600000" - DEFAULT_PROPERTY_VALUE="1209600000" FREAD_ONLY="FALSE"/> - - <!-- How long an agent is allowed to be quiet before we consider it down and backfill it --> - <data ID="52" PROPERTY_KEY="AGENT_MAX_QUIET_TIME_ALLOWED" PROPERTY_VALUE="300000" - DEFAULT_PROPERTY_VALUE="300000" FREAD_ONLY="FALSE"/> - - <!-- Will our server-cloud support agents auto-updating themselves? --> - <data ID="53" PROPERTY_KEY="ENABLE_AGENT_AUTO_UPDATE" PROPERTY_VALUE="true" - DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> - - <!-- How old does a trait have to be in order to get purged --> - <data ID="54" PROPERTY_KEY="TRAIT_PURGE" PROPERTY_VALUE="31536000000" - DEFAULT_PROPERTY_VALUE="31536000000" FREAD_ONLY="FALSE"/> - - <!-- How old does availability have to be in order to get purged --> - <data ID="55" PROPERTY_KEY="AVAILABILITY_PURGE" PROPERTY_VALUE="31536000000" - DEFAULT_PROPERTY_VALUE="31536000000" FREAD_ONLY="FALSE"/> - - <data ID="56" PROPERTY_KEY="RESOURCE_GENERIC_PROPERTIES_UPGRADE" PROPERTY_VALUE="false" - DEFAULT_PROPERTY_VALUE="false" FREAD_ONLY="FALSE"/> - - <!-- default drift server plugin settings --> - <data ID="57" PROPERTY_KEY="ACTIVE_DRIFT_PLUGIN" PROPERTY_VALUE="drift-jpa" - DEFAULT_PROPERTY_VALUE="drift-jpa" FREAD_ONLY="FALSE"/> - - <!-- purge drift files older than 31 days by default --> - <data ID="58" PROPERTY_KEY="DRIFT_FILE_PURGE" PROPERTY_VALUE="2678400000" - DEFAULT_PROPERTY_VALUE="2678400000" FREAD_ONLY="FALSE"/> - - </table> - -<!-- END: sysconfig-data.xml --> -<!-- BEGIN: measurement-data.xml --> - - <table name="RHQ_NUMBERS"> - <data i="0"/> - <data i="1"/> - <data i="2"/> - <data i="3"/> - <data i="4"/> - <data i="5"/> - <data i="6"/> - <data i="7"/> - <data i="8"/> - <data i="9"/> - <data i="10"/> - <data i="11"/> - <data i="12"/> - <data i="13"/> - <data i="14"/> - <data i="15"/> - <data i="16"/> - <data i="17"/> - <data i="18"/> - <data i="19"/> - <data i="20"/> - <data i="21"/> - <data i="22"/> - <data i="23"/> - <data i="24"/> - <data i="25"/> - <data i="26"/> - <data i="27"/> - <data i="28"/> - <data i="29"/> - <data i="30"/> - <data i="31"/> - <data i="32"/> - <data i="33"/> - <data i="34"/> - <data i="35"/> - <data i="36"/> - <data i="37"/> - <data i="38"/> - <data i="39"/> - <data i="40"/> - <data i="41"/> - <data i="42"/> - <data i="43"/> - <data i="44"/> - <data i="45"/> - <data i="46"/> - <data i="47"/> - <data i="48"/> - <data i="49"/> - <data i="50"/> - <data i="51"/> - <data i="52"/> - <data i="53"/> - <data i="54"/> - <data i="55"/> - <data i="56"/> - <data i="57"/> - <data i="58"/> - <data i="59"/> - </table> - -<!-- END: measurement-data.xml --> -<!-- BEGIN: content-data.xml --> - - <table name="RHQ_ARCHITECTURE"> - <data id="1" name="noarch"/> - <data id="2" name="i386"/> - <data id="3" name="i486"/> - <data id="4" name="i586"/> - <data id="5" name="i686"/> - <data id="6" name="alpha"/> - <data id="7" name="alphaev6"/> - <data id="8" name="ia64"/> - <data id="9" name="sparc"/> - <data id="10" name="sparcv9"/> - <data id="11" name="sparc64"/> - <data id="12" name="src"/> - <data id="13" name="s390"/> - <data id="14" name="athlon"/> - <data id="15" name="s390x"/> - <data id="16" name="ppc"/> - <data id="17" name="ppc64"/> - <data id="18" name="pSeries"/> - <data id="19" name="iSeries"/> - <data id="20" name="x86_64"/> - <data id="21" name="ppc64iseries"/> - <data id="22" name="ppc64pseries"/> - <data id="23" name="sparc-solaris"/> - <data id="24" name="sparc.sun4u-solaris"/> - <data id="25" name="tar"/> - <data id="26" name="ia32e"/> - <data id="27" name="amd64"/> - <data id="28" name="i386-solaris"/> - <data id="29" name="nosrc"/> - <data id="30" name="sparc-solaris-patch"/> - <data id="31" name="i386-solaris-patch"/> - <data id="32" name="sparc-solaris-patch-cluster"/> - <data id="33" name="i386-solaris-patch-cluster"/> - <data id="34" name="noarch-solaris"/> - <data id="35" name="noarch-solaris-patch"/> - <data id="36" name="noarch-solaris-patch-cluster"/> - <data id="37" name="solaris-patch"/> - <data id="38" name="solaris-patch-cluster"/> - </table> - - <table name="RHQ_REPO_GROUP_TYPE"> - <data id="1" name="family"/> - </table> - - <table name="RHQ_REPO_RELATION_TYPE"> - <data id="1" name="parent"/> - <data id="2" name="clone"/> - </table> - - <table name="RHQ_DISTRIBUTION_TYPE"> - <data id="1" name="kickstart" description="Linux kickstart distribution"/> - <data id="2" name="jumpstart" description="solaris jumpstart distribution"/> - </table> - -<!-- END: content-data.xml --> -<!-- BEGIN: jms-data.xml --> - -<!-- the schema matches that which would be automatically created by the JMS subsystem --> -<!-- see deploy/jms/rhq-jdbc-state-service.xml and rhq-jdbc2-service.xml --> -<!-- the data must match that which is expected in conf/login-config.xml --> - - - <table name="JMS_USERS"> - <data USERID="guest" PASSWD="guest" /> - </table> - - <table name="JMS_ROLES"> - <data ROLEID="guest" USERID="guest" /> - </table> - -<!-- END: jms-data.xml --> -</dbsetup> diff --git a/modules/enterprise/gui/installer/src/test/resources/org/rhq/enterprise/installer/db-schema-combined-2.4.0.xml b/modules/enterprise/gui/installer/src/test/resources/org/rhq/enterprise/installer/db-schema-combined-2.4.0.xml deleted file mode 100644 index 8ac0762..0000000 --- a/modules/enterprise/gui/installer/src/test/resources/org/rhq/enterprise/installer/db-schema-combined-2.4.0.xml +++ /dev/null @@ -1,2494 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<dbsetup name="schema"> -<!-- BEGIN: config-schema.xml --> - - - <!-- Definition or Metadata tables --> - - <table name="RHQ_CONFIG_DEF"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="NAME" type="VARCHAR2" required="true" size="100"/> - <column name="DESCRIPTION" type="VARCHAR2" required="false" size="250"/> - <column name="VERSION" type="VARCHAR2" required="false" size="50"/> - <column name="CONFIG_FORMAT" type="VARCHAR2" required="false" size="32"/> - </table> - - <table name="RHQ_CONFIG_PROP_GRP_DEF"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="NAME" type="VARCHAR2" required="true" size="100"/> - <column name="DISPLAY_NAME" type="VARCHAR2" required="false" size="100"/> - <column name="DESCRIPTION" type="VARCHAR2" required="false" size="250"/> - <column name="DEFAULT_HIDDEN" type="BOOLEAN" required="false"/> - <column name="ORDER_INDEX" type="INTEGER" required="false"/> - </table> - - <table name="RHQ_CONFIG_PROP_DEF"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="NAME" type="VARCHAR2" required="false" size="255"/> - <column name="DISPLAY_NAME" type="VARCHAR2" required="false" size="100"/> - <column name="DESCRIPTION" type="VARCHAR2" required="false" size="1000"/> - <column name="DEFAULT_VALUE" type="VARCHAR2" required="false" size="2000"/> - <column name="REQUIRED" type="BOOLEAN" required="false"/> - <column name="READONLY" type="BOOLEAN" required="false"/> - <column name="SUMMARY" type="BOOLEAN" required="false"/> - <column name="ACTIVATION_POLICY" type="VARCHAR2" required="false" size="20"/> - <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_GRP_DEF"/> - <column name="ORDER_INDEX" type="INTEGER" required="false"/> - <column name="VERSION" type="VARCHAR2" required="false" size="50"/> - <column name="PARENT_MAP_DEFINITION_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> - <column name="PARENT_LIST_DEFINITION_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> - <column name="SIMPLE_TYPE" type="VARCHAR2" required="false" size="20"/> - <column name="ALLOW_CUSTOM_ENUM_VALUE" type="BOOLEAN" required="false"/> - <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> - <column name="CONFIG_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_DEF"/> - - <!-- only simple properties (not lists and maps) have this --> - <column name="UNITS" type="SMALLINT" required="false"/> - - <!-- only dynamic properties (not simple) have this --> - <column name="DYNAMIC_TYPE" type="VARCHAR2" size="20" required="false"/> - <column name="DYNAMIC_KEY" type="VARCHAR2" size="128" required="false"/> - </table> - - <table name="RHQ_CONF_PROP_DEF_ENUM"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="STRING_VALUE" type="VARCHAR2" required="false" size="500"/> - <column name="ORDER_INDEX" type="INTEGER" required="false"/> - <column name="IS_DEFAULT" type="BOOLEAN" required="false"/> - <column name="NAME" type="VARCHAR2" required="false" size="100"/> - <column name="PROPERTY_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> - </table> - - <table name="RHQ_CONFIG_PROP_CONSTR"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="DTYPE" type="VARCHAR2" required="true" size="15"/> - <column name="DETAILS" type="VARCHAR2" required="false" size="250"/> - <column name="CONFIG_PROP_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> - <column name="ORDER_INDEX" type="INTEGER" required="false"/> - </table> - - - <!-- Content or value tables --> - - <table name="RHQ_CONFIG"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="NOTES" type="VARCHAR2" required="false" size="512"/> - <column name="VERSION" type="VARCHAR2" required="false" size="50"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - </table> - - <table name="RHQ_CONFIG_PROPERTY"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="CONFIGURATION_ID" type="INTEGER" required="false" references="RHQ_CONFIG" ondelete="cascade"/> - <column name="STRING_VALUE" type="VARCHAR2" required="false" size="2000"/> - <column name="OVERRIDE" type="BOOLEAN" required="false"/> - <column name="NAME" type="VARCHAR2" required="true" size="255"/> - <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> - <!-- Recursive cascade path to RHQ_CONFIG_PROPERTY causes constraint creation errors on SQL Server, see - http://support.microsoft.com/kb/321843 --> - <column name="PARENT_LIST_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROPERTY" ondelete="cascade" /> - <column name="PARENT_MAP_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROPERTY" ondelete="cascade" /> - <column name="LIST_INDEX" type="INTEGER"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <index name="RHQ_CONFIG_PROP_idx_prop_key" unique="false"> - <field ref="CONFIGURATION_ID"/> - <field ref="NAME"/> - </index> - <index name="RHQ_CONFIG_PROP_idx_map_key" unique="false"> - <field ref="PARENT_MAP_ID"/> - <field ref="NAME"/> - </index> - <index name="RHQ_CONFIG_PROP_idx_list_key" unique="false"> - <field ref="PARENT_LIST_ID"/> - </index> - <!-- List entries all have the same name --> - </table> - - <table name="RHQ_CONFIG_TEMPLATE"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="NAME" type="VARCHAR2" required="false" size="100"/> - <column name="DESCRIPTION" type="VARCHAR2" required="false" size="500"/> - <column name="CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> - <column name="CONFIG_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_DEF"/> - <column name="IS_DEFAULT" type="BOOLEAN" required="false"/> - </table> - - <table name="RHQ_RAW_CONFIG"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="CONFIG_ID" type="INTEGER" required="true" references="RHQ_CONFIG(ID)"/> - <column name="PATH" type="VARCHAR2" required="false" size="512"/> - <column name="CONTENTS" type="CLOB" required="true"/> - <column name="SHA256" type="VARCHAR2" size="64" required="true"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - </table> - -<!-- END: config-schema.xml --> -<!-- BEGIN: cluster-schema.xml --> - - <table name="RHQ_AFFINITY_GROUP"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" required="true" size="255" type="VARCHAR2"/> - </table> - - <table name="RHQ_SERVER"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" required="true" size="255" type="VARCHAR2"/> - <column name="ADDRESS" required="true" size="255" type="VARCHAR2"/> - <column name="PORT" required="true" type="INTEGER"/> - <column name="SECURE_PORT" required="true" type="INTEGER"/> - <column name="CTIME" required="true" type="LONG"/> - <column name="MTIME" required="true" type="LONG"/> - <column name="AFFINITY_GROUP_ID" type="INTEGER" references="RHQ_AFFINITY_GROUP" required="false"/> - <column name="COMPUTE_POWER" required="true" type="INTEGER"/> - <column name="OPERATION_MODE" required="true" size="32" type="VARCHAR2"/> - <column name="STATUS" type="INTEGER" required="false" default="0" /> - - <!-- This index is for constraint, not performance --> - <index name="RHQ_SERVER_NAME_UNIQUE" unique="true"> - <field ref="NAME"/> - </index> - </table> - - <!-- new agent --> - <table name="RHQ_AGENT"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" required="true" size="255" type="VARCHAR2"/> - <column name="ADDRESS" required="true" size="255" type="VARCHAR2"/> - <column name="PORT" required="true" type="INTEGER"/> - <column name="AGENTTOKEN" required="true" size="100" type="VARCHAR2"/> - <column name="REMOTE_ENDPOINT" required="false" size="4000" type="VARCHAR2"/> - <column name="CTIME" required="true" type="LONG"/> - <column name="MTIME" required="true" type="LONG"/> - <column name="LAST_AVAILABILITY_REPORT" required="false" type="LONG"/> - <column name="AFFINITY_GROUP_ID" type="INTEGER" references="RHQ_AFFINITY_GROUP" required="false"/> - <column name="SERVER_ID" type="INTEGER" references="RHQ_SERVER" required="false"/> - <column name="STATUS" type="INTEGER" required="false" default="0" /> - <column name="BACKFILLED" type="BOOLEAN" required="true" /> - - <index name="RHQ_AGENT_NAME_UNIQUE" unique="true"> - <field ref="NAME"/> - </index> - - <index name="RHQ_AGENT_ADDRESS_PORT" unique="true"> - <field ref="ADDRESS"/> - <field ref="PORT"/> - </index> - - <index name="RHQ_AGENT_TOKEN_UNIQUE" unique="true"> - <field ref="AGENTTOKEN"/> - </index> - </table> - - <table name="RHQ_PARTITION_EVENT"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="SUBJECT_NAME" required="true" size="255" type="VARCHAR2"/> - <column name="CTIME" required="true" type="LONG"/> - <column name="EVENT_TYPE" required="true" size="50" type="VARCHAR2"/> - <column name="EVENT_DETAIL" required="false" size="512" type="VARCHAR2"/> - <column name="EXECUTION_STATUS" required="true" size="32" type="VARCHAR2"/> - </table> - - <table name="RHQ_PARTITION_DETAILS"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="PARTITION_EVENT_ID" type="INTEGER" references="RHQ_PARTITION_EVENT" required="true"/> - <column name="AGENT_NAME" type="VARCHAR2" size="255" required="true"/> - <column name="SERVER_NAME" type="VARCHAR2" size="255" required="true"/> - </table> - - <table name="RHQ_FAILOVER_LIST"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="PARTITION_EVENT_ID" type="INTEGER" references="RHQ_PARTITION_EVENT" required="true"/> - <column name="AGENT_ID" type="INTEGER" references="RHQ_AGENT" required="true"/> - <column name="CTIME" required="true" type="LONG"/> - </table> - - <table name="RHQ_FAILOVER_DETAILS"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="FAILOVER_LIST_ID" type="INTEGER" references="RHQ_FAILOVER_LIST" required="true"/> - <column name="SERVER_ID" type="INTEGER" references="RHQ_SERVER" required="true"/> - <column name="ORDINAL" type = "INTEGER" required="true"/> - </table> - -<!-- END: cluster-schema.xml --> -<!-- BEGIN: inventory-schema.xml --> - - - <!-- NEW RESOURCE TYPES --> - <table name="RHQ_RESOURCE_TYPE"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" type="VARCHAR2" size="100" required="true"/> - <column name="CATEGORY" type="VARCHAR2" size="16" required="true"/> - <column name="CREATION_DATA_TYPE" type="VARCHAR2" size="16" required="true"/> - <column name="CREATE_DELETE_POLICY" type="VARCHAR2" size="16" required="true"/> - <column name="SINGLETON" type="BOOLEAN" required="true"/> - <column name="SUPPORTS_MANUAL_ADD" type="BOOLEAN" required="true"/> - <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> - <column name="PLUGIN" type="VARCHAR2" size="100"/> - <column name="CTIME" type="LONG"/> - <column name="MTIME" type="LONG"/> - <column name="SUBCATEGORY_ID" type="INTEGER"/> - <!-- - TODO add support to DB setup for tables with circular dependencies and then add back this RI - <column name="SUBCATEGORY_ID" type="INTEGER" references="RHQ_RESOURCE_SUBCAT" /> - --> - <column name="PLUGIN_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> - <column name="RES_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> - - <index name="RHQ_RES_TYPE_IDX_PLG_NAME" unique="true"> - <field ref="NAME"/> - <field ref="PLUGIN"/> - </index> - </table> - - <!-- NEW RESOURCE SUBCATEGORIES --> - <table name="RHQ_RESOURCE_SUBCAT"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" type="VARCHAR2" size="100"/> - <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> - <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> - <column name="CTIME" type="LONG"/> - <column name="MTIME" type="LONG"/> - <column name="PARENT_SUBCATEGORY_ID" type="INTEGER" references="RHQ_RESOURCE_SUBCAT"/> - <!-- resourceTypeId is not required on child sub categories --> - <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> - </table> - - <!-- Many To Many mapping for resource type to its parents --> - <table name="RHQ_RESOURCE_TYPE_PARENTS"> - <column name="RESOURCE_TYPE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> - <column name="PARENT_RESOURCE_TYPE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> - - <!-- not using full words to fit index name length --> - <constraint name="RHQ_RES_TYPE_PARENTS_KEY"> - <primaryKey> - <field ref="RESOURCE_TYPE_ID"/> - <field ref="PARENT_RESOURCE_TYPE_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_PROCESS_SCAN"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="QUERY" type="VARCHAR2" size="256" required="true"/> - <column name="NAME" type="VARCHAR2" size="100" required="false"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> - - <index name="RHQ_PROCESS_SCAN_QUERY_INDEX" unique="true"> - <field ref="QUERY"/> - <field ref="RESOURCE_TYPE_ID"/> - </index> - </table> - - <table name="RHQ_PRD_VER"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="VERSION" type="VARCHAR2" size="50" required="true"/> - <column name="RES_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> - </table> - - <table name="RHQ_RESOURCE"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> - <column name="UUID" type="CHAR" size="36" required="true"/> - <column name="NAME" type="VARCHAR2" size="500"/> - <column name="RESOURCE_KEY" type="VARCHAR2" required="true" size="500"/> - <column name="AGENT_ID" required="false" type="INTEGER" references="RHQ_AGENT(id)"/> - <column name="INVENTORY_STATUS" type="VARCHAR2" size="20"/> - <column name="CONNECTED" type="BOOLEAN"/> - <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> - <column name="VERSION" type="VARCHAR2" size="50"/> - <column name="CTIME" type="LONG"/> - <column name="MTIME" type="LONG"/> - <column name="ITIME" type="LONG"/> - <column name="RES_CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG"/> - <column name="PLUGIN_CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG"/> - <column name="MODIFIED_BY" required="false" type="INTEGER"/> - <column name="LOCATION" required="false" size="100" type="VARCHAR2"/> - <column name="PARENT_RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE"/> - <column name="PRODUCT_VERSION_ID" type="INTEGER" references="RHQ_PRD_VER"/> - - <index name="RHQ_RESOURCE_idx_key"> - <field ref="RESOURCE_KEY"/> - </index> - - <index name="RHQ_RESOURCE_idx_type"> - <field ref="RESOURCE_TYPE_ID"/> - </index> - - <index name="RHQ_RESOURCE_idx_agent"> - <field ref="AGENT_ID"/> - </index> - - <index name="RHQ_RESOURCE_idx_parent"> - <field ref="PARENT_RESOURCE_ID"/> - </index> - - </table> - - <table name="RHQ_RESOURCE_ERROR"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> - <column name="TIME_OCCURRED" type="LONG" required="true"/> - <column name="ERROR_TYPE" type="VARCHAR2" required="true" size="32"/> - <column name="SUMMARY" type="VARCHAR2" required="true" size="1000"/> - <column name="DETAIL" type="LONGVARCHAR" required="false"/> - - <index name="RHQ_RES_ERROR_IDX_RES_ID"> - <field ref="RESOURCE_ID"/> - </index> - </table> - - <table name="RHQ_GROUP_DEF"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" required="true" size="100" type="VARCHAR2"/> - <column name="DESCRIPTION" size="100" type="VARCHAR2"/> - <column name="CTIME" type="LONG"/> - <column name="MTIME" type="LONG"/> - <column name="CALC_TIME" type="LONG"/> - <column name="CALC_INTERVAL" type="LONG"/> - <column name="RECURSIVE" type="BOOLEAN"/> - <column name="EXPRESSION" type="VARCHAR2" size="1000"/> - - <index name="RHQ_GROUP_DEF_NAME" unique="true"> - <field ref="NAME"/> - </index> - </table> - - <table name="RHQ_RESOURCE_GROUP"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <!-- this name can be longer than the size of the GROUP_BY column, which is used to uniquely identify it --> - <!-- Max bytes for Oracle Varchar2 to accommodate large cluster keys --> - <column name="NAME" required="true" size="4000" type="VARCHAR2"/> - <column name="DESCRIPTION" size="100" type="VARCHAR2"/> - <column name="LOCATION" required="false" size="100" type="VARCHAR2"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> - <!-- Compatible groups only --> - <column name="CTIME" type="LONG"/> - <column name="MTIME" type="LONG"/> - <column name="MODIFIED_BY" required="false" type="INTEGER"/> - <!-- TODO: Reorder to allow this references="RHQ_SUBJECT" --> - <column name="RECURSIVE" type="BOOLEAN"/> - - <column name="GROUP_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_GROUP_DEF"/> - <column name="GROUP_BY" size="500" type="VARCHAR2"/> - - <column name="CATEGORY" type="VARCHAR2" size="20" required="true"/> - - <column name="CLUSTER_KEY" type="VARCHAR2" size="4000" required="false"/> - - <!-- These two only set if this is a backing group for a resource cluster --> - <column name="CLUSTER_RESOURCE_GROUP_ID" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> - - <column name="VISIBLE" type="BOOLEAN"/> - - <index name="RHQ_RES_GROUP_NAME" unique="false"> - <field ref="NAME"/> - </index> - </table> - - <!-- Many To Many mapping for groups to implicit resources --> - <table name="RHQ_RESOURCE_GROUP_RES_IMP_MAP"> - <column name="RESOURCE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE"/> - <column name="RESOURCE_GROUP_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> - - <!-- not using full words to fit index name length --> - <constraint name="RHQ_RES_GROUP_RES_IMP_MAP_KEY"> - <primaryKey> - <field ref="RESOURCE_ID"/> - <field ref="RESOURCE_GROUP_ID"/> - </primaryKey> - </constraint> - </table> - - <!-- Many To Many mapping for groups to explicit resources --> - <table name="RHQ_RESOURCE_GROUP_RES_EXP_MAP"> - <column name="RESOURCE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE"/> - <column name="RESOURCE_GROUP_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> - - <!-- not using full words to fit index name length --> - <constraint name="RHQ_RES_GROUP_RES_EXP_MAP_KEY"> - <primaryKey> - <field ref="RESOURCE_ID"/> - <field ref="RESOURCE_GROUP_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_CONFIG_GROUP_UPDATE"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="GROUP_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_GROUP"/> - <column name="CONFIGURATION_ID" type="INTEGER" required="true" references="RHQ_CONFIG"/> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="SUBJECT_NAME" type="VARCHAR2" required="false" size="100"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> - </table> - - <table name="RHQ_CONFIG_UPDATE"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="CONFIGURATION_ID" type="INTEGER" required="true" references="RHQ_CONFIG" ondelete="cascade"/> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="SUBJECT_NAME" type="VARCHAR2" required="false" size="100"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="CONFIG_RES_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> - <column name="PLUGIN_CONFIG_RES_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> - <column name="AGG_RES_UPDATE_ID" type="INTEGER" required="false" references="RHQ_CONFIG_GROUP_UPDATE"/> - <column name="AGG_PLUGIN_UPDATE_ID" type="INTEGER" required="false" references="RHQ_CONFIG_GROUP_UPDATE"/> - <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> - </table> - - - <table name="RHQ_TAGGING"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="NAMESPACE" type="VARCHAR2" required="false" size="20"/> - <column name="SEMANTIC" type="VARCHAR2" required="false" size="50"/> - <column name="NAME" type="VARCHAR2" required="true" size="100"/> - </table> - - <table name="RHQ_TAGGING_RESOURCE_MAP"> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> - <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> - <constraint name="RHQ_TAGGING_RESOURCE_MAP_KEY"> - <primaryKey> - <field ref="RESOURCE_ID"/> - <field ref="TAG_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_TAGGING_RES_GROUP_MAP"> - <column name="RESOURCE_GROUP_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_GROUP"/> - <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> - <constraint name="RHQ_TAGGING_RES_GROUP_MAP_KEY"> - <primaryKey> - <field ref="RESOURCE_GROUP_ID"/> - <field ref="TAG_ID"/> - </primaryKey> - </constraint> - </table> - -<!-- END: inventory-schema.xml --> -<!-- BEGIN: auth-schema.xml --> - - - <table name="RHQ_PRINCIPAL"> - - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="PRINCIPAL" required="true" type="VARCHAR2" size="100"/> - <column name="PASSWORD" required="true" type="VARCHAR2" size="64"/> - - <!-- ensure that principals are unique --> - <index name="RHQ_PRINCIPAL_PRINCIPAL_KEY" unique="true"> - <field ref="PRINCIPAL"/> - </index> - - </table> - -<!-- END: auth-schema.xml --> -<!-- BEGIN: authz-schema.xml --> - - - <table name="RHQ_ROLE"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" required="true" size="100" type="VARCHAR2"/> - <column name="DESCRIPTION" size="100" type="VARCHAR2"/> - <column name="FSYSTEM" type="BOOLEAN" default="false"/> - - <index name="RHQ_ROLE_NAME_KEY" unique="true"> - <field ref="NAME"/> - </index> - </table> - - <table name="RHQ_ROLE_RESOURCE_GROUP_MAP"> - <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> - <column name="RESOURCE_GROUP_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> - - <constraint name="RHQ_ROLE_RES_GROUP_MAP_KEY"> - <primaryKey> - <field ref="ROLE_ID"/> - <field ref="RESOURCE_GROUP_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_ROLE_LDAP_GROUP"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> - <column name="LDAP_GROUP_NAME" size="128" required="true" type="VARCHAR2"/> - - <index name="RHQ_ROLE_LDAP_GROUP_IDX" unique="true"> - <field ref="ROLE_ID"/> - <field ref="LDAP_GROUP_NAME"/> - </index> - </table> - - <table name="RHQ_PERMISSION"> - <column name="ROLE_ID" type="INTEGER" references="RHQ_ROLE" required="true"/> - <column name="OPERATION" type="INTEGER" required="true"/> - <constraint name="RHQ_PERMISSION_PK"> - <primaryKey> - <field ref="ROLE_ID"/> - <field ref="OPERATION"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_SUBJECT"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" required="true" size="100" type="VARCHAR2"/> - <column name="CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG"/> - <column name="FIRST_NAME" required="false" size="100" type="VARCHAR2"/> - <column name="LAST_NAME" required="false" size="100" type="VARCHAR2"/> - <column name="EMAIL_ADDRESS" size="100" type="VARCHAR2"/> - <column name="SMS_ADDRESS" size="100" type="VARCHAR2"/> - <column name="PHONE_NUMBER" size="100" type="VARCHAR2"/> - <column name="DEPARTMENT" size="100" type="VARCHAR2"/> - <column name="FACTIVE" required="true" type="BOOLEAN" default="true"/> - <column name="FSYSTEM" required="true" type="BOOLEAN" default="false"/> - - <index name="RHQ_SUBJECT_AUTH_KEY" unique="true"> - <field ref="NAME"/> - </index> - </table> - - <table name="RHQ_SUBJECT_ROLE_MAP"> - <column name="SUBJECT_ID" required="true" type="INTEGER" references="RHQ_SUBJECT"/> - <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> - - <constraint name="RHQ_SUBJECT_ROLE_MAPPING_KEY"> - <primaryKey> - <field ref="SUBJECT_ID"/> - <field ref="ROLE_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_SUBJECT_ROLE_LDAP_MAP"> - <column name="SUBJECT_ID" required="true" type="INTEGER" references="RHQ_SUBJECT"/> - <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> - <constraint name="RHQ_SUBJECT_ROLE_LDAP_MAP_PK"> - <primaryKey> - <field ref="SUBJECT_ID" /> - <field ref="ROLE_ID"/> - </primaryKey> - </constraint> - </table> -<!-- END: authz-schema.xml --> -<!-- BEGIN: search-schema.xml --> - - - <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="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="GLOBAL" type="BOOLEAN" required="true"/> - </table> - -<!-- END: search-schema.xml --> -<!-- BEGIN: operation-schema.xml --> - - - <table name="RHQ_OPERATION_DEF"> - - <!-- === required columns === --> - - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE(ID)"/> - <column name="NAME" type="VARCHAR2" required="true" size="100"/> - - <!-- === optional columns === --> - - <!-- an OSGI version range - if null, the operation def applies to all versions of the associated resource type --> - <column name="RESOURCE_VERSION_RANGE" type="VARCHAR2" size="100"/> - - <!-- A parameter config definition is only required for operations that have parameters. --> - <!-- A results config definition is only required for operations that return data. --> - <column name="PARAMETER_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> - <column name="RESULTS_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> - <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> - <column name="DESCRIPTION" type="VARCHAR2" size="4000"/> - <column name="TIMEOUT" type="INTEGER"/> - - <!-- === business key (RESOURCE_TYPE_ID + NAME) === --> - <index name="RHQ_OPERATION_DEF_KEY_IDX" unique="true"> - <field ref="RESOURCE_TYPE_ID"/> - <field ref="NAME"/> - </index> - - </table> - - <table name="RHQ_OPERATION_HISTORY"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="DTYPE" type="VARCHAR2" required="true" size="8"/> - <column name="JOB_NAME" type="VARCHAR2" required="true" size="100"/> - <column name="JOB_GROUP" type="VARCHAR2" required="true" size="100"/> - <column name="OPERATION_DEF_ID" type="INTEGER" required="true" references="RHQ_OPERATION_DEF"/> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="STIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="PARAMETERS_CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> - - <!-- for resource history --> - <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> - <column name="RESULTS_CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> - <column name="GROUP_HISTORY_ID" type="INTEGER" required="false" references="RHQ_OPERATION_HISTORY"/> - - <!-- for group history --> - <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_RESOURCE_GROUP"/> - - <index name="RHQ_OPERATION_HISTORY_JOB_IDX" unique="true"> - <field ref="JOB_NAME"/> - <field ref="JOB_GROUP"/> - <field ref="CTIME"/> - </index> - - </table> - - <!-- - This table is really just to support some specific use-cases. - Specifically, to be able to get a list of histories for a specific schedule (aka quartz job) - and to be able to query a list of all schedules along with their associated resource/group IDs - possibly sorted by their next fire time. - Note that a NULL next fire time means it won't fire again and the row is probaby about to be deleted; - we can probably not even insert rows with NULL and make it a non-nullable field. But rather than - code special conditions into the session bean, we'll allow a short-lived NULL next fire time row. - --> - <table name="RHQ_OPERATION_SCHEDULE"> - <column name="JOB_NAME" type="VARCHAR2" required="true" size="100"/> - <column name="JOB_GROUP" type="VARCHAR2" required="true" size="100"/> - <column name="DTYPE" type="VARCHAR2" required="true" size="8"/> - <column name="NEXT_FIRE_TIME" type="LONG" required="false"/> - - <!-- for resource history --> - <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> - - <!-- for group history --> - <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_RESOURCE_GROUP"/> - - <!-- - Note that this is the same primary key that Quartz uses for its schedules (RHQ_qrtz_job_details). - We do not need to add DTYPE to the key, because we ensure the name/group are unique - across resource/group schedules - --> - <constraint name="RHQ_OPERATION_SCHEDULE_KEY"> - <primaryKey> - <field ref="JOB_NAME"/> - <field ref="JOB_GROUP"/> - </primaryKey> - </constraint> - </table> - -<!-- END: operation-schema.xml --> -<!-- BEGIN: event-schema.xml --> - - - <!-- metadata --> - - <table name="RHQ_EVENT_DEF"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE(ID)"/> - - <column name="NAME" type="VARCHAR2" size="100" required="true"/> - <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> - <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> - - <index name="RHQ_EVENT_DEF_IDX" unique="true"> - <field ref="RESOURCE_TYPE_ID"/> - <field ref="NAME"/> - </index> - </table> - - <!-- instance data --> - - <table name="RHQ_EVENT_SOURCE"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="EVENT_DEF_ID" type="INTEGER" required="true" references="RHQ_EVENT_DEF(ID)"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE(ID)"/> - - <column name="LOCATION" required="true" size="2000" type="VARCHAR2"/> - - <index name="RHQ_EVENT_SOURCE_IDX" unique="true"> - <field ref="EVENT_DEF_ID"/> - <field ref="RESOURCE_ID"/> - <field ref="LOCATION"/> - </index> - </table> - - <table name="RHQ_EVENT"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="EVENT_SOURCE_ID" type="INTEGER" required="true" references="RHQ_EVENT_SOURCE(ID)"/> - - <column name="TIMESTAMP" required="true" type="LONG"/> - <column name="SEVERITY" required="true" size="20" type="VARCHAR2"/> - <column name="DETAIL" required="true" size="4000" type="VARCHAR2"/> - <index name="RHQ_EVENT_IDX" unique="false"> - <field ref="EVENT_SOURCE_ID"/> - <field ref="TIMESTAMP"/> - </index> - </table> - -<!-- END: event-schema.xml --> -<!-- BEGIN: alert-schema.xml --> - - - <table name="RHQ_ALERT_DEFINITION"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" required="true" size="100" type="VARCHAR2"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="PARENT_ID" type="INTEGER" required="false"/> - <column name="GROUP_ALERT_DEF_ID" type="INTEGER" required="false"/> - <column name="DESCRIPTION" required="false" size="250" type="VARCHAR2"/> - <column name="PRIORITY" type="VARCHAR2" size="15" required="true"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE" required="false"/> - <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE" required="false"/> - <column name="RESOURCE_GROUP_ID" type="INTEGER" references="RHQ_RESOURCE_GROUP" required="false"/> - <column name="ENABLED" required="true" default="TRUE" type="BOOLEAN"/> - - <column name="REQUIRED" required="true" type="SMALLINT"/> - - <column name="RECOVERY_ID" type="INTEGER" required="true"/> - <!-- required, but 0 effectively means null --> - <column name="WILL_RECOVER" required="true" default="false" type="BOOLEAN"/> - <column name="NOTIFY_FILTERED" required="true" default="false" type="BOOLEAN"/> - <column name="CONTROL_FILTERED" required="true" default="FALSE" type="BOOLEAN"/> - - <column name="DELETED" required="true" default="FALSE" type="BOOLEAN"/> - <column name="READ_ONLY" required="true" default="FALSE" type="BOOLEAN"/> - - <column name="DAMPENING_CATEGORY" type="SMALLINT" required="true"/> - <column name="DAMPENING_VALUE" type="INTEGER"/> - <column name="DAMPENING_VALUE_UNITS" type="SMALLINT"/> - <column name="DAMPENING_PERIOD" type="INTEGER"/> - <column name="DAMPENING_PERIOD_UNITS" type="SMALLINT"/> - </table> - - <table name="RHQ_ALERT_DAMPEN_EVENT"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> - <column name="EVENT_TYPE" required="true" type="SMALLINT"/> - <column name="EVENT_TIMESTAMP" required="true" type="LONG"/> - - <index name="RHQ_DAMPENING_EVENT_TYPE_IDX"> - <field ref="EVENT_TYPE"/> - </index> - <index name="RHQ_DAMPENING_EVENT_TS_IDX"> - <field ref="EVENT_TIMESTAMP"/> - </index> - </table> - - <table name="RHQ_ALERT_CONDITION"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="TYPE" required="true" type="VARCHAR2" size="15"/> - <!-- - <column name="REQUIRED" required="true" type="BOOLEAN"/> - --> - <column name="MEASUREMENT_DEFINITION_ID" required="false" type="INTEGER"/> - <column name="NAME" required="false" size="100" type="VARCHAR2"/> - <column name="COMPARATOR" required="false" size="2" type="VARCHAR2"/> - <column name="THRESHOLD" required="false" type="DOUBLE"/> - <!-- event-based conditions use OPTION_STATUS for the string match, so should be a decent length --> - <column name="OPTION_STATUS" required="false" size="256" type="VARCHAR2"/> - <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> - <column name="TRIGGER_ID" required="false" type="INTEGER"/> - </table> - - <table name="RHQ_ALERT" tablespace="DEFAULT" - storage-options="freelists 5" cache="true" logging="false"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> - <column name="CTIME" required="true" type="LONG"/> - <column name="RECOVERY_ID" type="INTEGER" required="true"/> - <!-- required, but 0 effectively means null --> - <column name="WILL_RECOVER" required="true" default="false" type="BOOLEAN"/> - <column name="ACK_TIME" required="false" type="LONG"/> - <column name="ACK_SUBJECT" required="false" size="100" type="VARCHAR2"/> - <index name="RHQ_ALERT_IDX_TIME" unique="false"> - <field ref="CTIME"/> - </index> - <index name="RHQ_ALERT_IDX_ALERTDEF" unique="false"> - <field ref="ALERT_DEFINITION_ID"/> - </index> - </table> - - <table name="RHQ_ALERT_NOTIF_LOG" tablespace="DEFAULT" - storage-options="freelists 5" cache="true" logging="false"> - <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="false"> - <field ref="ALERT_ID"/> - </index> - <column name="SENDER" required="false" size="100" type="VARCHAR2"/> - <column name="RESULT_STATE" required="false" size="20" type="VARCHAR2"/> - <column name="MESSAGE" required="false" size="4000" type="VARCHAR2"/> - </table> - - <table name="RHQ_ALERT_CONDITION_LOG" tablespace="DEFAULT" - storage-options="freelists 5" cache="true" logging="false"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="CTIME" required="true" type="LONG"/> - <column name="ALERT_ID" required="false" type="INTEGER" references="RHQ_ALERT(ID)"/> - <column name="CONDITION_ID" required="true" type="INTEGER" references="RHQ_ALERT_CONDITION(ID)"/> - <column name="VALUE" required="false" size="250" type="VARCHAR2"/> - <index name="RHQ_ALERT_COND_LOG_IDX_TIME"> - <field ref="CTIME" /> - </index> - <index name="RHQ_ALERT_COND_LOG_IDX_ALERT"> - <field ref="ALERT_ID"/> - </index> - </table> - - <table name="RHQ_ALERT_NOTIFICATION" tablespace="DEFAULT" - storage-options="freelists 5" cache="true" logging="false"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> - <column name="SENDER_CONFIG_ID" required="false" type="INTEGER" references="RHQ_CONFIG(ID)"/> - <column name="EXTRA_CONFIG_ID" required="false" type="INTEGER" references="RHQ_CONFIG(ID)"/> - <column name="SENDER_NAME" required="true" size="100" type="VARCHAR2" /> - </table> - -<!-- END: alert-schema.xml --> -<!-- BEGIN: sysconfig-schema.xml --> - - - <table name="RHQ_SYSTEM_CONFIG"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="PROPERTY_KEY" type="VARCHAR2" size="80"/> - <column name="PROPERTY_VALUE" type="VARCHAR2" size="300"/> - <column name="DEFAULT_PROPERTY_VALUE" type="VARCHAR2" size="300"/> - <column name="FREAD_ONLY" type="BOOLEAN" default="FALSE"/> - - <index name="RHQ_SYSTEM_CONFIG_KEY_INDX" unique="true"> - <field ref="PROPERTY_KEY"/> - </index> - </table> - -<!-- END: sysconfig-schema.xml --> -<!-- BEGIN: scheduler-schema.xml --> - - - <table name="RHQ_QRTZ_JOB_DETAILS"> - <column name="JOB_NAME" required="true" type="VARCHAR2" size="80"/> - <column name="JOB_GROUP" required="true" type="VARCHAR2" size="80"/> - <column name="DESCRIPTION" required="false" type="VARCHAR2" size="120"/> - <column name="JOB_CLASS_NAME" required="true" type="VARCHAR2" size="128"/> - <column name="IS_DURABLE" required="true" type="BOOLEAN" default="FALSE"/> - <column name="IS_VOLATILE" required="true" type="BOOLEAN"/> - <column name="IS_STATEFUL" required="true" type="BOOLEAN" default="FALSE"/> - <column name="REQUESTS_RECOVERY" required="true" type="BOOLEAN" default="FALSE"/> - <column name="JOB_DATA" required="false" type="BLOB"/> - - <constraint name="RHQ_PK_QRTZ_JOB_DETAILS"> - <primaryKey> - <field ref="JOB_NAME"/> - <field ref="JOB_GROUP"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_QRTZ_JOB_LISTENERS"> - <column name="JOB_NAME" required="true" type="VARCHAR2" size="80"/> - <column name="JOB_GROUP" required="true" type="VARCHAR2" size="80"/> - <column name="JOB_LISTENER" required="true" type="VARCHAR2" size="80"/> - - <constraint name="RHQ_PK_QRTZ_JOB_LISTENERS"> - <primaryKey> - <field ref="JOB_NAME"/> - <field ref="JOB_GROUP"/> - <field ref="JOB_LISTENER"/> - </primaryKey> - </constraint> - <constraint name="RHQ_FK_QRTZ_JOB_LSTNRS_JN_JG"> - <foreignKey local="JOB_NAME,JOB_GROUP" - references="RHQ_QRTZ_JOB_DETAILS(JOB_NAME,JOB_GROUP)" - ondelete="cascade"/> - </constraint> - </table> - - <table name="RHQ_QRTZ_TRIGGERS"> - <column name="TRIGGER_NAME" type="VARCHAR2" required="true" size="80"/> - <column name="TRIGGER_GROUP" type="VARCHAR2" required="true" size="80"/> - <column name="JOB_NAME" type="VARCHAR2" required="true" size="80"/> - <column name="JOB_GROUP" type="VARCHAR2" required="true" size="80"/> - <column name="IS_VOLATILE" type="BOOLEAN" required="true"/> - <column name="DESCRIPTION" type="VARCHAR2" required="false" size="120"/> - <column name="NEXT_FIRE_TIME" type="LONG" required="false"/> - <column name="PREV_FIRE_TIME" type="LONG" required="false"/> - <column name="PRIORITY" type="INTEGER" required="false"/> - <column name="TRIGGER_STATE" type="VARCHAR" required="true" size="16"/> - <column name="TRIGGER_TYPE" type="VARCHAR" required="true" size="8"/> - <column name="START_TIME" type="LONG" required="true"/> - <column name="END_TIME" type="LONG" required="false"/> - <column name="CALENDAR_NAME" type="VARCHAR2" required="false" size="80"/> - <column name="MISFIRE_INSTR" type="INTEGER" required="false"/> - <column name="JOB_DATA" type="BLOB" required="false"/> - - <constraint name="RHQ_PK_QRTZ_TRIGGERS"> - <primaryKey> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </primaryKey> - </constraint> - <constraint name="RHQ_FK_QRTZ_TRIGGERS_JN_JG"> - <foreignKey local="JOB_NAME,JOB_GROUP" - references="RHQ_QRTZ_JOB_DETAILS(JOB_NAME,JOB_GROUP)" - ondelete="cascade"/> - </constraint> - - <!-- Quartz docs recommend these indexes. --> - <index name="RHQ_QRTZ_TRIGGERS_JN_JG_IDX"> - <field ref="JOB_NAME"/> - <field ref="JOB_GROUP"/> - </index> - <index name="RHQ_QRTZ_TRIGGERS_NFT_IDX"> - <field ref="NEXT_FIRE_TIME"/> - </index> - <index name="RHQ_QRTZ_TRIGGERS_TS_IDX"> - <field ref="TRIGGER_STATE"/> - </index> - <index name="RHQ_QRTZ_TRIGGERS_TS_NFT_IDX"> - <field ref="TRIGGER_STATE"/> - <field ref="NEXT_FIRE_TIME"/> - </index> - - </table> - - <table name="RHQ_QRTZ_SIMPLE_TRIGGERS"> - <column name="TRIGGER_NAME" type="VARCHAR2" required="true" size="80"/> - <column name="TRIGGER_GROUP" type="VARCHAR2" required="true" size="80"/> - <column name="REPEAT_COUNT" type="LONG" required="true"/> - <column name="REPEAT_INTERVAL" type="LONG" required="true"/> - <column name="TIMES_TRIGGERED" type="LONG" required="true"/> - - <constraint name="RHQ_PK_QRTZ_SIMPLE_TRIGGERS"> - <primaryKey> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </primaryKey> - </constraint> - <constraint name="RHQ_FK_QRTZ_SIMPLE_TRGRS_TN_TG"> - <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" - references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" - ondelete="cascade"/> - </constraint> - - <!-- Quartz docs recommend this index. --> - <!-- Commenting out, because Oracle auto-creates an index for the - primary key column(s) and fails if you try to create another - index for the same column(s) (ips, 03/29/07). - --> - <!-- - <index name="RHQ_QRTZ_SIMPLE_TRGRS_TN_TG_IDX"> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </index> - --> - </table> - - <table name="RHQ_QRTZ_CRON_TRIGGERS"> - <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> - <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> - <column name="CRON_EXPRESSION" type="VARCHAR2" size="80" required="true"/> - <column name="TIME_ZONE_ID" type="VARCHAR2" size="80" required="false"/> - - <constraint name="RHQ_PK_QRTZ_CRON_TRIGGERS"> - <primaryKey> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </primaryKey> - </constraint> - <constraint name="RHQ_FK_QRTZ_CRON_TRIG_TN_TG"> - <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" - references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" - ondelete="cascade"/> - </constraint> - - <!-- Quartz docs recommend this index. --> - <!-- Commenting out, because Oracle auto-creates an index for the - primary key column(s) and fails if you try to create another - index for the same column(s) (ips, 03/29/07). - --> - <!-- - <index name="RHQ_QRTZ_CRON_TRGRS_TN_TG_IDX"> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </index> - --> - </table> - - <table name="RHQ_QRTZ_BLOB_TRIGGERS"> - <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> - <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> - <column name="BLOB_DATA" type="BLOB" required="false"/> - - <constraint name="RHQ_PK_QRTZ_BLOB_TRIGGERS"> - <primaryKey> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </primaryKey> - </constraint> - <constraint name="RHQ_FK_QRTZ_BLOB_TRIGG_TN_TG"> - <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" - references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" - ondelete="cascade"/> - </constraint> - - <!-- Quartz docs recommend this index. --> - <!-- Commenting out, because Oracle auto-creates an index for the - primary key column(s) and fails if you try to create another - index for the same column(s) (ips, 03/29/07). - --> - <!-- - <index name="RHQ_QRTZ_BLOB_TRGRS_TN_TG_IDX"> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </index> - --> - </table> - - <table name="RHQ_QRTZ_TRIGGER_LISTENERS"> - <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> - <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> - <column name="TRIGGER_LISTENER" type="VARCHAR2" size="80" required="true"/> - - <constraint name="RHQ_PK_QRTZ_TRIGGER_LISTENERS"> - <primaryKey> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - <field ref="TRIGGER_LISTENER"/> - </primaryKey> - </constraint> - <constraint name="RHQ_FK_QRTZ_TRGR_LSTNRS_TN_TG"> - <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" - references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" - ondelete="cascade"/> - </constraint> - - <!-- Quartz docs recommend this index. --> - <index name="RHQ_QRTZ_TRGR_LSTNRS_TN_TG_IDX"> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </index> - - </table> - - <table name="RHQ_QRTZ_FIRED_TRIGGERS"> - <column name="ENTRY_ID" primarykey="true" type="VARCHAR2" size="95" required="true"/> - <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> - <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> - <column name="INSTANCE_NAME" type="VARCHAR2" size="80" required="true"/> - <column name="FIRED_TIME" type="LONG" required="true"/> - <column name="PRIORITY" type="INTEGER" required="false"/> - <column name="STATE" type="VARCHAR2" size="16" required="true"/> - <column name="IS_VOLATILE" type="BOOLEAN" required="true"/> - <column name="JOB_NAME" type="VARCHAR2" size="80" required="false"/> - <column name="JOB_GROUP" type="VARCHAR2" size="80" required="false"/> - <column name="IS_STATEFUL" type="BOOLEAN" required="false"/> - <column name="REQUESTS_RECOVERY" type="BOOLEAN" required="false"/> - - <!-- Quartz docs recommend these indexes. --> - <index name="RHQ_QRTZ_FIRED_TRGRS_TN_IDX"> - <field ref="TRIGGER_NAME"/> - </index> - <index name="RHQ_QRTZ_FIRED_TRGRS_TG_IDX"> - <field ref="TRIGGER_GROUP"/> - </index> - <index name="RHQ_QRTZ_FIRED_TRGRS_TN_TG_IDX"> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </index> - <index name="RHQ_QRTZ_FIRED_TRGRS_IN_IDX"> - <field ref="INSTANCE_NAME"/> - </index> - <index name="RHQ_QRTZ_FIRED_TRGRS_JN_IDX"> - <field ref="JOB_NAME"/> - </index> - <index name="RHQ_QRTZ_FIRED_TRGRS_JG_IDX"> - <field ref="JOB_GROUP"/> - </index> - - </table> - - <table name="RHQ_QRTZ_CALENDARS"> - <column name="CALENDAR_NAME" primarykey="true" type="VARCHAR2" size="80" required="true"/> - <column name="CALENDAR" type="BLOB" required="true"/> - </table> - - <table name="RHQ_QRTZ_PAUSED_TRIGGER_GRPS"> - <column name="TRIGGER_GROUP" primarykey="true" type="VARCHAR2" size="80" required="true"/> - </table> - - <table name="RHQ_QRTZ_SCHEDULER_STATE"> - <column name="INSTANCE_NAME" primarykey="true" type="VARCHAR2" size="80" required="true"/> - <column name="LAST_CHECKIN_TIME" type="LONG" required="true"/> - <column name="CHECKIN_INTERVAL" type="LONG" required="true"/> - <column name="RECOVERER" type="VARCHAR2" size="80" required="false"/> - </table> - - <table name="RHQ_QRTZ_LOCKS"> - <column name="LOCK_NAME" primarykey="true" type="VARCHAR2" size="40" required="true"/> - <data LOCK_NAME="TRIGGER_ACCESS"/> - <data LOCK_NAME="JOB_ACCESS"/> - <data LOCK_NAME="CALENDAR_ACCESS"/> - <data LOCK_NAME="STATE_ACCESS"/> - <data LOCK_NAME="MISFIRE_ACCESS"/> - </table> - -<!-- END: scheduler-schema.xml --> -<!-- BEGIN: amps-schema.xml --> - - - <table name="RHQ_PLUGIN"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="4000" type="VARCHAR2" required="false"/> - <column name="VERSION" size="200" type="VARCHAR2" required="false"/> - <column name="AMPS_VERSION" size="16" type="VARCHAR2" required="false"/> - <column name="ENABLED" type="BOOLEAN" required="true"/> - <column name="STATUS" size="16" type="VARCHAR2" required="true"/> - <column name="HELP" type="CLOB" required="false"/> - <column name="PATH" size="500" type="VARCHAR2" required="true"/> - <column name="MD5" size="100" type="VARCHAR2" required="true"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="DEPLOYMENT" size="8" type="VARCHAR2" required="true"/> - <column name="PTYPE" size="200" type="VARCHAR2" required="false"/> - <column name="PLUGIN_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> - <column name="JOBS_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> - <column name="CONTENT" type="BLOB" required="false"/> - - <index name="RHQ_PLUGIN_NAME_DEPLOY_IDX" unique="true"> - <field ref="NAME"/> - <field ref="DEPLOYMENT"/> - </index> - </table> - -<!-- END: amps-schema.xml --> -<!-- BEGIN: measurement-schema.xml --> - - <table name="RHQ_MEASUREMENT_DEF"> - - <!-- === required columns === --> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE(ID)"/> - <column name="NAME" type="VARCHAR2" size="100" required="true"/> - - <!-- === optional columns === --> - <!-- an OSGI version range - if null, the metric def applies to all versions of the associated resource type --> - <column name="RESOURCE_VERSION_RANGE" type="VARCHAR2" size="100"/> - <column name="CATEGORY" type="SMALLINT"/> - <column name="UNITS" type="SMALLINT"/> - <column name="NUMERIC_TYPE" type="SMALLINT"/> - <column name="DISPLAY_TYPE" type="SMALLINT"/> - <column name="DATA_TYPE" type="SMALLINT"/> - <column name="RAW_NUMERIC_TYPE" type="SMALLINT"/> - <column name="DEFAULT_ON" type="BOOLEAN" default="false"/> - <column name="DEFAULT_INTERVAL" type="LONG" /> - <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> - <column name="DISPLAY_ORDER" type="INTEGER" default="1000"/> - <column name="DESCRIPTION" type="VARCHAR2" size="500"/> - <column name="DESTINATION_TYPE" type="VARCHAR2" size="100"/> - - <column name="VERSION" type="INTEGER"/> - <!-- for optimistic locking --> - - <!-- === business key (RESOURCE_TYPE_ID + NAME + RAW_NUMERIC_TYPE) === --> - <index name="RHQ_METRIC_DEF_KEY_IDX" unique="true"> - <field ref="RESOURCE_TYPE_ID"/> - <field ref="NAME"/> - <field ref="RAW_NUMERIC_TYPE"/> - </index> - <index name="RHQ_METRIC_DEF_NT_IDX"> - <field ref="NUMERIC_TYPE"/> - </index> - </table> - - - <table name="RHQ_MEASUREMENT_SCHED"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - - <column name="ENABLED" type="BOOLEAN" default="false"/> - <column name="MTIME" type="LONG" /> - <column name="DEFINITION" type="INTEGER" references="RHQ_MEASUREMENT_DEF(ID)"/> - <column name="VERSION" type="INTEGER" /> - <column name="COLL_INTERVAL" type="LONG" /> - <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE(ID)"/> - <index name="RHQ_MEAS_SCHED_UNIQ" unique="true"> - <field ref="RESOURCE_ID"/> - <field ref="DEFINITION"/> - </index> - </table> - - - <table name="RHQ_MEASUREMENT_BLINE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - - <column name="BL_USER_ENTERED" type="BOOLEAN" default="false" required="true"/> - <column name="BL_MIN" type="DOUBLE" required="true"/> - <column name="BL_MAX" type="DOUBLE" required="true"/> - <column name="BL_MEAN" type="DOUBLE" required="true"/> - <column name="BL_COMPUTE_TIME" type="LONG" required="true"/> - <column name="SCHEDULE_ID" type="INTEGER" required="true" references="RHQ_MEASUREMENT_SCHED(ID)"/> - <index name="RHQ_MEAS_BASELINE_CTIME_IDX"> - <field ref="BL_COMPUTE_TIME"/> - </index> - <index name="RHQ_MEAS_BASELINE_SID_IDX"> - <field ref="SCHEDULE_ID"/> - </index> - </table> - - - <table name="RHQ_MEASUREMENT_DATA_NUM_1H" logging="false" cache="true" - tablespace="DEFAULT" storage-options="freelists 20"> - - <column name="TIME_STAMP" required="true" type="LONG"/> - <column name="SCHEDULE_ID" required="true" type="INTEGER"/> - <column name="VALUE" required="false" type="DOUBLE"/> - <column name="MINVALUE" required="false" type="DOUBLE"/> - <column name="MAXVALUE" required="false" type="DOUBLE"/> - - <constraint name="RHQ_MEAS_DATA_1H_ID_TIME_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - - <index name="RHQ_MEAS_DATA_1H_TIME_IDX"> - <field ref="TIME_STAMP"/> - </index> - </table> - - - <table name="RHQ_MEASUREMENT_DATA_NUM_6H" logging="false" cache="true" - tablespace="DEFAULT" storage-options="freelists 20"> - - <column name="TIME_STAMP" required="true" type="LONG"/> - <column name="SCHEDULE_ID" required="true" type="INTEGER"/> - <column name="VALUE" required="false" type="DOUBLE"/> - <column name="MINVALUE" required="false" type="DOUBLE"/> - <column name="MAXVALUE" required="false" type="DOUBLE"/> - - <constraint name="RHQ_MEAS_DATA_6H_ID_TIME_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - - <index name="RHQ_MEAS_DATA_6H_TIME_IDX"> - <field ref="TIME_STAMP"/> - </index> - </table> - - - <table name="RHQ_MEASUREMENT_DATA_NUM_1D" logging="false" cache="true" - tablespace="DEFAULT" storage-options="freelists 20"> - - <column name="TIME_STAMP" required="true" type="LONG"/> - <column name="SCHEDULE_ID" required="true" type="INTEGER"/> - <column name="VALUE" required="false" type="DOUBLE"/> - <column name="MINVALUE" required="false" type="DOUBLE"/> - <column name="MAXVALUE" required="false" type="DOUBLE"/> - - <constraint name="RHQ_MEAS_DATA_1D_ID_TIME_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - - - <table name="RHQ_MEASUREMENT_DATA_TRAIT"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER" /> - <column name="VALUE" type="VARCHAR2" size="4000" /> - <constraint name="RHQ_MEAS_DATA_TRAIT_ID_TIME_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - - - <table name="RHQ_CALLTIME_DATA_KEY"> - <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> - <column name="SCHEDULE_ID" type="INTEGER" required="true"/> - <column name="CALL_DESTINATION" type="VARCHAR2" size="4000" required="true"/> - <index name="RHQ_CALLTIME_DATA_KEY_IDX" unique="true"> - <field ref="SCHEDULE_ID"/> - <field ref="CALL_DESTINATION"/> - </index> - </table> - - - <table name="RHQ_CALLTIME_DATA_VALUE"> - <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> - <column name="KEY_ID" type="INTEGER" references="RHQ_CALLTIME_DATA_KEY" required="true"/> - <column name="BEGIN_TIME" type="LONG" required="true"/> - <column name="END_TIME" type="LONG" required="true"/> - <column name="MINIMUM" type="DOUBLE" required="true"/> - <column name="MAXIMUM" type="DOUBLE" required="true"/> - <column name="TOTAL" type="DOUBLE" required="true"/> - <column name="COUNT" type="LONG" required="true"/> - <index name="RHQ_CT_DA_VA_END_TIM_IDX"> - <field ref="END_TIME"/> - </index> - </table> - - - <table name="RHQ_AVAILABILITY"> - <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE(ID)"/> - <column name="START_TIME" type="LONG" required="true" /> - <column name="END_TIME" type="LONG" required="false" /> - <column name="AVAILABILITY_TYPE" type="SMALLINT" required="false" /> - <index name="RHQ_AVAIL_RESOURCE_START_IDX"> - <field ref="RESOURCE_ID"/> - <field ref="START_TIME"/> - </index> - <!-- only one null row can exist for any resource --> - <index name="RHQ_AVAIL_RESOURCE_END_IDX" condition="END_TIME IS NULL"> - <field ref="RESOURCE_ID"/> - <field ref="END_TIME" /> - </index> - </table> - - <table name="RHQ_RESOURCE_AVAIL"> - <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE(ID)" ondelete="cascade"/> - <column name="AVAILABILITY_TYPE" type="SMALLINT" required="false" /> - <index name="RHQ_RESOURCE_AVAIL_IDX"> - <field ref="RESOURCE_ID" /> - </index> - </table> - - <table name="RHQ_MEASUREMENT_OOB"> - <column name="SCHEDULE_ID" type="INTEGER" references="RHQ_MEASUREMENT_SCHED(ID)" required="true"/> - <column name="TIME_STAMP" type="LONG" required="true"/> - <column name="OOB_FACTOR" type="INTEGER" required="true" /> - <constraint name="RHQ_MEAS_OOB_ID_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_MEASUREMENT_OOB_TMP"> - <column name="SCHEDULE_ID" type="INTEGER" required="true"/> - <column name="TIME_STAMP" type="LONG" required="true"/> - <column name="OOB_FACTOR" type="INTEGER" required="true" /> - <constraint name="RHQ_MEAS_OOB_TMP_ID_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_NUMBERS"> - <column name="i" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true" /> - </table> - - - <table name="RHQ_MEAS_DATA_NUM_R00"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R00_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R00_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R01"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R01_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R01_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R02"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R02_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R02_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R03"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R03_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R03_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R04"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R04_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R04_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R05"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R05_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R05_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R06"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R06_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R06_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R07"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R07_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R07_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R08"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R08_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R08_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R09"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R09_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R09_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R10"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R10_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R10_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R11"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R11_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R11_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R12"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R12_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R12_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R13"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R13_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R13_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R14"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R14_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R14_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - -<!-- END: measurement-schema.xml --> -<!-- BEGIN: content-schema.xml --> - - - <table name="RHQ_ARCHITECTURE"> - <column name="ID" default="sequence-only" initial="100" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="50" type="VARCHAR2" required="true"/> - <index name="RHQ_ARCHITECTURE_NAME_IDX" unique="true"> - <field ref="NAME"/> - </index> - </table> - - <table name="RHQ_REPO_GROUP_TYPE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - </table> - - - <table name="RHQ_REPO_GROUP"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - - <column name="REPO_GROUP_TYPE_ID" type="INTEGER" references="RHQ_REPO_GROUP_TYPE" required="true"/> - - <index name="RHQ_REPO_GROUP_IDX" unique="true"> - <field ref="NAME"/> - <field ref="REPO_GROUP_TYPE_ID"/> - </index> - </table> - - - <table name="RHQ_CONTENT_SOURCE_TYPE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="false"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="PLUGIN_NAME" size="100" type="VARCHAR2" required="false"/> - <!-- we might want this as part of natural key --> - <column name="DEFAULT_LAZY_LOAD" type="BOOLEAN" required="true"/> - <column name="DEFAULT_DOWNLOAD_MODE" size="16" type="VARCHAR2" required="true"/> - <column name="DEFAULT_SYNC_SCHEDULE" size="64" type="VARCHAR2" required="false"/> - <column name="API_CLASS" size="100" type="VARCHAR2" required="true"/> - - <column name="SOURCE_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF" required="false"/> - - <index name="RHQ_CONTENT_SOURCE_TYPE_IDX" unique="true"> - <field ref="NAME"/> - <!-- <field ref="PLUGIN_NAME"/> --> - </index> - </table> - - <table name="RHQ_CONTENT_SOURCE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="LAZY_LOAD" type="BOOLEAN" required="true"/> - <column name="DOWNLOAD_MODE" size="16" type="VARCHAR2" required="true"/> - <column name="SYNC_SCHEDULE" size="64" type="VARCHAR2" required="false"/> - <column name="LOAD_ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="CREATION_TIME" type="LONG" required="true"/> - <column name="LAST_MODIFIED_TIME" type="LONG" required="true"/> - - <column name="CONTENT_SOURCE_TYPE_ID" type="INTEGER" references="RHQ_CONTENT_SOURCE_TYPE" required="true"/> - <column name="CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> - - <index name="RHQ_CONTENT_SOURCE_IDX" unique="true"> - <field ref="NAME"/> - <field ref="CONTENT_SOURCE_TYPE_ID"/> - </index> - </table> - - <table name="RHQ_REPO"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="CREATION_TIME" type="LONG" required="true"/> - <column name="LAST_MODIFIED_TIME" type="LONG" required="true"/> - <column name="IS_CANDIDATE" type="BOOLEAN" required="true"/> - <column name="SYNC_SCHEDULE" size="64" type="VARCHAR2" required="false"/> - - <index name="RHQ_REPO_IDX" unique="true"> - <field ref="NAME"/> - </index> - </table> - - - <table name="RHQ_REPO_RELATION_TYPE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - </table> - - - <table name="RHQ_REPO_RELATION"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="RELATED_REPO_ID" type="INTEGER" references="RHQ_REPO" required="true"/> - <column name="REPO_RELATION_TYPE_ID" type="INTEGER" references="RHQ_REPO_RELATION_TYPE" required="true"/> - </table> - - - - <table name="RHQ_PACKAGE_TYPE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="false"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="CATEGORY" size="50" type="VARCHAR2" required="false"/> - <column name="DISCOVERY_INTERVAL" type="INTEGER" required="false"/> - <column name="IS_CREATION_DATA" type="BOOLEAN" required="true"/> - <column name="SUPPORTS_ARCHITECTURE" type="BOOLEAN" required="true"/> - - <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE" required="true"/> - <column name="DEPLOYMENT_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF" required="false"/> - <column name="PACKAGE_EXTRA_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG_DEF" required="false"/> - - <index name="RHQ_PACKAGE_TYPE_IDX" unique="true"> - <field ref="NAME"/> - <field ref="RESOURCE_TYPE_ID"/> - </index> - - </table> - - <table name="RHQ_PACKAGE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="CLASSIFICATION" size="200" type="VARCHAR2" required="false"/> - - <column name="PACKAGE_TYPE_ID" type="INTEGER" references="RHQ_PACKAGE_TYPE" required="true"/> - - <index name="RHQ_PACKAGE_IDX" unique="true"> - <field ref="NAME"/> - <field ref="PACKAGE_TYPE_ID"/> - </index> - </table> - - <table name="RHQ_PACKAGE_BITS"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="BITS" type="LARGEOBJECT" required="false"/> - </table> - - <table name="RHQ_PACKAGE_VERSION"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="false"/> - <column name="SHORT_DESCRIPTION" size="10000" type="CLOB" required="false"/> - <column name="LONG_DESCRIPTION" size="50000" type="CLOB" required="false"/> - <column name="VERSION" size="500" type="VARCHAR2" required="true"/> - <column name="DISPLAY_VERSION" size="500" type="VARCHAR2" required="false"/> - <column name="FILE_NAME" size="255" type="VARCHAR2" required="false"/> - <column name="FILE_SIZE" type="LONG" required="false"/> - <column name="FILE_MD5" size="32" type="VARCHAR2" required="false"/> - <column name="FILE_SHA256" size="64" type="VARCHAR2" required="false"/> - <column name="FILE_CREATION_TIME" type="LONG" required="false"/> - <column name="LICENSE_NAME" size="255" type="VARCHAR2" required="false"/> - <column name="LICENSE_VERSION" size="20" type="VARCHAR2" required="false"/> - <column name="METADATA" type="BLOB" required="false"/> - - <column name="PACKAGE_ID" type="INTEGER" references="RHQ_PACKAGE" required="true"/> - <column name="ARCHITECTURE_ID" type="INTEGER" references="RHQ_ARCHITECTURE" required="true"/> - <column name="CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> - <column name="PACKAGE_BITS_ID" type="INTEGER" references="RHQ_PACKAGE_BITS" required="false"/> - - <index name="RHQ_PACKAGE_VERSION_IDX" unique="true"> - <field ref="PACKAGE_ID"/> - <field ref="VERSION"/> - <field ref="ARCHITECTURE_ID"/> - </index> - - </table> - - <table name="RHQ_CONTENT_REQ"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="REQUEST_TYPE" type="VARCHAR2" required="true" size="20"/> - <column name="NOTES" type="VARCHAR2" required="false" size="512"/> - </table> - - <table name="RHQ_INSTALLED_PACKAGE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="INSTALLATION_TIME" type="LONG" required="false"/> - - <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE" required="true"/> - <column name="PACKAGE_VERSION_ID" type="INTEGER" references="RHQ_PACKAGE_VERSION" required="true"/> - <column name="SUBJECT_ID" type="INTEGER" references="RHQ_SUBJECT" required="false"/> - </table> - - <table name="RHQ_INSTALLED_PKG_HIST"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="STATUS" type="VARCHAR2" size="24" required="true"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="HISTORY_TIMESTAMP" type="LONG" required="false"/> - - <column name="PACKAGE_VERSION_ID" type="INTEGER" references="RHQ_PACKAGE_VERSION" required="true"/> - <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE" required="true"/> - <column name="DEPLOYMENT_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> - <column name="CONTENT_SERVICE_REQUEST_ID" type="INTEGER" references="RHQ_CONTENT_REQ" required="false"/> - </table> - - <table name="RHQ_CONTENT_SRC_SYNC"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="STATUS" type="VARCHAR2" size="16" required="true"/> - <column name="START_TIME" type="LONG" required="true"/> - <column name="END_TIME" type="LONG" required="false"/> - <column name="RESULTS" type="LONGVARCHAR" required="false"/> - <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> - </table> - - <table name="RHQ_REPO_SYNC"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="STATUS" type="VARCHAR2" size="16" required="true"/> - <column name="START_TIME" type="LONG" required="true"/> - <column name="END_TIME" type="LONG" required="false"/> - <column name="RESULTS" type="LONGVARCHAR" required="false"/> - <column name="PERCENT_COMPLETE" type="LONG" required="false"/> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - </table> - - - <table name="RHQ_PACKAGE_INST_STEP"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="STEP_KEY" type="VARCHAR2" size="500" required="true"/> - <column name="STEP_ORDER" type="INTEGER" required="true"/> - <column name="DESCRIPTION" type="VARCHAR2" size="4000" required="true"/> - <column name="ERROR_MSG" type="LONGVARCHAR" required="false"/> - <column name="RESULT" type="VARCHAR2" size="25" required="true"/> - - <column name="INSTALLED_PKG_HIST_ID" type="INTEGER" references="RHQ_INSTALLED_PKG_HIST"/> - </table> - - <table name="RHQ_REPO_RESOURCE_MAP"> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> - <column name="CTIME" type="LONG" required="true"/> - - <constraint name="RHQ_REPO_RESOURCE_MAP_KEY"> - <primaryKey> - <field ref="REPO_ID"/> - <field ref="RESOURCE_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_REPO_CONTENT_SRC_MAP"> 1 - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> - <column name="CTIME" type="LONG" required="true"/> - - <constraint name="RHQ_REPO_CONTENT_SRC_MAP_KEY"> - <primaryKey> - <field ref="REPO_ID"/> - <field ref="CONTENT_SRC_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_REPO_REPO_GROUP_MAP"> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - <column name="REPO_GROUP_ID" type="INTEGER" required="true" references="RHQ_REPO_GROUP"/> - <column name="CTIME" type="LONG" required="true"/> - - <constraint name="RHQ_REPO_REPO_GROUP_MAP_KEY"> - <primaryKey> - <field ref="REPO_ID"/> - <field ref="REPO_GROUP_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_REPO_REPO_RELATION_MAP"> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - <column name="REPO_RELATION_ID" type="INTEGER" required="true" references="RHQ_REPO_RELATION"/> - <column name="CTIME" type="LONG" required="true"/> - - <constraint name="RHQ_REPO_REPO_RELATION_MAP_KEY"> - <primaryKey> - <field ref="REPO_ID"/> - <field ref="REPO_RELATION_ID"/> - </primaryKey> - </constraint> - </table> - - - <table name="RHQ_REPO_PKG_VERSION_MAP"> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> - <column name="CTIME" type="LONG" required="true"/> - - <constraint name="RHQ_REPO_PKG_VER_MAP_KEY"> - <primaryKey> - <field ref="REPO_ID"/> - <field ref="PACKAGE_VERSION_ID"/> - </primaryKey> - </constraint> - <index name="RHQ_REPO_PKG_VER_MAP_IDX" unique="false"> - <field ref="PACKAGE_VERSION_ID"/> - </index> - </table> - - <table name="RHQ_PKG_VER_CONTENT_SRC_MAP"> - <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> - <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> - <column name="LOCATION" type="VARCHAR2" size="4000" required="true"/> - - <constraint name="RHQ_PKG_VER_CONTENT_SRC_KEY"> - <primaryKey> - <field ref="PACKAGE_VERSION_ID"/> - <field ref="CONTENT_SRC_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_PKG_PRD_MAP"> - <column name="PKG_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> - <column name="PRD_ID" type="INTEGER" required="true" references="RHQ_PRD_VER"/> - - <constraint name="RHQ_PKG_PRD_KEY"> - <primaryKey> - <field ref="PKG_ID"/> - <field ref="PRD_ID"/> - </primaryKey> - </constraint> - - </table> - - <table name="RHQ_DISTRIBUTION_TYPE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - - </table> - - <table name="RHQ_DISTRIBUTION"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="DISTRIBUTION_TYPE_ID" type="INTEGER" required="true" references="RHQ_DISTRIBUTION_TYPE"/> - <column name="LABEL" size="64" type="VARCHAR2" required="true"/> - <column name="BASE_PATH" size="256" type="VARCHAR2" required="true"/> - <column name="LAST_MODIFIED" type="LONG" required="true"/> - - <index name="RHQ_DISTRIBUTION_IDX" unique="true"> - <field ref="LABEL"/> - <field ref="BASE_PATH"/> - </index> - - </table> - - <table name="RHQ_REPO_DISTRIBUTION"> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - <column name="DISTRIBUTION_ID" type="INTEGER" required="true" references="RHQ_DISTRIBUTION"/> - <column name="LAST_MODIFIED" type="LONG" required="true"/> - - <constraint name="RHQ_REPO_DIST_MAP_KEY"> - <primaryKey> - <field ref="REPO_ID"/> - <field ref="DISTRIBUTION_ID"/> - </primaryKey> - </constraint> - </table> - - - - <table name="RHQ_DISTRIBUTION_FILE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="DISTRIBUTION_ID" type="INTEGER" required="true" references="RHQ_DISTRIBUTION"/> - <column name="RELATIVE_FILENAME" size="256" type="VARCHAR2" required="true"/> - <!--<column name="FILE_SIZE" type="NUMBER" required="true"/>--> - <column name="MD5SUM" size="64" type="VARCHAR2" required="true"/> - <column name="LAST_MODIFIED" type="LONG" required="true"/> - <!--<column name="CTIME" type="LONG" required="true"/>--> - - <index name="RHQ_DISTRIBUTION_FILE_IDX" unique="true"> - <field ref="DISTRIBUTION_ID"/> - <field ref="RELATIVE_FILENAME"/> - </index> - </table> - - - - - <table name="RHQ_ADVISORY"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="ADVISORY" size="64" type="VARCHAR2" required="true"/> - <column name="ADVISORY_TYPE" size="64" type="VARCHAR2" required="true" /> - <column name="ADVISORY_REL" size="64" type="VARCHAR2" required="false"/> - <column name="ADVISORY_NAME" size="64" type="VARCHAR2" required="false"/> - <column name="DESCRIPTION" size="4000" type="VARCHAR2" required="false"/> - <column name="SYNOPSIS" size="4000" type="VARCHAR2" required="true"/> - <column name="TOPIC" size="4000" type="VARCHAR2" required="false"/> - <column name="SOLUTION" size="4000" type="VARCHAR2" required="false"/> - <column name="SEVERITY" size="64" type="VARCHAR2" required="false"/> - <column name="ISSUE_DATE" type="LONG" required="false"/> - <column name="UPDATE_DATE" type="LONG" required="false"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="LAST_MODIFIED" type="LONG" required="true"/> - - <index name="RHQ_ADVISORY_NAME_UQ" unique="true"> - <field ref="ADVISORY_NAME"/> - </index> - - <index name="RHQ_ADVISORY_UQ" unique="true"> - <field ref="ADVISORY"/> - </index> - - <index name="RHQ_ADVISORY_UDATE_IDX" unique="false"> - <field ref="UPDATE_DATE"/> - </index> - </table> - - <table name="RHQ_ADVISORY_PACKAGE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> - <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> - <column name="LAST_MODIFIED" type="LONG" required="true"/> - - <index name="RHQ_ADVISORY_PKG_IDX" unique="true"> - <field ref="ADVISORY_ID"/> - <field ref="PACKAGE_VERSION_ID"/> - </index> - </table> - - <table name="RHQ_CVE"> - <column name="ID" default="sequence-only" initial="101" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="64" type="VARCHAR2" required="true"/> - </table> - - <table name="RHQ_ADVISORY_CVE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> - <column name="CVE_ID" type="INTEGER" required="true" references="RHQ_CVE"/> - <column name="LAST_MODIFIED" type="LONG" required="true"/> - - <index name="RHQ_ADVISORY_CVE_IDX" unique="true"> - <field ref="ADVISORY_ID"/> - <field ref="CVE_ID"/> - </index> - - </table> - - <table name="RHQ_ADVISORY_BUGLIST"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> - <column name="BUG_ID" size="256" type="VARCHAR2" required="true"/> - <column name="LAST_MODIFIED" type="LONG" required="true"/> - - <index name="RHQ_ADVISORY_BUG_IDX" unique="true"> - <field ref="ADVISORY_ID"/> - <field ref="BUG_ID"/> - </index> - </table> - - - <table name="RHQ_REPO_ADVISORY"> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> - <column name="LAST_MODIFIED" type="LONG" required="true"/> - - <constraint name="RHQ_REPO_ADV_MAP_KEY"> - <primaryKey> - <field ref="REPO_ID"/> - <field ref="ADVISORY_ID"/> - </primaryKey> - </constraint> - </table> - - <!-- BUNDLE_TYPE is things like "Cobbler profile" or "file-based bundle" or "puppet recipe" --> - <table name="RHQ_BUNDLE_TYPE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> - - <!-- This index is for constraint, not performance --> - <index name="RHQ_BUNDLE_TYPE_UNIQUE" unique="true"> - <field ref="NAME"/> - </index> - </table> - - <!-- BUNDLE is a named piece of content that can be versioned and installed somewhere --> - <table name="RHQ_BUNDLE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="BUNDLE_TYPE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_TYPE"/> - <column name="PACKAGE_TYPE_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_TYPE"/> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - - <!-- This index is for constraint, not performance --> - <index name="RHQ_BUNDLE_UNIQUE" unique="true"> - <field ref="BUNDLE_TYPE_ID"/> - <field ref="NAME"/> - </index> - </table> - - <!-- BUNDLE_VERSION represents an actual piece of content that needs to be installed somewhere --> - <table name="RHQ_BUNDLE_VERSION"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="VERSION" size="500" type="VARCHAR2" required="true"/> - <column name="VERSION_ORDER" type="INTEGER" required="true"/> - <column name="ACTION" type="CLOB" required="true"/> - <column name="CONFIG_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_DEF" /> - <column name="BUNDLE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE"/> - - <!-- This index is for constraint, not performance --> - <index name="RHQ_BUNDLE_VERSION_UNIQUE" unique="true"> - <field ref="BUNDLE_ID"/> - <field ref="NAME"/> - <field ref="VERSION"/> - </index> - </table> - - <!-- Many-to-many table that links many repos to a particular bundle version. destination platforms --> - <!-- would be required to have associations to the specified repos (to access required content --> - <table name="RHQ_BUNDLE_VERSION_REPO"> - <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - - <constraint name="RHQ_BUNDLE_VERSION_REPO_KEY"> - <primaryKey> - <field ref="BUNDLE_VERSION_ID"/> - <field ref="REPO_ID"/> - </primaryKey> - </constraint> - </table> - - <!-- BUNDLE_FILE represents a file that is associated with (possibly bundled inside) a bundle version --> - <table name="RHQ_BUNDLE_FILE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> - <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> - </table> - - <!-- A logical destination for a bundle deployment. Defines the platforms and directory on those targets. --> - <table name="RHQ_BUNDLE_DESTINATION"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="BUNDLE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE"/> - <column name="GROUP_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_GROUP"/> - <column name="DEPLOY_DIR" size="256" type="VARCHAR2" required="true"/> - - <!-- This index is for constraint, not performance --> - <index name="RHQ_BUNDLE_DESTINATION_UNIQUE" unique="true"> - <field ref="BUNDLE_ID"/> - <field ref="GROUP_ID"/> - <field ref="DEPLOY_DIR"/> - </index> - </table> - - <!-- An actual deployment of a bundle version to a destination, with a specific config. Bundle deployments - can differ only on ctime, which is assumed to be different --> - <table name="RHQ_BUNDLE_DEPLOYMENT"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> - <column name="BUNDLE_DESTINATION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DESTINATION"/> - <column name="CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG" /> - <column name="SUBJECT_NAME" type="VARCHAR2" required="false" size="255"/> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="IS_LIVE" type="BOOLEAN" required="true"/> - <column name="REPLACED_BUNDLE_DEPLOYMENT_ID" type="INTEGER" required="false" references="RHQ_BUNDLE_DEPLOYMENT"/> - </table> - - <!-- Represents a bundle version that is deployed on a platform resource --> - <table name="RHQ_BUNDLE_RES_DEPLOY"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="BUNDLE_DEPLOYMENT_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DEPLOYMENT" /> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE" /> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="CTIME" type="LONG" required="true"/> - - <index name="RHQ_BUNDLE_RES_DEPLOY_IDX" unique="true"> - <field ref="BUNDLE_DEPLOYMENT_ID"/> - <field ref="RESOURCE_ID"/> - </index> - </table> - - <table name="RHQ_BUNDLE_RES_DEP_HIST"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="BUNDLE_RES_DEPLOY_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_RES_DEPLOY" /> - <column name="SUBJECT_NAME" required="false" size="255" type="VARCHAR2"/> - <column name="AUDIT_TIME" required="true" type="LONG"/> - <column name="ACTION" required="true" size="128" type="VARCHAR2"/> - <column name="INFO" required="true" size="512" type="VARCHAR2"/> - <column name="CATEGORY" required="false" size="32" type="VARCHAR2"/> - <column name="STATUS" required="true" type="VARCHAR2" size="16"/> - <column name="MESSAGE" required="false" type="LONGVARCHAR"/> - <column name="ATTACHMENT" required="false" type="LONGVARCHAR"/> - </table> - - <table name="RHQ_TAGGING_BUNDLE_MAP"> - <column name="BUNDLE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE"/> - <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> - <constraint name="RHQ_TAGGING_BUNDLE_MAP_KEY"> - <primaryKey> - <field ref="BUNDLE_ID"/> - <field ref="TAG_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_TAGGING_BUNDLE_VERSION_MAP"> - <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> - <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> - <constraint name="RHQ_TAGGING_BUNDLE_VER_MAP_KEY"> - <primaryKey> - <field ref="BUNDLE_VERSION_ID"/> - <field ref="TAG_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_TAGGING_BUNDLE_DEPLOY_MAP"> - <column name="BUNDLE_DEPLOYMENT_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DEPLOYMENT"/> - <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> - <constraint name="RHQ_TAGGING_BUNDLE_DEP_MAP_KEY"> - <primaryKey> - <field ref="BUNDLE_DEPLOYMENT_ID"/> - <field ref="TAG_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_TAGGING_BUNDLE_DEST_MAP"> - <column name="BUNDLE_DESTINATION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DESTINATION"/> - <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> - <constraint name="RHQ_TAGGING_BUNDLE_DES_MAP_KEY"> - <primaryKey> - <field ref="BUNDLE_DESTINATION_ID"/> - <field ref="TAG_ID"/> - </primaryKey> - </constraint> - </table> - - -<!-- END: content-schema.xml --> -<!-- BEGIN: resource-request-schema.xml --> - - - <table name="RHQ_CREATE_RES_HIST"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="PARENT_RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> - <column name="CREATED_RESOURCE_NAME" type="VARCHAR2" size="500" required="false"/> - <column name="NEW_RESOURCE_KEY" type="VARCHAR2" required="false" size="500"/> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> - <column name="CONFIGURATION_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> - <column name="INSTALLED_PACKAGE_ID" type="INTEGER" required="false" references="RHQ_INSTALLED_PACKAGE"/> - </table> - - <table name="RHQ_DELETE_RES_HIST"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> - </table> - -<!-- END: resource-request-schema.xml --> -<!-- BEGIN: jms-schema.xml --> - -<!-- the schema matches that which would be automatically created by the JMS subsystem --> -<!-- see deploy/jms/rhq-jdbc-state-service.xml and rhq-jdbc2-service.xml --> - - - <table name="JMS_MESSAGES"> - <column name="MESSAGEID" required="true" type="INTEGER" /> - <column name="DESTINATION" required="true" type="VARCHAR2" size="255" /> - <column name="TXID" required="false" type="INTEGER" /> - <column name="TXOP" required="false" type="CHAR" size="1" /> - <column name="MESSAGEBLOB" required="false" type="BLOB" /> - - <constraint name="JMS_MESSAGES_PKEY"> - <primaryKey> - <field ref="MESSAGEID"/> - <field ref="DESTINATION"/> - </primaryKey> - </constraint> - - <index name="JMS_MESSAGES_TXOP_TXID"> - <field ref="TXOP"/> - <field ref="TXID"/> - </index> - <index name="JMS_MESSAGES_DESTINATION"> - <field ref="DESTINATION"/> - </index> - </table> - - <table name="JMS_TRANSACTIONS"> - <column name="TXID" required="true" type="INTEGER" primarykey="true" /> - </table> - - <table name="JMS_USERS"> - <column name="USERID" required="true" type="VARCHAR2" size="32" primarykey="true" /> - <column name="PASSWD" required="true" type="VARCHAR2" size="32" /> - <column name="CLIENTID" required="false" type="VARCHAR2" size="128" /> - </table> - - <table name="JMS_ROLES"> - <column name="ROLEID" required="true" type="VARCHAR2" size="32" /> - <column name="USERID" required="true" type="VARCHAR2" size="32" /> - - <constraint name="JMS_ROLES_PKEY"> - <primaryKey> - <field ref="USERID"/> - <field ref="ROLEID"/> - </primaryKey> - </constraint> - </table> - - <table name="JMS_SUBSCRIPTIONS"> - <column name="CLIENTID" required="true" type="VARCHAR2" size="128" /> - <column name="SUBNAME" required="true" type="VARCHAR2" size="128" /> - <column name="TOPIC" required="true" type="VARCHAR2" size="255" /> - <column name="SELECTOR" required="false" type="VARCHAR2" size="255" /> - - <constraint name="JMS_SUBSCRIPTIONS_PKEY"> - <primaryKey> - <field ref="CLIENTID"/> - <field ref="SUBNAME"/> - </primaryKey> - </constraint> - </table> - -<!-- END: jms-schema.xml --> -<!-- BEGIN: obsolete-schema.xml --> - - - <!-- NOTE: The tables will be dropped in the *** REVERSE ORDER *** as listed in this file! --> - <!-- NOTE: So, put the table you want dropped first at the bottom, and so on... --> - - - <!-- !!! REMOVED FROM CONTENT-SCHEMA !!!! --> - - <table name="RHQ_BUNDLE_CONFIG" obsolete="true"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG" /> - <!-- this probably needs a DTYPE discriminator so we know if its a bundle or a specific bundle version --> - <column name="BUNDLE_VERSION_ID" type="INTEGER" required="false" references="RHQ_BUNDLE_VERSION"/> - <column name="BUNDLE_ID" type="INTEGER" required="false" references="RHQ_BUNDLE"/> - </table> - - <table name="RHQ_CHANNEL" obsolete="true"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="CREATION_TIME" type="LONG" required="true"/> - <column name="LAST_MODIFIED_TIME" type="LONG" required="true"/> - - <index name="RHQ_CHANNEL_IDX" unique="true"> - <field ref="NAME"/> - </index> - </table> - - <table name="RHQ_CHANNEL_RESOURCE_MAP" obsolete="true"> - <column name="CHANNEL_ID" type="INTEGER" required="true" references="RHQ_CHANNEL"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> - <column name="CTIME" type="LONG" required="true"/> - - <constraint name="RHQ_CHANNEL_RESOURCE_MAP_KEY"> - <primaryKey> - <field ref="CHANNEL_ID"/> - <field ref="RESOURCE_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_CHANNEL_CONTENT_SRC_MAP" obsolete="true"> - <column name="CHANNEL_ID" type="INTEGER" required="true" references="RHQ_CHANNEL"/> - <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> - <column name="CTIME" type="LONG" required="true"/> - - <constraint name="RHQ_CHAN_CONTENT_SRC_MAP_KEY"> - <primaryKey> - <field ref="CHANNEL_ID"/> - <field ref="CONTENT_SRC_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_CHANNEL_PKG_VERSION_MAP" obsolete="true"> - <column name="CHANNEL_ID" type="INTEGER" required="true" references="RHQ_CHANNEL"/> - <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> - <column name="CTIME" type="LONG" required="true"/> - - <constraint name="RHQ_CHANNEL_PKG_VER_MAP_KEY"> - <primaryKey> - <field ref="CHANNEL_ID"/> - <field ref="PACKAGE_VERSION_ID"/> - </primaryKey> - </constraint> - </table> - - <!-- !!! REMOVED FROM MEASUREMENT-SCHEMA !!!! --> - - <table name="RHQ_MEASUREMENT_OOB" obsolete="true"> - <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> - <column name="SCHEDULE_ID" type="INTEGER" references="RHQ_MEASUREMENT_SCHED(ID)" required="true"/> - <column name="OCCURRED" type="LONG" required="true"/> - <column name="DIFF" type="DOUBLE" required="true"/> - - <index name="RHQ_MEASUREMENT_OOB_IDX" unique="true"> - <field ref="SCHEDULE_ID" /> - <field ref="OCCURRED" /> - </index> - </table> - - - <table name="RHQ_TAG" obsolete="true"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - </table> - - <table name="RHQ_REPO_TAG_MAP" obsolete="true"> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAG"/> - - <constraint name="RHQ_REPO_TAG_MAP_KEY"> - <primaryKey> - <field ref="REPO_ID"/> - <field ref="TAG_ID"/> - </primaryKey> - </constraint> - </table> - - -<!-- END: obsolete-schema.xml --> -</dbsetup> diff --git a/modules/enterprise/gui/installer/src/test/resources/org/rhq/enterprise/installer/db-schema-combined-3.0.0.xml b/modules/enterprise/gui/installer/src/test/resources/org/rhq/enterprise/installer/db-schema-combined-3.0.0.xml deleted file mode 100644 index 4c07e1a..0000000 --- a/modules/enterprise/gui/installer/src/test/resources/org/rhq/enterprise/installer/db-schema-combined-3.0.0.xml +++ /dev/null @@ -1,2649 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<dbsetup name="schema"> -<!-- BEGIN: config-schema.xml --> - - - <!-- Definition or Metadata tables --> - - <table name="RHQ_CONFIG_DEF"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="NAME" type="VARCHAR2" required="true" size="100"/> - <column name="DESCRIPTION" type="VARCHAR2" required="false" size="250"/> - <column name="VERSION" type="VARCHAR2" required="false" size="50"/> - <column name="CONFIG_FORMAT" type="VARCHAR2" required="false" size="32"/> - </table> - - <table name="RHQ_CONFIG_PROP_GRP_DEF"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="NAME" type="VARCHAR2" required="true" size="100"/> - <column name="DISPLAY_NAME" type="VARCHAR2" required="false" size="100"/> - <column name="DESCRIPTION" type="VARCHAR2" required="false" size="250"/> - <column name="DEFAULT_HIDDEN" type="BOOLEAN" required="false"/> - <column name="ORDER_INDEX" type="INTEGER" required="false"/> - </table> - - <table name="RHQ_CONFIG_PROP_DEF"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="NAME" type="VARCHAR2" required="false" size="255"/> - <column name="DISPLAY_NAME" type="VARCHAR2" required="false" size="100"/> - <column name="DESCRIPTION" type="VARCHAR2" required="false" size="1000"/> - <column name="DEFAULT_VALUE" type="VARCHAR2" required="false" size="2000"/> - <column name="REQUIRED" type="BOOLEAN" required="false"/> - <column name="READONLY" type="BOOLEAN" required="false"/> - <column name="SUMMARY" type="BOOLEAN" required="false"/> - <column name="ACTIVATION_POLICY" type="VARCHAR2" required="false" size="20"/> - <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_GRP_DEF"/> - <column name="ORDER_INDEX" type="INTEGER" required="false"/> - <column name="VERSION" type="VARCHAR2" required="false" size="50"/> - <column name="PARENT_MAP_DEFINITION_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> - <column name="PARENT_LIST_DEFINITION_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> - <column name="SIMPLE_TYPE" type="VARCHAR2" required="false" size="20"/> - <column name="ALLOW_CUSTOM_ENUM_VALUE" type="BOOLEAN" required="false"/> - <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> - <column name="CONFIG_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_DEF"/> - - <!-- only simple properties (not lists and maps) have this --> - <column name="UNITS" type="SMALLINT" required="false"/> - - <!-- only dynamic properties (not simple) have this --> - <column name="DYNAMIC_TYPE" type="VARCHAR2" size="20" required="false"/> - <column name="DYNAMIC_KEY" type="VARCHAR2" size="128" required="false"/> - </table> - - <table name="RHQ_CONF_PROP_DEF_ENUM"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="STRING_VALUE" type="VARCHAR2" required="false" size="500"/> - <column name="ORDER_INDEX" type="INTEGER" required="false"/> - <column name="NAME" type="VARCHAR2" required="false" size="100"/> - <column name="PROPERTY_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> - </table> - - <table name="RHQ_CONFIG_PD_OSRC"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="LINK_TO_TARGET" type="BOOLEAN" required="false"/> - <column name="FILTER" type="VARCHAR2" required="false" size="40"/> - <column name="EXPRESSION" type="VARCHAR2" required="true" size="400"/> - <column name="TARGET_TYPE" type="VARCHAR2" required="true" size="20"/> - <column name="PROPERTY_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> - </table> - - <table name="RHQ_CONFIG_PROP_CONSTR"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="DTYPE" type="VARCHAR2" required="true" size="15"/> - <column name="DETAILS" type="VARCHAR2" required="false" size="250"/> - <column name="CONFIG_PROP_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> - <column name="ORDER_INDEX" type="INTEGER" required="false"/> - </table> - - - <!-- Content or value tables --> - - <table name="RHQ_CONFIG"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="NOTES" type="VARCHAR2" required="false" size="512"/> - <column name="VERSION" type="VARCHAR2" required="false" size="50"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - </table> - - <table name="RHQ_CONFIG_PROPERTY"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="CONFIGURATION_ID" type="INTEGER" required="false" references="RHQ_CONFIG" ondelete="cascade"/> - <column name="STRING_VALUE" type="VARCHAR2" required="false" size="2000"/> - <column name="OVERRIDE" type="BOOLEAN" required="false"/> - <column name="NAME" type="VARCHAR2" required="true" size="255"/> - <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> - <!-- Recursive cascade path to RHQ_CONFIG_PROPERTY causes constraint creation errors on SQL Server, see - http://support.microsoft.com/kb/321843 --> - <column name="PARENT_LIST_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROPERTY" ondelete="cascade" /> - <column name="PARENT_MAP_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROPERTY" ondelete="cascade" /> - <column name="LIST_INDEX" type="INTEGER"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <index name="RHQ_CONFIG_PROP_idx_prop_key" unique="false"> - <field ref="CONFIGURATION_ID"/> - <field ref="NAME"/> - </index> - <index name="RHQ_CONFIG_PROP_idx_map_key" unique="false"> - <field ref="PARENT_MAP_ID"/> - <field ref="NAME"/> - </index> - <index name="RHQ_CONFIG_PROP_idx_list_key" unique="false"> - <field ref="PARENT_LIST_ID"/> - </index> - <!-- List entries all have the same name --> - </table> - - <table name="RHQ_CONFIG_TEMPLATE"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="NAME" type="VARCHAR2" required="false" size="100"/> - <column name="DESCRIPTION" type="VARCHAR2" required="false" size="500"/> - <column name="CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> - <column name="CONFIG_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_DEF"/> - <column name="IS_DEFAULT" type="BOOLEAN" required="false"/> - </table> - - <table name="RHQ_RAW_CONFIG"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="CONFIG_ID" type="INTEGER" required="true" references="RHQ_CONFIG(ID)"/> - <column name="PATH" type="VARCHAR2" required="false" size="512"/> - <column name="CONTENTS" type="CLOB" required="true"/> - <column name="SHA256" type="VARCHAR2" size="64" required="true"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - </table> - -<!-- END: config-schema.xml --> -<!-- BEGIN: cluster-schema.xml --> - - <table name="RHQ_AFFINITY_GROUP"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" required="true" size="255" type="VARCHAR2"/> - </table> - - <table name="RHQ_SERVER"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" required="true" size="255" type="VARCHAR2"/> - <column name="ADDRESS" required="true" size="255" type="VARCHAR2"/> - <column name="PORT" required="true" type="INTEGER"/> - <column name="SECURE_PORT" required="true" type="INTEGER"/> - <column name="CTIME" required="true" type="LONG"/> - <column name="MTIME" required="true" type="LONG"/> - <column name="AFFINITY_GROUP_ID" type="INTEGER" references="RHQ_AFFINITY_GROUP" required="false"/> - <column name="COMPUTE_POWER" required="true" type="INTEGER"/> - <column name="OPERATION_MODE" required="true" size="32" type="VARCHAR2"/> - <column name="STATUS" type="INTEGER" required="false" default="0" /> - - <!-- This index is for constraint, not performance --> - <index name="RHQ_SERVER_NAME_UNIQUE" unique="true"> - <field ref="NAME"/> - </index> - </table> - - <!-- new agent --> - <table name="RHQ_AGENT"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" required="true" size="255" type="VARCHAR2"/> - <column name="ADDRESS" required="true" size="255" type="VARCHAR2"/> - <column name="PORT" required="true" type="INTEGER"/> - <column name="AGENTTOKEN" required="true" size="100" type="VARCHAR2"/> - <column name="REMOTE_ENDPOINT" required="false" size="4000" type="VARCHAR2"/> - <column name="CTIME" required="true" type="LONG"/> - <column name="MTIME" required="true" type="LONG"/> - <column name="LAST_AVAILABILITY_REPORT" required="false" type="LONG"/> - <column name="AFFINITY_GROUP_ID" type="INTEGER" references="RHQ_AFFINITY_GROUP" required="false"/> - <column name="SERVER_ID" type="INTEGER" references="RHQ_SERVER" required="false"/> - <column name="STATUS" type="INTEGER" required="false" default="0" /> - <column name="BACKFILLED" type="BOOLEAN" required="true" /> - - <index name="RHQ_AGENT_NAME_UNIQUE" unique="true"> - <field ref="NAME"/> - </index> - - <index name="RHQ_AGENT_ADDRESS_PORT" unique="true"> - <field ref="ADDRESS"/> - <field ref="PORT"/> - </index> - - <index name="RHQ_AGENT_TOKEN_UNIQUE" unique="true"> - <field ref="AGENTTOKEN"/> - </index> - </table> - - <table name="RHQ_PARTITION_EVENT"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="SUBJECT_NAME" required="true" size="100" type="VARCHAR2"/> - <column name="CTIME" required="true" type="LONG"/> - <column name="EVENT_TYPE" required="true" size="50" type="VARCHAR2"/> - <column name="EVENT_DETAIL" required="false" size="512" type="VARCHAR2"/> - <column name="EXECUTION_STATUS" required="true" size="32" type="VARCHAR2"/> - </table> - - <table name="RHQ_PARTITION_DETAILS"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="PARTITION_EVENT_ID" type="INTEGER" references="RHQ_PARTITION_EVENT" required="true"/> - <column name="AGENT_NAME" type="VARCHAR2" size="255" required="true"/> - <column name="SERVER_NAME" type="VARCHAR2" size="255" required="true"/> - </table> - - <table name="RHQ_FAILOVER_LIST"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="PARTITION_EVENT_ID" type="INTEGER" references="RHQ_PARTITION_EVENT" required="true"/> - <column name="AGENT_ID" type="INTEGER" references="RHQ_AGENT" required="true"/> - <column name="CTIME" required="true" type="LONG"/> - </table> - - <table name="RHQ_FAILOVER_DETAILS"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="FAILOVER_LIST_ID" type="INTEGER" references="RHQ_FAILOVER_LIST" required="true"/> - <column name="SERVER_ID" type="INTEGER" references="RHQ_SERVER" required="true"/> - <column name="ORDINAL" type = "INTEGER" required="true"/> - </table> - -<!-- END: cluster-schema.xml --> -<!-- BEGIN: auth-schema.xml --> - - - <table name="RHQ_PRINCIPAL"> - - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="PRINCIPAL" required="true" type="VARCHAR2" size="100"/> - <column name="PASSWORD" required="true" type="VARCHAR2" size="64"/> - - <!-- ensure that principals are unique --> - <index name="RHQ_PRINCIPAL_PRINCIPAL_KEY" unique="true"> - <field ref="PRINCIPAL"/> - </index> - - </table> - - <table name="RHQ_SUBJECT"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" required="true" size="100" type="VARCHAR2"/> - <column name="CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG"/> - <column name="FIRST_NAME" required="false" size="100" type="VARCHAR2"/> - <column name="LAST_NAME" required="false" size="100" type="VARCHAR2"/> - <column name="EMAIL_ADDRESS" size="100" type="VARCHAR2"/> - <column name="SMS_ADDRESS" size="100" type="VARCHAR2"/> - <column name="PHONE_NUMBER" size="100" type="VARCHAR2"/> - <column name="DEPARTMENT" size="100" type="VARCHAR2"/> - <column name="FACTIVE" required="true" type="BOOLEAN" default="true"/> - <column name="FSYSTEM" required="true" type="BOOLEAN" default="false"/> - - <index name="RHQ_SUBJECT_AUTH_KEY" unique="true"> - <field ref="NAME"/> - </index> - </table> - -<!-- END: auth-schema.xml --> -<!-- BEGIN: inventory-schema.xml --> - - - <!-- NEW RESOURCE TYPES --> - <table name="RHQ_RESOURCE_TYPE"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" type="VARCHAR2" size="100" required="true"/> - <column name="CATEGORY" type="VARCHAR2" size="16" required="true"/> - <column name="CREATION_DATA_TYPE" type="VARCHAR2" size="16" required="true"/> - <column name="CREATE_DELETE_POLICY" type="VARCHAR2" size="16" required="true"/> - <column name="SINGLETON" type="BOOLEAN" required="true"/> - <column name="SUPPORTS_MANUAL_ADD" type="BOOLEAN" required="true"/> - <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> - <column name="PLUGIN" type="VARCHAR2" size="100"/> - <column name="CTIME" type="LONG"/> - <column name="MTIME" type="LONG"/> - <column name="DELETED" type="BOOLEAN" default="FALSE" required="TRUE"/> - <column name="SUBCATEGORY_ID" type="INTEGER"/> - <!-- - TODO add support to DB setup for tables with circular dependencies and then add back this RI - <column name="SUBCATEGORY_ID" type="INTEGER" references="RHQ_RESOURCE_SUBCAT" /> - --> - <column name="PLUGIN_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> - <column name="RES_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> - <column name="BUNDLE_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG"/> - - <index name="RHQ_RES_TYPE_IDX_PLG_NAME" unique="true"> - <field ref="NAME"/> - <field ref="PLUGIN"/> - </index> - </table> - - <!-- NEW RESOURCE SUBCATEGORIES --> - <table name="RHQ_RESOURCE_SUBCAT"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" type="VARCHAR2" size="100"/> - <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> - <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> - <column name="CTIME" type="LONG"/> - <column name="MTIME" type="LONG"/> - <column name="PARENT_SUBCATEGORY_ID" type="INTEGER" references="RHQ_RESOURCE_SUBCAT"/> - <!-- resourceTypeId is not required on child sub categories --> - <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> - </table> - - <!-- Many To Many mapping for resource type to its parents --> - <table name="RHQ_RESOURCE_TYPE_PARENTS"> - <column name="RESOURCE_TYPE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> - <column name="PARENT_RESOURCE_TYPE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> - - <!-- not using full words to fit index name length --> - <constraint name="RHQ_RES_TYPE_PARENTS_KEY"> - <primaryKey> - <field ref="RESOURCE_TYPE_ID"/> - <field ref="PARENT_RESOURCE_TYPE_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_PROCESS_SCAN"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="QUERY" type="VARCHAR2" size="256" required="true"/> - <column name="NAME" type="VARCHAR2" size="100" required="false"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> - - <index name="RHQ_PROCESS_SCAN_QUERY_INDEX" unique="true"> - <field ref="QUERY"/> - <field ref="RESOURCE_TYPE_ID"/> - </index> - </table> - - <table name="RHQ_PRD_VER"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="VERSION" type="VARCHAR2" size="100" required="true"/> - <column name="RES_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> - </table> - - <table name="RHQ_RESOURCE"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> - <column name="UUID" type="CHAR" size="36" required="true"/> - <column name="NAME" type="VARCHAR2" size="500"/> - <!-- ancestry holds the full parental ancestry, used for disambiguation --> - <column name="ANCESTRY" type="VARCHAR2" required="false" size="4000"/> - <column name="RESOURCE_KEY" type="VARCHAR2" required="true" size="500"/> - <column name="AGENT_ID" required="false" type="INTEGER" references="RHQ_AGENT(id)"/> - <column name="INVENTORY_STATUS" type="VARCHAR2" size="20"/> - <column name="CONNECTED" type="BOOLEAN"/> - <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> - <column name="VERSION" type="VARCHAR2" size="100"/> - <column name="CTIME" type="LONG"/> - <column name="MTIME" type="LONG"/> - <column name="ITIME" type="LONG"/> - <column name="RES_CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG"/> - <column name="PLUGIN_CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG"/> - <column name="MODIFIED_BY" required="false" size="100" type="VARCHAR2"/> - <column name="LOCATION" required="false" size="100" type="VARCHAR2"/> - <column name="PARENT_RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE"/> - <column name="PRODUCT_VERSION_ID" type="INTEGER" references="RHQ_PRD_VER"/> - - <index name="RHQ_RESOURCE_idx_key"> - <field ref="RESOURCE_KEY"/> - </index> - - <index name="RHQ_RESOURCE_idx_type"> - <field ref="RESOURCE_TYPE_ID"/> - </index> - - <index name="RHQ_RESOURCE_idx_agent"> - <field ref="AGENT_ID"/> - </index> - - <index name="RHQ_RESOURCE_idx_parent"> - <field ref="PARENT_RESOURCE_ID"/> - </index> - - </table> - - <table name="RHQ_RESOURCE_ERROR"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> - <column name="TIME_OCCURRED" type="LONG" required="true"/> - <column name="ERROR_TYPE" type="VARCHAR2" required="true" size="32"/> - <column name="SUMMARY" type="VARCHAR2" required="true" size="1000"/> - <column name="DETAIL" type="LONGVARCHAR" required="false"/> - - <index name="RHQ_RES_ERROR_IDX_RES_ID"> - <field ref="RESOURCE_ID"/> - </index> - </table> - - <table name="RHQ_GROUP_DEF"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" required="true" size="100" type="VARCHAR2"/> - <column name="DESCRIPTION" size="100" type="VARCHAR2"/> - <column name="CTIME" type="LONG"/> - <column name="MTIME" type="LONG"/> - <column name="CALC_TIME" type="LONG"/> - <column name="CALC_INTERVAL" type="LONG"/> - <column name="RECURSIVE" type="BOOLEAN"/> - <column name="EXPRESSION" type="VARCHAR2" size="1000"/> - - <index name="RHQ_GROUP_DEF_NAME" unique="true"> - <field ref="NAME"/> - </index> - </table> - - <table name="RHQ_RESOURCE_GROUP"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <!-- this name can be longer than the size of the GROUP_BY column, which is used to uniquely identify it --> - <!-- Max bytes for Oracle Varchar2 to accommodate large cluster keys --> - <column name="NAME" required="true" size="4000" type="VARCHAR2"/> - <column name="DESCRIPTION" size="100" type="VARCHAR2"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> - <!-- Compatible groups only --> - <column name="CTIME" type="LONG"/> - <column name="MTIME" type="LONG"/> - <column name="MODIFIED_BY" required="false" size="100" type="VARCHAR2"/> - <column name="RECURSIVE" type="BOOLEAN"/> - - <column name="GROUP_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_GROUP_DEF"/> - <column name="GROUP_BY" size="500" type="VARCHAR2"/> - - <column name="CATEGORY" type="VARCHAR2" size="20" required="true"/> - - <!-- This is only set if this is a subject-owned group (like an autogroup) --> - <column name="SUBJECT_ID" type="INTEGER" references="RHQ_SUBJECT"/> - - <!-- These two only set if this is a backing group for a resource auto-cluster --> - <column name="CLUSTER_KEY" type="VARCHAR2" size="4000" required="false"/> - <column name="CLUSTER_RESOURCE_GROUP_ID" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> - - <!-- This is only set if this is a backing group for a resource auto-group --> - <column name="AUTO_GROUP_PARENT_RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE"/> - - <column name="VISIBLE" type="BOOLEAN"/> - - <index name="RHQ_RES_GROUP_NAME" unique="false"> - <field ref="NAME"/> - </index> - </table> - - <!-- Many To Many mapping for groups to implicit resources --> - <table name="RHQ_RESOURCE_GROUP_RES_IMP_MAP"> - <column name="RESOURCE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE"/> - <column name="RESOURCE_GROUP_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> - - <!-- not using full words to fit index name length --> - <constraint name="RHQ_RES_GROUP_RES_IMP_MAP_KEY"> - <primaryKey> - <field ref="RESOURCE_ID"/> - <field ref="RESOURCE_GROUP_ID"/> - </primaryKey> - </constraint> - </table> - - <!-- Many To Many mapping for groups to explicit resources --> - <table name="RHQ_RESOURCE_GROUP_RES_EXP_MAP"> - <column name="RESOURCE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE"/> - <column name="RESOURCE_GROUP_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> - - <!-- not using full words to fit index name length --> - <constraint name="RHQ_RES_GROUP_RES_EXP_MAP_KEY"> - <primaryKey> - <field ref="RESOURCE_ID"/> - <field ref="RESOURCE_GROUP_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_CONFIG_GROUP_UPDATE"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="GROUP_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_GROUP"/> - <column name="CONFIGURATION_ID" type="INTEGER" required="true" references="RHQ_CONFIG"/> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="SUBJECT_NAME" type="VARCHAR2" required="false" size="100"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> - </table> - - <table name="RHQ_CONFIG_UPDATE"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="CONFIGURATION_ID" type="INTEGER" required="true" references="RHQ_CONFIG" ondelete="cascade"/> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="SUBJECT_NAME" type="VARCHAR2" required="false" size="100"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="CONFIG_RES_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> - <column name="PLUGIN_CONFIG_RES_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> - <column name="AGG_RES_UPDATE_ID" type="INTEGER" required="false" references="RHQ_CONFIG_GROUP_UPDATE"/> - <column name="AGG_PLUGIN_UPDATE_ID" type="INTEGER" required="false" references="RHQ_CONFIG_GROUP_UPDATE"/> - <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> - </table> - - - <table name="RHQ_TAGGING"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="NAMESPACE" type="VARCHAR2" required="false" size="20"/> - <column name="SEMANTIC" type="VARCHAR2" required="false" size="50"/> - <column name="NAME" type="VARCHAR2" required="true" size="100"/> - </table> - - <table name="RHQ_TAGGING_RESOURCE_MAP"> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> - <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> - <constraint name="RHQ_TAGGING_RESOURCE_MAP_KEY"> - <primaryKey> - <field ref="RESOURCE_ID"/> - <field ref="TAG_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_TAGGING_RES_GROUP_MAP"> - <column name="RESOURCE_GROUP_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_GROUP"/> - <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> - <constraint name="RHQ_TAGGING_RES_GROUP_MAP_KEY"> - <primaryKey> - <field ref="RESOURCE_GROUP_ID"/> - <field ref="TAG_ID"/> - </primaryKey> - </constraint> - </table> - -<!-- END: inventory-schema.xml --> -<!-- BEGIN: authz-schema.xml --> - - - <table name="RHQ_ROLE"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" required="true" size="100" type="VARCHAR2"/> - <column name="DESCRIPTION" size="100" type="VARCHAR2"/> - <column name="FSYSTEM" type="BOOLEAN" default="false"/> - - <index name="RHQ_ROLE_NAME_KEY" unique="true"> - <field ref="NAME"/> - </index> - </table> - - <table name="RHQ_ROLE_RESOURCE_GROUP_MAP"> - <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> - <column name="RESOURCE_GROUP_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> - - <constraint name="RHQ_ROLE_RES_GROUP_MAP_KEY"> - <primaryKey> - <field ref="ROLE_ID"/> - <field ref="RESOURCE_GROUP_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_ROLE_LDAP_GROUP"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> - <column name="LDAP_GROUP_NAME" size="128" required="true" type="VARCHAR2"/> - - <index name="RHQ_ROLE_LDAP_GROUP_IDX" unique="true"> - <field ref="ROLE_ID"/> - <field ref="LDAP_GROUP_NAME"/> - </index> - </table> - - <table name="RHQ_PERMISSION"> - <column name="ROLE_ID" type="INTEGER" references="RHQ_ROLE" required="true"/> - <column name="OPERATION" type="INTEGER" required="true"/> - <constraint name="RHQ_PERMISSION_PK"> - <primaryKey> - <field ref="ROLE_ID"/> - <field ref="OPERATION"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_SUBJECT_ROLE_MAP"> - <column name="SUBJECT_ID" required="true" type="INTEGER" references="RHQ_SUBJECT"/> - <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> - - <constraint name="RHQ_SUBJECT_ROLE_MAPPING_KEY"> - <primaryKey> - <field ref="SUBJECT_ID"/> - <field ref="ROLE_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_SUBJECT_ROLE_LDAP_MAP"> - <column name="SUBJECT_ID" required="true" type="INTEGER" references="RHQ_SUBJECT"/> - <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> - <constraint name="RHQ_SUBJECT_ROLE_LDAP_MAP_PK"> - <primaryKey> - <field ref="SUBJECT_ID" /> - <field ref="ROLE_ID"/> - </primaryKey> - </constraint> - </table> -<!-- END: authz-schema.xml --> -<!-- BEGIN: search-schema.xml --> - - - <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="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="GLOBAL" type="BOOLEAN" required="true"/> - </table> - -<!-- END: search-schema.xml --> -<!-- BEGIN: dashboard-schema.xml --> - - - - <table name="RHQ_DASHBOARD"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" type="VARCHAR2" size="200" required="true"/> - <column name="SUBJECT_ID" type="INTEGER" required="true" references="RHQ_SUBJECT"/> - <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> - <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_RESOURCE_GROUP"/> - <column name="CATEGORY" type="VARCHAR2" size="20" required="true"/> - <column name="SHARED" type="BOOLEAN" required="true"/> - <column name="CONFIGURATION_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> - </table> - - - <table name="RHQ_DASHBOARD_PORTLET"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" type="VARCHAR2" size="200" required="true"/> - <column name="PORTLET_KEY" type="VARCHAR2" size="200" required="true"/> - <column name="COL" type="INTEGER" required="true"/> - <column name="COL_INDEX" type="INTEGER" required="true"/> - <column name="HEIGHT" type="INTEGER" required="true"/> - <column name="CONFIGURATION_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> - <column name="DASHBOARD_ID" type="INTEGER" required="false" references="RHQ_DASHBOARD"/> - </table> - -<!-- END: dashboard-schema.xml --> -<!-- BEGIN: operation-schema.xml --> - - - <table name="RHQ_OPERATION_DEF"> - - <!-- === required columns === --> - - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE(ID)"/> - <column name="NAME" type="VARCHAR2" required="true" size="100"/> - - <!-- === optional columns === --> - - <!-- an OSGI version range - if null, the operation def applies to all versions of the associated resource type --> - <column name="RESOURCE_VERSION_RANGE" type="VARCHAR2" size="100"/> - - <!-- A parameter config definition is only required for operations that have parameters. --> - <!-- A results config definition is only required for operations that return data. --> - <column name="PARAMETER_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> - <column name="RESULTS_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> - <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> - <column name="DESCRIPTION" type="VARCHAR2" size="4000"/> - <column name="TIMEOUT" type="INTEGER"/> - - <!-- === business key (RESOURCE_TYPE_ID + NAME) === --> - <index name="RHQ_OPERATION_DEF_KEY_IDX" unique="true"> - <field ref="RESOURCE_TYPE_ID"/> - <field ref="NAME"/> - </index> - - </table> - - <table name="RHQ_OPERATION_HISTORY"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="DTYPE" type="VARCHAR2" required="true" size="8"/> - <column name="JOB_NAME" type="VARCHAR2" required="true" size="100"/> - <column name="JOB_GROUP" type="VARCHAR2" required="true" size="100"/> - <column name="OPERATION_DEF_ID" type="INTEGER" required="true" references="RHQ_OPERATION_DEF"/> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="STIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="PARAMETERS_CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> - - <!-- for resource history --> - <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> - <column name="RESULTS_CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> - <column name="GROUP_HISTORY_ID" type="INTEGER" required="false" references="RHQ_OPERATION_HISTORY"/> - - <!-- for group history --> - <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_RESOURCE_GROUP"/> - - <index name="RHQ_OPERATION_HISTORY_JOB_IDX" unique="true"> - <field ref="JOB_NAME"/> - <field ref="JOB_GROUP"/> - <field ref="CTIME"/> - </index> - - </table> - - <!-- - This table is really just to support some specific use-cases. - Specifically, to be able to get a list of histories for a specific schedule (aka quartz job) - and to be able to query a list of all schedules along with their associated resource/group IDs - possibly sorted by their next fire time. - Note that a NULL next fire time means it won't fire again and the row is probaby about to be deleted; - we can probably not even insert rows with NULL and make it a non-nullable field. But rather than - code special conditions into the session bean, we'll allow a short-lived NULL next fire time row. - --> - <table name="RHQ_OPERATION_SCHEDULE"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - - <column name="JOB_NAME" type="VARCHAR2" required="true" size="100"/> - <column name="JOB_GROUP" type="VARCHAR2" required="true" size="100"/> - <column name="DTYPE" type="VARCHAR2" required="true" size="8"/> - <column name="NEXT_FIRE_TIME" type="LONG" required="false"/> - - <!-- for resource history --> - <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> - - <!-- for group history --> - <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_RESOURCE_GROUP"/> - - <!-- - Note, this is the same as the primary key that Quartz uses for its schedules (RHQ_QRTZ_JOB_DETAILS). - We do not need to add DTYPE to the key, because we ensure the name/group are unique across resource/group - schedules - --> - <!-- === business key (JOB_NAME + JOB_GROUP) === --> - <index name="RHQ_OPERATION_SCHEDULE_KEY_IDX" unique="true"> - <field ref="JOB_NAME"/> - <field ref="JOB_GROUP"/> - </index> - </table> - -<!-- END: operation-schema.xml --> -<!-- BEGIN: event-schema.xml --> - - - <!-- metadata --> - - <table name="RHQ_EVENT_DEF"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE(ID)"/> - - <column name="NAME" type="VARCHAR2" size="100" required="true"/> - <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> - <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> - - <index name="RHQ_EVENT_DEF_IDX" unique="true"> - <field ref="RESOURCE_TYPE_ID"/> - <field ref="NAME"/> - </index> - </table> - - <!-- instance data --> - - <table name="RHQ_EVENT_SOURCE"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="EVENT_DEF_ID" type="INTEGER" required="true" references="RHQ_EVENT_DEF(ID)"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE(ID)"/> - - <column name="LOCATION" required="true" size="2000" type="VARCHAR2"/> - - <index name="RHQ_EVENT_SOURCE_IDX" unique="true"> - <field ref="EVENT_DEF_ID"/> - <field ref="RESOURCE_ID"/> - <field ref="LOCATION"/> - </index> - </table> - - <table name="RHQ_EVENT"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="EVENT_SOURCE_ID" type="INTEGER" required="true" references="RHQ_EVENT_SOURCE(ID)"/> - - <column name="TIMESTAMP" required="true" type="LONG"/> - <column name="SEVERITY" required="true" size="20" type="VARCHAR2"/> - <column name="DETAIL" required="true" size="4000" type="VARCHAR2"/> - <index name="RHQ_EVENT_IDX" unique="false"> - <field ref="EVENT_SOURCE_ID"/> - <field ref="TIMESTAMP"/> - </index> - </table> - -<!-- END: event-schema.xml --> -<!-- BEGIN: alert-schema.xml --> - - - <table name="RHQ_ALERT_DEFINITION"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" required="true" size="100" type="VARCHAR2"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="PARENT_ID" type="INTEGER" required="false"/> - <column name="GROUP_ALERT_DEF_ID" type="INTEGER" required="false"/> - <column name="DESCRIPTION" required="false" size="250" type="VARCHAR2"/> - <column name="PRIORITY" type="VARCHAR2" size="15" required="true"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE" required="false"/> - <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE" required="false"/> - <column name="RESOURCE_GROUP_ID" type="INTEGER" references="RHQ_RESOURCE_GROUP" required="false"/> - <column name="ENABLED" required="true" default="TRUE" type="BOOLEAN"/> - - <column name="REQUIRED" required="true" type="SMALLINT"/> - - <column name="RECOVERY_ID" type="INTEGER" required="true"/> - <!-- required, but 0 effectively means null --> - <column name="WILL_RECOVER" required="true" default="false" type="BOOLEAN"/> - <column name="NOTIFY_FILTERED" required="true" default="false" type="BOOLEAN"/> - <column name="CONTROL_FILTERED" required="true" default="FALSE" type="BOOLEAN"/> - - <column name="DELETED" required="true" default="FALSE" type="BOOLEAN"/> - <column name="READ_ONLY" required="true" default="FALSE" type="BOOLEAN"/> - - <column name="DAMPENING_CATEGORY" type="SMALLINT" required="true"/> - <column name="DAMPENING_VALUE" type="INTEGER"/> - <column name="DAMPENING_VALUE_UNITS" type="SMALLINT"/> - <column name="DAMPENING_PERIOD" type="INTEGER"/> - <column name="DAMPENING_PERIOD_UNITS" type="SMALLINT"/> - </table> - - <table name="RHQ_ALERT_DAMPEN_EVENT"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> - <column name="EVENT_TYPE" required="true" type="SMALLINT"/> - <column name="EVENT_TIMESTAMP" required="true" type="LONG"/> - - <index name="RHQ_DAMPENING_EVENT_TYPE_IDX"> - <field ref="EVENT_TYPE"/> - </index> - <index name="RHQ_DAMPENING_EVENT_TS_IDX"> - <field ref="EVENT_TIMESTAMP"/> - </index> - </table> - - <table name="RHQ_ALERT_CONDITION"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="TYPE" required="true" type="VARCHAR2" size="15"/> - <!-- - <column name="REQUIRED" required="true" type="BOOLEAN"/> - --> - <column name="MEASUREMENT_DEFINITION_ID" required="false" type="INTEGER"/> - <column name="NAME" required="false" size="100" type="VARCHAR2"/> - <column name="COMPARATOR" required="false" size="2" type="VARCHAR2"/> - <column name="THRESHOLD" required="false" type="DOUBLE"/> - <!-- event-based conditions use OPTION_STATUS for the string match, so should be a decent length --> - <column name="OPTION_STATUS" required="false" size="256" type="VARCHAR2"/> - <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> - <column name="TRIGGER_ID" required="false" type="INTEGER"/> - </table> - - <table name="RHQ_ALERT" tablespace="@@@LARGE_TABLESPACE_FOR_DATA@@@" - storage-options="freelists 5" cache="true" logging="false"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> - <column name="CTIME" required="true" type="LONG"/> - <column name="RECOVERY_ID" type="INTEGER" required="true"/> - <!-- required, but 0 effectively means null --> - <column name="WILL_RECOVER" required="true" default="false" type="BOOLEAN"/> - <column name="ACK_TIME" required="false" type="LONG"/> - <column name="ACK_SUBJECT" required="false" size="100" type="VARCHAR2"/> - <index name="RHQ_ALERT_IDX_TIME" unique="false"> - <field ref="CTIME"/> - </index> - <index name="RHQ_ALERT_IDX_ALERTDEF" unique="false"> - <field ref="ALERT_DEFINITION_ID"/> - </index> - </table> - - <table name="RHQ_ALERT_NOTIF_LOG" tablespace="@@@LARGE_TABLESPACE_FOR_DATA@@@" - storage-options="freelists 5" cache="true" logging="false"> - <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="false"> - <field ref="ALERT_ID"/> - </index> - <column name="SENDER" required="false" size="100" type="VARCHAR2"/> - <column name="RESULT_STATE" required="false" size="20" type="VARCHAR2"/> - <column name="MESSAGE" required="false" size="4000" type="VARCHAR2"/> - </table> - - <table name="RHQ_ALERT_CONDITION_LOG" tablespace="@@@LARGE_TABLESPACE_FOR_DATA@@@" - storage-options="freelists 5" cache="true" logging="false"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="CTIME" required="true" type="LONG"/> - <column name="ALERT_ID" required="false" type="INTEGER" references="RHQ_ALERT(ID)"/> - <column name="CONDITION_ID" required="true" type="INTEGER" references="RHQ_ALERT_CONDITION(ID)"/> - <column name="VALUE" required="true" size="250" type="VARCHAR2"/> - <index name="RHQ_ALERT_COND_LOG_IDX_TIME"> - <field ref="CTIME" /> - </index> - <index name="RHQ_ALERT_COND_LOG_IDX_ALERT"> - <field ref="ALERT_ID"/> - </index> - <index name="RHQ_ALERT_COND_LOG_COND_IDX"> - <field ref="CONDITION_ID"/> - </index> - </table> - - <table name="RHQ_ALERT_NOTIFICATION" tablespace="@@@LARGE_TABLESPACE_FOR_DATA@@@" - storage-options="freelists 5" cache="true" logging="false"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> - <column name="SENDER_CONFIG_ID" required="false" type="INTEGER" references="RHQ_CONFIG(ID)"/> - <column name="EXTRA_CONFIG_ID" required="false" type="INTEGER" references="RHQ_CONFIG(ID)"/> - <column name="SENDER_NAME" required="true" size="100" type="VARCHAR2" /> - </table> - -<!-- END: alert-schema.xml --> -<!-- BEGIN: sysconfig-schema.xml --> - - - <table name="RHQ_SYSTEM_CONFIG"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="PROPERTY_KEY" type="VARCHAR2" size="80"/> - <column name="PROPERTY_VALUE" type="VARCHAR2" size="300"/> - <column name="DEFAULT_PROPERTY_VALUE" type="VARCHAR2" size="300"/> - <column name="FREAD_ONLY" type="BOOLEAN" default="FALSE"/> - - <index name="RHQ_SYSTEM_CONFIG_KEY_INDX" unique="true"> - <field ref="PROPERTY_KEY"/> - </index> - </table> - -<!-- END: sysconfig-schema.xml --> -<!-- BEGIN: scheduler-schema.xml --> - - - <table name="RHQ_QRTZ_JOB_DETAILS"> - <column name="JOB_NAME" required="true" type="VARCHAR2" size="80"/> - <column name="JOB_GROUP" required="true" type="VARCHAR2" size="80"/> - <column name="DESCRIPTION" required="false" type="VARCHAR2" size="120"/> - <column name="JOB_CLASS_NAME" required="true" type="VARCHAR2" size="128"/> - <column name="IS_DURABLE" required="true" type="BOOLEAN" default="FALSE"/> - <column name="IS_VOLATILE" required="true" type="BOOLEAN"/> - <column name="IS_STATEFUL" required="true" type="BOOLEAN" default="FALSE"/> - <column name="REQUESTS_RECOVERY" required="true" type="BOOLEAN" default="FALSE"/> - <column name="JOB_DATA" required="false" type="BLOB"/> - - <constraint name="RHQ_PK_QRTZ_JOB_DETAILS"> - <primaryKey> - <field ref="JOB_NAME"/> - <field ref="JOB_GROUP"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_QRTZ_JOB_LISTENERS"> - <column name="JOB_NAME" required="true" type="VARCHAR2" size="80"/> - <column name="JOB_GROUP" required="true" type="VARCHAR2" size="80"/> - <column name="JOB_LISTENER" required="true" type="VARCHAR2" size="80"/> - - <constraint name="RHQ_PK_QRTZ_JOB_LISTENERS"> - <primaryKey> - <field ref="JOB_NAME"/> - <field ref="JOB_GROUP"/> - <field ref="JOB_LISTENER"/> - </primaryKey> - </constraint> - <constraint name="RHQ_FK_QRTZ_JOB_LSTNRS_JN_JG"> - <foreignKey local="JOB_NAME,JOB_GROUP" - references="RHQ_QRTZ_JOB_DETAILS(JOB_NAME,JOB_GROUP)" - ondelete="cascade"/> - </constraint> - </table> - - <table name="RHQ_QRTZ_TRIGGERS"> - <column name="TRIGGER_NAME" type="VARCHAR2" required="true" size="80"/> - <column name="TRIGGER_GROUP" type="VARCHAR2" required="true" size="80"/> - <column name="JOB_NAME" type="VARCHAR2" required="true" size="80"/> - <column name="JOB_GROUP" type="VARCHAR2" required="true" size="80"/> - <column name="IS_VOLATILE" type="BOOLEAN" required="true"/> - <column name="DESCRIPTION" type="VARCHAR2" required="false" size="120"/> - <column name="NEXT_FIRE_TIME" type="LONG" required="false"/> - <column name="PREV_FIRE_TIME" type="LONG" required="false"/> - <column name="PRIORITY" type="INTEGER" required="false"/> - <column name="TRIGGER_STATE" type="VARCHAR" required="true" size="16"/> - <column name="TRIGGER_TYPE" type="VARCHAR" required="true" size="8"/> - <column name="START_TIME" type="LONG" required="true"/> - <column name="END_TIME" type="LONG" required="false"/> - <column name="CALENDAR_NAME" type="VARCHAR2" required="false" size="80"/> - <column name="MISFIRE_INSTR" type="INTEGER" required="false"/> - <column name="JOB_DATA" type="BLOB" required="false"/> - - <constraint name="RHQ_PK_QRTZ_TRIGGERS"> - <primaryKey> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </primaryKey> - </constraint> - <constraint name="RHQ_FK_QRTZ_TRIGGERS_JN_JG"> - <foreignKey local="JOB_NAME,JOB_GROUP" - references="RHQ_QRTZ_JOB_DETAILS(JOB_NAME,JOB_GROUP)" - ondelete="cascade"/> - </constraint> - - <!-- Quartz docs recommend these indexes. --> - <index name="RHQ_QRTZ_TRIGGERS_JN_JG_IDX"> - <field ref="JOB_NAME"/> - <field ref="JOB_GROUP"/> - </index> - <index name="RHQ_QRTZ_TRIGGERS_NFT_IDX"> - <field ref="NEXT_FIRE_TIME"/> - </index> - <index name="RHQ_QRTZ_TRIGGERS_TS_IDX"> - <field ref="TRIGGER_STATE"/> - </index> - <index name="RHQ_QRTZ_TRIGGERS_TS_NFT_IDX"> - <field ref="TRIGGER_STATE"/> - <field ref="NEXT_FIRE_TIME"/> - </index> - - </table> - - <table name="RHQ_QRTZ_SIMPLE_TRIGGERS"> - <column name="TRIGGER_NAME" type="VARCHAR2" required="true" size="80"/> - <column name="TRIGGER_GROUP" type="VARCHAR2" required="true" size="80"/> - <column name="REPEAT_COUNT" type="LONG" required="true"/> - <column name="REPEAT_INTERVAL" type="LONG" required="true"/> - <column name="TIMES_TRIGGERED" type="LONG" required="true"/> - - <constraint name="RHQ_PK_QRTZ_SIMPLE_TRIGGERS"> - <primaryKey> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </primaryKey> - </constraint> - <constraint name="RHQ_FK_QRTZ_SIMPLE_TRGRS_TN_TG"> - <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" - references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" - ondelete="cascade"/> - </constraint> - - <!-- Quartz docs recommend this index. --> - <!-- Commenting out, because Oracle auto-creates an index for the - primary key column(s) and fails if you try to create another - index for the same column(s) (ips, 03/29/07). - --> - <!-- - <index name="RHQ_QRTZ_SIMPLE_TRGRS_TN_TG_IDX"> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </index> - --> - </table> - - <table name="RHQ_QRTZ_CRON_TRIGGERS"> - <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> - <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> - <column name="CRON_EXPRESSION" type="VARCHAR2" size="80" required="true"/> - <column name="TIME_ZONE_ID" type="VARCHAR2" size="80" required="false"/> - - <constraint name="RHQ_PK_QRTZ_CRON_TRIGGERS"> - <primaryKey> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </primaryKey> - </constraint> - <constraint name="RHQ_FK_QRTZ_CRON_TRIG_TN_TG"> - <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" - references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" - ondelete="cascade"/> - </constraint> - - <!-- Quartz docs recommend this index. --> - <!-- Commenting out, because Oracle auto-creates an index for the - primary key column(s) and fails if you try to create another - index for the same column(s) (ips, 03/29/07). - --> - <!-- - <index name="RHQ_QRTZ_CRON_TRGRS_TN_TG_IDX"> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </index> - --> - </table> - - <table name="RHQ_QRTZ_BLOB_TRIGGERS"> - <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> - <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> - <column name="BLOB_DATA" type="BLOB" required="false"/> - - <constraint name="RHQ_PK_QRTZ_BLOB_TRIGGERS"> - <primaryKey> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </primaryKey> - </constraint> - <constraint name="RHQ_FK_QRTZ_BLOB_TRIGG_TN_TG"> - <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" - references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" - ondelete="cascade"/> - </constraint> - - <!-- Quartz docs recommend this index. --> - <!-- Commenting out, because Oracle auto-creates an index for the - primary key column(s) and fails if you try to create another - index for the same column(s) (ips, 03/29/07). - --> - <!-- - <index name="RHQ_QRTZ_BLOB_TRGRS_TN_TG_IDX"> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </index> - --> - </table> - - <table name="RHQ_QRTZ_TRIGGER_LISTENERS"> - <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> - <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> - <column name="TRIGGER_LISTENER" type="VARCHAR2" size="80" required="true"/> - - <constraint name="RHQ_PK_QRTZ_TRIGGER_LISTENERS"> - <primaryKey> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - <field ref="TRIGGER_LISTENER"/> - </primaryKey> - </constraint> - <constraint name="RHQ_FK_QRTZ_TRGR_LSTNRS_TN_TG"> - <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" - references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" - ondelete="cascade"/> - </constraint> - - <!-- Quartz docs recommend this index. --> - <index name="RHQ_QRTZ_TRGR_LSTNRS_TN_TG_IDX"> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </index> - - </table> - - <table name="RHQ_QRTZ_FIRED_TRIGGERS"> - <column name="ENTRY_ID" primarykey="true" type="VARCHAR2" size="95" required="true"/> - <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> - <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> - <column name="INSTANCE_NAME" type="VARCHAR2" size="80" required="true"/> - <column name="FIRED_TIME" type="LONG" required="true"/> - <column name="PRIORITY" type="INTEGER" required="false"/> - <column name="STATE" type="VARCHAR2" size="16" required="true"/> - <column name="IS_VOLATILE" type="BOOLEAN" required="true"/> - <column name="JOB_NAME" type="VARCHAR2" size="80" required="false"/> - <column name="JOB_GROUP" type="VARCHAR2" size="80" required="false"/> - <column name="IS_STATEFUL" type="BOOLEAN" required="false"/> - <column name="REQUESTS_RECOVERY" type="BOOLEAN" required="false"/> - - <!-- Quartz docs recommend these indexes. --> - <index name="RHQ_QRTZ_FIRED_TRGRS_TN_IDX"> - <field ref="TRIGGER_NAME"/> - </index> - <index name="RHQ_QRTZ_FIRED_TRGRS_TG_IDX"> - <field ref="TRIGGER_GROUP"/> - </index> - <index name="RHQ_QRTZ_FIRED_TRGRS_TN_TG_IDX"> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </index> - <index name="RHQ_QRTZ_FIRED_TRGRS_IN_IDX"> - <field ref="INSTANCE_NAME"/> - </index> - <index name="RHQ_QRTZ_FIRED_TRGRS_JN_IDX"> - <field ref="JOB_NAME"/> - </index> - <index name="RHQ_QRTZ_FIRED_TRGRS_JG_IDX"> - <field ref="JOB_GROUP"/> - </index> - - </table> - - <table name="RHQ_QRTZ_CALENDARS"> - <column name="CALENDAR_NAME" primarykey="true" type="VARCHAR2" size="80" required="true"/> - <column name="CALENDAR" type="BLOB" required="true"/> - </table> - - <table name="RHQ_QRTZ_PAUSED_TRIGGER_GRPS"> - <column name="TRIGGER_GROUP" primarykey="true" type="VARCHAR2" size="80" required="true"/> - </table> - - <table name="RHQ_QRTZ_SCHEDULER_STATE"> - <column name="INSTANCE_NAME" primarykey="true" type="VARCHAR2" size="80" required="true"/> - <column name="LAST_CHECKIN_TIME" type="LONG" required="true"/> - <column name="CHECKIN_INTERVAL" type="LONG" required="true"/> - <column name="RECOVERER" type="VARCHAR2" size="80" required="false"/> - </table> - - <table name="RHQ_QRTZ_LOCKS"> - <column name="LOCK_NAME" primarykey="true" type="VARCHAR2" size="40" required="true"/> - <data LOCK_NAME="TRIGGER_ACCESS"/> - <data LOCK_NAME="JOB_ACCESS"/> - <data LOCK_NAME="CALENDAR_ACCESS"/> - <data LOCK_NAME="STATE_ACCESS"/> - <data LOCK_NAME="MISFIRE_ACCESS"/> - </table> - -<!-- END: scheduler-schema.xml --> -<!-- BEGIN: amps-schema.xml --> - - - <table name="RHQ_PLUGIN"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="4000" type="VARCHAR2" required="false"/> - <column name="VERSION" size="200" type="VARCHAR2" required="false"/> - <column name="AMPS_VERSION" size="16" type="VARCHAR2" required="false"/> - <column name="ENABLED" type="BOOLEAN" required="true"/> - <column name="STATUS" size="16" type="VARCHAR2" required="true"/> - <column name="HELP" type="CLOB" required="false"/> - <column name="PATH" size="500" type="VARCHAR2" required="true"/> - <column name="MD5" size="100" type="VARCHAR2" required="true"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="DEPLOYMENT" size="8" type="VARCHAR2" required="true"/> - <column name="PTYPE" size="200" type="VARCHAR2" required="false"/> - <column name="PLUGIN_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> - <column name="JOBS_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> - <column name="CONTENT" type="BLOB" required="false"/> - - <index name="RHQ_PLUGIN_NAME_DEPLOY_IDX" unique="true"> - <field ref="NAME"/> - <field ref="DEPLOYMENT"/> - </index> - </table> - -<!-- END: amps-schema.xml --> -<!-- BEGIN: measurement-schema.xml --> - - <table name="RHQ_MEASUREMENT_DEF"> - - <!-- === required columns === --> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE(ID)"/> - <column name="NAME" type="VARCHAR2" size="100" required="true"/> - - <!-- === optional columns === --> - <!-- an OSGI version range - if null, the metric def applies to all versions of the associated resource type --> - <column name="RESOURCE_VERSION_RANGE" type="VARCHAR2" size="100"/> - <column name="CATEGORY" type="SMALLINT"/> - <column name="UNITS" type="SMALLINT"/> - <column name="NUMERIC_TYPE" type="SMALLINT"/> - <column name="DISPLAY_TYPE" type="SMALLINT"/> - <column name="DATA_TYPE" type="SMALLINT"/> - <column name="RAW_NUMERIC_TYPE" type="SMALLINT"/> - <column name="DEFAULT_ON" type="BOOLEAN" default="false"/> - <column name="DEFAULT_INTERVAL" type="LONG" /> - <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> - <column name="DISPLAY_ORDER" type="INTEGER" default="1000"/> - <column name="DESCRIPTION" type="VARCHAR2" size="500"/> - <column name="DESTINATION_TYPE" type="VARCHAR2" size="100"/> - - <column name="VERSION" type="INTEGER"/> - <!-- for optimistic locking --> - - <!-- === business key (RESOURCE_TYPE_ID + NAME + RAW_NUMERIC_TYPE) === --> - <index name="RHQ_METRIC_DEF_KEY_IDX" unique="true"> - <field ref="RESOURCE_TYPE_ID"/> - <field ref="NAME"/> - <field ref="RAW_NUMERIC_TYPE"/> - </index> - <index name="RHQ_METRIC_DEF_NT_IDX"> - <field ref="NUMERIC_TYPE"/> - </index> - </table> - - - <table name="RHQ_MEASUREMENT_SCHED"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - - <column name="ENABLED" type="BOOLEAN" default="false"/> - <column name="MTIME" type="LONG" /> - <column name="DEFINITION" type="INTEGER" references="RHQ_MEASUREMENT_DEF(ID)"/> - <column name="VERSION" type="INTEGER" /> - <column name="COLL_INTERVAL" type="LONG" /> - <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE(ID)"/> - <index name="RHQ_MEAS_SCHED_UNIQ" unique="true"> - <field ref="RESOURCE_ID"/> - <field ref="DEFINITION"/> - </index> - <index name="RHQ_MEAS_SCHED_RESID_IDX"> - <field ref="RESOURCE_ID"/> - </index> - </table> - - - <table name="RHQ_MEASUREMENT_BLINE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - - <column name="BL_USER_ENTERED" type="BOOLEAN" default="false" required="true"/> - <column name="BL_MIN" type="DOUBLE" required="true"/> - <column name="BL_MAX" type="DOUBLE" required="true"/> - <column name="BL_MEAN" type="DOUBLE" required="true"/> - <column name="BL_COMPUTE_TIME" type="LONG" required="true"/> - <column name="SCHEDULE_ID" type="INTEGER" required="true" references="RHQ_MEASUREMENT_SCHED(ID)"/> - <index name="RHQ_MEAS_BASELINE_CTIME_IDX"> - <field ref="BL_COMPUTE_TIME"/> - </index> - <index name="RHQ_MEAS_BASELINE_SID_IDX"> - <field ref="SCHEDULE_ID"/> - </index> - </table> - - - <table name="RHQ_MEASUREMENT_DATA_NUM_1H" logging="false" cache="true" - tablespace="@@@LARGE_TABLESPACE_FOR_DATA@@@" storage-options="freelists 20"> - - <column name="TIME_STAMP" required="true" type="LONG"/> - <column name="SCHEDULE_ID" required="true" type="INTEGER"/> - <column name="VALUE" required="false" type="DOUBLE"/> - <column name="MINVALUE" required="false" type="DOUBLE"/> - <column name="MAXVALUE" required="false" type="DOUBLE"/> - - <constraint name="RHQ_MEAS_DATA_1H_ID_TIME_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - - <index name="RHQ_MEAS_DATA_1H_TIME_IDX"> - <field ref="TIME_STAMP"/> - </index> - </table> - - - <table name="RHQ_MEASUREMENT_DATA_NUM_6H" logging="false" cache="true" - tablespace="@@@LARGE_TABLESPACE_FOR_DATA@@@" storage-options="freelists 20"> - - <column name="TIME_STAMP" required="true" type="LONG"/> - <column name="SCHEDULE_ID" required="true" type="INTEGER"/> - <column name="VALUE" required="false" type="DOUBLE"/> - <column name="MINVALUE" required="false" type="DOUBLE"/> - <column name="MAXVALUE" required="false" type="DOUBLE"/> - - <constraint name="RHQ_MEAS_DATA_6H_ID_TIME_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - - <index name="RHQ_MEAS_DATA_6H_TIME_IDX"> - <field ref="TIME_STAMP"/> - </index> - </table> - - - <table name="RHQ_MEASUREMENT_DATA_NUM_1D" logging="false" cache="true" - tablespace="@@@LARGE_TABLESPACE_FOR_DATA@@@" storage-options="freelists 20"> - - <column name="TIME_STAMP" required="true" type="LONG"/> - <column name="SCHEDULE_ID" required="true" type="INTEGER"/> - <column name="VALUE" required="false" type="DOUBLE"/> - <column name="MINVALUE" required="false" type="DOUBLE"/> - <column name="MAXVALUE" required="false" type="DOUBLE"/> - - <constraint name="RHQ_MEAS_DATA_1D_ID_TIME_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - - <index name="RHQ_MEAS_DATA_1D_TIME_IDX"> - <field ref="TIME_STAMP" /> - </index> - </table> - - - <table name="RHQ_MEASUREMENT_DATA_TRAIT"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER" /> - <column name="VALUE" type="VARCHAR2" size="4000" /> - <constraint name="RHQ_MEAS_DATA_TRAIT_ID_TIME_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - - - <table name="RHQ_CALLTIME_DATA_KEY"> - <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> - <column name="SCHEDULE_ID" type="INTEGER" required="true"/> - <column name="CALL_DESTINATION" type="VARCHAR2" size="4000" required="true"/> - <index name="RHQ_CALLTIME_DATA_KEY_IDX" unique="true"> - <field ref="SCHEDULE_ID"/> - <field ref="CALL_DESTINATION"/> - </index> - </table> - - - <table name="RHQ_CALLTIME_DATA_VALUE"> - <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> - <column name="KEY_ID" type="INTEGER" references="RHQ_CALLTIME_DATA_KEY" required="true"/> - <column name="BEGIN_TIME" type="LONG" required="true"/> - <column name="END_TIME" type="LONG" required="true"/> - <column name="MINIMUM" type="DOUBLE" required="true"/> - <column name="MAXIMUM" type="DOUBLE" required="true"/> - <column name="TOTAL" type="DOUBLE" required="true"/> - <column name="COUNT" type="LONG" required="true"/> - <index name="RHQ_CT_DA_VA_END_TIM_IDX"> - <field ref="END_TIME"/> - </index> - </table> - - - <table name="RHQ_AVAILABILITY"> - <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE(ID)"/> - <column name="START_TIME" type="LONG" required="true" /> - <column name="END_TIME" type="LONG" required="false" /> - <column name="AVAILABILITY_TYPE" type="SMALLINT" required="false" /> - <index name="RHQ_AVAIL_RESOURCE_START_IDX"> - <field ref="RESOURCE_ID"/> - <field ref="START_TIME"/> - </index> - <!-- only one null row can exist for any resource --> - <index name="RHQ_AVAIL_RESOURCE_END_IDX" condition="END_TIME IS NULL"> - <field ref="RESOURCE_ID"/> - <field ref="END_TIME" /> - </index> - </table> - - <table name="RHQ_RESOURCE_AVAIL"> - <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE(ID)" ondelete="cascade"/> - <column name="AVAILABILITY_TYPE" type="SMALLINT" required="false" /> - <index name="RHQ_RESOURCE_AVAIL_IDX"> - <field ref="RESOURCE_ID" /> - </index> - </table> - - <table name="RHQ_MEASUREMENT_OOB"> - <column name="SCHEDULE_ID" type="INTEGER" references="RHQ_MEASUREMENT_SCHED(ID)" required="true"/> - <column name="TIME_STAMP" type="LONG" required="true"/> - <column name="OOB_FACTOR" type="INTEGER" required="true" /> - <constraint name="RHQ_MEAS_OOB_ID_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_MEASUREMENT_OOB_TMP"> - <column name="SCHEDULE_ID" type="INTEGER" required="true"/> - <column name="TIME_STAMP" type="LONG" required="true"/> - <column name="OOB_FACTOR" type="INTEGER" required="true" /> - <constraint name="RHQ_MEAS_OOB_TMP_ID_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_NUMBERS"> - <column name="i" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true" /> - </table> - - - <table name="RHQ_MEAS_DATA_NUM_R00"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R00_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R00_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R01"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R01_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R01_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R02"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R02_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R02_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R03"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R03_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R03_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R04"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R04_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R04_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R05"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R05_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R05_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R06"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R06_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R06_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R07"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R07_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R07_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R08"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R08_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R08_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R09"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R09_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R09_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R10"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R10_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R10_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R11"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R11_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R11_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R12"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R12_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R12_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R13"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R13_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R13_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R14"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R14_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R14_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - -<!-- END: measurement-schema.xml --> -<!-- BEGIN: content-schema.xml --> - - - <table name="RHQ_ARCHITECTURE"> - <column name="ID" default="sequence-only" initial="100" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="50" type="VARCHAR2" required="true"/> - <index name="RHQ_ARCHITECTURE_NAME_IDX" unique="true"> - <field ref="NAME"/> - </index> - </table> - - <table name="RHQ_REPO_GROUP_TYPE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - </table> - - - <table name="RHQ_REPO_GROUP"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - - <column name="REPO_GROUP_TYPE_ID" type="INTEGER" references="RHQ_REPO_GROUP_TYPE" required="true"/> - - <index name="RHQ_REPO_GROUP_IDX" unique="true"> - <field ref="NAME"/> - <field ref="REPO_GROUP_TYPE_ID"/> - </index> - </table> - - - <table name="RHQ_CONTENT_SOURCE_TYPE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="false"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="PLUGIN_NAME" size="100" type="VARCHAR2" required="false"/> - <!-- we might want this as part of natural key --> - <column name="DEFAULT_LAZY_LOAD" type="BOOLEAN" required="true"/> - <column name="DEFAULT_DOWNLOAD_MODE" size="16" type="VARCHAR2" required="true"/> - <column name="DEFAULT_SYNC_SCHEDULE" size="64" type="VARCHAR2" required="false"/> - <column name="API_CLASS" size="100" type="VARCHAR2" required="true"/> - - <column name="SOURCE_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF" required="false"/> - - <index name="RHQ_CONTENT_SOURCE_TYPE_IDX" unique="true"> - <field ref="NAME"/> - <!-- <field ref="PLUGIN_NAME"/> --> - </index> - </table> - - <table name="RHQ_CONTENT_SOURCE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="LAZY_LOAD" type="BOOLEAN" required="true"/> - <column name="DOWNLOAD_MODE" size="16" type="VARCHAR2" required="true"/> - <column name="SYNC_SCHEDULE" size="64" type="VARCHAR2" required="false"/> - <column name="LOAD_ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="CREATION_TIME" type="LONG" required="true"/> - <column name="LAST_MODIFIED_TIME" type="LONG" required="true"/> - - <column name="CONTENT_SOURCE_TYPE_ID" type="INTEGER" references="RHQ_CONTENT_SOURCE_TYPE" required="true"/> - <column name="CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> - - <index name="RHQ_CONTENT_SOURCE_IDX" unique="true"> - <field ref="NAME"/> - <field ref="CONTENT_SOURCE_TYPE_ID"/> - </index> - </table> - - <table name="RHQ_REPO"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="CREATION_TIME" type="LONG" required="true"/> - <column name="LAST_MODIFIED_TIME" type="LONG" required="true"/> - <column name="IS_CANDIDATE" type="BOOLEAN" required="true"/> - <column name="SYNC_SCHEDULE" size="64" type="VARCHAR2" required="false"/> - <column name="OWNER_ID" type="INTEGER" required="false" references="RHQ_SUBJECT" /> - <column name="IS_PRIVATE" type="BOOLEAN" required="true" /> - - <index name="RHQ_REPO_IDX" unique="true"> - <field ref="NAME"/> - </index> - </table> - - - <table name="RHQ_REPO_RELATION_TYPE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - </table> - - - <table name="RHQ_REPO_RELATION"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="RELATED_REPO_ID" type="INTEGER" references="RHQ_REPO" required="true"/> - <column name="REPO_RELATION_TYPE_ID" type="INTEGER" references="RHQ_REPO_RELATION_TYPE" required="true"/> - </table> - - - - <table name="RHQ_PACKAGE_TYPE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="false"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="CATEGORY" size="50" type="VARCHAR2" required="false"/> - <column name="DISCOVERY_INTERVAL" type="INTEGER" required="false"/> - <column name="IS_CREATION_DATA" type="BOOLEAN" required="true"/> - <column name="SUPPORTS_ARCHITECTURE" type="BOOLEAN" required="true"/> - - <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE" required="false"/> - <column name="DEPLOYMENT_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF" required="false"/> - <column name="PACKAGE_EXTRA_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG_DEF" required="false"/> - - <index name="RHQ_PACKAGE_TYPE_IDX" unique="true"> - <field ref="NAME"/> - <field ref="RESOURCE_TYPE_ID"/> - </index> - - </table> - - <table name="RHQ_PACKAGE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="CLASSIFICATION" size="200" type="VARCHAR2" required="false"/> - - <column name="PACKAGE_TYPE_ID" type="INTEGER" references="RHQ_PACKAGE_TYPE" required="true"/> - - <index name="RHQ_PACKAGE_IDX" unique="true"> - <field ref="NAME"/> - <field ref="PACKAGE_TYPE_ID"/> - </index> - </table> - - <table name="RHQ_PACKAGE_BITS"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="BITS" type="LARGEOBJECT" required="false"/> - </table> - - <table name="RHQ_PACKAGE_VERSION"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="false"/> - <column name="SHORT_DESCRIPTION" size="10000" type="CLOB" required="false"/> - <column name="LONG_DESCRIPTION" size="50000" type="CLOB" required="false"/> - <column name="VERSION" size="500" type="VARCHAR2" required="true"/> - <column name="DISPLAY_VERSION" size="500" type="VARCHAR2" required="false"/> - <column name="FILE_NAME" size="255" type="VARCHAR2" required="false"/> - <column name="FILE_SIZE" type="LONG" required="false"/> - <column name="FILE_MD5" size="32" type="VARCHAR2" required="false"/> - <column name="FILE_SHA256" size="64" type="VARCHAR2" required="false"/> - <column name="FILE_CREATION_TIME" type="LONG" required="false"/> - <column name="LICENSE_NAME" size="255" type="VARCHAR2" required="false"/> - <column name="LICENSE_VERSION" size="20" type="VARCHAR2" required="false"/> - <column name="METADATA" type="BLOB" required="false"/> - - <column name="PACKAGE_ID" type="INTEGER" references="RHQ_PACKAGE" required="true"/> - <column name="ARCHITECTURE_ID" type="INTEGER" references="RHQ_ARCHITECTURE" required="true"/> - <column name="CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> - <column name="PACKAGE_BITS_ID" type="INTEGER" references="RHQ_PACKAGE_BITS" required="false"/> - - <index name="RHQ_PACKAGE_VERSION_IDX" unique="true"> - <field ref="PACKAGE_ID"/> - <field ref="VERSION"/> - <field ref="ARCHITECTURE_ID"/> - </index> - - </table> - - <table name="RHQ_CONTENT_REQ"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="REQUEST_TYPE" type="VARCHAR2" required="true" size="20"/> - <column name="NOTES" type="VARCHAR2" required="false" size="512"/> - </table> - - <table name="RHQ_INSTALLED_PACKAGE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="INSTALLATION_TIME" type="LONG" required="false"/> - - <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE" required="true"/> - <column name="PACKAGE_VERSION_ID" type="INTEGER" references="RHQ_PACKAGE_VERSION" required="true"/> - <column name="SUBJECT_ID" type="INTEGER" references="RHQ_SUBJECT" required="false"/> - </table> - - <table name="RHQ_INSTALLED_PKG_HIST"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="STATUS" type="VARCHAR2" size="24" required="true"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="HISTORY_TIMESTAMP" type="LONG" required="false"/> - - <column name="PACKAGE_VERSION_ID" type="INTEGER" references="RHQ_PACKAGE_VERSION" required="true"/> - <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE" required="true"/> - <column name="DEPLOYMENT_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> - <column name="CONTENT_SERVICE_REQUEST_ID" type="INTEGER" references="RHQ_CONTENT_REQ" required="false"/> - </table> - - <table name="RHQ_CONTENT_SRC_SYNC"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="STATUS" type="VARCHAR2" size="16" required="true"/> - <column name="START_TIME" type="LONG" required="true"/> - <column name="END_TIME" type="LONG" required="false"/> - <column name="RESULTS" type="LONGVARCHAR" required="false"/> - <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> - </table> - - <table name="RHQ_REPO_SYNC"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="STATUS" type="VARCHAR2" size="16" required="true"/> - <column name="START_TIME" type="LONG" required="true"/> - <column name="END_TIME" type="LONG" required="false"/> - <column name="RESULTS" type="LONGVARCHAR" required="false"/> - <column name="PERCENT_COMPLETE" type="LONG" required="false"/> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - </table> - - - <table name="RHQ_PACKAGE_INST_STEP"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="STEP_KEY" type="VARCHAR2" size="500" required="true"/> - <column name="STEP_ORDER" type="INTEGER" required="true"/> - <column name="DESCRIPTION" type="VARCHAR2" size="4000" required="true"/> - <column name="ERROR_MSG" type="LONGVARCHAR" required="false"/> - <column name="RESULT" type="VARCHAR2" size="25" required="true"/> - - <column name="INSTALLED_PKG_HIST_ID" type="INTEGER" references="RHQ_INSTALLED_PKG_HIST"/> - </table> - - <table name="RHQ_REPO_RESOURCE_MAP"> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> - <column name="CTIME" type="LONG" required="true"/> - - <constraint name="RHQ_REPO_RESOURCE_MAP_KEY"> - <primaryKey> - <field ref="REPO_ID"/> - <field ref="RESOURCE_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_REPO_CONTENT_SRC_MAP"> 1 - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> - <column name="CTIME" type="LONG" required="true"/> - - <constraint name="RHQ_REPO_CONTENT_SRC_MAP_KEY"> - <primaryKey> - <field ref="REPO_ID"/> - <field ref="CONTENT_SRC_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_REPO_REPO_GROUP_MAP"> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - <column name="REPO_GROUP_ID" type="INTEGER" required="true" references="RHQ_REPO_GROUP"/> - <column name="CTIME" type="LONG" required="true"/> - - <constraint name="RHQ_REPO_REPO_GROUP_MAP_KEY"> - <primaryKey> - <field ref="REPO_ID"/> - <field ref="REPO_GROUP_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_REPO_REPO_RELATION_MAP"> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - <column name="REPO_RELATION_ID" type="INTEGER" required="true" references="RHQ_REPO_RELATION"/> - <column name="CTIME" type="LONG" required="true"/> - - <constraint name="RHQ_REPO_REPO_RELATION_MAP_KEY"> - <primaryKey> - <field ref="REPO_ID"/> - <field ref="REPO_RELATION_ID"/> - </primaryKey> - </constraint> - </table> - - - <table name="RHQ_REPO_PKG_VERSION_MAP"> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> - <column name="CTIME" type="LONG" required="true"/> - - <constraint name="RHQ_REPO_PKG_VER_MAP_KEY"> - <primaryKey> - <field ref="REPO_ID"/> - <field ref="PACKAGE_VERSION_ID"/> - </primaryKey> - </constraint> - <index name="RHQ_REPO_PKG_VER_MAP_IDX" unique="false"> - <field ref="PACKAGE_VERSION_ID"/> - </index> - </table> - - <table name="RHQ_PKG_VER_CONTENT_SRC_MAP"> - <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> - <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> - <column name="LOCATION" type="VARCHAR2" size="4000" required="true"/> - - <constraint name="RHQ_PKG_VER_CONTENT_SRC_KEY"> - <primaryKey> - <field ref="PACKAGE_VERSION_ID"/> - <field ref="CONTENT_SRC_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_PKG_PRD_MAP"> - <column name="PKG_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> - <column name="PRD_ID" type="INTEGER" required="true" references="RHQ_PRD_VER"/> - - <constraint name="RHQ_PKG_PRD_KEY"> - <primaryKey> - <field ref="PKG_ID"/> - <field ref="PRD_ID"/> - </primaryKey> - </constraint> - - </table> - - <table name="RHQ_DISTRIBUTION_TYPE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - - </table> - - <table name="RHQ_DISTRIBUTION"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="DISTRIBUTION_TYPE_ID" type="INTEGER" required="true" references="RHQ_DISTRIBUTION_TYPE"/> - <column name="LABEL" size="64" type="VARCHAR2" required="true"/> - <column name="BASE_PATH" size="256" type="VARCHAR2" required="true"/> - <column name="LAST_MODIFIED" type="LONG" required="true"/> - - <index name="RHQ_DISTRIBUTION_IDX" unique="true"> - <field ref="LABEL"/> - <field ref="BASE_PATH"/> - </index> - - </table> - - <table name="RHQ_REPO_DISTRIBUTION"> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - <column name="DISTRIBUTION_ID" type="INTEGER" required="true" references="RHQ_DISTRIBUTION"/> - <column name="LAST_MODIFIED" type="LONG" required="true"/> - - <constraint name="RHQ_REPO_DIST_MAP_KEY"> - <primaryKey> - <field ref="REPO_ID"/> - <field ref="DISTRIBUTION_ID"/> - </primaryKey> - </constraint> - </table> - - - - <table name="RHQ_DISTRIBUTION_FILE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="DISTRIBUTION_ID" type="INTEGER" required="true" references="RHQ_DISTRIBUTION"/> - <column name="RELATIVE_FILENAME" size="256" type="VARCHAR2" required="true"/> - <!--<column name="FILE_SIZE" type="NUMBER" required="true"/>--> - <column name="MD5SUM" size="64" type="VARCHAR2" required="true"/> - <column name="LAST_MODIFIED" type="LONG" required="true"/> - <!--<column name="CTIME" type="LONG" required="true"/>--> - - <index name="RHQ_DISTRIBUTION_FILE_IDX" unique="true"> - <field ref="DISTRIBUTION_ID"/> - <field ref="RELATIVE_FILENAME"/> - </index> - </table> - - - - - <table name="RHQ_ADVISORY"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="ADVISORY" size="64" type="VARCHAR2" required="true"/> - <column name="ADVISORY_TYPE" size="64" type="VARCHAR2" required="true" /> - <column name="ADVISORY_REL" size="64" type="VARCHAR2" required="false"/> - <column name="ADVISORY_NAME" size="64" type="VARCHAR2" required="false"/> - <column name="DESCRIPTION" size="4000" type="VARCHAR2" required="false"/> - <column name="SYNOPSIS" size="4000" type="VARCHAR2" required="true"/> - <column name="TOPIC" size="4000" type="VARCHAR2" required="false"/> - <column name="SOLUTION" size="4000" type="VARCHAR2" required="false"/> - <column name="SEVERITY" size="64" type="VARCHAR2" required="false"/> - <column name="ISSUE_DATE" type="LONG" required="false"/> - <column name="UPDATE_DATE" type="LONG" required="false"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="LAST_MODIFIED" type="LONG" required="true"/> - - <index name="RHQ_ADVISORY_NAME_UQ" unique="true"> - <field ref="ADVISORY_NAME"/> - </index> - - <index name="RHQ_ADVISORY_UQ" unique="true"> - <field ref="ADVISORY"/> - </index> - - <index name="RHQ_ADVISORY_UDATE_IDX" unique="false"> - <field ref="UPDATE_DATE"/> - </index> - </table> - - <table name="RHQ_ADVISORY_PACKAGE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> - <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> - <column name="LAST_MODIFIED" type="LONG" required="true"/> - - <index name="RHQ_ADVISORY_PKG_IDX" unique="true"> - <field ref="ADVISORY_ID"/> - <field ref="PACKAGE_VERSION_ID"/> - </index> - </table> - - <table name="RHQ_CVE"> - <column name="ID" default="sequence-only" initial="101" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="64" type="VARCHAR2" required="true"/> - </table> - - <table name="RHQ_ADVISORY_CVE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> - <column name="CVE_ID" type="INTEGER" required="true" references="RHQ_CVE"/> - <column name="LAST_MODIFIED" type="LONG" required="true"/> - - <index name="RHQ_ADVISORY_CVE_IDX" unique="true"> - <field ref="ADVISORY_ID"/> - <field ref="CVE_ID"/> - </index> - - </table> - - <table name="RHQ_ADVISORY_BUGLIST"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> - <column name="BUG_ID" size="256" type="VARCHAR2" required="true"/> - <column name="LAST_MODIFIED" type="LONG" required="true"/> - - <index name="RHQ_ADVISORY_BUG_IDX" unique="true"> - <field ref="ADVISORY_ID"/> - <field ref="BUG_ID"/> - </index> - </table> - - - <table name="RHQ_REPO_ADVISORY"> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> - <column name="LAST_MODIFIED" type="LONG" required="true"/> - - <constraint name="RHQ_REPO_ADV_MAP_KEY"> - <primaryKey> - <field ref="REPO_ID"/> - <field ref="ADVISORY_ID"/> - </primaryKey> - </constraint> - </table> - - <!-- BUNDLE_TYPE is things like "Cobbler profile" or "file-based bundle" or "puppet recipe" --> - <table name="RHQ_BUNDLE_TYPE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> - - <!-- This index is for constraint, not performance --> - <index name="RHQ_BUNDLE_TYPE_UNIQUE" unique="true"> - <field ref="NAME"/> - </index> - </table> - - <!-- BUNDLE is a named piece of content that can be versioned and installed somewhere --> - <table name="RHQ_BUNDLE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="BUNDLE_TYPE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_TYPE"/> - <column name="PACKAGE_TYPE_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_TYPE"/> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - - <!-- This index is for constraint, not performance --> - <index name="RHQ_BUNDLE_UNIQUE" unique="true"> - <field ref="BUNDLE_TYPE_ID"/> - <field ref="NAME"/> - </index> - </table> - - <!-- BUNDLE_VERSION represents an actual piece of content that needs to be installed somewhere --> - <table name="RHQ_BUNDLE_VERSION"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="VERSION" size="500" type="VARCHAR2" required="true"/> - <column name="VERSION_ORDER" type="INTEGER" required="true"/> - <column name="ACTION" type="CLOB" required="true"/> - <column name="CONFIG_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_DEF" /> - <column name="BUNDLE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE"/> - - <!-- This index is for constraint, not performance --> - <index name="RHQ_BUNDLE_VERSION_UNIQUE" unique="true"> - <field ref="BUNDLE_ID"/> - <field ref="NAME"/> - <field ref="VERSION"/> - </index> - </table> - - <!-- Many-to-many table that links many repos to a particular bundle version. destination platforms --> - <!-- would be required to have associations to the specified repos (to access required content --> - <table name="RHQ_BUNDLE_VERSION_REPO"> - <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - - <constraint name="RHQ_BUNDLE_VERSION_REPO_KEY"> - <primaryKey> - <field ref="BUNDLE_VERSION_ID"/> - <field ref="REPO_ID"/> - </primaryKey> - </constraint> - </table> - - <!-- BUNDLE_FILE represents a file that is associated with (possibly bundled inside) a bundle version --> - <table name="RHQ_BUNDLE_FILE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> - <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> - </table> - - <!-- A logical destination for a bundle deployment. Defines the platforms and directory on those targets. --> - <table name="RHQ_BUNDLE_DESTINATION"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="BUNDLE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE"/> - <column name="GROUP_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_GROUP"/> - <column name="DEPLOY_DIR" size="256" type="VARCHAR2" required="true"/> - <column name="DEST_BASE_DIR_NAME" size="200" type="VARCHAR2" required="true"/> - - <!-- This index is for constraint, not performance --> - <index name="RHQ_BUNDLE_DESTINATION_UNIQUE" unique="true"> - <field ref="BUNDLE_ID"/> - <field ref="GROUP_ID"/> - <field ref="DEPLOY_DIR"/> - </index> - </table> - - <!-- An actual deployment of a bundle version to a destination, with a specific config. Bundle deployments - can differ only on ctime, which is assumed to be different --> - <table name="RHQ_BUNDLE_DEPLOYMENT"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> - <column name="BUNDLE_DESTINATION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DESTINATION"/> - <column name="CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG" /> - <column name="SUBJECT_NAME" type="VARCHAR2" required="false" size="255"/> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="IS_LIVE" type="BOOLEAN" required="true"/> - <column name="REPLACED_BUNDLE_DEPLOYMENT_ID" type="INTEGER" required="false" references="RHQ_BUNDLE_DEPLOYMENT"/> - </table> - - <!-- Represents a bundle version that is deployed on a platform resource --> - <table name="RHQ_BUNDLE_RES_DEPLOY"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="BUNDLE_DEPLOYMENT_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DEPLOYMENT" /> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE" /> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="CTIME" type="LONG" required="true"/> - - <index name="RHQ_BUNDLE_RES_DEPLOY_IDX" unique="true"> - <field ref="BUNDLE_DEPLOYMENT_ID"/> - <field ref="RESOURCE_ID"/> - </index> - </table> - - <table name="RHQ_BUNDLE_RES_DEP_HIST"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="BUNDLE_RES_DEPLOY_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_RES_DEPLOY" /> - <column name="SUBJECT_NAME" required="false" size="255" type="VARCHAR2"/> - <column name="AUDIT_TIME" required="true" type="LONG"/> - <column name="ACTION" required="true" size="128" type="VARCHAR2"/> - <column name="INFO" required="true" size="512" type="VARCHAR2"/> - <column name="CATEGORY" required="false" size="32" type="VARCHAR2"/> - <column name="STATUS" required="true" type="VARCHAR2" size="16"/> - <column name="MESSAGE" required="false" type="LONGVARCHAR"/> - <column name="ATTACHMENT" required="false" type="LONGVARCHAR"/> - </table> - - <table name="RHQ_TAGGING_BUNDLE_MAP"> - <column name="BUNDLE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE"/> - <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> - <constraint name="RHQ_TAGGING_BUNDLE_MAP_KEY"> - <primaryKey> - <field ref="BUNDLE_ID"/> - <field ref="TAG_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_TAGGING_BUNDLE_VERSION_MAP"> - <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> - <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> - <constraint name="RHQ_TAGGING_BUNDLE_VER_MAP_KEY"> - <primaryKey> - <field ref="BUNDLE_VERSION_ID"/> - <field ref="TAG_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_TAGGING_BUNDLE_DEPLOY_MAP"> - <column name="BUNDLE_DEPLOYMENT_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DEPLOYMENT"/> - <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> - <constraint name="RHQ_TAGGING_BUNDLE_DEP_MAP_KEY"> - <primaryKey> - <field ref="BUNDLE_DEPLOYMENT_ID"/> - <field ref="TAG_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_TAGGING_BUNDLE_DEST_MAP"> - <column name="BUNDLE_DESTINATION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DESTINATION"/> - <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> - <constraint name="RHQ_TAGGING_BUNDLE_DES_MAP_KEY"> - <primaryKey> - <field ref="BUNDLE_DESTINATION_ID"/> - <field ref="TAG_ID"/> - </primaryKey> - </constraint> - </table> - - <!-- Drift Management Tables --> - <table name="RHQ_DRIFT_DEF_TEMPLATE"> - <column name="ID" default="sequence-only" initial="1001" primarykey="true" required="true" type="INTEGER"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> - <column name="CONFIG_ID" type="INTEGER" required="true" references="RHQ_CONFIG"/> - <column name="NAME" type="VARCHAR2" size="128" required="true"/> - <column name="DESCRIPTION" type="VARCHAR2" size="512" required="false"/> - <!-- true if defined by user, false if provided by plugin --> - <column name="IS_USER_DEFINED" type="BOOLEAN" required="true"/> - <!-- - Change sets are managed by the drift server plugins; therefore, we cannot maintain - a FK constraint on the change set id. And the type cannot be integer because - other back ends like MongoDB use other types that are basically variants of a - UUID - - jsanda - --> - <column name="DRIFT_CHANGE_SET_ID" type="VARCHAR2" size="64" required="false"/> - <column name="CTIME" type="LONG" required="true"/> - - <index name="RHQ_DRIFT_DEF_TEMPLATE_UNIQUE" unique="true"> - <field ref="RESOURCE_TYPE_ID"/> - <field ref="NAME"/> - </index> - </table> - - <!-- Content of a file being managed for drift. Used for diff and/or remediation --> - <table name="RHQ_DRIFT_FILE"> - <column name="HASH_ID" type="VARCHAR2" size="64" primarykey="true" required="true"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="DATA" type="LARGEOBJECT" required="false"/> - <column name="DATA_SIZE" type="LONG" required="false"/> - <column name="STATUS" type="VARCHAR2" size="20" required="true"/> - </table> - - <!-- A single drift definition defining file tracking - Note: A resource or group (todo: group, other?) can have zero or more drift configurations. - Note: The name, interval and is_enabled values are also stored withing the referenced config. - This allows us to use the config editor to manipulate all fields. - Note: Name is read-only - Note: Interval unit is millis - --> - <table name="RHQ_DRIFT_DEFINITION"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="CONFIG_ID" type="INTEGER" required="true" references="RHQ_CONFIG"/> - <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> - <column name="DRIFT_DEF_TEMPLATE_ID" type="INTEGER" required="false" references="RHQ_DRIFT_DEF_TEMPLATE"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="NAME" type="VARCHAR2" size="512" required="true"/> - <column name="DESCRIPTION" type="VARCHAR2" size="512" required="false"/> - <column name="INTERVAL" type="LONG" required="true"/> - <column name="IS_ENABLED" type="BOOLEAN" required="true"/> - <column name="DRIFT_HANDLING_MODE" type="VARCHAR2" size="20" required="true"/> - <column name="IS_PINNED" type="BOOLEAN" required="true"/> - <column name="IS_ATTACHED" type="BOOLEAN" required="true"/> - <column name="COMPLIANCE_STATUS" type="INTEGER" required="true"/> - </table> - - <!-- A set of drift records (note, this is for the JPA server plugin impl only) --> - <table name="RHQ_DRIFT_SET"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - </table> - - <!-- A drift change-set report for a resource (note, this is for the JPA server plugin impl only) --> - <table name="RHQ_DRIFT_CHANGE_SET"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="DRIFT_SET_ID" type="INTEGER" required="false" references="RHQ_DRIFT_SET"/> - <column name="CTIME" type="LONG" required="true"/> - <!-- Version 0 is initial change-set --> - <column name="VERSION" type="INTEGER" required="true"/> - <column name="CATEGORY" type="VARCHAR2" size="20" required="true"/> - <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> - <column name="DRIFT_DEFINITION_ID" type="INTEGER" required="false" references="RHQ_DRIFT_DEFINITION"/> - <!-- the drift handling mode at changeset creation time --> - <column name="DRIFT_HANDLING_MODE" type="VARCHAR2" size="20" required="true"/> - </table> - - <!-- A single occurence of drift for a resource (note, this is for the JPA server plugin impl only) --> - <table name="RHQ_DRIFT"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="CATEGORY" type="VARCHAR2" size="20" required="true"/> - <column name="DRIFT_SET_ID" type="INTEGER" required="false" references="RHQ_DRIFT_SET"/> - <column name="DRIFT_CHANGE_SET_ID" type="INTEGER" required="true" references="RHQ_DRIFT_CHANGE_SET"/> - <!-- the file path not including the base directory --> - <column name="PATH" type="VARCHAR2" size="1024" required="true"/> - <!-- the same as PATH less [/]filename.ext. Redundant storage for the purpose of strict directory search. - this field can be considered transient for serialization purposes --> - <column name="PATH_DIRECTORY" type="VARCHAR2" size="1024" required="true"/> - <column name="OLD_DRIFT_FILE" type="VARCHAR2" size="64" required="false" references="RHQ_DRIFT_FILE"/> - <column name="NEW_DRIFT_FILE" type="VARCHAR2" size="64" required="false" references="RHQ_DRIFT_FILE"/> - </table> - - -<!-- END: content-schema.xml --> -<!-- BEGIN: resource-request-schema.xml --> - - - <table name="RHQ_CREATE_RES_HIST"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="PARENT_RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> - <column name="CREATED_RESOURCE_NAME" type="VARCHAR2" size="500" required="false"/> - <column name="NEW_RESOURCE_KEY" type="VARCHAR2" required="false" size="500"/> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> - <column name="CONFIGURATION_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> - <column name="INSTALLED_PACKAGE_ID" type="INTEGER" required="false" references="RHQ_INSTALLED_PACKAGE"/> - </table> - - <table name="RHQ_DELETE_RES_HIST"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> - </table> - -<!-- END: resource-request-schema.xml --> -<!-- BEGIN: jms-schema.xml --> - -<!-- the schema matches that which would be automatically created by the JMS subsystem --> -<!-- see deploy/jms/rhq-jdbc-state-service.xml and rhq-jdbc2-service.xml --> - - - <table name="JMS_MESSAGES"> - <column name="MESSAGEID" required="true" type="INTEGER" /> - <column name="DESTINATION" required="true" type="VARCHAR2" size="255" /> - <column name="TXID" required="false" type="INTEGER" /> - <column name="TXOP" required="false" type="CHAR" size="1" /> - <column name="MESSAGEBLOB" required="false" type="BLOB" /> - - <constraint name="JMS_MESSAGES_PKEY"> - <primaryKey> - <field ref="MESSAGEID"/> - <field ref="DESTINATION"/> - </primaryKey> - </constraint> - - <index name="JMS_MESSAGES_TXOP_TXID"> - <field ref="TXOP"/> - <field ref="TXID"/> - </index> - <index name="JMS_MESSAGES_DESTINATION"> - <field ref="DESTINATION"/> - </index> - </table> - - <table name="JMS_TRANSACTIONS"> - <column name="TXID" required="true" type="INTEGER" primarykey="true" /> - </table> - - <table name="JMS_USERS"> - <column name="USERID" required="true" type="VARCHAR2" size="32" primarykey="true" /> - <column name="PASSWD" required="true" type="VARCHAR2" size="32" /> - <column name="CLIENTID" required="false" type="VARCHAR2" size="128" /> - </table> - - <table name="JMS_ROLES"> - <column name="ROLEID" required="true" type="VARCHAR2" size="32" /> - <column name="USERID" required="true" type="VARCHAR2" size="32" /> - - <constraint name="JMS_ROLES_PKEY"> - <primaryKey> - <field ref="USERID"/> - <field ref="ROLEID"/> - </primaryKey> - </constraint> - </table> - - <table name="JMS_SUBSCRIPTIONS"> - <column name="CLIENTID" required="true" type="VARCHAR2" size="128" /> - <column name="SUBNAME" required="true" type="VARCHAR2" size="128" /> - <column name="TOPIC" required="true" type="VARCHAR2" size="255" /> - <column name="SELECTOR" required="false" type="VARCHAR2" size="255" /> - - <constraint name="JMS_SUBSCRIPTIONS_PKEY"> - <primaryKey> - <field ref="CLIENTID"/> - <field ref="SUBNAME"/> - </primaryKey> - </constraint> - </table> - -<!-- END: jms-schema.xml --> -<!-- BEGIN: obsolete-schema.xml --> - - - <!-- NOTE: The tables will be dropped in the *** REVERSE ORDER *** as listed in this file! --> - <!-- NOTE: So, put the table you want dropped first at the bottom, and so on... --> - - - <!-- !!! REMOVED FROM CONTENT-SCHEMA !!!! --> - - <table name="RHQ_DRIFT_TEMPLATE_MAP"> - <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> - <column name="CONFIG_TEMPLATE_ID" type="INTEGER" required="true" references="RHQ_CONFIG_TEMPLATE"/> - </table> - - <table name="RHQ_BUNDLE_CONFIG" obsolete="true"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG" /> - <!-- this probably needs a DTYPE discriminator so we know if its a bundle or a specific bundle version --> - <column name="BUNDLE_VERSION_ID" type="INTEGER" required="false" references="RHQ_BUNDLE_VERSION"/> - <column name="BUNDLE_ID" type="INTEGER" required="false" references="RHQ_BUNDLE"/> - </table> - - <table name="RHQ_CHANNEL" obsolete="true"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="CREATION_TIME" type="LONG" required="true"/> - <column name="LAST_MODIFIED_TIME" type="LONG" required="true"/> - - <index name="RHQ_CHANNEL_IDX" unique="true"> - <field ref="NAME"/> - </index> - </table> - - <table name="RHQ_CHANNEL_RESOURCE_MAP" obsolete="true"> - <column name="CHANNEL_ID" type="INTEGER" required="true" references="RHQ_CHANNEL"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> - <column name="CTIME" type="LONG" required="true"/> - - <constraint name="RHQ_CHANNEL_RESOURCE_MAP_KEY"> - <primaryKey> - <field ref="CHANNEL_ID"/> - <field ref="RESOURCE_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_CHANNEL_CONTENT_SRC_MAP" obsolete="true"> - <column name="CHANNEL_ID" type="INTEGER" required="true" references="RHQ_CHANNEL"/> - <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> - <column name="CTIME" type="LONG" required="true"/> - - <constraint name="RHQ_CHAN_CONTENT_SRC_MAP_KEY"> - <primaryKey> - <field ref="CHANNEL_ID"/> - <field ref="CONTENT_SRC_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_CHANNEL_PKG_VERSION_MAP" obsolete="true"> - <column name="CHANNEL_ID" type="INTEGER" required="true" references="RHQ_CHANNEL"/> - <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> - <column name="CTIME" type="LONG" required="true"/> - - <constraint name="RHQ_CHANNEL_PKG_VER_MAP_KEY"> - <primaryKey> - <field ref="CHANNEL_ID"/> - <field ref="PACKAGE_VERSION_ID"/> - </primaryKey> - </constraint> - </table> - - <!-- !!! REMOVED FROM MEASUREMENT-SCHEMA !!!! --> - - <table name="RHQ_MEASUREMENT_OOB" obsolete="true"> - <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> - <column name="SCHEDULE_ID" type="INTEGER" references="RHQ_MEASUREMENT_SCHED(ID)" required="true"/> - <column name="OCCURRED" type="LONG" required="true"/> - <column name="DIFF" type="DOUBLE" required="true"/> - - <index name="RHQ_MEASUREMENT_OOB_IDX" unique="true"> - <field ref="SCHEDULE_ID" /> - <field ref="OCCURRED" /> - </index> - </table> - - - <table name="RHQ_TAG" obsolete="true"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - </table> - - <table name="RHQ_REPO_TAG_MAP" obsolete="true"> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAG"/> - - <constraint name="RHQ_REPO_TAG_MAP_KEY"> - <primaryKey> - <field ref="REPO_ID"/> - <field ref="TAG_ID"/> - </primaryKey> - </constraint> - </table> - - -<!-- END: obsolete-schema.xml --> -</dbsetup> diff --git a/modules/enterprise/gui/installer/src/test/resources/org/rhq/enterprise/installer/db-schema-combined-rhq-4.2.0.xml b/modules/enterprise/gui/installer/src/test/resources/org/rhq/enterprise/installer/db-schema-combined-rhq-4.2.0.xml deleted file mode 100644 index 425a806..0000000 --- a/modules/enterprise/gui/installer/src/test/resources/org/rhq/enterprise/installer/db-schema-combined-rhq-4.2.0.xml +++ /dev/null @@ -1,2642 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<dbsetup name="schema"> -<!-- BEGIN: config-schema.xml --> - - - <!-- Definition or Metadata tables --> - - <table name="RHQ_CONFIG_DEF"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="NAME" type="VARCHAR2" required="true" size="100"/> - <column name="DESCRIPTION" type="VARCHAR2" required="false" size="250"/> - <column name="VERSION" type="VARCHAR2" required="false" size="50"/> - <column name="CONFIG_FORMAT" type="VARCHAR2" required="false" size="32"/> - </table> - - <table name="RHQ_CONFIG_PROP_GRP_DEF"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="NAME" type="VARCHAR2" required="true" size="100"/> - <column name="DISPLAY_NAME" type="VARCHAR2" required="false" size="100"/> - <column name="DESCRIPTION" type="VARCHAR2" required="false" size="250"/> - <column name="DEFAULT_HIDDEN" type="BOOLEAN" required="false"/> - <column name="ORDER_INDEX" type="INTEGER" required="false"/> - </table> - - <table name="RHQ_CONFIG_PROP_DEF"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="NAME" type="VARCHAR2" required="false" size="255"/> - <column name="DISPLAY_NAME" type="VARCHAR2" required="false" size="100"/> - <column name="DESCRIPTION" type="VARCHAR2" required="false" size="1000"/> - <column name="DEFAULT_VALUE" type="VARCHAR2" required="false" size="2000"/> - <column name="REQUIRED" type="BOOLEAN" required="false"/> - <column name="READONLY" type="BOOLEAN" required="false"/> - <column name="SUMMARY" type="BOOLEAN" required="false"/> - <column name="ACTIVATION_POLICY" type="VARCHAR2" required="false" size="20"/> - <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_GRP_DEF"/> - <column name="ORDER_INDEX" type="INTEGER" required="false"/> - <column name="VERSION" type="VARCHAR2" required="false" size="50"/> - <column name="PARENT_MAP_DEFINITION_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> - <column name="PARENT_LIST_DEFINITION_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> - <column name="SIMPLE_TYPE" type="VARCHAR2" required="false" size="20"/> - <column name="ALLOW_CUSTOM_ENUM_VALUE" type="BOOLEAN" required="false"/> - <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> - <column name="CONFIG_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_DEF"/> - - <!-- only simple properties (not lists and maps) have this --> - <column name="UNITS" type="SMALLINT" required="false"/> - - <!-- only dynamic properties (not simple) have this --> - <column name="DYNAMIC_TYPE" type="VARCHAR2" size="20" required="false"/> - <column name="DYNAMIC_KEY" type="VARCHAR2" size="128" required="false"/> - </table> - - <table name="RHQ_CONF_PROP_DEF_ENUM"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="STRING_VALUE" type="VARCHAR2" required="false" size="500"/> - <column name="ORDER_INDEX" type="INTEGER" required="false"/> - <column name="NAME" type="VARCHAR2" required="false" size="100"/> - <column name="PROPERTY_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> - </table> - - <table name="RHQ_CONFIG_PD_OSRC"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="LINK_TO_TARGET" type="BOOLEAN" required="false"/> - <column name="FILTER" type="VARCHAR2" required="false" size="40"/> - <column name="EXPRESSION" type="VARCHAR2" required="true" size="400"/> - <column name="TARGET_TYPE" type="VARCHAR2" required="true" size="20"/> - <column name="PROPERTY_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> - </table> - - <table name="RHQ_CONFIG_PROP_CONSTR"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="DTYPE" type="VARCHAR2" required="true" size="15"/> - <column name="DETAILS" type="VARCHAR2" required="false" size="250"/> - <column name="CONFIG_PROP_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> - <column name="ORDER_INDEX" type="INTEGER" required="false"/> - </table> - - - <!-- Content or value tables --> - - <table name="RHQ_CONFIG"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="NOTES" type="VARCHAR2" required="false" size="512"/> - <column name="VERSION" type="VARCHAR2" required="false" size="50"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - </table> - - <table name="RHQ_CONFIG_PROPERTY"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="CONFIGURATION_ID" type="INTEGER" required="false" references="RHQ_CONFIG" ondelete="cascade"/> - <column name="STRING_VALUE" type="VARCHAR2" required="false" size="2000"/> - <column name="OVERRIDE" type="BOOLEAN" required="false"/> - <column name="NAME" type="VARCHAR2" required="true" size="255"/> - <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> - <!-- Recursive cascade path to RHQ_CONFIG_PROPERTY causes constraint creation errors on SQL Server, see - http://support.microsoft.com/kb/321843 --> - <column name="PARENT_LIST_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROPERTY" ondelete="cascade" /> - <column name="PARENT_MAP_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROPERTY" ondelete="cascade" /> - <column name="LIST_INDEX" type="INTEGER"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <index name="RHQ_CONFIG_PROP_idx_prop_key" unique="false"> - <field ref="CONFIGURATION_ID"/> - <field ref="NAME"/> - </index> - <index name="RHQ_CONFIG_PROP_idx_map_key" unique="false"> - <field ref="PARENT_MAP_ID"/> - <field ref="NAME"/> - </index> - <index name="RHQ_CONFIG_PROP_idx_list_key" unique="false"> - <field ref="PARENT_LIST_ID"/> - </index> - <!-- List entries all have the same name --> - </table> - - <table name="RHQ_CONFIG_TEMPLATE"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="NAME" type="VARCHAR2" required="false" size="100"/> - <column name="DESCRIPTION" type="VARCHAR2" required="false" size="500"/> - <column name="CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> - <column name="CONFIG_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_DEF"/> - <column name="IS_DEFAULT" type="BOOLEAN" required="false"/> - </table> - - <table name="RHQ_RAW_CONFIG"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="CONFIG_ID" type="INTEGER" required="true" references="RHQ_CONFIG(ID)"/> - <column name="PATH" type="VARCHAR2" required="false" size="512"/> - <column name="CONTENTS" type="CLOB" required="true"/> - <column name="SHA256" type="VARCHAR2" size="64" required="true"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - </table> - -<!-- END: config-schema.xml --> -<!-- BEGIN: cluster-schema.xml --> - - <table name="RHQ_AFFINITY_GROUP"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" required="true" size="255" type="VARCHAR2"/> - </table> - - <table name="RHQ_SERVER"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" required="true" size="255" type="VARCHAR2"/> - <column name="ADDRESS" required="true" size="255" type="VARCHAR2"/> - <column name="PORT" required="true" type="INTEGER"/> - <column name="SECURE_PORT" required="true" type="INTEGER"/> - <column name="CTIME" required="true" type="LONG"/> - <column name="MTIME" required="true" type="LONG"/> - <column name="AFFINITY_GROUP_ID" type="INTEGER" references="RHQ_AFFINITY_GROUP" required="false"/> - <column name="COMPUTE_POWER" required="true" type="INTEGER"/> - <column name="OPERATION_MODE" required="true" size="32" type="VARCHAR2"/> - <column name="STATUS" type="INTEGER" required="false" default="0" /> - - <!-- This index is for constraint, not performance --> - <index name="RHQ_SERVER_NAME_UNIQUE" unique="true"> - <field ref="NAME"/> - </index> - </table> - - <!-- new agent --> - <table name="RHQ_AGENT"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" required="true" size="255" type="VARCHAR2"/> - <column name="ADDRESS" required="true" size="255" type="VARCHAR2"/> - <column name="PORT" required="true" type="INTEGER"/> - <column name="AGENTTOKEN" required="true" size="100" type="VARCHAR2"/> - <column name="REMOTE_ENDPOINT" required="false" size="4000" type="VARCHAR2"/> - <column name="CTIME" required="true" type="LONG"/> - <column name="MTIME" required="true" type="LONG"/> - <column name="LAST_AVAILABILITY_REPORT" required="false" type="LONG"/> - <column name="AFFINITY_GROUP_ID" type="INTEGER" references="RHQ_AFFINITY_GROUP" required="false"/> - <column name="SERVER_ID" type="INTEGER" references="RHQ_SERVER" required="false"/> - <column name="STATUS" type="INTEGER" required="false" default="0" /> - <column name="BACKFILLED" type="BOOLEAN" required="true" /> - - <index name="RHQ_AGENT_NAME_UNIQUE" unique="true"> - <field ref="NAME"/> - </index> - - <index name="RHQ_AGENT_ADDRESS_PORT" unique="true"> - <field ref="ADDRESS"/> - <field ref="PORT"/> - </index> - - <index name="RHQ_AGENT_TOKEN_UNIQUE" unique="true"> - <field ref="AGENTTOKEN"/> - </index> - </table> - - <table name="RHQ_PARTITION_EVENT"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="SUBJECT_NAME" required="true" size="100" type="VARCHAR2"/> - <column name="CTIME" required="true" type="LONG"/> - <column name="EVENT_TYPE" required="true" size="50" type="VARCHAR2"/> - <column name="EVENT_DETAIL" required="false" size="512" type="VARCHAR2"/> - <column name="EXECUTION_STATUS" required="true" size="32" type="VARCHAR2"/> - </table> - - <table name="RHQ_PARTITION_DETAILS"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="PARTITION_EVENT_ID" type="INTEGER" references="RHQ_PARTITION_EVENT" required="true"/> - <column name="AGENT_NAME" type="VARCHAR2" size="255" required="true"/> - <column name="SERVER_NAME" type="VARCHAR2" size="255" required="true"/> - </table> - - <table name="RHQ_FAILOVER_LIST"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="PARTITION_EVENT_ID" type="INTEGER" references="RHQ_PARTITION_EVENT" required="true"/> - <column name="AGENT_ID" type="INTEGER" references="RHQ_AGENT" required="true"/> - <column name="CTIME" required="true" type="LONG"/> - </table> - - <table name="RHQ_FAILOVER_DETAILS"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="FAILOVER_LIST_ID" type="INTEGER" references="RHQ_FAILOVER_LIST" required="true"/> - <column name="SERVER_ID" type="INTEGER" references="RHQ_SERVER" required="true"/> - <column name="ORDINAL" type = "INTEGER" required="true"/> - </table> - -<!-- END: cluster-schema.xml --> -<!-- BEGIN: auth-schema.xml --> - - - <table name="RHQ_PRINCIPAL"> - - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="PRINCIPAL" required="true" type="VARCHAR2" size="100"/> - <column name="PASSWORD" required="true" type="VARCHAR2" size="64"/> - - <!-- ensure that principals are unique --> - <index name="RHQ_PRINCIPAL_PRINCIPAL_KEY" unique="true"> - <field ref="PRINCIPAL"/> - </index> - - </table> - - <table name="RHQ_SUBJECT"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" required="true" size="100" type="VARCHAR2"/> - <column name="CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG"/> - <column name="FIRST_NAME" required="false" size="100" type="VARCHAR2"/> - <column name="LAST_NAME" required="false" size="100" type="VARCHAR2"/> - <column name="EMAIL_ADDRESS" size="100" type="VARCHAR2"/> - <column name="SMS_ADDRESS" size="100" type="VARCHAR2"/> - <column name="PHONE_NUMBER" size="100" type="VARCHAR2"/> - <column name="DEPARTMENT" size="100" type="VARCHAR2"/> - <column name="FACTIVE" required="true" type="BOOLEAN" default="true"/> - <column name="FSYSTEM" required="true" type="BOOLEAN" default="false"/> - - <index name="RHQ_SUBJECT_AUTH_KEY" unique="true"> - <field ref="NAME"/> - </index> - </table> - -<!-- END: auth-schema.xml --> -<!-- BEGIN: inventory-schema.xml --> - - - <!-- NEW RESOURCE TYPES --> - <table name="RHQ_RESOURCE_TYPE"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" type="VARCHAR2" size="100" required="true"/> - <column name="CATEGORY" type="VARCHAR2" size="16" required="true"/> - <column name="CREATION_DATA_TYPE" type="VARCHAR2" size="16" required="true"/> - <column name="CREATE_DELETE_POLICY" type="VARCHAR2" size="16" required="true"/> - <column name="SINGLETON" type="BOOLEAN" required="true"/> - <column name="SUPPORTS_MANUAL_ADD" type="BOOLEAN" required="true"/> - <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> - <column name="PLUGIN" type="VARCHAR2" size="100"/> - <column name="CTIME" type="LONG"/> - <column name="MTIME" type="LONG"/> - <column name="DELETED" type="BOOLEAN" default="FALSE" required="TRUE"/> - <column name="SUBCATEGORY_ID" type="INTEGER"/> - <!-- - TODO add support to DB setup for tables with circular dependencies and then add back this RI - <column name="SUBCATEGORY_ID" type="INTEGER" references="RHQ_RESOURCE_SUBCAT" /> - --> - <column name="PLUGIN_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> - <column name="RES_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> - <column name="BUNDLE_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG"/> - - <index name="RHQ_RES_TYPE_IDX_PLG_NAME" unique="true"> - <field ref="NAME"/> - <field ref="PLUGIN"/> - </index> - </table> - - <!-- NEW RESOURCE SUBCATEGORIES --> - <table name="RHQ_RESOURCE_SUBCAT"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" type="VARCHAR2" size="100"/> - <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> - <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> - <column name="CTIME" type="LONG"/> - <column name="MTIME" type="LONG"/> - <column name="PARENT_SUBCATEGORY_ID" type="INTEGER" references="RHQ_RESOURCE_SUBCAT"/> - <!-- resourceTypeId is not required on child sub categories --> - <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> - </table> - - <!-- Many To Many mapping for resource type to its parents --> - <table name="RHQ_RESOURCE_TYPE_PARENTS"> - <column name="RESOURCE_TYPE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> - <column name="PARENT_RESOURCE_TYPE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> - - <!-- not using full words to fit index name length --> - <constraint name="RHQ_RES_TYPE_PARENTS_KEY"> - <primaryKey> - <field ref="RESOURCE_TYPE_ID"/> - <field ref="PARENT_RESOURCE_TYPE_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_PROCESS_SCAN"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="QUERY" type="VARCHAR2" size="256" required="true"/> - <column name="NAME" type="VARCHAR2" size="100" required="false"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> - - <index name="RHQ_PROCESS_SCAN_QUERY_INDEX" unique="true"> - <field ref="QUERY"/> - <field ref="RESOURCE_TYPE_ID"/> - </index> - </table> - - <table name="RHQ_PRD_VER"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="VERSION" type="VARCHAR2" size="50" required="true"/> - <column name="RES_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> - </table> - - <table name="RHQ_RESOURCE"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> - <column name="UUID" type="CHAR" size="36" required="true"/> - <column name="NAME" type="VARCHAR2" size="500"/> - <!-- ancestry holds the full parental ancestry, used for disambiguation --> - <column name="ANCESTRY" type="VARCHAR2" required="false" size="4000"/> - <column name="RESOURCE_KEY" type="VARCHAR2" required="true" size="500"/> - <column name="AGENT_ID" required="false" type="INTEGER" references="RHQ_AGENT(id)"/> - <column name="INVENTORY_STATUS" type="VARCHAR2" size="20"/> - <column name="CONNECTED" type="BOOLEAN"/> - <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> - <column name="VERSION" type="VARCHAR2" size="100"/> - <column name="CTIME" type="LONG"/> - <column name="MTIME" type="LONG"/> - <column name="ITIME" type="LONG"/> - <column name="RES_CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG"/> - <column name="PLUGIN_CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG"/> - <column name="MODIFIED_BY" required="false" size="100" type="VARCHAR2"/> - <column name="LOCATION" required="false" size="100" type="VARCHAR2"/> - <column name="PARENT_RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE"/> - <column name="PRODUCT_VERSION_ID" type="INTEGER" references="RHQ_PRD_VER"/> - - <index name="RHQ_RESOURCE_idx_key"> - <field ref="RESOURCE_KEY"/> - </index> - - <index name="RHQ_RESOURCE_idx_type"> - <field ref="RESOURCE_TYPE_ID"/> - </index> - - <index name="RHQ_RESOURCE_idx_agent"> - <field ref="AGENT_ID"/> - </index> - - <index name="RHQ_RESOURCE_idx_parent"> - <field ref="PARENT_RESOURCE_ID"/> - </index> - - </table> - - <table name="RHQ_RESOURCE_ERROR"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> - <column name="TIME_OCCURRED" type="LONG" required="true"/> - <column name="ERROR_TYPE" type="VARCHAR2" required="true" size="32"/> - <column name="SUMMARY" type="VARCHAR2" required="true" size="1000"/> - <column name="DETAIL" type="LONGVARCHAR" required="false"/> - - <index name="RHQ_RES_ERROR_IDX_RES_ID"> - <field ref="RESOURCE_ID"/> - </index> - </table> - - <table name="RHQ_GROUP_DEF"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" required="true" size="100" type="VARCHAR2"/> - <column name="DESCRIPTION" size="100" type="VARCHAR2"/> - <column name="CTIME" type="LONG"/> - <column name="MTIME" type="LONG"/> - <column name="CALC_TIME" type="LONG"/> - <column name="CALC_INTERVAL" type="LONG"/> - <column name="RECURSIVE" type="BOOLEAN"/> - <column name="EXPRESSION" type="VARCHAR2" size="1000"/> - - <index name="RHQ_GROUP_DEF_NAME" unique="true"> - <field ref="NAME"/> - </index> - </table> - - <table name="RHQ_RESOURCE_GROUP"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <!-- this name can be longer than the size of the GROUP_BY column, which is used to uniquely identify it --> - <!-- Max bytes for Oracle Varchar2 to accommodate large cluster keys --> - <column name="NAME" required="true" size="4000" type="VARCHAR2"/> - <column name="DESCRIPTION" size="100" type="VARCHAR2"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> - <!-- Compatible groups only --> - <column name="CTIME" type="LONG"/> - <column name="MTIME" type="LONG"/> - <column name="MODIFIED_BY" required="false" size="100" type="VARCHAR2"/> - <column name="RECURSIVE" type="BOOLEAN"/> - - <column name="GROUP_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_GROUP_DEF"/> - <column name="GROUP_BY" size="500" type="VARCHAR2"/> - - <column name="CATEGORY" type="VARCHAR2" size="20" required="true"/> - - <!-- This is only set if this is a subject-owned group (like an autogroup) --> - <column name="SUBJECT_ID" type="INTEGER" references="RHQ_SUBJECT"/> - - <!-- These two only set if this is a backing group for a resource auto-cluster --> - <column name="CLUSTER_KEY" type="VARCHAR2" size="4000" required="false"/> - <column name="CLUSTER_RESOURCE_GROUP_ID" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> - - <!-- This is only set if this is a backing group for a resource auto-group --> - <column name="AUTO_GROUP_PARENT_RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE"/> - - <column name="VISIBLE" type="BOOLEAN"/> - - <index name="RHQ_RES_GROUP_NAME" unique="false"> - <field ref="NAME"/> - </index> - </table> - - <!-- Many To Many mapping for groups to implicit resources --> - <table name="RHQ_RESOURCE_GROUP_RES_IMP_MAP"> - <column name="RESOURCE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE"/> - <column name="RESOURCE_GROUP_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> - - <!-- not using full words to fit index name length --> - <constraint name="RHQ_RES_GROUP_RES_IMP_MAP_KEY"> - <primaryKey> - <field ref="RESOURCE_ID"/> - <field ref="RESOURCE_GROUP_ID"/> - </primaryKey> - </constraint> - </table> - - <!-- Many To Many mapping for groups to explicit resources --> - <table name="RHQ_RESOURCE_GROUP_RES_EXP_MAP"> - <column name="RESOURCE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE"/> - <column name="RESOURCE_GROUP_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> - - <!-- not using full words to fit index name length --> - <constraint name="RHQ_RES_GROUP_RES_EXP_MAP_KEY"> - <primaryKey> - <field ref="RESOURCE_ID"/> - <field ref="RESOURCE_GROUP_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_CONFIG_GROUP_UPDATE"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="GROUP_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_GROUP"/> - <column name="CONFIGURATION_ID" type="INTEGER" required="true" references="RHQ_CONFIG"/> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="SUBJECT_NAME" type="VARCHAR2" required="false" size="100"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> - </table> - - <table name="RHQ_CONFIG_UPDATE"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="CONFIGURATION_ID" type="INTEGER" required="true" references="RHQ_CONFIG" ondelete="cascade"/> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="SUBJECT_NAME" type="VARCHAR2" required="false" size="100"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="CONFIG_RES_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> - <column name="PLUGIN_CONFIG_RES_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> - <column name="AGG_RES_UPDATE_ID" type="INTEGER" required="false" references="RHQ_CONFIG_GROUP_UPDATE"/> - <column name="AGG_PLUGIN_UPDATE_ID" type="INTEGER" required="false" references="RHQ_CONFIG_GROUP_UPDATE"/> - <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> - </table> - - - <table name="RHQ_TAGGING"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="NAMESPACE" type="VARCHAR2" required="false" size="20"/> - <column name="SEMANTIC" type="VARCHAR2" required="false" size="50"/> - <column name="NAME" type="VARCHAR2" required="true" size="100"/> - </table> - - <table name="RHQ_TAGGING_RESOURCE_MAP"> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> - <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> - <constraint name="RHQ_TAGGING_RESOURCE_MAP_KEY"> - <primaryKey> - <field ref="RESOURCE_ID"/> - <field ref="TAG_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_TAGGING_RES_GROUP_MAP"> - <column name="RESOURCE_GROUP_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_GROUP"/> - <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> - <constraint name="RHQ_TAGGING_RES_GROUP_MAP_KEY"> - <primaryKey> - <field ref="RESOURCE_GROUP_ID"/> - <field ref="TAG_ID"/> - </primaryKey> - </constraint> - </table> - -<!-- END: inventory-schema.xml --> -<!-- BEGIN: authz-schema.xml --> - - - <table name="RHQ_ROLE"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" required="true" size="100" type="VARCHAR2"/> - <column name="DESCRIPTION" size="100" type="VARCHAR2"/> - <column name="FSYSTEM" type="BOOLEAN" default="false"/> - - <index name="RHQ_ROLE_NAME_KEY" unique="true"> - <field ref="NAME"/> - </index> - </table> - - <table name="RHQ_ROLE_RESOURCE_GROUP_MAP"> - <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> - <column name="RESOURCE_GROUP_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> - - <constraint name="RHQ_ROLE_RES_GROUP_MAP_KEY"> - <primaryKey> - <field ref="ROLE_ID"/> - <field ref="RESOURCE_GROUP_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_ROLE_LDAP_GROUP"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> - <column name="LDAP_GROUP_NAME" size="128" required="true" type="VARCHAR2"/> - - <index name="RHQ_ROLE_LDAP_GROUP_IDX" unique="true"> - <field ref="ROLE_ID"/> - <field ref="LDAP_GROUP_NAME"/> - </index> - </table> - - <table name="RHQ_PERMISSION"> - <column name="ROLE_ID" type="INTEGER" references="RHQ_ROLE" required="true"/> - <column name="OPERATION" type="INTEGER" required="true"/> - <constraint name="RHQ_PERMISSION_PK"> - <primaryKey> - <field ref="ROLE_ID"/> - <field ref="OPERATION"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_SUBJECT_ROLE_MAP"> - <column name="SUBJECT_ID" required="true" type="INTEGER" references="RHQ_SUBJECT"/> - <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> - - <constraint name="RHQ_SUBJECT_ROLE_MAPPING_KEY"> - <primaryKey> - <field ref="SUBJECT_ID"/> - <field ref="ROLE_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_SUBJECT_ROLE_LDAP_MAP"> - <column name="SUBJECT_ID" required="true" type="INTEGER" references="RHQ_SUBJECT"/> - <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> - <constraint name="RHQ_SUBJECT_ROLE_LDAP_MAP_PK"> - <primaryKey> - <field ref="SUBJECT_ID" /> - <field ref="ROLE_ID"/> - </primaryKey> - </constraint> - </table> -<!-- END: authz-schema.xml --> -<!-- BEGIN: search-schema.xml --> - - - <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="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="GLOBAL" type="BOOLEAN" required="true"/> - </table> - -<!-- END: search-schema.xml --> -<!-- BEGIN: dashboard-schema.xml --> - - - - <table name="RHQ_DASHBOARD"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" type="VARCHAR2" size="200" required="true"/> - <column name="SUBJECT_ID" type="INTEGER" required="true" references="RHQ_SUBJECT"/> - <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> - <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_RESOURCE_GROUP"/> - <column name="CATEGORY" type="VARCHAR2" size="20" required="true"/> - <column name="SHARED" type="BOOLEAN" required="true"/> - <column name="CONFIGURATION_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> - </table> - - - <table name="RHQ_DASHBOARD_PORTLET"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" type="VARCHAR2" size="200" required="true"/> - <column name="PORTLET_KEY" type="VARCHAR2" size="200" required="true"/> - <column name="COL" type="INTEGER" required="true"/> - <column name="COL_INDEX" type="INTEGER" required="true"/> - <column name="HEIGHT" type="INTEGER" required="true"/> - <column name="CONFIGURATION_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> - <column name="DASHBOARD_ID" type="INTEGER" required="false" references="RHQ_DASHBOARD"/> - </table> - -<!-- END: dashboard-schema.xml --> -<!-- BEGIN: operation-schema.xml --> - - - <table name="RHQ_OPERATION_DEF"> - - <!-- === required columns === --> - - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE(ID)"/> - <column name="NAME" type="VARCHAR2" required="true" size="100"/> - - <!-- === optional columns === --> - - <!-- an OSGI version range - if null, the operation def applies to all versions of the associated resource type --> - <column name="RESOURCE_VERSION_RANGE" type="VARCHAR2" size="100"/> - - <!-- A parameter config definition is only required for operations that have parameters. --> - <!-- A results config definition is only required for operations that return data. --> - <column name="PARAMETER_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> - <column name="RESULTS_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> - <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> - <column name="DESCRIPTION" type="VARCHAR2" size="4000"/> - <column name="TIMEOUT" type="INTEGER"/> - - <!-- === business key (RESOURCE_TYPE_ID + NAME) === --> - <index name="RHQ_OPERATION_DEF_KEY_IDX" unique="true"> - <field ref="RESOURCE_TYPE_ID"/> - <field ref="NAME"/> - </index> - - </table> - - <table name="RHQ_OPERATION_HISTORY"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="DTYPE" type="VARCHAR2" required="true" size="8"/> - <column name="JOB_NAME" type="VARCHAR2" required="true" size="100"/> - <column name="JOB_GROUP" type="VARCHAR2" required="true" size="100"/> - <column name="OPERATION_DEF_ID" type="INTEGER" required="true" references="RHQ_OPERATION_DEF"/> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="STIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="PARAMETERS_CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> - - <!-- for resource history --> - <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> - <column name="RESULTS_CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> - <column name="GROUP_HISTORY_ID" type="INTEGER" required="false" references="RHQ_OPERATION_HISTORY"/> - - <!-- for group history --> - <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_RESOURCE_GROUP"/> - - <index name="RHQ_OPERATION_HISTORY_JOB_IDX" unique="true"> - <field ref="JOB_NAME"/> - <field ref="JOB_GROUP"/> - <field ref="CTIME"/> - </index> - - </table> - - <!-- - This table is really just to support some specific use-cases. - Specifically, to be able to get a list of histories for a specific schedule (aka quartz job) - and to be able to query a list of all schedules along with their associated resource/group IDs - possibly sorted by their next fire time. - Note that a NULL next fire time means it won't fire again and the row is probaby about to be deleted; - we can probably not even insert rows with NULL and make it a non-nullable field. But rather than - code special conditions into the session bean, we'll allow a short-lived NULL next fire time row. - --> - <table name="RHQ_OPERATION_SCHEDULE"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - - <column name="JOB_NAME" type="VARCHAR2" required="true" size="100"/> - <column name="JOB_GROUP" type="VARCHAR2" required="true" size="100"/> - <column name="DTYPE" type="VARCHAR2" required="true" size="8"/> - <column name="NEXT_FIRE_TIME" type="LONG" required="false"/> - - <!-- for resource history --> - <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> - - <!-- for group history --> - <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_RESOURCE_GROUP"/> - - <!-- - Note, this is the same as the primary key that Quartz uses for its schedules (RHQ_QRTZ_JOB_DETAILS). - We do not need to add DTYPE to the key, because we ensure the name/group are unique across resource/group - schedules - --> - <!-- === business key (JOB_NAME + JOB_GROUP) === --> - <index name="RHQ_OPERATION_SCHEDULE_KEY_IDX" unique="true"> - <field ref="JOB_NAME"/> - <field ref="JOB_GROUP"/> - </index> - </table> - -<!-- END: operation-schema.xml --> -<!-- BEGIN: event-schema.xml --> - - - <!-- metadata --> - - <table name="RHQ_EVENT_DEF"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE(ID)"/> - - <column name="NAME" type="VARCHAR2" size="100" required="true"/> - <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> - <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> - - <index name="RHQ_EVENT_DEF_IDX" unique="true"> - <field ref="RESOURCE_TYPE_ID"/> - <field ref="NAME"/> - </index> - </table> - - <!-- instance data --> - - <table name="RHQ_EVENT_SOURCE"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="EVENT_DEF_ID" type="INTEGER" required="true" references="RHQ_EVENT_DEF(ID)"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE(ID)"/> - - <column name="LOCATION" required="true" size="2000" type="VARCHAR2"/> - - <index name="RHQ_EVENT_SOURCE_IDX" unique="true"> - <field ref="EVENT_DEF_ID"/> - <field ref="RESOURCE_ID"/> - <field ref="LOCATION"/> - </index> - </table> - - <table name="RHQ_EVENT"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="EVENT_SOURCE_ID" type="INTEGER" required="true" references="RHQ_EVENT_SOURCE(ID)"/> - - <column name="TIMESTAMP" required="true" type="LONG"/> - <column name="SEVERITY" required="true" size="20" type="VARCHAR2"/> - <column name="DETAIL" required="true" size="4000" type="VARCHAR2"/> - <index name="RHQ_EVENT_IDX" unique="false"> - <field ref="EVENT_SOURCE_ID"/> - <field ref="TIMESTAMP"/> - </index> - </table> - -<!-- END: event-schema.xml --> -<!-- BEGIN: alert-schema.xml --> - - - <table name="RHQ_ALERT_DEFINITION"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" required="true" size="100" type="VARCHAR2"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="PARENT_ID" type="INTEGER" required="false"/> - <column name="GROUP_ALERT_DEF_ID" type="INTEGER" required="false"/> - <column name="DESCRIPTION" required="false" size="250" type="VARCHAR2"/> - <column name="PRIORITY" type="VARCHAR2" size="15" required="true"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE" required="false"/> - <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE" required="false"/> - <column name="RESOURCE_GROUP_ID" type="INTEGER" references="RHQ_RESOURCE_GROUP" required="false"/> - <column name="ENABLED" required="true" default="TRUE" type="BOOLEAN"/> - - <column name="REQUIRED" required="true" type="SMALLINT"/> - - <column name="RECOVERY_ID" type="INTEGER" required="true"/> - <!-- required, but 0 effectively means null --> - <column name="WILL_RECOVER" required="true" default="false" type="BOOLEAN"/> - <column name="NOTIFY_FILTERED" required="true" default="false" type="BOOLEAN"/> - <column name="CONTROL_FILTERED" required="true" default="FALSE" type="BOOLEAN"/> - - <column name="DELETED" required="true" default="FALSE" type="BOOLEAN"/> - <column name="READ_ONLY" required="true" default="FALSE" type="BOOLEAN"/> - - <column name="DAMPENING_CATEGORY" type="SMALLINT" required="true"/> - <column name="DAMPENING_VALUE" type="INTEGER"/> - <column name="DAMPENING_VALUE_UNITS" type="SMALLINT"/> - <column name="DAMPENING_PERIOD" type="INTEGER"/> - <column name="DAMPENING_PERIOD_UNITS" type="SMALLINT"/> - </table> - - <table name="RHQ_ALERT_DAMPEN_EVENT"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> - <column name="EVENT_TYPE" required="true" type="SMALLINT"/> - <column name="EVENT_TIMESTAMP" required="true" type="LONG"/> - - <index name="RHQ_DAMPENING_EVENT_TYPE_IDX"> - <field ref="EVENT_TYPE"/> - </index> - <index name="RHQ_DAMPENING_EVENT_TS_IDX"> - <field ref="EVENT_TIMESTAMP"/> - </index> - </table> - - <table name="RHQ_ALERT_CONDITION"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="TYPE" required="true" type="VARCHAR2" size="15"/> - <!-- - <column name="REQUIRED" required="true" type="BOOLEAN"/> - --> - <column name="MEASUREMENT_DEFINITION_ID" required="false" type="INTEGER"/> - <column name="NAME" required="false" size="100" type="VARCHAR2"/> - <column name="COMPARATOR" required="false" size="2" type="VARCHAR2"/> - <column name="THRESHOLD" required="false" type="DOUBLE"/> - <!-- event-based conditions use OPTION_STATUS for the string match, so should be a decent length --> - <column name="OPTION_STATUS" required="false" size="256" type="VARCHAR2"/> - <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> - <column name="TRIGGER_ID" required="false" type="INTEGER"/> - </table> - - <table name="RHQ_ALERT" tablespace="DEFAULT" - storage-options="freelists 5" cache="true" logging="false"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> - <column name="CTIME" required="true" type="LONG"/> - <column name="RECOVERY_ID" type="INTEGER" required="true"/> - <!-- required, but 0 effectively means null --> - <column name="WILL_RECOVER" required="true" default="false" type="BOOLEAN"/> - <column name="ACK_TIME" required="false" type="LONG"/> - <column name="ACK_SUBJECT" required="false" size="100" type="VARCHAR2"/> - <index name="RHQ_ALERT_IDX_TIME" unique="false"> - <field ref="CTIME"/> - </index> - <index name="RHQ_ALERT_IDX_ALERTDEF" unique="false"> - <field ref="ALERT_DEFINITION_ID"/> - </index> - </table> - - <table name="RHQ_ALERT_NOTIF_LOG" tablespace="DEFAULT" - storage-options="freelists 5" cache="true" logging="false"> - <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="false"> - <field ref="ALERT_ID"/> - </index> - <column name="SENDER" required="false" size="100" type="VARCHAR2"/> - <column name="RESULT_STATE" required="false" size="20" type="VARCHAR2"/> - <column name="MESSAGE" required="false" size="4000" type="VARCHAR2"/> - </table> - - <table name="RHQ_ALERT_CONDITION_LOG" tablespace="DEFAULT" - storage-options="freelists 5" cache="true" logging="false"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="CTIME" required="true" type="LONG"/> - <column name="ALERT_ID" required="false" type="INTEGER" references="RHQ_ALERT(ID)"/> - <column name="CONDITION_ID" required="true" type="INTEGER" references="RHQ_ALERT_CONDITION(ID)"/> - <column name="VALUE" required="true" size="250" type="VARCHAR2"/> - <index name="RHQ_ALERT_COND_LOG_IDX_TIME"> - <field ref="CTIME" /> - </index> - <index name="RHQ_ALERT_COND_LOG_IDX_ALERT"> - <field ref="ALERT_ID"/> - </index> - <index name="RHQ_ALERT_COND_LOG_COND_IDX"> - <field ref="CONDITION_ID"/> - </index> - </table> - - <table name="RHQ_ALERT_NOTIFICATION" tablespace="DEFAULT" - storage-options="freelists 5" cache="true" logging="false"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> - <column name="SENDER_CONFIG_ID" required="false" type="INTEGER" references="RHQ_CONFIG(ID)"/> - <column name="EXTRA_CONFIG_ID" required="false" type="INTEGER" references="RHQ_CONFIG(ID)"/> - <column name="SENDER_NAME" required="true" size="100" type="VARCHAR2" /> - </table> - -<!-- END: alert-schema.xml --> -<!-- BEGIN: sysconfig-schema.xml --> - - - <table name="RHQ_SYSTEM_CONFIG"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="PROPERTY_KEY" type="VARCHAR2" size="80"/> - <column name="PROPERTY_VALUE" type="VARCHAR2" size="300"/> - <column name="DEFAULT_PROPERTY_VALUE" type="VARCHAR2" size="300"/> - <column name="FREAD_ONLY" type="BOOLEAN" default="FALSE"/> - - <index name="RHQ_SYSTEM_CONFIG_KEY_INDX" unique="true"> - <field ref="PROPERTY_KEY"/> - </index> - </table> - -<!-- END: sysconfig-schema.xml --> -<!-- BEGIN: scheduler-schema.xml --> - - - <table name="RHQ_QRTZ_JOB_DETAILS"> - <column name="JOB_NAME" required="true" type="VARCHAR2" size="80"/> - <column name="JOB_GROUP" required="true" type="VARCHAR2" size="80"/> - <column name="DESCRIPTION" required="false" type="VARCHAR2" size="120"/> - <column name="JOB_CLASS_NAME" required="true" type="VARCHAR2" size="128"/> - <column name="IS_DURABLE" required="true" type="BOOLEAN" default="FALSE"/> - <column name="IS_VOLATILE" required="true" type="BOOLEAN"/> - <column name="IS_STATEFUL" required="true" type="BOOLEAN" default="FALSE"/> - <column name="REQUESTS_RECOVERY" required="true" type="BOOLEAN" default="FALSE"/> - <column name="JOB_DATA" required="false" type="BLOB"/> - - <constraint name="RHQ_PK_QRTZ_JOB_DETAILS"> - <primaryKey> - <field ref="JOB_NAME"/> - <field ref="JOB_GROUP"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_QRTZ_JOB_LISTENERS"> - <column name="JOB_NAME" required="true" type="VARCHAR2" size="80"/> - <column name="JOB_GROUP" required="true" type="VARCHAR2" size="80"/> - <column name="JOB_LISTENER" required="true" type="VARCHAR2" size="80"/> - - <constraint name="RHQ_PK_QRTZ_JOB_LISTENERS"> - <primaryKey> - <field ref="JOB_NAME"/> - <field ref="JOB_GROUP"/> - <field ref="JOB_LISTENER"/> - </primaryKey> - </constraint> - <constraint name="RHQ_FK_QRTZ_JOB_LSTNRS_JN_JG"> - <foreignKey local="JOB_NAME,JOB_GROUP" - references="RHQ_QRTZ_JOB_DETAILS(JOB_NAME,JOB_GROUP)" - ondelete="cascade"/> - </constraint> - </table> - - <table name="RHQ_QRTZ_TRIGGERS"> - <column name="TRIGGER_NAME" type="VARCHAR2" required="true" size="80"/> - <column name="TRIGGER_GROUP" type="VARCHAR2" required="true" size="80"/> - <column name="JOB_NAME" type="VARCHAR2" required="true" size="80"/> - <column name="JOB_GROUP" type="VARCHAR2" required="true" size="80"/> - <column name="IS_VOLATILE" type="BOOLEAN" required="true"/> - <column name="DESCRIPTION" type="VARCHAR2" required="false" size="120"/> - <column name="NEXT_FIRE_TIME" type="LONG" required="false"/> - <column name="PREV_FIRE_TIME" type="LONG" required="false"/> - <column name="PRIORITY" type="INTEGER" required="false"/> - <column name="TRIGGER_STATE" type="VARCHAR" required="true" size="16"/> - <column name="TRIGGER_TYPE" type="VARCHAR" required="true" size="8"/> - <column name="START_TIME" type="LONG" required="true"/> - <column name="END_TIME" type="LONG" required="false"/> - <column name="CALENDAR_NAME" type="VARCHAR2" required="false" size="80"/> - <column name="MISFIRE_INSTR" type="INTEGER" required="false"/> - <column name="JOB_DATA" type="BLOB" required="false"/> - - <constraint name="RHQ_PK_QRTZ_TRIGGERS"> - <primaryKey> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </primaryKey> - </constraint> - <constraint name="RHQ_FK_QRTZ_TRIGGERS_JN_JG"> - <foreignKey local="JOB_NAME,JOB_GROUP" - references="RHQ_QRTZ_JOB_DETAILS(JOB_NAME,JOB_GROUP)" - ondelete="cascade"/> - </constraint> - - <!-- Quartz docs recommend these indexes. --> - <index name="RHQ_QRTZ_TRIGGERS_JN_JG_IDX"> - <field ref="JOB_NAME"/> - <field ref="JOB_GROUP"/> - </index> - <index name="RHQ_QRTZ_TRIGGERS_NFT_IDX"> - <field ref="NEXT_FIRE_TIME"/> - </index> - <index name="RHQ_QRTZ_TRIGGERS_TS_IDX"> - <field ref="TRIGGER_STATE"/> - </index> - <index name="RHQ_QRTZ_TRIGGERS_TS_NFT_IDX"> - <field ref="TRIGGER_STATE"/> - <field ref="NEXT_FIRE_TIME"/> - </index> - - </table> - - <table name="RHQ_QRTZ_SIMPLE_TRIGGERS"> - <column name="TRIGGER_NAME" type="VARCHAR2" required="true" size="80"/> - <column name="TRIGGER_GROUP" type="VARCHAR2" required="true" size="80"/> - <column name="REPEAT_COUNT" type="LONG" required="true"/> - <column name="REPEAT_INTERVAL" type="LONG" required="true"/> - <column name="TIMES_TRIGGERED" type="LONG" required="true"/> - - <constraint name="RHQ_PK_QRTZ_SIMPLE_TRIGGERS"> - <primaryKey> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </primaryKey> - </constraint> - <constraint name="RHQ_FK_QRTZ_SIMPLE_TRGRS_TN_TG"> - <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" - references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" - ondelete="cascade"/> - </constraint> - - <!-- Quartz docs recommend this index. --> - <!-- Commenting out, because Oracle auto-creates an index for the - primary key column(s) and fails if you try to create another - index for the same column(s) (ips, 03/29/07). - --> - <!-- - <index name="RHQ_QRTZ_SIMPLE_TRGRS_TN_TG_IDX"> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </index> - --> - </table> - - <table name="RHQ_QRTZ_CRON_TRIGGERS"> - <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> - <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> - <column name="CRON_EXPRESSION" type="VARCHAR2" size="80" required="true"/> - <column name="TIME_ZONE_ID" type="VARCHAR2" size="80" required="false"/> - - <constraint name="RHQ_PK_QRTZ_CRON_TRIGGERS"> - <primaryKey> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </primaryKey> - </constraint> - <constraint name="RHQ_FK_QRTZ_CRON_TRIG_TN_TG"> - <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" - references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" - ondelete="cascade"/> - </constraint> - - <!-- Quartz docs recommend this index. --> - <!-- Commenting out, because Oracle auto-creates an index for the - primary key column(s) and fails if you try to create another - index for the same column(s) (ips, 03/29/07). - --> - <!-- - <index name="RHQ_QRTZ_CRON_TRGRS_TN_TG_IDX"> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </index> - --> - </table> - - <table name="RHQ_QRTZ_BLOB_TRIGGERS"> - <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> - <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> - <column name="BLOB_DATA" type="BLOB" required="false"/> - - <constraint name="RHQ_PK_QRTZ_BLOB_TRIGGERS"> - <primaryKey> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </primaryKey> - </constraint> - <constraint name="RHQ_FK_QRTZ_BLOB_TRIGG_TN_TG"> - <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" - references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" - ondelete="cascade"/> - </constraint> - - <!-- Quartz docs recommend this index. --> - <!-- Commenting out, because Oracle auto-creates an index for the - primary key column(s) and fails if you try to create another - index for the same column(s) (ips, 03/29/07). - --> - <!-- - <index name="RHQ_QRTZ_BLOB_TRGRS_TN_TG_IDX"> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </index> - --> - </table> - - <table name="RHQ_QRTZ_TRIGGER_LISTENERS"> - <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> - <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> - <column name="TRIGGER_LISTENER" type="VARCHAR2" size="80" required="true"/> - - <constraint name="RHQ_PK_QRTZ_TRIGGER_LISTENERS"> - <primaryKey> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - <field ref="TRIGGER_LISTENER"/> - </primaryKey> - </constraint> - <constraint name="RHQ_FK_QRTZ_TRGR_LSTNRS_TN_TG"> - <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" - references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" - ondelete="cascade"/> - </constraint> - - <!-- Quartz docs recommend this index. --> - <index name="RHQ_QRTZ_TRGR_LSTNRS_TN_TG_IDX"> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </index> - - </table> - - <table name="RHQ_QRTZ_FIRED_TRIGGERS"> - <column name="ENTRY_ID" primarykey="true" type="VARCHAR2" size="95" required="true"/> - <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> - <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> - <column name="INSTANCE_NAME" type="VARCHAR2" size="80" required="true"/> - <column name="FIRED_TIME" type="LONG" required="true"/> - <column name="PRIORITY" type="INTEGER" required="false"/> - <column name="STATE" type="VARCHAR2" size="16" required="true"/> - <column name="IS_VOLATILE" type="BOOLEAN" required="true"/> - <column name="JOB_NAME" type="VARCHAR2" size="80" required="false"/> - <column name="JOB_GROUP" type="VARCHAR2" size="80" required="false"/> - <column name="IS_STATEFUL" type="BOOLEAN" required="false"/> - <column name="REQUESTS_RECOVERY" type="BOOLEAN" required="false"/> - - <!-- Quartz docs recommend these indexes. --> - <index name="RHQ_QRTZ_FIRED_TRGRS_TN_IDX"> - <field ref="TRIGGER_NAME"/> - </index> - <index name="RHQ_QRTZ_FIRED_TRGRS_TG_IDX"> - <field ref="TRIGGER_GROUP"/> - </index> - <index name="RHQ_QRTZ_FIRED_TRGRS_TN_TG_IDX"> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </index> - <index name="RHQ_QRTZ_FIRED_TRGRS_IN_IDX"> - <field ref="INSTANCE_NAME"/> - </index> - <index name="RHQ_QRTZ_FIRED_TRGRS_JN_IDX"> - <field ref="JOB_NAME"/> - </index> - <index name="RHQ_QRTZ_FIRED_TRGRS_JG_IDX"> - <field ref="JOB_GROUP"/> - </index> - - </table> - - <table name="RHQ_QRTZ_CALENDARS"> - <column name="CALENDAR_NAME" primarykey="true" type="VARCHAR2" size="80" required="true"/> - <column name="CALENDAR" type="BLOB" required="true"/> - </table> - - <table name="RHQ_QRTZ_PAUSED_TRIGGER_GRPS"> - <column name="TRIGGER_GROUP" primarykey="true" type="VARCHAR2" size="80" required="true"/> - </table> - - <table name="RHQ_QRTZ_SCHEDULER_STATE"> - <column name="INSTANCE_NAME" primarykey="true" type="VARCHAR2" size="80" required="true"/> - <column name="LAST_CHECKIN_TIME" type="LONG" required="true"/> - <column name="CHECKIN_INTERVAL" type="LONG" required="true"/> - <column name="RECOVERER" type="VARCHAR2" size="80" required="false"/> - </table> - - <table name="RHQ_QRTZ_LOCKS"> - <column name="LOCK_NAME" primarykey="true" type="VARCHAR2" size="40" required="true"/> - <data LOCK_NAME="TRIGGER_ACCESS"/> - <data LOCK_NAME="JOB_ACCESS"/> - <data LOCK_NAME="CALENDAR_ACCESS"/> - <data LOCK_NAME="STATE_ACCESS"/> - <data LOCK_NAME="MISFIRE_ACCESS"/> - </table> - -<!-- END: scheduler-schema.xml --> -<!-- BEGIN: amps-schema.xml --> - - - <table name="RHQ_PLUGIN"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="4000" type="VARCHAR2" required="false"/> - <column name="VERSION" size="200" type="VARCHAR2" required="false"/> - <column name="AMPS_VERSION" size="16" type="VARCHAR2" required="false"/> - <column name="ENABLED" type="BOOLEAN" required="true"/> - <column name="STATUS" size="16" type="VARCHAR2" required="true"/> - <column name="HELP" type="CLOB" required="false"/> - <column name="PATH" size="500" type="VARCHAR2" required="true"/> - <column name="MD5" size="100" type="VARCHAR2" required="true"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="DEPLOYMENT" size="8" type="VARCHAR2" required="true"/> - <column name="PTYPE" size="200" type="VARCHAR2" required="false"/> - <column name="PLUGIN_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> - <column name="JOBS_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> - <column name="CONTENT" type="BLOB" required="false"/> - - <index name="RHQ_PLUGIN_NAME_DEPLOY_IDX" unique="true"> - <field ref="NAME"/> - <field ref="DEPLOYMENT"/> - </index> - </table> - -<!-- END: amps-schema.xml --> -<!-- BEGIN: measurement-schema.xml --> - - <table name="RHQ_MEASUREMENT_DEF"> - - <!-- === required columns === --> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE(ID)"/> - <column name="NAME" type="VARCHAR2" size="100" required="true"/> - - <!-- === optional columns === --> - <!-- an OSGI version range - if null, the metric def applies to all versions of the associated resource type --> - <column name="RESOURCE_VERSION_RANGE" type="VARCHAR2" size="100"/> - <column name="CATEGORY" type="SMALLINT"/> - <column name="UNITS" type="SMALLINT"/> - <column name="NUMERIC_TYPE" type="SMALLINT"/> - <column name="DISPLAY_TYPE" type="SMALLINT"/> - <column name="DATA_TYPE" type="SMALLINT"/> - <column name="RAW_NUMERIC_TYPE" type="SMALLINT"/> - <column name="DEFAULT_ON" type="BOOLEAN" default="false"/> - <column name="DEFAULT_INTERVAL" type="LONG" /> - <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> - <column name="DISPLAY_ORDER" type="INTEGER" default="1000"/> - <column name="DESCRIPTION" type="VARCHAR2" size="500"/> - <column name="DESTINATION_TYPE" type="VARCHAR2" size="100"/> - - <column name="VERSION" type="INTEGER"/> - <!-- for optimistic locking --> - - <!-- === business key (RESOURCE_TYPE_ID + NAME + RAW_NUMERIC_TYPE) === --> - <index name="RHQ_METRIC_DEF_KEY_IDX" unique="true"> - <field ref="RESOURCE_TYPE_ID"/> - <field ref="NAME"/> - <field ref="RAW_NUMERIC_TYPE"/> - </index> - <index name="RHQ_METRIC_DEF_NT_IDX"> - <field ref="NUMERIC_TYPE"/> - </index> - </table> - - - <table name="RHQ_MEASUREMENT_SCHED"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - - <column name="ENABLED" type="BOOLEAN" default="false"/> - <column name="MTIME" type="LONG" /> - <column name="DEFINITION" type="INTEGER" references="RHQ_MEASUREMENT_DEF(ID)"/> - <column name="VERSION" type="INTEGER" /> - <column name="COLL_INTERVAL" type="LONG" /> - <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE(ID)"/> - <index name="RHQ_MEAS_SCHED_UNIQ" unique="true"> - <field ref="RESOURCE_ID"/> - <field ref="DEFINITION"/> - </index> - <index name="RHQ_MEAS_SCHED_RESID_IDX"> - <field ref="RESOURCE_ID"/> - </index> - </table> - - - <table name="RHQ_MEASUREMENT_BLINE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - - <column name="BL_USER_ENTERED" type="BOOLEAN" default="false" required="true"/> - <column name="BL_MIN" type="DOUBLE" required="true"/> - <column name="BL_MAX" type="DOUBLE" required="true"/> - <column name="BL_MEAN" type="DOUBLE" required="true"/> - <column name="BL_COMPUTE_TIME" type="LONG" required="true"/> - <column name="SCHEDULE_ID" type="INTEGER" required="true" references="RHQ_MEASUREMENT_SCHED(ID)"/> - <index name="RHQ_MEAS_BASELINE_CTIME_IDX"> - <field ref="BL_COMPUTE_TIME"/> - </index> - <index name="RHQ_MEAS_BASELINE_SID_IDX"> - <field ref="SCHEDULE_ID"/> - </index> - </table> - - - <table name="RHQ_MEASUREMENT_DATA_NUM_1H" logging="false" cache="true" - tablespace="DEFAULT" storage-options="freelists 20"> - - <column name="TIME_STAMP" required="true" type="LONG"/> - <column name="SCHEDULE_ID" required="true" type="INTEGER"/> - <column name="VALUE" required="false" type="DOUBLE"/> - <column name="MINVALUE" required="false" type="DOUBLE"/> - <column name="MAXVALUE" required="false" type="DOUBLE"/> - - <constraint name="RHQ_MEAS_DATA_1H_ID_TIME_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - - <index name="RHQ_MEAS_DATA_1H_TIME_IDX"> - <field ref="TIME_STAMP"/> - </index> - </table> - - - <table name="RHQ_MEASUREMENT_DATA_NUM_6H" logging="false" cache="true" - tablespace="DEFAULT" storage-options="freelists 20"> - - <column name="TIME_STAMP" required="true" type="LONG"/> - <column name="SCHEDULE_ID" required="true" type="INTEGER"/> - <column name="VALUE" required="false" type="DOUBLE"/> - <column name="MINVALUE" required="false" type="DOUBLE"/> - <column name="MAXVALUE" required="false" type="DOUBLE"/> - - <constraint name="RHQ_MEAS_DATA_6H_ID_TIME_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - - <index name="RHQ_MEAS_DATA_6H_TIME_IDX"> - <field ref="TIME_STAMP"/> - </index> - </table> - - - <table name="RHQ_MEASUREMENT_DATA_NUM_1D" logging="false" cache="true" - tablespace="DEFAULT" storage-options="freelists 20"> - - <column name="TIME_STAMP" required="true" type="LONG"/> - <column name="SCHEDULE_ID" required="true" type="INTEGER"/> - <column name="VALUE" required="false" type="DOUBLE"/> - <column name="MINVALUE" required="false" type="DOUBLE"/> - <column name="MAXVALUE" required="false" type="DOUBLE"/> - - <constraint name="RHQ_MEAS_DATA_1D_ID_TIME_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - - <index name="RHQ_MEAS_DATA_1D_TIME_IDX"> - <field ref="TIME_STAMP" /> - </index> - </table> - - - <table name="RHQ_MEASUREMENT_DATA_TRAIT"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER" /> - <column name="VALUE" type="VARCHAR2" size="4000" /> - <constraint name="RHQ_MEAS_DATA_TRAIT_ID_TIME_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - - - <table name="RHQ_CALLTIME_DATA_KEY"> - <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> - <column name="SCHEDULE_ID" type="INTEGER" required="true"/> - <column name="CALL_DESTINATION" type="VARCHAR2" size="4000" required="true"/> - <index name="RHQ_CALLTIME_DATA_KEY_IDX" unique="true"> - <field ref="SCHEDULE_ID"/> - <field ref="CALL_DESTINATION"/> - </index> - </table> - - - <table name="RHQ_CALLTIME_DATA_VALUE"> - <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> - <column name="KEY_ID" type="INTEGER" references="RHQ_CALLTIME_DATA_KEY" required="true"/> - <column name="BEGIN_TIME" type="LONG" required="true"/> - <column name="END_TIME" type="LONG" required="true"/> - <column name="MINIMUM" type="DOUBLE" required="true"/> - <column name="MAXIMUM" type="DOUBLE" required="true"/> - <column name="TOTAL" type="DOUBLE" required="true"/> - <column name="COUNT" type="LONG" required="true"/> - <index name="RHQ_CT_DA_VA_END_TIM_IDX"> - <field ref="END_TIME"/> - </index> - </table> - - - <table name="RHQ_AVAILABILITY"> - <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE(ID)"/> - <column name="START_TIME" type="LONG" required="true" /> - <column name="END_TIME" type="LONG" required="false" /> - <column name="AVAILABILITY_TYPE" type="SMALLINT" required="false" /> - <index name="RHQ_AVAIL_RESOURCE_START_IDX"> - <field ref="RESOURCE_ID"/> - <field ref="START_TIME"/> - </index> - <!-- only one null row can exist for any resource --> - <index name="RHQ_AVAIL_RESOURCE_END_IDX" condition="END_TIME IS NULL"> - <field ref="RESOURCE_ID"/> - <field ref="END_TIME" /> - </index> - </table> - - <table name="RHQ_RESOURCE_AVAIL"> - <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE(ID)" ondelete="cascade"/> - <column name="AVAILABILITY_TYPE" type="SMALLINT" required="false" /> - <index name="RHQ_RESOURCE_AVAIL_IDX"> - <field ref="RESOURCE_ID" /> - </index> - </table> - - <table name="RHQ_MEASUREMENT_OOB"> - <column name="SCHEDULE_ID" type="INTEGER" references="RHQ_MEASUREMENT_SCHED(ID)" required="true"/> - <column name="TIME_STAMP" type="LONG" required="true"/> - <column name="OOB_FACTOR" type="INTEGER" required="true" /> - <constraint name="RHQ_MEAS_OOB_ID_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_MEASUREMENT_OOB_TMP"> - <column name="SCHEDULE_ID" type="INTEGER" required="true"/> - <column name="TIME_STAMP" type="LONG" required="true"/> - <column name="OOB_FACTOR" type="INTEGER" required="true" /> - <constraint name="RHQ_MEAS_OOB_TMP_ID_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_NUMBERS"> - <column name="i" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true" /> - </table> - - - <table name="RHQ_MEAS_DATA_NUM_R00"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R00_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R00_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R01"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R01_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R01_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R02"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R02_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R02_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R03"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R03_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R03_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R04"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R04_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R04_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R05"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R05_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R05_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R06"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R06_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R06_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R07"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R07_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R07_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R08"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R08_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R08_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R09"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R09_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R09_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R10"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R10_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R10_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R11"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R11_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R11_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R12"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R12_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R12_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R13"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R13_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R13_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R14"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R14_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R14_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - -<!-- END: measurement-schema.xml --> -<!-- BEGIN: content-schema.xml --> - - - <table name="RHQ_ARCHITECTURE"> - <column name="ID" default="sequence-only" initial="100" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="50" type="VARCHAR2" required="true"/> - <index name="RHQ_ARCHITECTURE_NAME_IDX" unique="true"> - <field ref="NAME"/> - </index> - </table> - - <table name="RHQ_REPO_GROUP_TYPE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - </table> - - - <table name="RHQ_REPO_GROUP"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - - <column name="REPO_GROUP_TYPE_ID" type="INTEGER" references="RHQ_REPO_GROUP_TYPE" required="true"/> - - <index name="RHQ_REPO_GROUP_IDX" unique="true"> - <field ref="NAME"/> - <field ref="REPO_GROUP_TYPE_ID"/> - </index> - </table> - - - <table name="RHQ_CONTENT_SOURCE_TYPE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="false"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="PLUGIN_NAME" size="100" type="VARCHAR2" required="false"/> - <!-- we might want this as part of natural key --> - <column name="DEFAULT_LAZY_LOAD" type="BOOLEAN" required="true"/> - <column name="DEFAULT_DOWNLOAD_MODE" size="16" type="VARCHAR2" required="true"/> - <column name="DEFAULT_SYNC_SCHEDULE" size="64" type="VARCHAR2" required="false"/> - <column name="API_CLASS" size="100" type="VARCHAR2" required="true"/> - - <column name="SOURCE_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF" required="false"/> - - <index name="RHQ_CONTENT_SOURCE_TYPE_IDX" unique="true"> - <field ref="NAME"/> - <!-- <field ref="PLUGIN_NAME"/> --> - </index> - </table> - - <table name="RHQ_CONTENT_SOURCE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="LAZY_LOAD" type="BOOLEAN" required="true"/> - <column name="DOWNLOAD_MODE" size="16" type="VARCHAR2" required="true"/> - <column name="SYNC_SCHEDULE" size="64" type="VARCHAR2" required="false"/> - <column name="LOAD_ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="CREATION_TIME" type="LONG" required="true"/> - <column name="LAST_MODIFIED_TIME" type="LONG" required="true"/> - - <column name="CONTENT_SOURCE_TYPE_ID" type="INTEGER" references="RHQ_CONTENT_SOURCE_TYPE" required="true"/> - <column name="CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> - - <index name="RHQ_CONTENT_SOURCE_IDX" unique="true"> - <field ref="NAME"/> - <field ref="CONTENT_SOURCE_TYPE_ID"/> - </index> - </table> - - <table name="RHQ_REPO"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="CREATION_TIME" type="LONG" required="true"/> - <column name="LAST_MODIFIED_TIME" type="LONG" required="true"/> - <column name="IS_CANDIDATE" type="BOOLEAN" required="true"/> - <column name="SYNC_SCHEDULE" size="64" type="VARCHAR2" required="false"/> - <column name="OWNER_ID" type="INTEGER" required="false" references="RHQ_SUBJECT" /> - <column name="IS_PRIVATE" type="BOOLEAN" required="true" /> - - <index name="RHQ_REPO_IDX" unique="true"> - <field ref="NAME"/> - </index> - </table> - - - <table name="RHQ_REPO_RELATION_TYPE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - </table> - - - <table name="RHQ_REPO_RELATION"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="RELATED_REPO_ID" type="INTEGER" references="RHQ_REPO" required="true"/> - <column name="REPO_RELATION_TYPE_ID" type="INTEGER" references="RHQ_REPO_RELATION_TYPE" required="true"/> - </table> - - - - <table name="RHQ_PACKAGE_TYPE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="false"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="CATEGORY" size="50" type="VARCHAR2" required="false"/> - <column name="DISCOVERY_INTERVAL" type="INTEGER" required="false"/> - <column name="IS_CREATION_DATA" type="BOOLEAN" required="true"/> - <column name="SUPPORTS_ARCHITECTURE" type="BOOLEAN" required="true"/> - - <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE" required="false"/> - <column name="DEPLOYMENT_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF" required="false"/> - <column name="PACKAGE_EXTRA_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG_DEF" required="false"/> - - <index name="RHQ_PACKAGE_TYPE_IDX" unique="true"> - <field ref="NAME"/> - <field ref="RESOURCE_TYPE_ID"/> - </index> - - </table> - - <table name="RHQ_PACKAGE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="CLASSIFICATION" size="200" type="VARCHAR2" required="false"/> - - <column name="PACKAGE_TYPE_ID" type="INTEGER" references="RHQ_PACKAGE_TYPE" required="true"/> - - <index name="RHQ_PACKAGE_IDX" unique="true"> - <field ref="NAME"/> - <field ref="PACKAGE_TYPE_ID"/> - </index> - </table> - - <table name="RHQ_PACKAGE_BITS"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="BITS" type="LARGEOBJECT" required="false"/> - </table> - - <table name="RHQ_PACKAGE_VERSION"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="false"/> - <column name="SHORT_DESCRIPTION" size="10000" type="CLOB" required="false"/> - <column name="LONG_DESCRIPTION" size="50000" type="CLOB" required="false"/> - <column name="VERSION" size="500" type="VARCHAR2" required="true"/> - <column name="DISPLAY_VERSION" size="500" type="VARCHAR2" required="false"/> - <column name="FILE_NAME" size="255" type="VARCHAR2" required="false"/> - <column name="FILE_SIZE" type="LONG" required="false"/> - <column name="FILE_MD5" size="32" type="VARCHAR2" required="false"/> - <column name="FILE_SHA256" size="64" type="VARCHAR2" required="false"/> - <column name="FILE_CREATION_TIME" type="LONG" required="false"/> - <column name="LICENSE_NAME" size="255" type="VARCHAR2" required="false"/> - <column name="LICENSE_VERSION" size="20" type="VARCHAR2" required="false"/> - <column name="METADATA" type="BLOB" required="false"/> - - <column name="PACKAGE_ID" type="INTEGER" references="RHQ_PACKAGE" required="true"/> - <column name="ARCHITECTURE_ID" type="INTEGER" references="RHQ_ARCHITECTURE" required="true"/> - <column name="CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> - <column name="PACKAGE_BITS_ID" type="INTEGER" references="RHQ_PACKAGE_BITS" required="false"/> - - <index name="RHQ_PACKAGE_VERSION_IDX" unique="true"> - <field ref="PACKAGE_ID"/> - <field ref="VERSION"/> - <field ref="ARCHITECTURE_ID"/> - </index> - - </table> - - <table name="RHQ_CONTENT_REQ"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="REQUEST_TYPE" type="VARCHAR2" required="true" size="20"/> - <column name="NOTES" type="VARCHAR2" required="false" size="512"/> - </table> - - <table name="RHQ_INSTALLED_PACKAGE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="INSTALLATION_TIME" type="LONG" required="false"/> - - <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE" required="true"/> - <column name="PACKAGE_VERSION_ID" type="INTEGER" references="RHQ_PACKAGE_VERSION" required="true"/> - <column name="SUBJECT_ID" type="INTEGER" references="RHQ_SUBJECT" required="false"/> - </table> - - <table name="RHQ_INSTALLED_PKG_HIST"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="STATUS" type="VARCHAR2" size="24" required="true"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="HISTORY_TIMESTAMP" type="LONG" required="false"/> - - <column name="PACKAGE_VERSION_ID" type="INTEGER" references="RHQ_PACKAGE_VERSION" required="true"/> - <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE" required="true"/> - <column name="DEPLOYMENT_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> - <column name="CONTENT_SERVICE_REQUEST_ID" type="INTEGER" references="RHQ_CONTENT_REQ" required="false"/> - </table> - - <table name="RHQ_CONTENT_SRC_SYNC"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="STATUS" type="VARCHAR2" size="16" required="true"/> - <column name="START_TIME" type="LONG" required="true"/> - <column name="END_TIME" type="LONG" required="false"/> - <column name="RESULTS" type="LONGVARCHAR" required="false"/> - <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> - </table> - - <table name="RHQ_REPO_SYNC"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="STATUS" type="VARCHAR2" size="16" required="true"/> - <column name="START_TIME" type="LONG" required="true"/> - <column name="END_TIME" type="LONG" required="false"/> - <column name="RESULTS" type="LONGVARCHAR" required="false"/> - <column name="PERCENT_COMPLETE" type="LONG" required="false"/> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - </table> - - - <table name="RHQ_PACKAGE_INST_STEP"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="STEP_KEY" type="VARCHAR2" size="500" required="true"/> - <column name="STEP_ORDER" type="INTEGER" required="true"/> - <column name="DESCRIPTION" type="VARCHAR2" size="4000" required="true"/> - <column name="ERROR_MSG" type="LONGVARCHAR" required="false"/> - <column name="RESULT" type="VARCHAR2" size="25" required="true"/> - - <column name="INSTALLED_PKG_HIST_ID" type="INTEGER" references="RHQ_INSTALLED_PKG_HIST"/> - </table> - - <table name="RHQ_REPO_RESOURCE_MAP"> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> - <column name="CTIME" type="LONG" required="true"/> - - <constraint name="RHQ_REPO_RESOURCE_MAP_KEY"> - <primaryKey> - <field ref="REPO_ID"/> - <field ref="RESOURCE_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_REPO_CONTENT_SRC_MAP"> 1 - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> - <column name="CTIME" type="LONG" required="true"/> - - <constraint name="RHQ_REPO_CONTENT_SRC_MAP_KEY"> - <primaryKey> - <field ref="REPO_ID"/> - <field ref="CONTENT_SRC_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_REPO_REPO_GROUP_MAP"> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - <column name="REPO_GROUP_ID" type="INTEGER" required="true" references="RHQ_REPO_GROUP"/> - <column name="CTIME" type="LONG" required="true"/> - - <constraint name="RHQ_REPO_REPO_GROUP_MAP_KEY"> - <primaryKey> - <field ref="REPO_ID"/> - <field ref="REPO_GROUP_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_REPO_REPO_RELATION_MAP"> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - <column name="REPO_RELATION_ID" type="INTEGER" required="true" references="RHQ_REPO_RELATION"/> - <column name="CTIME" type="LONG" required="true"/> - - <constraint name="RHQ_REPO_REPO_RELATION_MAP_KEY"> - <primaryKey> - <field ref="REPO_ID"/> - <field ref="REPO_RELATION_ID"/> - </primaryKey> - </constraint> - </table> - - - <table name="RHQ_REPO_PKG_VERSION_MAP"> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> - <column name="CTIME" type="LONG" required="true"/> - - <constraint name="RHQ_REPO_PKG_VER_MAP_KEY"> - <primaryKey> - <field ref="REPO_ID"/> - <field ref="PACKAGE_VERSION_ID"/> - </primaryKey> - </constraint> - <index name="RHQ_REPO_PKG_VER_MAP_IDX" unique="false"> - <field ref="PACKAGE_VERSION_ID"/> - </index> - </table> - - <table name="RHQ_PKG_VER_CONTENT_SRC_MAP"> - <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> - <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> - <column name="LOCATION" type="VARCHAR2" size="4000" required="true"/> - - <constraint name="RHQ_PKG_VER_CONTENT_SRC_KEY"> - <primaryKey> - <field ref="PACKAGE_VERSION_ID"/> - <field ref="CONTENT_SRC_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_PKG_PRD_MAP"> - <column name="PKG_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> - <column name="PRD_ID" type="INTEGER" required="true" references="RHQ_PRD_VER"/> - - <constraint name="RHQ_PKG_PRD_KEY"> - <primaryKey> - <field ref="PKG_ID"/> - <field ref="PRD_ID"/> - </primaryKey> - </constraint> - - </table> - - <table name="RHQ_DISTRIBUTION_TYPE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - - </table> - - <table name="RHQ_DISTRIBUTION"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="DISTRIBUTION_TYPE_ID" type="INTEGER" required="true" references="RHQ_DISTRIBUTION_TYPE"/> - <column name="LABEL" size="64" type="VARCHAR2" required="true"/> - <column name="BASE_PATH" size="256" type="VARCHAR2" required="true"/> - <column name="LAST_MODIFIED" type="LONG" required="true"/> - - <index name="RHQ_DISTRIBUTION_IDX" unique="true"> - <field ref="LABEL"/> - <field ref="BASE_PATH"/> - </index> - - </table> - - <table name="RHQ_REPO_DISTRIBUTION"> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - <column name="DISTRIBUTION_ID" type="INTEGER" required="true" references="RHQ_DISTRIBUTION"/> - <column name="LAST_MODIFIED" type="LONG" required="true"/> - - <constraint name="RHQ_REPO_DIST_MAP_KEY"> - <primaryKey> - <field ref="REPO_ID"/> - <field ref="DISTRIBUTION_ID"/> - </primaryKey> - </constraint> - </table> - - - - <table name="RHQ_DISTRIBUTION_FILE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="DISTRIBUTION_ID" type="INTEGER" required="true" references="RHQ_DISTRIBUTION"/> - <column name="RELATIVE_FILENAME" size="256" type="VARCHAR2" required="true"/> - <!--<column name="FILE_SIZE" type="NUMBER" required="true"/>--> - <column name="MD5SUM" size="64" type="VARCHAR2" required="true"/> - <column name="LAST_MODIFIED" type="LONG" required="true"/> - <!--<column name="CTIME" type="LONG" required="true"/>--> - - <index name="RHQ_DISTRIBUTION_FILE_IDX" unique="true"> - <field ref="DISTRIBUTION_ID"/> - <field ref="RELATIVE_FILENAME"/> - </index> - </table> - - - - - <table name="RHQ_ADVISORY"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="ADVISORY" size="64" type="VARCHAR2" required="true"/> - <column name="ADVISORY_TYPE" size="64" type="VARCHAR2" required="true" /> - <column name="ADVISORY_REL" size="64" type="VARCHAR2" required="false"/> - <column name="ADVISORY_NAME" size="64" type="VARCHAR2" required="false"/> - <column name="DESCRIPTION" size="4000" type="VARCHAR2" required="false"/> - <column name="SYNOPSIS" size="4000" type="VARCHAR2" required="true"/> - <column name="TOPIC" size="4000" type="VARCHAR2" required="false"/> - <column name="SOLUTION" size="4000" type="VARCHAR2" required="false"/> - <column name="SEVERITY" size="64" type="VARCHAR2" required="false"/> - <column name="ISSUE_DATE" type="LONG" required="false"/> - <column name="UPDATE_DATE" type="LONG" required="false"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="LAST_MODIFIED" type="LONG" required="true"/> - - <index name="RHQ_ADVISORY_NAME_UQ" unique="true"> - <field ref="ADVISORY_NAME"/> - </index> - - <index name="RHQ_ADVISORY_UQ" unique="true"> - <field ref="ADVISORY"/> - </index> - - <index name="RHQ_ADVISORY_UDATE_IDX" unique="false"> - <field ref="UPDATE_DATE"/> - </index> - </table> - - <table name="RHQ_ADVISORY_PACKAGE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> - <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> - <column name="LAST_MODIFIED" type="LONG" required="true"/> - - <index name="RHQ_ADVISORY_PKG_IDX" unique="true"> - <field ref="ADVISORY_ID"/> - <field ref="PACKAGE_VERSION_ID"/> - </index> - </table> - - <table name="RHQ_CVE"> - <column name="ID" default="sequence-only" initial="101" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="64" type="VARCHAR2" required="true"/> - </table> - - <table name="RHQ_ADVISORY_CVE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> - <column name="CVE_ID" type="INTEGER" required="true" references="RHQ_CVE"/> - <column name="LAST_MODIFIED" type="LONG" required="true"/> - - <index name="RHQ_ADVISORY_CVE_IDX" unique="true"> - <field ref="ADVISORY_ID"/> - <field ref="CVE_ID"/> - </index> - - </table> - - <table name="RHQ_ADVISORY_BUGLIST"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> - <column name="BUG_ID" size="256" type="VARCHAR2" required="true"/> - <column name="LAST_MODIFIED" type="LONG" required="true"/> - - <index name="RHQ_ADVISORY_BUG_IDX" unique="true"> - <field ref="ADVISORY_ID"/> - <field ref="BUG_ID"/> - </index> - </table> - - - <table name="RHQ_REPO_ADVISORY"> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> - <column name="LAST_MODIFIED" type="LONG" required="true"/> - - <constraint name="RHQ_REPO_ADV_MAP_KEY"> - <primaryKey> - <field ref="REPO_ID"/> - <field ref="ADVISORY_ID"/> - </primaryKey> - </constraint> - </table> - - <!-- BUNDLE_TYPE is things like "Cobbler profile" or "file-based bundle" or "puppet recipe" --> - <table name="RHQ_BUNDLE_TYPE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> - - <!-- This index is for constraint, not performance --> - <index name="RHQ_BUNDLE_TYPE_UNIQUE" unique="true"> - <field ref="NAME"/> - </index> - </table> - - <!-- BUNDLE is a named piece of content that can be versioned and installed somewhere --> - <table name="RHQ_BUNDLE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="BUNDLE_TYPE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_TYPE"/> - <column name="PACKAGE_TYPE_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_TYPE"/> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - - <!-- This index is for constraint, not performance --> - <index name="RHQ_BUNDLE_UNIQUE" unique="true"> - <field ref="BUNDLE_TYPE_ID"/> - <field ref="NAME"/> - </index> - </table> - - <!-- BUNDLE_VERSION represents an actual piece of content that needs to be installed somewhere --> - <table name="RHQ_BUNDLE_VERSION"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="VERSION" size="500" type="VARCHAR2" required="true"/> - <column name="VERSION_ORDER" type="INTEGER" required="true"/> - <column name="ACTION" type="CLOB" required="true"/> - <column name="CONFIG_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_DEF" /> - <column name="BUNDLE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE"/> - - <!-- This index is for constraint, not performance --> - <index name="RHQ_BUNDLE_VERSION_UNIQUE" unique="true"> - <field ref="BUNDLE_ID"/> - <field ref="NAME"/> - <field ref="VERSION"/> - </index> - </table> - - <!-- Many-to-many table that links many repos to a particular bundle version. destination platforms --> - <!-- would be required to have associations to the specified repos (to access required content --> - <table name="RHQ_BUNDLE_VERSION_REPO"> - <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - - <constraint name="RHQ_BUNDLE_VERSION_REPO_KEY"> - <primaryKey> - <field ref="BUNDLE_VERSION_ID"/> - <field ref="REPO_ID"/> - </primaryKey> - </constraint> - </table> - - <!-- BUNDLE_FILE represents a file that is associated with (possibly bundled inside) a bundle version --> - <table name="RHQ_BUNDLE_FILE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> - <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> - </table> - - <!-- A logical destination for a bundle deployment. Defines the platforms and directory on those targets. --> - <table name="RHQ_BUNDLE_DESTINATION"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="BUNDLE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE"/> - <column name="GROUP_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_GROUP"/> - <column name="DEPLOY_DIR" size="256" type="VARCHAR2" required="true"/> - <column name="DEST_BASE_DIR_NAME" size="200" type="VARCHAR2" required="true"/> - - <!-- This index is for constraint, not performance --> - <index name="RHQ_BUNDLE_DESTINATION_UNIQUE" unique="true"> - <field ref="BUNDLE_ID"/> - <field ref="GROUP_ID"/> - <field ref="DEPLOY_DIR"/> - </index> - </table> - - <!-- An actual deployment of a bundle version to a destination, with a specific config. Bundle deployments - can differ only on ctime, which is assumed to be different --> - <table name="RHQ_BUNDLE_DEPLOYMENT"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> - <column name="BUNDLE_DESTINATION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DESTINATION"/> - <column name="CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG" /> - <column name="SUBJECT_NAME" type="VARCHAR2" required="false" size="255"/> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="IS_LIVE" type="BOOLEAN" required="true"/> - <column name="REPLACED_BUNDLE_DEPLOYMENT_ID" type="INTEGER" required="false" references="RHQ_BUNDLE_DEPLOYMENT"/> - </table> - - <!-- Represents a bundle version that is deployed on a platform resource --> - <table name="RHQ_BUNDLE_RES_DEPLOY"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="BUNDLE_DEPLOYMENT_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DEPLOYMENT" /> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE" /> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="CTIME" type="LONG" required="true"/> - - <index name="RHQ_BUNDLE_RES_DEPLOY_IDX" unique="true"> - <field ref="BUNDLE_DEPLOYMENT_ID"/> - <field ref="RESOURCE_ID"/> - </index> - </table> - - <table name="RHQ_BUNDLE_RES_DEP_HIST"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="BUNDLE_RES_DEPLOY_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_RES_DEPLOY" /> - <column name="SUBJECT_NAME" required="false" size="255" type="VARCHAR2"/> - <column name="AUDIT_TIME" required="true" type="LONG"/> - <column name="ACTION" required="true" size="128" type="VARCHAR2"/> - <column name="INFO" required="true" size="512" type="VARCHAR2"/> - <column name="CATEGORY" required="false" size="32" type="VARCHAR2"/> - <column name="STATUS" required="true" type="VARCHAR2" size="16"/> - <column name="MESSAGE" required="false" type="LONGVARCHAR"/> - <column name="ATTACHMENT" required="false" type="LONGVARCHAR"/> - </table> - - <table name="RHQ_TAGGING_BUNDLE_MAP"> - <column name="BUNDLE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE"/> - <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> - <constraint name="RHQ_TAGGING_BUNDLE_MAP_KEY"> - <primaryKey> - <field ref="BUNDLE_ID"/> - <field ref="TAG_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_TAGGING_BUNDLE_VERSION_MAP"> - <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> - <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> - <constraint name="RHQ_TAGGING_BUNDLE_VER_MAP_KEY"> - <primaryKey> - <field ref="BUNDLE_VERSION_ID"/> - <field ref="TAG_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_TAGGING_BUNDLE_DEPLOY_MAP"> - <column name="BUNDLE_DEPLOYMENT_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DEPLOYMENT"/> - <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> - <constraint name="RHQ_TAGGING_BUNDLE_DEP_MAP_KEY"> - <primaryKey> - <field ref="BUNDLE_DEPLOYMENT_ID"/> - <field ref="TAG_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_TAGGING_BUNDLE_DEST_MAP"> - <column name="BUNDLE_DESTINATION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DESTINATION"/> - <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> - <constraint name="RHQ_TAGGING_BUNDLE_DES_MAP_KEY"> - <primaryKey> - <field ref="BUNDLE_DESTINATION_ID"/> - <field ref="TAG_ID"/> - </primaryKey> - </constraint> - </table> - - <!-- Drift Management Tables --> - <table name="RHQ_DRIFT_DEF_TEMPLATE"> - <column name="ID" default="sequence-only" initial="1001" primarykey="true" required="true" type="INTEGER"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> - <column name="CONFIG_ID" type="INTEGER" required="true" references="RHQ_CONFIG"/> - <column name="NAME" type="VARCHAR2" size="128" required="true"/> - <column name="DESCRIPTION" type="VARCHAR2" size="512" required="false"/> - <!-- true if defined by user, false if provided by plugin --> - <column name="IS_USER_DEFINED" type="BOOLEAN" required="true"/> - <!-- - Change sets are managed by the drift server plugins; therefore, we cannot maintain - a FK constraint on the change set id. And the type cannot be integer because - other back ends like MongoDB use other types that are basically variants of a - UUID - - jsanda - --> - <column name="DRIFT_CHANGE_SET_ID" type="VARCHAR2" size="64" required="false"/> - <column name="CTIME" type="LONG" required="true"/> - - <index name="RHQ_DRIFT_DEF_TEMPLATE_UNIQUE" unique="true"> - <field ref="RESOURCE_TYPE_ID"/> - <field ref="NAME"/> - </index> - </table> - - <!-- Content of a file being managed for drift. Used for diff and/or remediation --> - <table name="RHQ_DRIFT_FILE"> - <column name="HASH_ID" type="VARCHAR2" size="64" primarykey="true" required="true"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="DATA" type="LARGEOBJECT" required="false"/> - <column name="DATA_SIZE" type="LONG" required="false"/> - <column name="STATUS" type="VARCHAR2" size="20" required="true"/> - </table> - - <!-- A single drift definition defining file tracking - Note: A resource or group (todo: group, other?) can have zero or more drift configurations. - Note: The name, interval and is_enabled values are also stored withing the referenced config. - This allows us to use the config editor to manipulate all fields. - Note: Name is read-only - Note: Interval unit is millis - --> - <table name="RHQ_DRIFT_DEFINITION"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="CONFIG_ID" type="INTEGER" required="true" references="RHQ_CONFIG"/> - <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> - <column name="DRIFT_DEF_TEMPLATE_ID" type="INTEGER" required="false" references="RHQ_DRIFT_DEF_TEMPLATE"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="NAME" type="VARCHAR2" size="128" required="true"/> - <column name="DESCRIPTION" type="VARCHAR2" size="512" required="false"/> - <column name="INTERVAL" type="LONG" required="true"/> - <column name="IS_ENABLED" type="BOOLEAN" required="true"/> - <column name="DRIFT_HANDLING_MODE" type="VARCHAR2" size="20" required="true"/> - <column name="IS_PINNED" type="BOOLEAN" required="true"/> - <column name="IS_ATTACHED" type="BOOLEAN" required="true"/> - </table> - - <table name="RHQ_DRIFT_SET"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - </table> - - <!-- A drift change-set report for a resource --> - <table name="RHQ_DRIFT_CHANGE_SET"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="DRIFT_SET_ID" type="INTEGER" required="false" references="RHQ_DRIFT_SET"/> - <column name="CTIME" type="LONG" required="true"/> - <!-- Version 0 is initial change-set --> - <column name="VERSION" type="INTEGER" required="true"/> - <column name="CATEGORY" type="VARCHAR2" size="20" required="true"/> - <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> - <column name="DRIFT_DEFINITION_ID" type="INTEGER" required="false" references="RHQ_DRIFT_DEFINITION"/> - <!-- the drift handling mode at changeset creation time --> - <column name="DRIFT_HANDLING_MODE" type="VARCHAR2" size="20" required="true"/> - </table> - - <!-- A single occurence of drift for a resource --> - <table name="RHQ_DRIFT"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="CATEGORY" type="VARCHAR2" size="20" required="true"/> - <column name="DRIFT_SET_ID" type="INTEGER" required="false" references="RHQ_DRIFT_SET"/> - <column name="DRIFT_CHANGE_SET_ID" type="INTEGER" required="true" references="RHQ_DRIFT_CHANGE_SET"/> - <!-- the file path not including the base directory --> - <column name="PATH" type="VARCHAR2" size="1024" required="true"/> - <!-- the same as PATH less [/]filename.ext. Redundant storage for the purpose of strict directory search. - this field can be considered transient for serialization purposes --> - <column name="PATH_DIRECTORY" type="VARCHAR2" size="1024" required="true"/> - <column name="OLD_DRIFT_FILE" type="VARCHAR2" size="64" required="false" references="RHQ_DRIFT_FILE"/> - <column name="NEW_DRIFT_FILE" type="VARCHAR2" size="64" required="false" references="RHQ_DRIFT_FILE"/> - </table> - - -<!-- END: content-schema.xml --> -<!-- BEGIN: resource-request-schema.xml --> - - - <table name="RHQ_CREATE_RES_HIST"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="PARENT_RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> - <column name="CREATED_RESOURCE_NAME" type="VARCHAR2" size="500" required="false"/> - <column name="NEW_RESOURCE_KEY" type="VARCHAR2" required="false" size="500"/> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> - <column name="CONFIGURATION_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> - <column name="INSTALLED_PACKAGE_ID" type="INTEGER" required="false" references="RHQ_INSTALLED_PACKAGE"/> - </table> - - <table name="RHQ_DELETE_RES_HIST"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> - </table> - -<!-- END: resource-request-schema.xml --> -<!-- BEGIN: jms-schema.xml --> - -<!-- the schema matches that which would be automatically created by the JMS subsystem --> -<!-- see deploy/jms/rhq-jdbc-state-service.xml and rhq-jdbc2-service.xml --> - - - <table name="JMS_MESSAGES"> - <column name="MESSAGEID" required="true" type="INTEGER" /> - <column name="DESTINATION" required="true" type="VARCHAR2" size="255" /> - <column name="TXID" required="false" type="INTEGER" /> - <column name="TXOP" required="false" type="CHAR" size="1" /> - <column name="MESSAGEBLOB" required="false" type="BLOB" /> - - <constraint name="JMS_MESSAGES_PKEY"> - <primaryKey> - <field ref="MESSAGEID"/> - <field ref="DESTINATION"/> - </primaryKey> - </constraint> - - <index name="JMS_MESSAGES_TXOP_TXID"> - <field ref="TXOP"/> - <field ref="TXID"/> - </index> - <index name="JMS_MESSAGES_DESTINATION"> - <field ref="DESTINATION"/> - </index> - </table> - - <table name="JMS_TRANSACTIONS"> - <column name="TXID" required="true" type="INTEGER" primarykey="true" /> - </table> - - <table name="JMS_USERS"> - <column name="USERID" required="true" type="VARCHAR2" size="32" primarykey="true" /> - <column name="PASSWD" required="true" type="VARCHAR2" size="32" /> - <column name="CLIENTID" required="false" type="VARCHAR2" size="128" /> - </table> - - <table name="JMS_ROLES"> - <column name="ROLEID" required="true" type="VARCHAR2" size="32" /> - <column name="USERID" required="true" type="VARCHAR2" size="32" /> - - <constraint name="JMS_ROLES_PKEY"> - <primaryKey> - <field ref="USERID"/> - <field ref="ROLEID"/> - </primaryKey> - </constraint> - </table> - - <table name="JMS_SUBSCRIPTIONS"> - <column name="CLIENTID" required="true" type="VARCHAR2" size="128" /> - <column name="SUBNAME" required="true" type="VARCHAR2" size="128" /> - <column name="TOPIC" required="true" type="VARCHAR2" size="255" /> - <column name="SELECTOR" required="false" type="VARCHAR2" size="255" /> - - <constraint name="JMS_SUBSCRIPTIONS_PKEY"> - <primaryKey> - <field ref="CLIENTID"/> - <field ref="SUBNAME"/> - </primaryKey> - </constraint> - </table> - -<!-- END: jms-schema.xml --> -<!-- BEGIN: obsolete-schema.xml --> - - - <!-- NOTE: The tables will be dropped in the *** REVERSE ORDER *** as listed in this file! --> - <!-- NOTE: So, put the table you want dropped first at the bottom, and so on... --> - - - <!-- !!! REMOVED FROM CONTENT-SCHEMA !!!! --> - - <table name="RHQ_BUNDLE_CONFIG" obsolete="true"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG" /> - <!-- this probably needs a DTYPE discriminator so we know if its a bundle or a specific bundle version --> - <column name="BUNDLE_VERSION_ID" type="INTEGER" required="false" references="RHQ_BUNDLE_VERSION"/> - <column name="BUNDLE_ID" type="INTEGER" required="false" references="RHQ_BUNDLE"/> - </table> - - <table name="RHQ_CHANNEL" obsolete="true"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="CREATION_TIME" type="LONG" required="true"/> - <column name="LAST_MODIFIED_TIME" type="LONG" required="true"/> - - <index name="RHQ_CHANNEL_IDX" unique="true"> - <field ref="NAME"/> - </index> - </table> - - <table name="RHQ_CHANNEL_RESOURCE_MAP" obsolete="true"> - <column name="CHANNEL_ID" type="INTEGER" required="true" references="RHQ_CHANNEL"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> - <column name="CTIME" type="LONG" required="true"/> - - <constraint name="RHQ_CHANNEL_RESOURCE_MAP_KEY"> - <primaryKey> - <field ref="CHANNEL_ID"/> - <field ref="RESOURCE_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_CHANNEL_CONTENT_SRC_MAP" obsolete="true"> - <column name="CHANNEL_ID" type="INTEGER" required="true" references="RHQ_CHANNEL"/> - <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> - <column name="CTIME" type="LONG" required="true"/> - - <constraint name="RHQ_CHAN_CONTENT_SRC_MAP_KEY"> - <primaryKey> - <field ref="CHANNEL_ID"/> - <field ref="CONTENT_SRC_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_CHANNEL_PKG_VERSION_MAP" obsolete="true"> - <column name="CHANNEL_ID" type="INTEGER" required="true" references="RHQ_CHANNEL"/> - <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> - <column name="CTIME" type="LONG" required="true"/> - - <constraint name="RHQ_CHANNEL_PKG_VER_MAP_KEY"> - <primaryKey> - <field ref="CHANNEL_ID"/> - <field ref="PACKAGE_VERSION_ID"/> - </primaryKey> - </constraint> - </table> - - <!-- !!! REMOVED FROM MEASUREMENT-SCHEMA !!!! --> - - <table name="RHQ_MEASUREMENT_OOB" obsolete="true"> - <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> - <column name="SCHEDULE_ID" type="INTEGER" references="RHQ_MEASUREMENT_SCHED(ID)" required="true"/> - <column name="OCCURRED" type="LONG" required="true"/> - <column name="DIFF" type="DOUBLE" required="true"/> - - <index name="RHQ_MEASUREMENT_OOB_IDX" unique="true"> - <field ref="SCHEDULE_ID" /> - <field ref="OCCURRED" /> - </index> - </table> - - - <table name="RHQ_TAG" obsolete="true"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - </table> - - <table name="RHQ_REPO_TAG_MAP" obsolete="true"> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAG"/> - - <constraint name="RHQ_REPO_TAG_MAP_KEY"> - <primaryKey> - <field ref="REPO_ID"/> - <field ref="TAG_ID"/> - </primaryKey> - </constraint> - </table> - - -<!-- END: obsolete-schema.xml --> -</dbsetup> diff --git a/modules/enterprise/gui/installer/src/test/resources/org/rhq/enterprise/installer/db-schema-combined-rhq-4.3.0.xml b/modules/enterprise/gui/installer/src/test/resources/org/rhq/enterprise/installer/db-schema-combined-rhq-4.3.0.xml deleted file mode 100644 index 3fd833f..0000000 --- a/modules/enterprise/gui/installer/src/test/resources/org/rhq/enterprise/installer/db-schema-combined-rhq-4.3.0.xml +++ /dev/null @@ -1,2649 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<dbsetup name="schema"> -<!-- BEGIN: config-schema.xml --> - - - <!-- Definition or Metadata tables --> - - <table name="RHQ_CONFIG_DEF"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="NAME" type="VARCHAR2" required="true" size="100"/> - <column name="DESCRIPTION" type="VARCHAR2" required="false" size="250"/> - <column name="VERSION" type="VARCHAR2" required="false" size="50"/> - <column name="CONFIG_FORMAT" type="VARCHAR2" required="false" size="32"/> - </table> - - <table name="RHQ_CONFIG_PROP_GRP_DEF"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="NAME" type="VARCHAR2" required="true" size="100"/> - <column name="DISPLAY_NAME" type="VARCHAR2" required="false" size="100"/> - <column name="DESCRIPTION" type="VARCHAR2" required="false" size="250"/> - <column name="DEFAULT_HIDDEN" type="BOOLEAN" required="false"/> - <column name="ORDER_INDEX" type="INTEGER" required="false"/> - </table> - - <table name="RHQ_CONFIG_PROP_DEF"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="NAME" type="VARCHAR2" required="false" size="255"/> - <column name="DISPLAY_NAME" type="VARCHAR2" required="false" size="100"/> - <column name="DESCRIPTION" type="VARCHAR2" required="false" size="1000"/> - <column name="DEFAULT_VALUE" type="VARCHAR2" required="false" size="2000"/> - <column name="REQUIRED" type="BOOLEAN" required="false"/> - <column name="READONLY" type="BOOLEAN" required="false"/> - <column name="SUMMARY" type="BOOLEAN" required="false"/> - <column name="ACTIVATION_POLICY" type="VARCHAR2" required="false" size="20"/> - <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_GRP_DEF"/> - <column name="ORDER_INDEX" type="INTEGER" required="false"/> - <column name="VERSION" type="VARCHAR2" required="false" size="50"/> - <column name="PARENT_MAP_DEFINITION_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> - <column name="PARENT_LIST_DEFINITION_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> - <column name="SIMPLE_TYPE" type="VARCHAR2" required="false" size="20"/> - <column name="ALLOW_CUSTOM_ENUM_VALUE" type="BOOLEAN" required="false"/> - <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> - <column name="CONFIG_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_DEF"/> - - <!-- only simple properties (not lists and maps) have this --> - <column name="UNITS" type="SMALLINT" required="false"/> - - <!-- only dynamic properties (not simple) have this --> - <column name="DYNAMIC_TYPE" type="VARCHAR2" size="20" required="false"/> - <column name="DYNAMIC_KEY" type="VARCHAR2" size="128" required="false"/> - </table> - - <table name="RHQ_CONF_PROP_DEF_ENUM"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="STRING_VALUE" type="VARCHAR2" required="false" size="500"/> - <column name="ORDER_INDEX" type="INTEGER" required="false"/> - <column name="NAME" type="VARCHAR2" required="false" size="100"/> - <column name="PROPERTY_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> - </table> - - <table name="RHQ_CONFIG_PD_OSRC"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="LINK_TO_TARGET" type="BOOLEAN" required="false"/> - <column name="FILTER" type="VARCHAR2" required="false" size="40"/> - <column name="EXPRESSION" type="VARCHAR2" required="true" size="400"/> - <column name="TARGET_TYPE" type="VARCHAR2" required="true" size="20"/> - <column name="PROPERTY_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> - </table> - - <table name="RHQ_CONFIG_PROP_CONSTR"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="DTYPE" type="VARCHAR2" required="true" size="15"/> - <column name="DETAILS" type="VARCHAR2" required="false" size="250"/> - <column name="CONFIG_PROP_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> - <column name="ORDER_INDEX" type="INTEGER" required="false"/> - </table> - - - <!-- Content or value tables --> - - <table name="RHQ_CONFIG"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="NOTES" type="VARCHAR2" required="false" size="512"/> - <column name="VERSION" type="VARCHAR2" required="false" size="50"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - </table> - - <table name="RHQ_CONFIG_PROPERTY"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="CONFIGURATION_ID" type="INTEGER" required="false" references="RHQ_CONFIG" ondelete="cascade"/> - <column name="STRING_VALUE" type="VARCHAR2" required="false" size="2000"/> - <column name="OVERRIDE" type="BOOLEAN" required="false"/> - <column name="NAME" type="VARCHAR2" required="true" size="255"/> - <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> - <!-- Recursive cascade path to RHQ_CONFIG_PROPERTY causes constraint creation errors on SQL Server, see - http://support.microsoft.com/kb/321843 --> - <column name="PARENT_LIST_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROPERTY" ondelete="cascade" /> - <column name="PARENT_MAP_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROPERTY" ondelete="cascade" /> - <column name="LIST_INDEX" type="INTEGER"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <index name="RHQ_CONFIG_PROP_idx_prop_key" unique="false"> - <field ref="CONFIGURATION_ID"/> - <field ref="NAME"/> - </index> - <index name="RHQ_CONFIG_PROP_idx_map_key" unique="false"> - <field ref="PARENT_MAP_ID"/> - <field ref="NAME"/> - </index> - <index name="RHQ_CONFIG_PROP_idx_list_key" unique="false"> - <field ref="PARENT_LIST_ID"/> - </index> - <!-- List entries all have the same name --> - </table> - - <table name="RHQ_CONFIG_TEMPLATE"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="NAME" type="VARCHAR2" required="false" size="100"/> - <column name="DESCRIPTION" type="VARCHAR2" required="false" size="500"/> - <column name="CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> - <column name="CONFIG_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_DEF"/> - <column name="IS_DEFAULT" type="BOOLEAN" required="false"/> - </table> - - <table name="RHQ_RAW_CONFIG"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="CONFIG_ID" type="INTEGER" required="true" references="RHQ_CONFIG(ID)"/> - <column name="PATH" type="VARCHAR2" required="false" size="512"/> - <column name="CONTENTS" type="CLOB" required="true"/> - <column name="SHA256" type="VARCHAR2" size="64" required="true"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - </table> - -<!-- END: config-schema.xml --> -<!-- BEGIN: cluster-schema.xml --> - - <table name="RHQ_AFFINITY_GROUP"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" required="true" size="255" type="VARCHAR2"/> - </table> - - <table name="RHQ_SERVER"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" required="true" size="255" type="VARCHAR2"/> - <column name="ADDRESS" required="true" size="255" type="VARCHAR2"/> - <column name="PORT" required="true" type="INTEGER"/> - <column name="SECURE_PORT" required="true" type="INTEGER"/> - <column name="CTIME" required="true" type="LONG"/> - <column name="MTIME" required="true" type="LONG"/> - <column name="AFFINITY_GROUP_ID" type="INTEGER" references="RHQ_AFFINITY_GROUP" required="false"/> - <column name="COMPUTE_POWER" required="true" type="INTEGER"/> - <column name="OPERATION_MODE" required="true" size="32" type="VARCHAR2"/> - <column name="STATUS" type="INTEGER" required="false" default="0" /> - - <!-- This index is for constraint, not performance --> - <index name="RHQ_SERVER_NAME_UNIQUE" unique="true"> - <field ref="NAME"/> - </index> - </table> - - <!-- new agent --> - <table name="RHQ_AGENT"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" required="true" size="255" type="VARCHAR2"/> - <column name="ADDRESS" required="true" size="255" type="VARCHAR2"/> - <column name="PORT" required="true" type="INTEGER"/> - <column name="AGENTTOKEN" required="true" size="100" type="VARCHAR2"/> - <column name="REMOTE_ENDPOINT" required="false" size="4000" type="VARCHAR2"/> - <column name="CTIME" required="true" type="LONG"/> - <column name="MTIME" required="true" type="LONG"/> - <column name="LAST_AVAILABILITY_REPORT" required="false" type="LONG"/> - <column name="AFFINITY_GROUP_ID" type="INTEGER" references="RHQ_AFFINITY_GROUP" required="false"/> - <column name="SERVER_ID" type="INTEGER" references="RHQ_SERVER" required="false"/> - <column name="STATUS" type="INTEGER" required="false" default="0" /> - <column name="BACKFILLED" type="BOOLEAN" required="true" /> - - <index name="RHQ_AGENT_NAME_UNIQUE" unique="true"> - <field ref="NAME"/> - </index> - - <index name="RHQ_AGENT_ADDRESS_PORT" unique="true"> - <field ref="ADDRESS"/> - <field ref="PORT"/> - </index> - - <index name="RHQ_AGENT_TOKEN_UNIQUE" unique="true"> - <field ref="AGENTTOKEN"/> - </index> - </table> - - <table name="RHQ_PARTITION_EVENT"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="SUBJECT_NAME" required="true" size="100" type="VARCHAR2"/> - <column name="CTIME" required="true" type="LONG"/> - <column name="EVENT_TYPE" required="true" size="50" type="VARCHAR2"/> - <column name="EVENT_DETAIL" required="false" size="512" type="VARCHAR2"/> - <column name="EXECUTION_STATUS" required="true" size="32" type="VARCHAR2"/> - </table> - - <table name="RHQ_PARTITION_DETAILS"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="PARTITION_EVENT_ID" type="INTEGER" references="RHQ_PARTITION_EVENT" required="true"/> - <column name="AGENT_NAME" type="VARCHAR2" size="255" required="true"/> - <column name="SERVER_NAME" type="VARCHAR2" size="255" required="true"/> - </table> - - <table name="RHQ_FAILOVER_LIST"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="PARTITION_EVENT_ID" type="INTEGER" references="RHQ_PARTITION_EVENT" required="true"/> - <column name="AGENT_ID" type="INTEGER" references="RHQ_AGENT" required="true"/> - <column name="CTIME" required="true" type="LONG"/> - </table> - - <table name="RHQ_FAILOVER_DETAILS"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="FAILOVER_LIST_ID" type="INTEGER" references="RHQ_FAILOVER_LIST" required="true"/> - <column name="SERVER_ID" type="INTEGER" references="RHQ_SERVER" required="true"/> - <column name="ORDINAL" type = "INTEGER" required="true"/> - </table> - -<!-- END: cluster-schema.xml --> -<!-- BEGIN: auth-schema.xml --> - - - <table name="RHQ_PRINCIPAL"> - - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="PRINCIPAL" required="true" type="VARCHAR2" size="100"/> - <column name="PASSWORD" required="true" type="VARCHAR2" size="64"/> - - <!-- ensure that principals are unique --> - <index name="RHQ_PRINCIPAL_PRINCIPAL_KEY" unique="true"> - <field ref="PRINCIPAL"/> - </index> - - </table> - - <table name="RHQ_SUBJECT"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" required="true" size="100" type="VARCHAR2"/> - <column name="CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG"/> - <column name="FIRST_NAME" required="false" size="100" type="VARCHAR2"/> - <column name="LAST_NAME" required="false" size="100" type="VARCHAR2"/> - <column name="EMAIL_ADDRESS" size="100" type="VARCHAR2"/> - <column name="SMS_ADDRESS" size="100" type="VARCHAR2"/> - <column name="PHONE_NUMBER" size="100" type="VARCHAR2"/> - <column name="DEPARTMENT" size="100" type="VARCHAR2"/> - <column name="FACTIVE" required="true" type="BOOLEAN" default="true"/> - <column name="FSYSTEM" required="true" type="BOOLEAN" default="false"/> - - <index name="RHQ_SUBJECT_AUTH_KEY" unique="true"> - <field ref="NAME"/> - </index> - </table> - -<!-- END: auth-schema.xml --> -<!-- BEGIN: inventory-schema.xml --> - - - <!-- NEW RESOURCE TYPES --> - <table name="RHQ_RESOURCE_TYPE"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" type="VARCHAR2" size="100" required="true"/> - <column name="CATEGORY" type="VARCHAR2" size="16" required="true"/> - <column name="CREATION_DATA_TYPE" type="VARCHAR2" size="16" required="true"/> - <column name="CREATE_DELETE_POLICY" type="VARCHAR2" size="16" required="true"/> - <column name="SINGLETON" type="BOOLEAN" required="true"/> - <column name="SUPPORTS_MANUAL_ADD" type="BOOLEAN" required="true"/> - <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> - <column name="PLUGIN" type="VARCHAR2" size="100"/> - <column name="CTIME" type="LONG"/> - <column name="MTIME" type="LONG"/> - <column name="DELETED" type="BOOLEAN" default="FALSE" required="TRUE"/> - <column name="SUBCATEGORY_ID" type="INTEGER"/> - <!-- - TODO add support to DB setup for tables with circular dependencies and then add back this RI - <column name="SUBCATEGORY_ID" type="INTEGER" references="RHQ_RESOURCE_SUBCAT" /> - --> - <column name="PLUGIN_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> - <column name="RES_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> - <column name="BUNDLE_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG"/> - - <index name="RHQ_RES_TYPE_IDX_PLG_NAME" unique="true"> - <field ref="NAME"/> - <field ref="PLUGIN"/> - </index> - </table> - - <!-- NEW RESOURCE SUBCATEGORIES --> - <table name="RHQ_RESOURCE_SUBCAT"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" type="VARCHAR2" size="100"/> - <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> - <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> - <column name="CTIME" type="LONG"/> - <column name="MTIME" type="LONG"/> - <column name="PARENT_SUBCATEGORY_ID" type="INTEGER" references="RHQ_RESOURCE_SUBCAT"/> - <!-- resourceTypeId is not required on child sub categories --> - <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> - </table> - - <!-- Many To Many mapping for resource type to its parents --> - <table name="RHQ_RESOURCE_TYPE_PARENTS"> - <column name="RESOURCE_TYPE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> - <column name="PARENT_RESOURCE_TYPE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> - - <!-- not using full words to fit index name length --> - <constraint name="RHQ_RES_TYPE_PARENTS_KEY"> - <primaryKey> - <field ref="RESOURCE_TYPE_ID"/> - <field ref="PARENT_RESOURCE_TYPE_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_PROCESS_SCAN"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="QUERY" type="VARCHAR2" size="256" required="true"/> - <column name="NAME" type="VARCHAR2" size="100" required="false"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> - - <index name="RHQ_PROCESS_SCAN_QUERY_INDEX" unique="true"> - <field ref="QUERY"/> - <field ref="RESOURCE_TYPE_ID"/> - </index> - </table> - - <table name="RHQ_PRD_VER"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="VERSION" type="VARCHAR2" size="100" required="true"/> - <column name="RES_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> - </table> - - <table name="RHQ_RESOURCE"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> - <column name="UUID" type="CHAR" size="36" required="true"/> - <column name="NAME" type="VARCHAR2" size="500"/> - <!-- ancestry holds the full parental ancestry, used for disambiguation --> - <column name="ANCESTRY" type="VARCHAR2" required="false" size="4000"/> - <column name="RESOURCE_KEY" type="VARCHAR2" required="true" size="500"/> - <column name="AGENT_ID" required="false" type="INTEGER" references="RHQ_AGENT(id)"/> - <column name="INVENTORY_STATUS" type="VARCHAR2" size="20"/> - <column name="CONNECTED" type="BOOLEAN"/> - <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> - <column name="VERSION" type="VARCHAR2" size="100"/> - <column name="CTIME" type="LONG"/> - <column name="MTIME" type="LONG"/> - <column name="ITIME" type="LONG"/> - <column name="RES_CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG"/> - <column name="PLUGIN_CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG"/> - <column name="MODIFIED_BY" required="false" size="100" type="VARCHAR2"/> - <column name="LOCATION" required="false" size="100" type="VARCHAR2"/> - <column name="PARENT_RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE"/> - <column name="PRODUCT_VERSION_ID" type="INTEGER" references="RHQ_PRD_VER"/> - - <index name="RHQ_RESOURCE_idx_key"> - <field ref="RESOURCE_KEY"/> - </index> - - <index name="RHQ_RESOURCE_idx_type"> - <field ref="RESOURCE_TYPE_ID"/> - </index> - - <index name="RHQ_RESOURCE_idx_agent"> - <field ref="AGENT_ID"/> - </index> - - <index name="RHQ_RESOURCE_idx_parent"> - <field ref="PARENT_RESOURCE_ID"/> - </index> - - </table> - - <table name="RHQ_RESOURCE_ERROR"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> - <column name="TIME_OCCURRED" type="LONG" required="true"/> - <column name="ERROR_TYPE" type="VARCHAR2" required="true" size="32"/> - <column name="SUMMARY" type="VARCHAR2" required="true" size="1000"/> - <column name="DETAIL" type="LONGVARCHAR" required="false"/> - - <index name="RHQ_RES_ERROR_IDX_RES_ID"> - <field ref="RESOURCE_ID"/> - </index> - </table> - - <table name="RHQ_GROUP_DEF"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" required="true" size="100" type="VARCHAR2"/> - <column name="DESCRIPTION" size="100" type="VARCHAR2"/> - <column name="CTIME" type="LONG"/> - <column name="MTIME" type="LONG"/> - <column name="CALC_TIME" type="LONG"/> - <column name="CALC_INTERVAL" type="LONG"/> - <column name="RECURSIVE" type="BOOLEAN"/> - <column name="EXPRESSION" type="VARCHAR2" size="1000"/> - - <index name="RHQ_GROUP_DEF_NAME" unique="true"> - <field ref="NAME"/> - </index> - </table> - - <table name="RHQ_RESOURCE_GROUP"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <!-- this name can be longer than the size of the GROUP_BY column, which is used to uniquely identify it --> - <!-- Max bytes for Oracle Varchar2 to accommodate large cluster keys --> - <column name="NAME" required="true" size="4000" type="VARCHAR2"/> - <column name="DESCRIPTION" size="100" type="VARCHAR2"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> - <!-- Compatible groups only --> - <column name="CTIME" type="LONG"/> - <column name="MTIME" type="LONG"/> - <column name="MODIFIED_BY" required="false" size="100" type="VARCHAR2"/> - <column name="RECURSIVE" type="BOOLEAN"/> - - <column name="GROUP_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_GROUP_DEF"/> - <column name="GROUP_BY" size="500" type="VARCHAR2"/> - - <column name="CATEGORY" type="VARCHAR2" size="20" required="true"/> - - <!-- This is only set if this is a subject-owned group (like an autogroup) --> - <column name="SUBJECT_ID" type="INTEGER" references="RHQ_SUBJECT"/> - - <!-- These two only set if this is a backing group for a resource auto-cluster --> - <column name="CLUSTER_KEY" type="VARCHAR2" size="4000" required="false"/> - <column name="CLUSTER_RESOURCE_GROUP_ID" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> - - <!-- This is only set if this is a backing group for a resource auto-group --> - <column name="AUTO_GROUP_PARENT_RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE"/> - - <column name="VISIBLE" type="BOOLEAN"/> - - <index name="RHQ_RES_GROUP_NAME" unique="false"> - <field ref="NAME"/> - </index> - </table> - - <!-- Many To Many mapping for groups to implicit resources --> - <table name="RHQ_RESOURCE_GROUP_RES_IMP_MAP"> - <column name="RESOURCE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE"/> - <column name="RESOURCE_GROUP_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> - - <!-- not using full words to fit index name length --> - <constraint name="RHQ_RES_GROUP_RES_IMP_MAP_KEY"> - <primaryKey> - <field ref="RESOURCE_ID"/> - <field ref="RESOURCE_GROUP_ID"/> - </primaryKey> - </constraint> - </table> - - <!-- Many To Many mapping for groups to explicit resources --> - <table name="RHQ_RESOURCE_GROUP_RES_EXP_MAP"> - <column name="RESOURCE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE"/> - <column name="RESOURCE_GROUP_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> - - <!-- not using full words to fit index name length --> - <constraint name="RHQ_RES_GROUP_RES_EXP_MAP_KEY"> - <primaryKey> - <field ref="RESOURCE_ID"/> - <field ref="RESOURCE_GROUP_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_CONFIG_GROUP_UPDATE"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="GROUP_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_GROUP"/> - <column name="CONFIGURATION_ID" type="INTEGER" required="true" references="RHQ_CONFIG"/> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="SUBJECT_NAME" type="VARCHAR2" required="false" size="100"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> - </table> - - <table name="RHQ_CONFIG_UPDATE"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="CONFIGURATION_ID" type="INTEGER" required="true" references="RHQ_CONFIG" ondelete="cascade"/> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="SUBJECT_NAME" type="VARCHAR2" required="false" size="100"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="CONFIG_RES_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> - <column name="PLUGIN_CONFIG_RES_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> - <column name="AGG_RES_UPDATE_ID" type="INTEGER" required="false" references="RHQ_CONFIG_GROUP_UPDATE"/> - <column name="AGG_PLUGIN_UPDATE_ID" type="INTEGER" required="false" references="RHQ_CONFIG_GROUP_UPDATE"/> - <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> - </table> - - - <table name="RHQ_TAGGING"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="NAMESPACE" type="VARCHAR2" required="false" size="20"/> - <column name="SEMANTIC" type="VARCHAR2" required="false" size="50"/> - <column name="NAME" type="VARCHAR2" required="true" size="100"/> - </table> - - <table name="RHQ_TAGGING_RESOURCE_MAP"> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> - <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> - <constraint name="RHQ_TAGGING_RESOURCE_MAP_KEY"> - <primaryKey> - <field ref="RESOURCE_ID"/> - <field ref="TAG_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_TAGGING_RES_GROUP_MAP"> - <column name="RESOURCE_GROUP_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_GROUP"/> - <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> - <constraint name="RHQ_TAGGING_RES_GROUP_MAP_KEY"> - <primaryKey> - <field ref="RESOURCE_GROUP_ID"/> - <field ref="TAG_ID"/> - </primaryKey> - </constraint> - </table> - -<!-- END: inventory-schema.xml --> -<!-- BEGIN: authz-schema.xml --> - - - <table name="RHQ_ROLE"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" required="true" size="100" type="VARCHAR2"/> - <column name="DESCRIPTION" size="100" type="VARCHAR2"/> - <column name="FSYSTEM" type="BOOLEAN" default="false"/> - - <index name="RHQ_ROLE_NAME_KEY" unique="true"> - <field ref="NAME"/> - </index> - </table> - - <table name="RHQ_ROLE_RESOURCE_GROUP_MAP"> - <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> - <column name="RESOURCE_GROUP_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> - - <constraint name="RHQ_ROLE_RES_GROUP_MAP_KEY"> - <primaryKey> - <field ref="ROLE_ID"/> - <field ref="RESOURCE_GROUP_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_ROLE_LDAP_GROUP"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> - <column name="LDAP_GROUP_NAME" size="128" required="true" type="VARCHAR2"/> - - <index name="RHQ_ROLE_LDAP_GROUP_IDX" unique="true"> - <field ref="ROLE_ID"/> - <field ref="LDAP_GROUP_NAME"/> - </index> - </table> - - <table name="RHQ_PERMISSION"> - <column name="ROLE_ID" type="INTEGER" references="RHQ_ROLE" required="true"/> - <column name="OPERATION" type="INTEGER" required="true"/> - <constraint name="RHQ_PERMISSION_PK"> - <primaryKey> - <field ref="ROLE_ID"/> - <field ref="OPERATION"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_SUBJECT_ROLE_MAP"> - <column name="SUBJECT_ID" required="true" type="INTEGER" references="RHQ_SUBJECT"/> - <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> - - <constraint name="RHQ_SUBJECT_ROLE_MAPPING_KEY"> - <primaryKey> - <field ref="SUBJECT_ID"/> - <field ref="ROLE_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_SUBJECT_ROLE_LDAP_MAP"> - <column name="SUBJECT_ID" required="true" type="INTEGER" references="RHQ_SUBJECT"/> - <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> - <constraint name="RHQ_SUBJECT_ROLE_LDAP_MAP_PK"> - <primaryKey> - <field ref="SUBJECT_ID" /> - <field ref="ROLE_ID"/> - </primaryKey> - </constraint> - </table> -<!-- END: authz-schema.xml --> -<!-- BEGIN: search-schema.xml --> - - - <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="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="GLOBAL" type="BOOLEAN" required="true"/> - </table> - -<!-- END: search-schema.xml --> -<!-- BEGIN: dashboard-schema.xml --> - - - - <table name="RHQ_DASHBOARD"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" type="VARCHAR2" size="200" required="true"/> - <column name="SUBJECT_ID" type="INTEGER" required="true" references="RHQ_SUBJECT"/> - <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> - <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_RESOURCE_GROUP"/> - <column name="CATEGORY" type="VARCHAR2" size="20" required="true"/> - <column name="SHARED" type="BOOLEAN" required="true"/> - <column name="CONFIGURATION_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> - </table> - - - <table name="RHQ_DASHBOARD_PORTLET"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" type="VARCHAR2" size="200" required="true"/> - <column name="PORTLET_KEY" type="VARCHAR2" size="200" required="true"/> - <column name="COL" type="INTEGER" required="true"/> - <column name="COL_INDEX" type="INTEGER" required="true"/> - <column name="HEIGHT" type="INTEGER" required="true"/> - <column name="CONFIGURATION_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> - <column name="DASHBOARD_ID" type="INTEGER" required="false" references="RHQ_DASHBOARD"/> - </table> - -<!-- END: dashboard-schema.xml --> -<!-- BEGIN: operation-schema.xml --> - - - <table name="RHQ_OPERATION_DEF"> - - <!-- === required columns === --> - - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE(ID)"/> - <column name="NAME" type="VARCHAR2" required="true" size="100"/> - - <!-- === optional columns === --> - - <!-- an OSGI version range - if null, the operation def applies to all versions of the associated resource type --> - <column name="RESOURCE_VERSION_RANGE" type="VARCHAR2" size="100"/> - - <!-- A parameter config definition is only required for operations that have parameters. --> - <!-- A results config definition is only required for operations that return data. --> - <column name="PARAMETER_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> - <column name="RESULTS_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> - <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> - <column name="DESCRIPTION" type="VARCHAR2" size="4000"/> - <column name="TIMEOUT" type="INTEGER"/> - - <!-- === business key (RESOURCE_TYPE_ID + NAME) === --> - <index name="RHQ_OPERATION_DEF_KEY_IDX" unique="true"> - <field ref="RESOURCE_TYPE_ID"/> - <field ref="NAME"/> - </index> - - </table> - - <table name="RHQ_OPERATION_HISTORY"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="DTYPE" type="VARCHAR2" required="true" size="8"/> - <column name="JOB_NAME" type="VARCHAR2" required="true" size="100"/> - <column name="JOB_GROUP" type="VARCHAR2" required="true" size="100"/> - <column name="OPERATION_DEF_ID" type="INTEGER" required="true" references="RHQ_OPERATION_DEF"/> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="STIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="PARAMETERS_CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> - - <!-- for resource history --> - <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> - <column name="RESULTS_CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> - <column name="GROUP_HISTORY_ID" type="INTEGER" required="false" references="RHQ_OPERATION_HISTORY"/> - - <!-- for group history --> - <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_RESOURCE_GROUP"/> - - <index name="RHQ_OPERATION_HISTORY_JOB_IDX" unique="true"> - <field ref="JOB_NAME"/> - <field ref="JOB_GROUP"/> - <field ref="CTIME"/> - </index> - - </table> - - <!-- - This table is really just to support some specific use-cases. - Specifically, to be able to get a list of histories for a specific schedule (aka quartz job) - and to be able to query a list of all schedules along with their associated resource/group IDs - possibly sorted by their next fire time. - Note that a NULL next fire time means it won't fire again and the row is probaby about to be deleted; - we can probably not even insert rows with NULL and make it a non-nullable field. But rather than - code special conditions into the session bean, we'll allow a short-lived NULL next fire time row. - --> - <table name="RHQ_OPERATION_SCHEDULE"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - - <column name="JOB_NAME" type="VARCHAR2" required="true" size="100"/> - <column name="JOB_GROUP" type="VARCHAR2" required="true" size="100"/> - <column name="DTYPE" type="VARCHAR2" required="true" size="8"/> - <column name="NEXT_FIRE_TIME" type="LONG" required="false"/> - - <!-- for resource history --> - <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> - - <!-- for group history --> - <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_RESOURCE_GROUP"/> - - <!-- - Note, this is the same as the primary key that Quartz uses for its schedules (RHQ_QRTZ_JOB_DETAILS). - We do not need to add DTYPE to the key, because we ensure the name/group are unique across resource/group - schedules - --> - <!-- === business key (JOB_NAME + JOB_GROUP) === --> - <index name="RHQ_OPERATION_SCHEDULE_KEY_IDX" unique="true"> - <field ref="JOB_NAME"/> - <field ref="JOB_GROUP"/> - </index> - </table> - -<!-- END: operation-schema.xml --> -<!-- BEGIN: event-schema.xml --> - - - <!-- metadata --> - - <table name="RHQ_EVENT_DEF"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE(ID)"/> - - <column name="NAME" type="VARCHAR2" size="100" required="true"/> - <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> - <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> - - <index name="RHQ_EVENT_DEF_IDX" unique="true"> - <field ref="RESOURCE_TYPE_ID"/> - <field ref="NAME"/> - </index> - </table> - - <!-- instance data --> - - <table name="RHQ_EVENT_SOURCE"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="EVENT_DEF_ID" type="INTEGER" required="true" references="RHQ_EVENT_DEF(ID)"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE(ID)"/> - - <column name="LOCATION" required="true" size="2000" type="VARCHAR2"/> - - <index name="RHQ_EVENT_SOURCE_IDX" unique="true"> - <field ref="EVENT_DEF_ID"/> - <field ref="RESOURCE_ID"/> - <field ref="LOCATION"/> - </index> - </table> - - <table name="RHQ_EVENT"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="EVENT_SOURCE_ID" type="INTEGER" required="true" references="RHQ_EVENT_SOURCE(ID)"/> - - <column name="TIMESTAMP" required="true" type="LONG"/> - <column name="SEVERITY" required="true" size="20" type="VARCHAR2"/> - <column name="DETAIL" required="true" size="4000" type="VARCHAR2"/> - <index name="RHQ_EVENT_IDX" unique="false"> - <field ref="EVENT_SOURCE_ID"/> - <field ref="TIMESTAMP"/> - </index> - </table> - -<!-- END: event-schema.xml --> -<!-- BEGIN: alert-schema.xml --> - - - <table name="RHQ_ALERT_DEFINITION"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" required="true" size="100" type="VARCHAR2"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="PARENT_ID" type="INTEGER" required="false"/> - <column name="GROUP_ALERT_DEF_ID" type="INTEGER" required="false"/> - <column name="DESCRIPTION" required="false" size="250" type="VARCHAR2"/> - <column name="PRIORITY" type="VARCHAR2" size="15" required="true"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE" required="false"/> - <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE" required="false"/> - <column name="RESOURCE_GROUP_ID" type="INTEGER" references="RHQ_RESOURCE_GROUP" required="false"/> - <column name="ENABLED" required="true" default="TRUE" type="BOOLEAN"/> - - <column name="REQUIRED" required="true" type="SMALLINT"/> - - <column name="RECOVERY_ID" type="INTEGER" required="true"/> - <!-- required, but 0 effectively means null --> - <column name="WILL_RECOVER" required="true" default="false" type="BOOLEAN"/> - <column name="NOTIFY_FILTERED" required="true" default="false" type="BOOLEAN"/> - <column name="CONTROL_FILTERED" required="true" default="FALSE" type="BOOLEAN"/> - - <column name="DELETED" required="true" default="FALSE" type="BOOLEAN"/> - <column name="READ_ONLY" required="true" default="FALSE" type="BOOLEAN"/> - - <column name="DAMPENING_CATEGORY" type="SMALLINT" required="true"/> - <column name="DAMPENING_VALUE" type="INTEGER"/> - <column name="DAMPENING_VALUE_UNITS" type="SMALLINT"/> - <column name="DAMPENING_PERIOD" type="INTEGER"/> - <column name="DAMPENING_PERIOD_UNITS" type="SMALLINT"/> - </table> - - <table name="RHQ_ALERT_DAMPEN_EVENT"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> - <column name="EVENT_TYPE" required="true" type="SMALLINT"/> - <column name="EVENT_TIMESTAMP" required="true" type="LONG"/> - - <index name="RHQ_DAMPENING_EVENT_TYPE_IDX"> - <field ref="EVENT_TYPE"/> - </index> - <index name="RHQ_DAMPENING_EVENT_TS_IDX"> - <field ref="EVENT_TIMESTAMP"/> - </index> - </table> - - <table name="RHQ_ALERT_CONDITION"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="TYPE" required="true" type="VARCHAR2" size="15"/> - <!-- - <column name="REQUIRED" required="true" type="BOOLEAN"/> - --> - <column name="MEASUREMENT_DEFINITION_ID" required="false" type="INTEGER"/> - <column name="NAME" required="false" size="100" type="VARCHAR2"/> - <column name="COMPARATOR" required="false" size="2" type="VARCHAR2"/> - <column name="THRESHOLD" required="false" type="DOUBLE"/> - <!-- event-based conditions use OPTION_STATUS for the string match, so should be a decent length --> - <column name="OPTION_STATUS" required="false" size="256" type="VARCHAR2"/> - <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> - <column name="TRIGGER_ID" required="false" type="INTEGER"/> - </table> - - <table name="RHQ_ALERT" tablespace="DEFAULT" - storage-options="freelists 5" cache="true" logging="false"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> - <column name="CTIME" required="true" type="LONG"/> - <column name="RECOVERY_ID" type="INTEGER" required="true"/> - <!-- required, but 0 effectively means null --> - <column name="WILL_RECOVER" required="true" default="false" type="BOOLEAN"/> - <column name="ACK_TIME" required="false" type="LONG"/> - <column name="ACK_SUBJECT" required="false" size="100" type="VARCHAR2"/> - <index name="RHQ_ALERT_IDX_TIME" unique="false"> - <field ref="CTIME"/> - </index> - <index name="RHQ_ALERT_IDX_ALERTDEF" unique="false"> - <field ref="ALERT_DEFINITION_ID"/> - </index> - </table> - - <table name="RHQ_ALERT_NOTIF_LOG" tablespace="DEFAULT" - storage-options="freelists 5" cache="true" logging="false"> - <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="false"> - <field ref="ALERT_ID"/> - </index> - <column name="SENDER" required="false" size="100" type="VARCHAR2"/> - <column name="RESULT_STATE" required="false" size="20" type="VARCHAR2"/> - <column name="MESSAGE" required="false" size="4000" type="VARCHAR2"/> - </table> - - <table name="RHQ_ALERT_CONDITION_LOG" tablespace="DEFAULT" - storage-options="freelists 5" cache="true" logging="false"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="CTIME" required="true" type="LONG"/> - <column name="ALERT_ID" required="false" type="INTEGER" references="RHQ_ALERT(ID)"/> - <column name="CONDITION_ID" required="true" type="INTEGER" references="RHQ_ALERT_CONDITION(ID)"/> - <column name="VALUE" required="true" size="250" type="VARCHAR2"/> - <index name="RHQ_ALERT_COND_LOG_IDX_TIME"> - <field ref="CTIME" /> - </index> - <index name="RHQ_ALERT_COND_LOG_IDX_ALERT"> - <field ref="ALERT_ID"/> - </index> - <index name="RHQ_ALERT_COND_LOG_COND_IDX"> - <field ref="CONDITION_ID"/> - </index> - </table> - - <table name="RHQ_ALERT_NOTIFICATION" tablespace="DEFAULT" - storage-options="freelists 5" cache="true" logging="false"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> - <column name="SENDER_CONFIG_ID" required="false" type="INTEGER" references="RHQ_CONFIG(ID)"/> - <column name="EXTRA_CONFIG_ID" required="false" type="INTEGER" references="RHQ_CONFIG(ID)"/> - <column name="SENDER_NAME" required="true" size="100" type="VARCHAR2" /> - </table> - -<!-- END: alert-schema.xml --> -<!-- BEGIN: sysconfig-schema.xml --> - - - <table name="RHQ_SYSTEM_CONFIG"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="PROPERTY_KEY" type="VARCHAR2" size="80"/> - <column name="PROPERTY_VALUE" type="VARCHAR2" size="300"/> - <column name="DEFAULT_PROPERTY_VALUE" type="VARCHAR2" size="300"/> - <column name="FREAD_ONLY" type="BOOLEAN" default="FALSE"/> - - <index name="RHQ_SYSTEM_CONFIG_KEY_INDX" unique="true"> - <field ref="PROPERTY_KEY"/> - </index> - </table> - -<!-- END: sysconfig-schema.xml --> -<!-- BEGIN: scheduler-schema.xml --> - - - <table name="RHQ_QRTZ_JOB_DETAILS"> - <column name="JOB_NAME" required="true" type="VARCHAR2" size="80"/> - <column name="JOB_GROUP" required="true" type="VARCHAR2" size="80"/> - <column name="DESCRIPTION" required="false" type="VARCHAR2" size="120"/> - <column name="JOB_CLASS_NAME" required="true" type="VARCHAR2" size="128"/> - <column name="IS_DURABLE" required="true" type="BOOLEAN" default="FALSE"/> - <column name="IS_VOLATILE" required="true" type="BOOLEAN"/> - <column name="IS_STATEFUL" required="true" type="BOOLEAN" default="FALSE"/> - <column name="REQUESTS_RECOVERY" required="true" type="BOOLEAN" default="FALSE"/> - <column name="JOB_DATA" required="false" type="BLOB"/> - - <constraint name="RHQ_PK_QRTZ_JOB_DETAILS"> - <primaryKey> - <field ref="JOB_NAME"/> - <field ref="JOB_GROUP"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_QRTZ_JOB_LISTENERS"> - <column name="JOB_NAME" required="true" type="VARCHAR2" size="80"/> - <column name="JOB_GROUP" required="true" type="VARCHAR2" size="80"/> - <column name="JOB_LISTENER" required="true" type="VARCHAR2" size="80"/> - - <constraint name="RHQ_PK_QRTZ_JOB_LISTENERS"> - <primaryKey> - <field ref="JOB_NAME"/> - <field ref="JOB_GROUP"/> - <field ref="JOB_LISTENER"/> - </primaryKey> - </constraint> - <constraint name="RHQ_FK_QRTZ_JOB_LSTNRS_JN_JG"> - <foreignKey local="JOB_NAME,JOB_GROUP" - references="RHQ_QRTZ_JOB_DETAILS(JOB_NAME,JOB_GROUP)" - ondelete="cascade"/> - </constraint> - </table> - - <table name="RHQ_QRTZ_TRIGGERS"> - <column name="TRIGGER_NAME" type="VARCHAR2" required="true" size="80"/> - <column name="TRIGGER_GROUP" type="VARCHAR2" required="true" size="80"/> - <column name="JOB_NAME" type="VARCHAR2" required="true" size="80"/> - <column name="JOB_GROUP" type="VARCHAR2" required="true" size="80"/> - <column name="IS_VOLATILE" type="BOOLEAN" required="true"/> - <column name="DESCRIPTION" type="VARCHAR2" required="false" size="120"/> - <column name="NEXT_FIRE_TIME" type="LONG" required="false"/> - <column name="PREV_FIRE_TIME" type="LONG" required="false"/> - <column name="PRIORITY" type="INTEGER" required="false"/> - <column name="TRIGGER_STATE" type="VARCHAR" required="true" size="16"/> - <column name="TRIGGER_TYPE" type="VARCHAR" required="true" size="8"/> - <column name="START_TIME" type="LONG" required="true"/> - <column name="END_TIME" type="LONG" required="false"/> - <column name="CALENDAR_NAME" type="VARCHAR2" required="false" size="80"/> - <column name="MISFIRE_INSTR" type="INTEGER" required="false"/> - <column name="JOB_DATA" type="BLOB" required="false"/> - - <constraint name="RHQ_PK_QRTZ_TRIGGERS"> - <primaryKey> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </primaryKey> - </constraint> - <constraint name="RHQ_FK_QRTZ_TRIGGERS_JN_JG"> - <foreignKey local="JOB_NAME,JOB_GROUP" - references="RHQ_QRTZ_JOB_DETAILS(JOB_NAME,JOB_GROUP)" - ondelete="cascade"/> - </constraint> - - <!-- Quartz docs recommend these indexes. --> - <index name="RHQ_QRTZ_TRIGGERS_JN_JG_IDX"> - <field ref="JOB_NAME"/> - <field ref="JOB_GROUP"/> - </index> - <index name="RHQ_QRTZ_TRIGGERS_NFT_IDX"> - <field ref="NEXT_FIRE_TIME"/> - </index> - <index name="RHQ_QRTZ_TRIGGERS_TS_IDX"> - <field ref="TRIGGER_STATE"/> - </index> - <index name="RHQ_QRTZ_TRIGGERS_TS_NFT_IDX"> - <field ref="TRIGGER_STATE"/> - <field ref="NEXT_FIRE_TIME"/> - </index> - - </table> - - <table name="RHQ_QRTZ_SIMPLE_TRIGGERS"> - <column name="TRIGGER_NAME" type="VARCHAR2" required="true" size="80"/> - <column name="TRIGGER_GROUP" type="VARCHAR2" required="true" size="80"/> - <column name="REPEAT_COUNT" type="LONG" required="true"/> - <column name="REPEAT_INTERVAL" type="LONG" required="true"/> - <column name="TIMES_TRIGGERED" type="LONG" required="true"/> - - <constraint name="RHQ_PK_QRTZ_SIMPLE_TRIGGERS"> - <primaryKey> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </primaryKey> - </constraint> - <constraint name="RHQ_FK_QRTZ_SIMPLE_TRGRS_TN_TG"> - <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" - references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" - ondelete="cascade"/> - </constraint> - - <!-- Quartz docs recommend this index. --> - <!-- Commenting out, because Oracle auto-creates an index for the - primary key column(s) and fails if you try to create another - index for the same column(s) (ips, 03/29/07). - --> - <!-- - <index name="RHQ_QRTZ_SIMPLE_TRGRS_TN_TG_IDX"> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </index> - --> - </table> - - <table name="RHQ_QRTZ_CRON_TRIGGERS"> - <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> - <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> - <column name="CRON_EXPRESSION" type="VARCHAR2" size="80" required="true"/> - <column name="TIME_ZONE_ID" type="VARCHAR2" size="80" required="false"/> - - <constraint name="RHQ_PK_QRTZ_CRON_TRIGGERS"> - <primaryKey> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </primaryKey> - </constraint> - <constraint name="RHQ_FK_QRTZ_CRON_TRIG_TN_TG"> - <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" - references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" - ondelete="cascade"/> - </constraint> - - <!-- Quartz docs recommend this index. --> - <!-- Commenting out, because Oracle auto-creates an index for the - primary key column(s) and fails if you try to create another - index for the same column(s) (ips, 03/29/07). - --> - <!-- - <index name="RHQ_QRTZ_CRON_TRGRS_TN_TG_IDX"> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </index> - --> - </table> - - <table name="RHQ_QRTZ_BLOB_TRIGGERS"> - <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> - <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> - <column name="BLOB_DATA" type="BLOB" required="false"/> - - <constraint name="RHQ_PK_QRTZ_BLOB_TRIGGERS"> - <primaryKey> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </primaryKey> - </constraint> - <constraint name="RHQ_FK_QRTZ_BLOB_TRIGG_TN_TG"> - <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" - references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" - ondelete="cascade"/> - </constraint> - - <!-- Quartz docs recommend this index. --> - <!-- Commenting out, because Oracle auto-creates an index for the - primary key column(s) and fails if you try to create another - index for the same column(s) (ips, 03/29/07). - --> - <!-- - <index name="RHQ_QRTZ_BLOB_TRGRS_TN_TG_IDX"> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </index> - --> - </table> - - <table name="RHQ_QRTZ_TRIGGER_LISTENERS"> - <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> - <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> - <column name="TRIGGER_LISTENER" type="VARCHAR2" size="80" required="true"/> - - <constraint name="RHQ_PK_QRTZ_TRIGGER_LISTENERS"> - <primaryKey> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - <field ref="TRIGGER_LISTENER"/> - </primaryKey> - </constraint> - <constraint name="RHQ_FK_QRTZ_TRGR_LSTNRS_TN_TG"> - <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" - references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" - ondelete="cascade"/> - </constraint> - - <!-- Quartz docs recommend this index. --> - <index name="RHQ_QRTZ_TRGR_LSTNRS_TN_TG_IDX"> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </index> - - </table> - - <table name="RHQ_QRTZ_FIRED_TRIGGERS"> - <column name="ENTRY_ID" primarykey="true" type="VARCHAR2" size="95" required="true"/> - <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> - <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> - <column name="INSTANCE_NAME" type="VARCHAR2" size="80" required="true"/> - <column name="FIRED_TIME" type="LONG" required="true"/> - <column name="PRIORITY" type="INTEGER" required="false"/> - <column name="STATE" type="VARCHAR2" size="16" required="true"/> - <column name="IS_VOLATILE" type="BOOLEAN" required="true"/> - <column name="JOB_NAME" type="VARCHAR2" size="80" required="false"/> - <column name="JOB_GROUP" type="VARCHAR2" size="80" required="false"/> - <column name="IS_STATEFUL" type="BOOLEAN" required="false"/> - <column name="REQUESTS_RECOVERY" type="BOOLEAN" required="false"/> - - <!-- Quartz docs recommend these indexes. --> - <index name="RHQ_QRTZ_FIRED_TRGRS_TN_IDX"> - <field ref="TRIGGER_NAME"/> - </index> - <index name="RHQ_QRTZ_FIRED_TRGRS_TG_IDX"> - <field ref="TRIGGER_GROUP"/> - </index> - <index name="RHQ_QRTZ_FIRED_TRGRS_TN_TG_IDX"> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </index> - <index name="RHQ_QRTZ_FIRED_TRGRS_IN_IDX"> - <field ref="INSTANCE_NAME"/> - </index> - <index name="RHQ_QRTZ_FIRED_TRGRS_JN_IDX"> - <field ref="JOB_NAME"/> - </index> - <index name="RHQ_QRTZ_FIRED_TRGRS_JG_IDX"> - <field ref="JOB_GROUP"/> - </index> - - </table> - - <table name="RHQ_QRTZ_CALENDARS"> - <column name="CALENDAR_NAME" primarykey="true" type="VARCHAR2" size="80" required="true"/> - <column name="CALENDAR" type="BLOB" required="true"/> - </table> - - <table name="RHQ_QRTZ_PAUSED_TRIGGER_GRPS"> - <column name="TRIGGER_GROUP" primarykey="true" type="VARCHAR2" size="80" required="true"/> - </table> - - <table name="RHQ_QRTZ_SCHEDULER_STATE"> - <column name="INSTANCE_NAME" primarykey="true" type="VARCHAR2" size="80" required="true"/> - <column name="LAST_CHECKIN_TIME" type="LONG" required="true"/> - <column name="CHECKIN_INTERVAL" type="LONG" required="true"/> - <column name="RECOVERER" type="VARCHAR2" size="80" required="false"/> - </table> - - <table name="RHQ_QRTZ_LOCKS"> - <column name="LOCK_NAME" primarykey="true" type="VARCHAR2" size="40" required="true"/> - <data LOCK_NAME="TRIGGER_ACCESS"/> - <data LOCK_NAME="JOB_ACCESS"/> - <data LOCK_NAME="CALENDAR_ACCESS"/> - <data LOCK_NAME="STATE_ACCESS"/> - <data LOCK_NAME="MISFIRE_ACCESS"/> - </table> - -<!-- END: scheduler-schema.xml --> -<!-- BEGIN: amps-schema.xml --> - - - <table name="RHQ_PLUGIN"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="4000" type="VARCHAR2" required="false"/> - <column name="VERSION" size="200" type="VARCHAR2" required="false"/> - <column name="AMPS_VERSION" size="16" type="VARCHAR2" required="false"/> - <column name="ENABLED" type="BOOLEAN" required="true"/> - <column name="STATUS" size="16" type="VARCHAR2" required="true"/> - <column name="HELP" type="CLOB" required="false"/> - <column name="PATH" size="500" type="VARCHAR2" required="true"/> - <column name="MD5" size="100" type="VARCHAR2" required="true"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="DEPLOYMENT" size="8" type="VARCHAR2" required="true"/> - <column name="PTYPE" size="200" type="VARCHAR2" required="false"/> - <column name="PLUGIN_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> - <column name="JOBS_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> - <column name="CONTENT" type="BLOB" required="false"/> - - <index name="RHQ_PLUGIN_NAME_DEPLOY_IDX" unique="true"> - <field ref="NAME"/> - <field ref="DEPLOYMENT"/> - </index> - </table> - -<!-- END: amps-schema.xml --> -<!-- BEGIN: measurement-schema.xml --> - - <table name="RHQ_MEASUREMENT_DEF"> - - <!-- === required columns === --> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE(ID)"/> - <column name="NAME" type="VARCHAR2" size="100" required="true"/> - - <!-- === optional columns === --> - <!-- an OSGI version range - if null, the metric def applies to all versions of the associated resource type --> - <column name="RESOURCE_VERSION_RANGE" type="VARCHAR2" size="100"/> - <column name="CATEGORY" type="SMALLINT"/> - <column name="UNITS" type="SMALLINT"/> - <column name="NUMERIC_TYPE" type="SMALLINT"/> - <column name="DISPLAY_TYPE" type="SMALLINT"/> - <column name="DATA_TYPE" type="SMALLINT"/> - <column name="RAW_NUMERIC_TYPE" type="SMALLINT"/> - <column name="DEFAULT_ON" type="BOOLEAN" default="false"/> - <column name="DEFAULT_INTERVAL" type="LONG" /> - <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> - <column name="DISPLAY_ORDER" type="INTEGER" default="1000"/> - <column name="DESCRIPTION" type="VARCHAR2" size="500"/> - <column name="DESTINATION_TYPE" type="VARCHAR2" size="100"/> - - <column name="VERSION" type="INTEGER"/> - <!-- for optimistic locking --> - - <!-- === business key (RESOURCE_TYPE_ID + NAME + RAW_NUMERIC_TYPE) === --> - <index name="RHQ_METRIC_DEF_KEY_IDX" unique="true"> - <field ref="RESOURCE_TYPE_ID"/> - <field ref="NAME"/> - <field ref="RAW_NUMERIC_TYPE"/> - </index> - <index name="RHQ_METRIC_DEF_NT_IDX"> - <field ref="NUMERIC_TYPE"/> - </index> - </table> - - - <table name="RHQ_MEASUREMENT_SCHED"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - - <column name="ENABLED" type="BOOLEAN" default="false"/> - <column name="MTIME" type="LONG" /> - <column name="DEFINITION" type="INTEGER" references="RHQ_MEASUREMENT_DEF(ID)"/> - <column name="VERSION" type="INTEGER" /> - <column name="COLL_INTERVAL" type="LONG" /> - <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE(ID)"/> - <index name="RHQ_MEAS_SCHED_UNIQ" unique="true"> - <field ref="RESOURCE_ID"/> - <field ref="DEFINITION"/> - </index> - <index name="RHQ_MEAS_SCHED_RESID_IDX"> - <field ref="RESOURCE_ID"/> - </index> - </table> - - - <table name="RHQ_MEASUREMENT_BLINE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - - <column name="BL_USER_ENTERED" type="BOOLEAN" default="false" required="true"/> - <column name="BL_MIN" type="DOUBLE" required="true"/> - <column name="BL_MAX" type="DOUBLE" required="true"/> - <column name="BL_MEAN" type="DOUBLE" required="true"/> - <column name="BL_COMPUTE_TIME" type="LONG" required="true"/> - <column name="SCHEDULE_ID" type="INTEGER" required="true" references="RHQ_MEASUREMENT_SCHED(ID)"/> - <index name="RHQ_MEAS_BASELINE_CTIME_IDX"> - <field ref="BL_COMPUTE_TIME"/> - </index> - <index name="RHQ_MEAS_BASELINE_SID_IDX"> - <field ref="SCHEDULE_ID"/> - </index> - </table> - - - <table name="RHQ_MEASUREMENT_DATA_NUM_1H" logging="false" cache="true" - tablespace="DEFAULT" storage-options="freelists 20"> - - <column name="TIME_STAMP" required="true" type="LONG"/> - <column name="SCHEDULE_ID" required="true" type="INTEGER"/> - <column name="VALUE" required="false" type="DOUBLE"/> - <column name="MINVALUE" required="false" type="DOUBLE"/> - <column name="MAXVALUE" required="false" type="DOUBLE"/> - - <constraint name="RHQ_MEAS_DATA_1H_ID_TIME_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - - <index name="RHQ_MEAS_DATA_1H_TIME_IDX"> - <field ref="TIME_STAMP"/> - </index> - </table> - - - <table name="RHQ_MEASUREMENT_DATA_NUM_6H" logging="false" cache="true" - tablespace="DEFAULT" storage-options="freelists 20"> - - <column name="TIME_STAMP" required="true" type="LONG"/> - <column name="SCHEDULE_ID" required="true" type="INTEGER"/> - <column name="VALUE" required="false" type="DOUBLE"/> - <column name="MINVALUE" required="false" type="DOUBLE"/> - <column name="MAXVALUE" required="false" type="DOUBLE"/> - - <constraint name="RHQ_MEAS_DATA_6H_ID_TIME_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - - <index name="RHQ_MEAS_DATA_6H_TIME_IDX"> - <field ref="TIME_STAMP"/> - </index> - </table> - - - <table name="RHQ_MEASUREMENT_DATA_NUM_1D" logging="false" cache="true" - tablespace="DEFAULT" storage-options="freelists 20"> - - <column name="TIME_STAMP" required="true" type="LONG"/> - <column name="SCHEDULE_ID" required="true" type="INTEGER"/> - <column name="VALUE" required="false" type="DOUBLE"/> - <column name="MINVALUE" required="false" type="DOUBLE"/> - <column name="MAXVALUE" required="false" type="DOUBLE"/> - - <constraint name="RHQ_MEAS_DATA_1D_ID_TIME_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - - <index name="RHQ_MEAS_DATA_1D_TIME_IDX"> - <field ref="TIME_STAMP" /> - </index> - </table> - - - <table name="RHQ_MEASUREMENT_DATA_TRAIT"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER" /> - <column name="VALUE" type="VARCHAR2" size="4000" /> - <constraint name="RHQ_MEAS_DATA_TRAIT_ID_TIME_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - - - <table name="RHQ_CALLTIME_DATA_KEY"> - <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> - <column name="SCHEDULE_ID" type="INTEGER" required="true"/> - <column name="CALL_DESTINATION" type="VARCHAR2" size="4000" required="true"/> - <index name="RHQ_CALLTIME_DATA_KEY_IDX" unique="true"> - <field ref="SCHEDULE_ID"/> - <field ref="CALL_DESTINATION"/> - </index> - </table> - - - <table name="RHQ_CALLTIME_DATA_VALUE"> - <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> - <column name="KEY_ID" type="INTEGER" references="RHQ_CALLTIME_DATA_KEY" required="true"/> - <column name="BEGIN_TIME" type="LONG" required="true"/> - <column name="END_TIME" type="LONG" required="true"/> - <column name="MINIMUM" type="DOUBLE" required="true"/> - <column name="MAXIMUM" type="DOUBLE" required="true"/> - <column name="TOTAL" type="DOUBLE" required="true"/> - <column name="COUNT" type="LONG" required="true"/> - <index name="RHQ_CT_DA_VA_END_TIM_IDX"> - <field ref="END_TIME"/> - </index> - </table> - - - <table name="RHQ_AVAILABILITY"> - <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE(ID)"/> - <column name="START_TIME" type="LONG" required="true" /> - <column name="END_TIME" type="LONG" required="false" /> - <column name="AVAILABILITY_TYPE" type="SMALLINT" required="false" /> - <index name="RHQ_AVAIL_RESOURCE_START_IDX"> - <field ref="RESOURCE_ID"/> - <field ref="START_TIME"/> - </index> - <!-- only one null row can exist for any resource --> - <index name="RHQ_AVAIL_RESOURCE_END_IDX" condition="END_TIME IS NULL"> - <field ref="RESOURCE_ID"/> - <field ref="END_TIME" /> - </index> - </table> - - <table name="RHQ_RESOURCE_AVAIL"> - <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE(ID)" ondelete="cascade"/> - <column name="AVAILABILITY_TYPE" type="SMALLINT" required="false" /> - <index name="RHQ_RESOURCE_AVAIL_IDX"> - <field ref="RESOURCE_ID" /> - </index> - </table> - - <table name="RHQ_MEASUREMENT_OOB"> - <column name="SCHEDULE_ID" type="INTEGER" references="RHQ_MEASUREMENT_SCHED(ID)" required="true"/> - <column name="TIME_STAMP" type="LONG" required="true"/> - <column name="OOB_FACTOR" type="INTEGER" required="true" /> - <constraint name="RHQ_MEAS_OOB_ID_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_MEASUREMENT_OOB_TMP"> - <column name="SCHEDULE_ID" type="INTEGER" required="true"/> - <column name="TIME_STAMP" type="LONG" required="true"/> - <column name="OOB_FACTOR" type="INTEGER" required="true" /> - <constraint name="RHQ_MEAS_OOB_TMP_ID_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_NUMBERS"> - <column name="i" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true" /> - </table> - - - <table name="RHQ_MEAS_DATA_NUM_R00"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R00_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R00_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R01"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R01_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R01_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R02"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R02_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R02_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R03"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R03_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R03_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R04"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R04_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R04_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R05"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R05_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R05_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R06"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R06_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R06_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R07"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R07_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R07_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R08"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R08_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R08_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R09"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R09_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R09_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R10"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R10_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R10_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R11"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R11_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R11_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R12"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R12_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R12_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R13"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R13_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R13_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R14"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R14_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R14_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - -<!-- END: measurement-schema.xml --> -<!-- BEGIN: content-schema.xml --> - - - <table name="RHQ_ARCHITECTURE"> - <column name="ID" default="sequence-only" initial="100" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="50" type="VARCHAR2" required="true"/> - <index name="RHQ_ARCHITECTURE_NAME_IDX" unique="true"> - <field ref="NAME"/> - </index> - </table> - - <table name="RHQ_REPO_GROUP_TYPE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - </table> - - - <table name="RHQ_REPO_GROUP"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - - <column name="REPO_GROUP_TYPE_ID" type="INTEGER" references="RHQ_REPO_GROUP_TYPE" required="true"/> - - <index name="RHQ_REPO_GROUP_IDX" unique="true"> - <field ref="NAME"/> - <field ref="REPO_GROUP_TYPE_ID"/> - </index> - </table> - - - <table name="RHQ_CONTENT_SOURCE_TYPE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="false"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="PLUGIN_NAME" size="100" type="VARCHAR2" required="false"/> - <!-- we might want this as part of natural key --> - <column name="DEFAULT_LAZY_LOAD" type="BOOLEAN" required="true"/> - <column name="DEFAULT_DOWNLOAD_MODE" size="16" type="VARCHAR2" required="true"/> - <column name="DEFAULT_SYNC_SCHEDULE" size="64" type="VARCHAR2" required="false"/> - <column name="API_CLASS" size="100" type="VARCHAR2" required="true"/> - - <column name="SOURCE_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF" required="false"/> - - <index name="RHQ_CONTENT_SOURCE_TYPE_IDX" unique="true"> - <field ref="NAME"/> - <!-- <field ref="PLUGIN_NAME"/> --> - </index> - </table> - - <table name="RHQ_CONTENT_SOURCE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="LAZY_LOAD" type="BOOLEAN" required="true"/> - <column name="DOWNLOAD_MODE" size="16" type="VARCHAR2" required="true"/> - <column name="SYNC_SCHEDULE" size="64" type="VARCHAR2" required="false"/> - <column name="LOAD_ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="CREATION_TIME" type="LONG" required="true"/> - <column name="LAST_MODIFIED_TIME" type="LONG" required="true"/> - - <column name="CONTENT_SOURCE_TYPE_ID" type="INTEGER" references="RHQ_CONTENT_SOURCE_TYPE" required="true"/> - <column name="CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> - - <index name="RHQ_CONTENT_SOURCE_IDX" unique="true"> - <field ref="NAME"/> - <field ref="CONTENT_SOURCE_TYPE_ID"/> - </index> - </table> - - <table name="RHQ_REPO"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="CREATION_TIME" type="LONG" required="true"/> - <column name="LAST_MODIFIED_TIME" type="LONG" required="true"/> - <column name="IS_CANDIDATE" type="BOOLEAN" required="true"/> - <column name="SYNC_SCHEDULE" size="64" type="VARCHAR2" required="false"/> - <column name="OWNER_ID" type="INTEGER" required="false" references="RHQ_SUBJECT" /> - <column name="IS_PRIVATE" type="BOOLEAN" required="true" /> - - <index name="RHQ_REPO_IDX" unique="true"> - <field ref="NAME"/> - </index> - </table> - - - <table name="RHQ_REPO_RELATION_TYPE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - </table> - - - <table name="RHQ_REPO_RELATION"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="RELATED_REPO_ID" type="INTEGER" references="RHQ_REPO" required="true"/> - <column name="REPO_RELATION_TYPE_ID" type="INTEGER" references="RHQ_REPO_RELATION_TYPE" required="true"/> - </table> - - - - <table name="RHQ_PACKAGE_TYPE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="false"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="CATEGORY" size="50" type="VARCHAR2" required="false"/> - <column name="DISCOVERY_INTERVAL" type="INTEGER" required="false"/> - <column name="IS_CREATION_DATA" type="BOOLEAN" required="true"/> - <column name="SUPPORTS_ARCHITECTURE" type="BOOLEAN" required="true"/> - - <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE" required="false"/> - <column name="DEPLOYMENT_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF" required="false"/> - <column name="PACKAGE_EXTRA_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG_DEF" required="false"/> - - <index name="RHQ_PACKAGE_TYPE_IDX" unique="true"> - <field ref="NAME"/> - <field ref="RESOURCE_TYPE_ID"/> - </index> - - </table> - - <table name="RHQ_PACKAGE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="CLASSIFICATION" size="200" type="VARCHAR2" required="false"/> - - <column name="PACKAGE_TYPE_ID" type="INTEGER" references="RHQ_PACKAGE_TYPE" required="true"/> - - <index name="RHQ_PACKAGE_IDX" unique="true"> - <field ref="NAME"/> - <field ref="PACKAGE_TYPE_ID"/> - </index> - </table> - - <table name="RHQ_PACKAGE_BITS"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="BITS" type="LARGEOBJECT" required="false"/> - </table> - - <table name="RHQ_PACKAGE_VERSION"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="false"/> - <column name="SHORT_DESCRIPTION" size="10000" type="CLOB" required="false"/> - <column name="LONG_DESCRIPTION" size="50000" type="CLOB" required="false"/> - <column name="VERSION" size="500" type="VARCHAR2" required="true"/> - <column name="DISPLAY_VERSION" size="500" type="VARCHAR2" required="false"/> - <column name="FILE_NAME" size="255" type="VARCHAR2" required="false"/> - <column name="FILE_SIZE" type="LONG" required="false"/> - <column name="FILE_MD5" size="32" type="VARCHAR2" required="false"/> - <column name="FILE_SHA256" size="64" type="VARCHAR2" required="false"/> - <column name="FILE_CREATION_TIME" type="LONG" required="false"/> - <column name="LICENSE_NAME" size="255" type="VARCHAR2" required="false"/> - <column name="LICENSE_VERSION" size="20" type="VARCHAR2" required="false"/> - <column name="METADATA" type="BLOB" required="false"/> - - <column name="PACKAGE_ID" type="INTEGER" references="RHQ_PACKAGE" required="true"/> - <column name="ARCHITECTURE_ID" type="INTEGER" references="RHQ_ARCHITECTURE" required="true"/> - <column name="CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> - <column name="PACKAGE_BITS_ID" type="INTEGER" references="RHQ_PACKAGE_BITS" required="false"/> - - <index name="RHQ_PACKAGE_VERSION_IDX" unique="true"> - <field ref="PACKAGE_ID"/> - <field ref="VERSION"/> - <field ref="ARCHITECTURE_ID"/> - </index> - - </table> - - <table name="RHQ_CONTENT_REQ"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="REQUEST_TYPE" type="VARCHAR2" required="true" size="20"/> - <column name="NOTES" type="VARCHAR2" required="false" size="512"/> - </table> - - <table name="RHQ_INSTALLED_PACKAGE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="INSTALLATION_TIME" type="LONG" required="false"/> - - <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE" required="true"/> - <column name="PACKAGE_VERSION_ID" type="INTEGER" references="RHQ_PACKAGE_VERSION" required="true"/> - <column name="SUBJECT_ID" type="INTEGER" references="RHQ_SUBJECT" required="false"/> - </table> - - <table name="RHQ_INSTALLED_PKG_HIST"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="STATUS" type="VARCHAR2" size="24" required="true"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="HISTORY_TIMESTAMP" type="LONG" required="false"/> - - <column name="PACKAGE_VERSION_ID" type="INTEGER" references="RHQ_PACKAGE_VERSION" required="true"/> - <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE" required="true"/> - <column name="DEPLOYMENT_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> - <column name="CONTENT_SERVICE_REQUEST_ID" type="INTEGER" references="RHQ_CONTENT_REQ" required="false"/> - </table> - - <table name="RHQ_CONTENT_SRC_SYNC"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="STATUS" type="VARCHAR2" size="16" required="true"/> - <column name="START_TIME" type="LONG" required="true"/> - <column name="END_TIME" type="LONG" required="false"/> - <column name="RESULTS" type="LONGVARCHAR" required="false"/> - <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> - </table> - - <table name="RHQ_REPO_SYNC"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="STATUS" type="VARCHAR2" size="16" required="true"/> - <column name="START_TIME" type="LONG" required="true"/> - <column name="END_TIME" type="LONG" required="false"/> - <column name="RESULTS" type="LONGVARCHAR" required="false"/> - <column name="PERCENT_COMPLETE" type="LONG" required="false"/> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - </table> - - - <table name="RHQ_PACKAGE_INST_STEP"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="STEP_KEY" type="VARCHAR2" size="500" required="true"/> - <column name="STEP_ORDER" type="INTEGER" required="true"/> - <column name="DESCRIPTION" type="VARCHAR2" size="4000" required="true"/> - <column name="ERROR_MSG" type="LONGVARCHAR" required="false"/> - <column name="RESULT" type="VARCHAR2" size="25" required="true"/> - - <column name="INSTALLED_PKG_HIST_ID" type="INTEGER" references="RHQ_INSTALLED_PKG_HIST"/> - </table> - - <table name="RHQ_REPO_RESOURCE_MAP"> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> - <column name="CTIME" type="LONG" required="true"/> - - <constraint name="RHQ_REPO_RESOURCE_MAP_KEY"> - <primaryKey> - <field ref="REPO_ID"/> - <field ref="RESOURCE_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_REPO_CONTENT_SRC_MAP"> 1 - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> - <column name="CTIME" type="LONG" required="true"/> - - <constraint name="RHQ_REPO_CONTENT_SRC_MAP_KEY"> - <primaryKey> - <field ref="REPO_ID"/> - <field ref="CONTENT_SRC_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_REPO_REPO_GROUP_MAP"> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - <column name="REPO_GROUP_ID" type="INTEGER" required="true" references="RHQ_REPO_GROUP"/> - <column name="CTIME" type="LONG" required="true"/> - - <constraint name="RHQ_REPO_REPO_GROUP_MAP_KEY"> - <primaryKey> - <field ref="REPO_ID"/> - <field ref="REPO_GROUP_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_REPO_REPO_RELATION_MAP"> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - <column name="REPO_RELATION_ID" type="INTEGER" required="true" references="RHQ_REPO_RELATION"/> - <column name="CTIME" type="LONG" required="true"/> - - <constraint name="RHQ_REPO_REPO_RELATION_MAP_KEY"> - <primaryKey> - <field ref="REPO_ID"/> - <field ref="REPO_RELATION_ID"/> - </primaryKey> - </constraint> - </table> - - - <table name="RHQ_REPO_PKG_VERSION_MAP"> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> - <column name="CTIME" type="LONG" required="true"/> - - <constraint name="RHQ_REPO_PKG_VER_MAP_KEY"> - <primaryKey> - <field ref="REPO_ID"/> - <field ref="PACKAGE_VERSION_ID"/> - </primaryKey> - </constraint> - <index name="RHQ_REPO_PKG_VER_MAP_IDX" unique="false"> - <field ref="PACKAGE_VERSION_ID"/> - </index> - </table> - - <table name="RHQ_PKG_VER_CONTENT_SRC_MAP"> - <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> - <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> - <column name="LOCATION" type="VARCHAR2" size="4000" required="true"/> - - <constraint name="RHQ_PKG_VER_CONTENT_SRC_KEY"> - <primaryKey> - <field ref="PACKAGE_VERSION_ID"/> - <field ref="CONTENT_SRC_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_PKG_PRD_MAP"> - <column name="PKG_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> - <column name="PRD_ID" type="INTEGER" required="true" references="RHQ_PRD_VER"/> - - <constraint name="RHQ_PKG_PRD_KEY"> - <primaryKey> - <field ref="PKG_ID"/> - <field ref="PRD_ID"/> - </primaryKey> - </constraint> - - </table> - - <table name="RHQ_DISTRIBUTION_TYPE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - - </table> - - <table name="RHQ_DISTRIBUTION"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="DISTRIBUTION_TYPE_ID" type="INTEGER" required="true" references="RHQ_DISTRIBUTION_TYPE"/> - <column name="LABEL" size="64" type="VARCHAR2" required="true"/> - <column name="BASE_PATH" size="256" type="VARCHAR2" required="true"/> - <column name="LAST_MODIFIED" type="LONG" required="true"/> - - <index name="RHQ_DISTRIBUTION_IDX" unique="true"> - <field ref="LABEL"/> - <field ref="BASE_PATH"/> - </index> - - </table> - - <table name="RHQ_REPO_DISTRIBUTION"> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - <column name="DISTRIBUTION_ID" type="INTEGER" required="true" references="RHQ_DISTRIBUTION"/> - <column name="LAST_MODIFIED" type="LONG" required="true"/> - - <constraint name="RHQ_REPO_DIST_MAP_KEY"> - <primaryKey> - <field ref="REPO_ID"/> - <field ref="DISTRIBUTION_ID"/> - </primaryKey> - </constraint> - </table> - - - - <table name="RHQ_DISTRIBUTION_FILE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="DISTRIBUTION_ID" type="INTEGER" required="true" references="RHQ_DISTRIBUTION"/> - <column name="RELATIVE_FILENAME" size="256" type="VARCHAR2" required="true"/> - <!--<column name="FILE_SIZE" type="NUMBER" required="true"/>--> - <column name="MD5SUM" size="64" type="VARCHAR2" required="true"/> - <column name="LAST_MODIFIED" type="LONG" required="true"/> - <!--<column name="CTIME" type="LONG" required="true"/>--> - - <index name="RHQ_DISTRIBUTION_FILE_IDX" unique="true"> - <field ref="DISTRIBUTION_ID"/> - <field ref="RELATIVE_FILENAME"/> - </index> - </table> - - - - - <table name="RHQ_ADVISORY"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="ADVISORY" size="64" type="VARCHAR2" required="true"/> - <column name="ADVISORY_TYPE" size="64" type="VARCHAR2" required="true" /> - <column name="ADVISORY_REL" size="64" type="VARCHAR2" required="false"/> - <column name="ADVISORY_NAME" size="64" type="VARCHAR2" required="false"/> - <column name="DESCRIPTION" size="4000" type="VARCHAR2" required="false"/> - <column name="SYNOPSIS" size="4000" type="VARCHAR2" required="true"/> - <column name="TOPIC" size="4000" type="VARCHAR2" required="false"/> - <column name="SOLUTION" size="4000" type="VARCHAR2" required="false"/> - <column name="SEVERITY" size="64" type="VARCHAR2" required="false"/> - <column name="ISSUE_DATE" type="LONG" required="false"/> - <column name="UPDATE_DATE" type="LONG" required="false"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="LAST_MODIFIED" type="LONG" required="true"/> - - <index name="RHQ_ADVISORY_NAME_UQ" unique="true"> - <field ref="ADVISORY_NAME"/> - </index> - - <index name="RHQ_ADVISORY_UQ" unique="true"> - <field ref="ADVISORY"/> - </index> - - <index name="RHQ_ADVISORY_UDATE_IDX" unique="false"> - <field ref="UPDATE_DATE"/> - </index> - </table> - - <table name="RHQ_ADVISORY_PACKAGE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> - <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> - <column name="LAST_MODIFIED" type="LONG" required="true"/> - - <index name="RHQ_ADVISORY_PKG_IDX" unique="true"> - <field ref="ADVISORY_ID"/> - <field ref="PACKAGE_VERSION_ID"/> - </index> - </table> - - <table name="RHQ_CVE"> - <column name="ID" default="sequence-only" initial="101" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="64" type="VARCHAR2" required="true"/> - </table> - - <table name="RHQ_ADVISORY_CVE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> - <column name="CVE_ID" type="INTEGER" required="true" references="RHQ_CVE"/> - <column name="LAST_MODIFIED" type="LONG" required="true"/> - - <index name="RHQ_ADVISORY_CVE_IDX" unique="true"> - <field ref="ADVISORY_ID"/> - <field ref="CVE_ID"/> - </index> - - </table> - - <table name="RHQ_ADVISORY_BUGLIST"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> - <column name="BUG_ID" size="256" type="VARCHAR2" required="true"/> - <column name="LAST_MODIFIED" type="LONG" required="true"/> - - <index name="RHQ_ADVISORY_BUG_IDX" unique="true"> - <field ref="ADVISORY_ID"/> - <field ref="BUG_ID"/> - </index> - </table> - - - <table name="RHQ_REPO_ADVISORY"> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> - <column name="LAST_MODIFIED" type="LONG" required="true"/> - - <constraint name="RHQ_REPO_ADV_MAP_KEY"> - <primaryKey> - <field ref="REPO_ID"/> - <field ref="ADVISORY_ID"/> - </primaryKey> - </constraint> - </table> - - <!-- BUNDLE_TYPE is things like "Cobbler profile" or "file-based bundle" or "puppet recipe" --> - <table name="RHQ_BUNDLE_TYPE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> - - <!-- This index is for constraint, not performance --> - <index name="RHQ_BUNDLE_TYPE_UNIQUE" unique="true"> - <field ref="NAME"/> - </index> - </table> - - <!-- BUNDLE is a named piece of content that can be versioned and installed somewhere --> - <table name="RHQ_BUNDLE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="BUNDLE_TYPE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_TYPE"/> - <column name="PACKAGE_TYPE_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_TYPE"/> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - - <!-- This index is for constraint, not performance --> - <index name="RHQ_BUNDLE_UNIQUE" unique="true"> - <field ref="BUNDLE_TYPE_ID"/> - <field ref="NAME"/> - </index> - </table> - - <!-- BUNDLE_VERSION represents an actual piece of content that needs to be installed somewhere --> - <table name="RHQ_BUNDLE_VERSION"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="VERSION" size="500" type="VARCHAR2" required="true"/> - <column name="VERSION_ORDER" type="INTEGER" required="true"/> - <column name="ACTION" type="CLOB" required="true"/> - <column name="CONFIG_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_DEF" /> - <column name="BUNDLE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE"/> - - <!-- This index is for constraint, not performance --> - <index name="RHQ_BUNDLE_VERSION_UNIQUE" unique="true"> - <field ref="BUNDLE_ID"/> - <field ref="NAME"/> - <field ref="VERSION"/> - </index> - </table> - - <!-- Many-to-many table that links many repos to a particular bundle version. destination platforms --> - <!-- would be required to have associations to the specified repos (to access required content --> - <table name="RHQ_BUNDLE_VERSION_REPO"> - <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - - <constraint name="RHQ_BUNDLE_VERSION_REPO_KEY"> - <primaryKey> - <field ref="BUNDLE_VERSION_ID"/> - <field ref="REPO_ID"/> - </primaryKey> - </constraint> - </table> - - <!-- BUNDLE_FILE represents a file that is associated with (possibly bundled inside) a bundle version --> - <table name="RHQ_BUNDLE_FILE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> - <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> - </table> - - <!-- A logical destination for a bundle deployment. Defines the platforms and directory on those targets. --> - <table name="RHQ_BUNDLE_DESTINATION"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="BUNDLE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE"/> - <column name="GROUP_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_GROUP"/> - <column name="DEPLOY_DIR" size="256" type="VARCHAR2" required="true"/> - <column name="DEST_BASE_DIR_NAME" size="200" type="VARCHAR2" required="true"/> - - <!-- This index is for constraint, not performance --> - <index name="RHQ_BUNDLE_DESTINATION_UNIQUE" unique="true"> - <field ref="BUNDLE_ID"/> - <field ref="GROUP_ID"/> - <field ref="DEPLOY_DIR"/> - </index> - </table> - - <!-- An actual deployment of a bundle version to a destination, with a specific config. Bundle deployments - can differ only on ctime, which is assumed to be different --> - <table name="RHQ_BUNDLE_DEPLOYMENT"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> - <column name="BUNDLE_DESTINATION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DESTINATION"/> - <column name="CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG" /> - <column name="SUBJECT_NAME" type="VARCHAR2" required="false" size="255"/> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="IS_LIVE" type="BOOLEAN" required="true"/> - <column name="REPLACED_BUNDLE_DEPLOYMENT_ID" type="INTEGER" required="false" references="RHQ_BUNDLE_DEPLOYMENT"/> - </table> - - <!-- Represents a bundle version that is deployed on a platform resource --> - <table name="RHQ_BUNDLE_RES_DEPLOY"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="BUNDLE_DEPLOYMENT_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DEPLOYMENT" /> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE" /> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="CTIME" type="LONG" required="true"/> - - <index name="RHQ_BUNDLE_RES_DEPLOY_IDX" unique="true"> - <field ref="BUNDLE_DEPLOYMENT_ID"/> - <field ref="RESOURCE_ID"/> - </index> - </table> - - <table name="RHQ_BUNDLE_RES_DEP_HIST"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="BUNDLE_RES_DEPLOY_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_RES_DEPLOY" /> - <column name="SUBJECT_NAME" required="false" size="255" type="VARCHAR2"/> - <column name="AUDIT_TIME" required="true" type="LONG"/> - <column name="ACTION" required="true" size="128" type="VARCHAR2"/> - <column name="INFO" required="true" size="512" type="VARCHAR2"/> - <column name="CATEGORY" required="false" size="32" type="VARCHAR2"/> - <column name="STATUS" required="true" type="VARCHAR2" size="16"/> - <column name="MESSAGE" required="false" type="LONGVARCHAR"/> - <column name="ATTACHMENT" required="false" type="LONGVARCHAR"/> - </table> - - <table name="RHQ_TAGGING_BUNDLE_MAP"> - <column name="BUNDLE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE"/> - <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> - <constraint name="RHQ_TAGGING_BUNDLE_MAP_KEY"> - <primaryKey> - <field ref="BUNDLE_ID"/> - <field ref="TAG_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_TAGGING_BUNDLE_VERSION_MAP"> - <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> - <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> - <constraint name="RHQ_TAGGING_BUNDLE_VER_MAP_KEY"> - <primaryKey> - <field ref="BUNDLE_VERSION_ID"/> - <field ref="TAG_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_TAGGING_BUNDLE_DEPLOY_MAP"> - <column name="BUNDLE_DEPLOYMENT_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DEPLOYMENT"/> - <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> - <constraint name="RHQ_TAGGING_BUNDLE_DEP_MAP_KEY"> - <primaryKey> - <field ref="BUNDLE_DEPLOYMENT_ID"/> - <field ref="TAG_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_TAGGING_BUNDLE_DEST_MAP"> - <column name="BUNDLE_DESTINATION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DESTINATION"/> - <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> - <constraint name="RHQ_TAGGING_BUNDLE_DES_MAP_KEY"> - <primaryKey> - <field ref="BUNDLE_DESTINATION_ID"/> - <field ref="TAG_ID"/> - </primaryKey> - </constraint> - </table> - - <!-- Drift Management Tables --> - <table name="RHQ_DRIFT_DEF_TEMPLATE"> - <column name="ID" default="sequence-only" initial="1001" primarykey="true" required="true" type="INTEGER"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> - <column name="CONFIG_ID" type="INTEGER" required="true" references="RHQ_CONFIG"/> - <column name="NAME" type="VARCHAR2" size="128" required="true"/> - <column name="DESCRIPTION" type="VARCHAR2" size="512" required="false"/> - <!-- true if defined by user, false if provided by plugin --> - <column name="IS_USER_DEFINED" type="BOOLEAN" required="true"/> - <!-- - Change sets are managed by the drift server plugins; therefore, we cannot maintain - a FK constraint on the change set id. And the type cannot be integer because - other back ends like MongoDB use other types that are basically variants of a - UUID - - jsanda - --> - <column name="DRIFT_CHANGE_SET_ID" type="VARCHAR2" size="64" required="false"/> - <column name="CTIME" type="LONG" required="true"/> - - <index name="RHQ_DRIFT_DEF_TEMPLATE_UNIQUE" unique="true"> - <field ref="RESOURCE_TYPE_ID"/> - <field ref="NAME"/> - </index> - </table> - - <!-- Content of a file being managed for drift. Used for diff and/or remediation --> - <table name="RHQ_DRIFT_FILE"> - <column name="HASH_ID" type="VARCHAR2" size="64" primarykey="true" required="true"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="DATA" type="LARGEOBJECT" required="false"/> - <column name="DATA_SIZE" type="LONG" required="false"/> - <column name="STATUS" type="VARCHAR2" size="20" required="true"/> - </table> - - <!-- A single drift definition defining file tracking - Note: A resource or group (todo: group, other?) can have zero or more drift configurations. - Note: The name, interval and is_enabled values are also stored withing the referenced config. - This allows us to use the config editor to manipulate all fields. - Note: Name is read-only - Note: Interval unit is millis - --> - <table name="RHQ_DRIFT_DEFINITION"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="CONFIG_ID" type="INTEGER" required="true" references="RHQ_CONFIG"/> - <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> - <column name="DRIFT_DEF_TEMPLATE_ID" type="INTEGER" required="false" references="RHQ_DRIFT_DEF_TEMPLATE"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="NAME" type="VARCHAR2" size="512" required="true"/> - <column name="DESCRIPTION" type="VARCHAR2" size="512" required="false"/> - <column name="INTERVAL" type="LONG" required="true"/> - <column name="IS_ENABLED" type="BOOLEAN" required="true"/> - <column name="DRIFT_HANDLING_MODE" type="VARCHAR2" size="20" required="true"/> - <column name="IS_PINNED" type="BOOLEAN" required="true"/> - <column name="IS_ATTACHED" type="BOOLEAN" required="true"/> - <column name="COMPLIANCE_STATUS" type="INTEGER" required="true"/> - </table> - - <!-- A set of drift records (note, this is for the JPA server plugin impl only) --> - <table name="RHQ_DRIFT_SET"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - </table> - - <!-- A drift change-set report for a resource (note, this is for the JPA server plugin impl only) --> - <table name="RHQ_DRIFT_CHANGE_SET"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="DRIFT_SET_ID" type="INTEGER" required="false" references="RHQ_DRIFT_SET"/> - <column name="CTIME" type="LONG" required="true"/> - <!-- Version 0 is initial change-set --> - <column name="VERSION" type="INTEGER" required="true"/> - <column name="CATEGORY" type="VARCHAR2" size="20" required="true"/> - <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> - <column name="DRIFT_DEFINITION_ID" type="INTEGER" required="false" references="RHQ_DRIFT_DEFINITION"/> - <!-- the drift handling mode at changeset creation time --> - <column name="DRIFT_HANDLING_MODE" type="VARCHAR2" size="20" required="true"/> - </table> - - <!-- A single occurence of drift for a resource (note, this is for the JPA server plugin impl only) --> - <table name="RHQ_DRIFT"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="CATEGORY" type="VARCHAR2" size="20" required="true"/> - <column name="DRIFT_SET_ID" type="INTEGER" required="false" references="RHQ_DRIFT_SET"/> - <column name="DRIFT_CHANGE_SET_ID" type="INTEGER" required="true" references="RHQ_DRIFT_CHANGE_SET"/> - <!-- the file path not including the base directory --> - <column name="PATH" type="VARCHAR2" size="1024" required="true"/> - <!-- the same as PATH less [/]filename.ext. Redundant storage for the purpose of strict directory search. - this field can be considered transient for serialization purposes --> - <column name="PATH_DIRECTORY" type="VARCHAR2" size="1024" required="true"/> - <column name="OLD_DRIFT_FILE" type="VARCHAR2" size="64" required="false" references="RHQ_DRIFT_FILE"/> - <column name="NEW_DRIFT_FILE" type="VARCHAR2" size="64" required="false" references="RHQ_DRIFT_FILE"/> - </table> - - -<!-- END: content-schema.xml --> -<!-- BEGIN: resource-request-schema.xml --> - - - <table name="RHQ_CREATE_RES_HIST"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="PARENT_RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> - <column name="CREATED_RESOURCE_NAME" type="VARCHAR2" size="500" required="false"/> - <column name="NEW_RESOURCE_KEY" type="VARCHAR2" required="false" size="500"/> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> - <column name="CONFIGURATION_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> - <column name="INSTALLED_PACKAGE_ID" type="INTEGER" required="false" references="RHQ_INSTALLED_PACKAGE"/> - </table> - - <table name="RHQ_DELETE_RES_HIST"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> - </table> - -<!-- END: resource-request-schema.xml --> -<!-- BEGIN: jms-schema.xml --> - -<!-- the schema matches that which would be automatically created by the JMS subsystem --> -<!-- see deploy/jms/rhq-jdbc-state-service.xml and rhq-jdbc2-service.xml --> - - - <table name="JMS_MESSAGES"> - <column name="MESSAGEID" required="true" type="INTEGER" /> - <column name="DESTINATION" required="true" type="VARCHAR2" size="255" /> - <column name="TXID" required="false" type="INTEGER" /> - <column name="TXOP" required="false" type="CHAR" size="1" /> - <column name="MESSAGEBLOB" required="false" type="BLOB" /> - - <constraint name="JMS_MESSAGES_PKEY"> - <primaryKey> - <field ref="MESSAGEID"/> - <field ref="DESTINATION"/> - </primaryKey> - </constraint> - - <index name="JMS_MESSAGES_TXOP_TXID"> - <field ref="TXOP"/> - <field ref="TXID"/> - </index> - <index name="JMS_MESSAGES_DESTINATION"> - <field ref="DESTINATION"/> - </index> - </table> - - <table name="JMS_TRANSACTIONS"> - <column name="TXID" required="true" type="INTEGER" primarykey="true" /> - </table> - - <table name="JMS_USERS"> - <column name="USERID" required="true" type="VARCHAR2" size="32" primarykey="true" /> - <column name="PASSWD" required="true" type="VARCHAR2" size="32" /> - <column name="CLIENTID" required="false" type="VARCHAR2" size="128" /> - </table> - - <table name="JMS_ROLES"> - <column name="ROLEID" required="true" type="VARCHAR2" size="32" /> - <column name="USERID" required="true" type="VARCHAR2" size="32" /> - - <constraint name="JMS_ROLES_PKEY"> - <primaryKey> - <field ref="USERID"/> - <field ref="ROLEID"/> - </primaryKey> - </constraint> - </table> - - <table name="JMS_SUBSCRIPTIONS"> - <column name="CLIENTID" required="true" type="VARCHAR2" size="128" /> - <column name="SUBNAME" required="true" type="VARCHAR2" size="128" /> - <column name="TOPIC" required="true" type="VARCHAR2" size="255" /> - <column name="SELECTOR" required="false" type="VARCHAR2" size="255" /> - - <constraint name="JMS_SUBSCRIPTIONS_PKEY"> - <primaryKey> - <field ref="CLIENTID"/> - <field ref="SUBNAME"/> - </primaryKey> - </constraint> - </table> - -<!-- END: jms-schema.xml --> -<!-- BEGIN: obsolete-schema.xml --> - - - <!-- NOTE: The tables will be dropped in the *** REVERSE ORDER *** as listed in this file! --> - <!-- NOTE: So, put the table you want dropped first at the bottom, and so on... --> - - - <!-- !!! REMOVED FROM CONTENT-SCHEMA !!!! --> - - <table name="RHQ_DRIFT_TEMPLATE_MAP"> - <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> - <column name="CONFIG_TEMPLATE_ID" type="INTEGER" required="true" references="RHQ_CONFIG_TEMPLATE"/> - </table> - - <table name="RHQ_BUNDLE_CONFIG" obsolete="true"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG" /> - <!-- this probably needs a DTYPE discriminator so we know if its a bundle or a specific bundle version --> - <column name="BUNDLE_VERSION_ID" type="INTEGER" required="false" references="RHQ_BUNDLE_VERSION"/> - <column name="BUNDLE_ID" type="INTEGER" required="false" references="RHQ_BUNDLE"/> - </table> - - <table name="RHQ_CHANNEL" obsolete="true"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="CREATION_TIME" type="LONG" required="true"/> - <column name="LAST_MODIFIED_TIME" type="LONG" required="true"/> - - <index name="RHQ_CHANNEL_IDX" unique="true"> - <field ref="NAME"/> - </index> - </table> - - <table name="RHQ_CHANNEL_RESOURCE_MAP" obsolete="true"> - <column name="CHANNEL_ID" type="INTEGER" required="true" references="RHQ_CHANNEL"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> - <column name="CTIME" type="LONG" required="true"/> - - <constraint name="RHQ_CHANNEL_RESOURCE_MAP_KEY"> - <primaryKey> - <field ref="CHANNEL_ID"/> - <field ref="RESOURCE_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_CHANNEL_CONTENT_SRC_MAP" obsolete="true"> - <column name="CHANNEL_ID" type="INTEGER" required="true" references="RHQ_CHANNEL"/> - <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> - <column name="CTIME" type="LONG" required="true"/> - - <constraint name="RHQ_CHAN_CONTENT_SRC_MAP_KEY"> - <primaryKey> - <field ref="CHANNEL_ID"/> - <field ref="CONTENT_SRC_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_CHANNEL_PKG_VERSION_MAP" obsolete="true"> - <column name="CHANNEL_ID" type="INTEGER" required="true" references="RHQ_CHANNEL"/> - <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> - <column name="CTIME" type="LONG" required="true"/> - - <constraint name="RHQ_CHANNEL_PKG_VER_MAP_KEY"> - <primaryKey> - <field ref="CHANNEL_ID"/> - <field ref="PACKAGE_VERSION_ID"/> - </primaryKey> - </constraint> - </table> - - <!-- !!! REMOVED FROM MEASUREMENT-SCHEMA !!!! --> - - <table name="RHQ_MEASUREMENT_OOB" obsolete="true"> - <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> - <column name="SCHEDULE_ID" type="INTEGER" references="RHQ_MEASUREMENT_SCHED(ID)" required="true"/> - <column name="OCCURRED" type="LONG" required="true"/> - <column name="DIFF" type="DOUBLE" required="true"/> - - <index name="RHQ_MEASUREMENT_OOB_IDX" unique="true"> - <field ref="SCHEDULE_ID" /> - <field ref="OCCURRED" /> - </index> - </table> - - - <table name="RHQ_TAG" obsolete="true"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - </table> - - <table name="RHQ_REPO_TAG_MAP" obsolete="true"> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAG"/> - - <constraint name="RHQ_REPO_TAG_MAP_KEY"> - <primaryKey> - <field ref="REPO_ID"/> - <field ref="TAG_ID"/> - </primaryKey> - </constraint> - </table> - - -<!-- END: obsolete-schema.xml --> -</dbsetup> diff --git a/modules/enterprise/gui/installer/src/test/resources/org/rhq/enterprise/installer/db-schema-combined-rhq-4.4.0.xml b/modules/enterprise/gui/installer/src/test/resources/org/rhq/enterprise/installer/db-schema-combined-rhq-4.4.0.xml deleted file mode 100644 index 2eb4b19..0000000 --- a/modules/enterprise/gui/installer/src/test/resources/org/rhq/enterprise/installer/db-schema-combined-rhq-4.4.0.xml +++ /dev/null @@ -1,2649 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<dbsetup name="schema"> -<!-- BEGIN: config-schema.xml --> - - - <!-- Definition or Metadata tables --> - - <table name="RHQ_CONFIG_DEF"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="NAME" type="VARCHAR2" required="true" size="100"/> - <column name="DESCRIPTION" type="VARCHAR2" required="false" size="250"/> - <column name="VERSION" type="VARCHAR2" required="false" size="50"/> - <column name="CONFIG_FORMAT" type="VARCHAR2" required="false" size="32"/> - </table> - - <table name="RHQ_CONFIG_PROP_GRP_DEF"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="NAME" type="VARCHAR2" required="true" size="100"/> - <column name="DISPLAY_NAME" type="VARCHAR2" required="false" size="100"/> - <column name="DESCRIPTION" type="VARCHAR2" required="false" size="250"/> - <column name="DEFAULT_HIDDEN" type="BOOLEAN" required="false"/> - <column name="ORDER_INDEX" type="INTEGER" required="false"/> - </table> - - <table name="RHQ_CONFIG_PROP_DEF"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="NAME" type="VARCHAR2" required="false" size="255"/> - <column name="DISPLAY_NAME" type="VARCHAR2" required="false" size="100"/> - <column name="DESCRIPTION" type="VARCHAR2" required="false" size="1000"/> - <column name="DEFAULT_VALUE" type="VARCHAR2" required="false" size="2000"/> - <column name="REQUIRED" type="BOOLEAN" required="false"/> - <column name="READONLY" type="BOOLEAN" required="false"/> - <column name="SUMMARY" type="BOOLEAN" required="false"/> - <column name="ACTIVATION_POLICY" type="VARCHAR2" required="false" size="20"/> - <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_GRP_DEF"/> - <column name="ORDER_INDEX" type="INTEGER" required="false"/> - <column name="VERSION" type="VARCHAR2" required="false" size="50"/> - <column name="PARENT_MAP_DEFINITION_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> - <column name="PARENT_LIST_DEFINITION_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> - <column name="SIMPLE_TYPE" type="VARCHAR2" required="false" size="20"/> - <column name="ALLOW_CUSTOM_ENUM_VALUE" type="BOOLEAN" required="false"/> - <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> - <column name="CONFIG_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_DEF"/> - - <!-- only simple properties (not lists and maps) have this --> - <column name="UNITS" type="SMALLINT" required="false"/> - - <!-- only dynamic properties (not simple) have this --> - <column name="DYNAMIC_TYPE" type="VARCHAR2" size="20" required="false"/> - <column name="DYNAMIC_KEY" type="VARCHAR2" size="128" required="false"/> - </table> - - <table name="RHQ_CONF_PROP_DEF_ENUM"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="STRING_VALUE" type="VARCHAR2" required="false" size="500"/> - <column name="ORDER_INDEX" type="INTEGER" required="false"/> - <column name="NAME" type="VARCHAR2" required="false" size="100"/> - <column name="PROPERTY_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> - </table> - - <table name="RHQ_CONFIG_PD_OSRC"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="LINK_TO_TARGET" type="BOOLEAN" required="false"/> - <column name="FILTER" type="VARCHAR2" required="false" size="40"/> - <column name="EXPRESSION" type="VARCHAR2" required="true" size="400"/> - <column name="TARGET_TYPE" type="VARCHAR2" required="true" size="20"/> - <column name="PROPERTY_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> - </table> - - <table name="RHQ_CONFIG_PROP_CONSTR"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="DTYPE" type="VARCHAR2" required="true" size="15"/> - <column name="DETAILS" type="VARCHAR2" required="false" size="250"/> - <column name="CONFIG_PROP_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> - <column name="ORDER_INDEX" type="INTEGER" required="false"/> - </table> - - - <!-- Content or value tables --> - - <table name="RHQ_CONFIG"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="NOTES" type="VARCHAR2" required="false" size="512"/> - <column name="VERSION" type="VARCHAR2" required="false" size="50"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - </table> - - <table name="RHQ_CONFIG_PROPERTY"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="CONFIGURATION_ID" type="INTEGER" required="false" references="RHQ_CONFIG" ondelete="cascade"/> - <column name="STRING_VALUE" type="VARCHAR2" required="false" size="2000"/> - <column name="OVERRIDE" type="BOOLEAN" required="false"/> - <column name="NAME" type="VARCHAR2" required="true" size="255"/> - <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> - <!-- Recursive cascade path to RHQ_CONFIG_PROPERTY causes constraint creation errors on SQL Server, see - http://support.microsoft.com/kb/321843 --> - <column name="PARENT_LIST_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROPERTY" ondelete="cascade" /> - <column name="PARENT_MAP_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROPERTY" ondelete="cascade" /> - <column name="LIST_INDEX" type="INTEGER"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <index name="RHQ_CONFIG_PROP_idx_prop_key" unique="false"> - <field ref="CONFIGURATION_ID"/> - <field ref="NAME"/> - </index> - <index name="RHQ_CONFIG_PROP_idx_map_key" unique="false"> - <field ref="PARENT_MAP_ID"/> - <field ref="NAME"/> - </index> - <index name="RHQ_CONFIG_PROP_idx_list_key" unique="false"> - <field ref="PARENT_LIST_ID"/> - </index> - <!-- List entries all have the same name --> - </table> - - <table name="RHQ_CONFIG_TEMPLATE"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="NAME" type="VARCHAR2" required="false" size="100"/> - <column name="DESCRIPTION" type="VARCHAR2" required="false" size="500"/> - <column name="CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> - <column name="CONFIG_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_DEF"/> - <column name="IS_DEFAULT" type="BOOLEAN" required="false"/> - </table> - - <table name="RHQ_RAW_CONFIG"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="CONFIG_ID" type="INTEGER" required="true" references="RHQ_CONFIG(ID)"/> - <column name="PATH" type="VARCHAR2" required="false" size="512"/> - <column name="CONTENTS" type="CLOB" required="true"/> - <column name="SHA256" type="VARCHAR2" size="64" required="true"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - </table> - -<!-- END: config-schema.xml --> -<!-- BEGIN: cluster-schema.xml --> - - <table name="RHQ_AFFINITY_GROUP"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" required="true" size="255" type="VARCHAR2"/> - </table> - - <table name="RHQ_SERVER"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" required="true" size="255" type="VARCHAR2"/> - <column name="ADDRESS" required="true" size="255" type="VARCHAR2"/> - <column name="PORT" required="true" type="INTEGER"/> - <column name="SECURE_PORT" required="true" type="INTEGER"/> - <column name="CTIME" required="true" type="LONG"/> - <column name="MTIME" required="true" type="LONG"/> - <column name="AFFINITY_GROUP_ID" type="INTEGER" references="RHQ_AFFINITY_GROUP" required="false"/> - <column name="COMPUTE_POWER" required="true" type="INTEGER"/> - <column name="OPERATION_MODE" required="true" size="32" type="VARCHAR2"/> - <column name="STATUS" type="INTEGER" required="false" default="0" /> - - <!-- This index is for constraint, not performance --> - <index name="RHQ_SERVER_NAME_UNIQUE" unique="true"> - <field ref="NAME"/> - </index> - </table> - - <!-- new agent --> - <table name="RHQ_AGENT"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" required="true" size="255" type="VARCHAR2"/> - <column name="ADDRESS" required="true" size="255" type="VARCHAR2"/> - <column name="PORT" required="true" type="INTEGER"/> - <column name="AGENTTOKEN" required="true" size="100" type="VARCHAR2"/> - <column name="REMOTE_ENDPOINT" required="false" size="4000" type="VARCHAR2"/> - <column name="CTIME" required="true" type="LONG"/> - <column name="MTIME" required="true" type="LONG"/> - <column name="LAST_AVAILABILITY_REPORT" required="false" type="LONG"/> - <column name="LAST_AVAILABILITY_PING" required="false" type="LONG"/> - <column name="AFFINITY_GROUP_ID" type="INTEGER" references="RHQ_AFFINITY_GROUP" required="false"/> - <column name="SERVER_ID" type="INTEGER" references="RHQ_SERVER" required="false"/> - <column name="STATUS" type="INTEGER" required="false" default="0" /> - <column name="BACKFILLED" type="BOOLEAN" required="true" /> - - <index name="RHQ_AGENT_NAME_UNIQUE" unique="true"> - <field ref="NAME"/> - </index> - - <index name="RHQ_AGENT_ADDRESS_PORT" unique="true"> - <field ref="ADDRESS"/> - <field ref="PORT"/> - </index> - - <index name="RHQ_AGENT_TOKEN_UNIQUE" unique="true"> - <field ref="AGENTTOKEN"/> - </index> - </table> - - <table name="RHQ_PARTITION_EVENT"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="SUBJECT_NAME" required="true" size="100" type="VARCHAR2"/> - <column name="CTIME" required="true" type="LONG"/> - <column name="EVENT_TYPE" required="true" size="50" type="VARCHAR2"/> - <column name="EVENT_DETAIL" required="false" size="512" type="VARCHAR2"/> - <column name="EXECUTION_STATUS" required="true" size="32" type="VARCHAR2"/> - </table> - - <table name="RHQ_PARTITION_DETAILS"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="PARTITION_EVENT_ID" type="INTEGER" references="RHQ_PARTITION_EVENT" required="true"/> - <column name="AGENT_NAME" type="VARCHAR2" size="255" required="true"/> - <column name="SERVER_NAME" type="VARCHAR2" size="255" required="true"/> - </table> - - <table name="RHQ_FAILOVER_LIST"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="PARTITION_EVENT_ID" type="INTEGER" references="RHQ_PARTITION_EVENT" required="true"/> - <column name="AGENT_ID" type="INTEGER" references="RHQ_AGENT" required="true"/> - <column name="CTIME" required="true" type="LONG"/> - </table> - - <table name="RHQ_FAILOVER_DETAILS"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="FAILOVER_LIST_ID" type="INTEGER" references="RHQ_FAILOVER_LIST" required="true"/> - <column name="SERVER_ID" type="INTEGER" references="RHQ_SERVER" required="true"/> - <column name="ORDINAL" type = "INTEGER" required="true"/> - </table> - -<!-- END: cluster-schema.xml --> -<!-- BEGIN: auth-schema.xml --> - - - <table name="RHQ_PRINCIPAL"> - - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="PRINCIPAL" required="true" type="VARCHAR2" size="100"/> - <column name="PASSWORD" required="true" type="VARCHAR2" size="64"/> - - <!-- ensure that principals are unique --> - <index name="RHQ_PRINCIPAL_PRINCIPAL_KEY" unique="true"> - <field ref="PRINCIPAL"/> - </index> - - </table> - - <table name="RHQ_SUBJECT"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" required="true" size="100" type="VARCHAR2"/> - <column name="CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG"/> - <column name="FIRST_NAME" required="false" size="100" type="VARCHAR2"/> - <column name="LAST_NAME" required="false" size="100" type="VARCHAR2"/> - <column name="EMAIL_ADDRESS" size="100" type="VARCHAR2"/> - <column name="SMS_ADDRESS" size="100" type="VARCHAR2"/> - <column name="PHONE_NUMBER" size="100" type="VARCHAR2"/> - <column name="DEPARTMENT" size="100" type="VARCHAR2"/> - <column name="FACTIVE" required="true" type="BOOLEAN" default="true"/> - <column name="FSYSTEM" required="true" type="BOOLEAN" default="false"/> - - <index name="RHQ_SUBJECT_AUTH_KEY" unique="true"> - <field ref="NAME"/> - </index> - </table> - -<!-- END: auth-schema.xml --> -<!-- BEGIN: inventory-schema.xml --> - - - <!-- NEW RESOURCE TYPES --> - <table name="RHQ_RESOURCE_TYPE"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" type="VARCHAR2" size="100" required="true"/> - <column name="CATEGORY" type="VARCHAR2" size="16" required="true"/> - <column name="CREATION_DATA_TYPE" type="VARCHAR2" size="16" required="true"/> - <column name="CREATE_DELETE_POLICY" type="VARCHAR2" size="16" required="true"/> - <column name="SINGLETON" type="BOOLEAN" required="true"/> - <column name="SUPPORTS_MANUAL_ADD" type="BOOLEAN" required="true"/> - <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> - <column name="PLUGIN" type="VARCHAR2" size="100"/> - <column name="CTIME" type="LONG"/> - <column name="MTIME" type="LONG"/> - <column name="DELETED" type="BOOLEAN" default="FALSE" required="TRUE"/> - <column name="SUBCATEGORY_ID" type="INTEGER"/> - <!-- - TODO add support to DB setup for tables with circular dependencies and then add back this RI - <column name="SUBCATEGORY_ID" type="INTEGER" references="RHQ_RESOURCE_SUBCAT" /> - --> - <column name="PLUGIN_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> - <column name="RES_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> - <column name="BUNDLE_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG"/> - - <index name="RHQ_RES_TYPE_IDX_PLG_NAME" unique="true"> - <field ref="NAME"/> - <field ref="PLUGIN"/> - </index> - </table> - - <!-- NEW RESOURCE SUBCATEGORIES --> - <table name="RHQ_RESOURCE_SUBCAT"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" type="VARCHAR2" size="100"/> - <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> - <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> - <column name="CTIME" type="LONG"/> - <column name="MTIME" type="LONG"/> - <column name="PARENT_SUBCATEGORY_ID" type="INTEGER" references="RHQ_RESOURCE_SUBCAT"/> - <!-- resourceTypeId is not required on child sub categories --> - <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> - </table> - - <!-- Many To Many mapping for resource type to its parents --> - <table name="RHQ_RESOURCE_TYPE_PARENTS"> - <column name="RESOURCE_TYPE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> - <column name="PARENT_RESOURCE_TYPE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> - - <!-- not using full words to fit index name length --> - <constraint name="RHQ_RES_TYPE_PARENTS_KEY"> - <primaryKey> - <field ref="RESOURCE_TYPE_ID"/> - <field ref="PARENT_RESOURCE_TYPE_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_PROCESS_SCAN"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="QUERY" type="VARCHAR2" size="256" required="true"/> - <column name="NAME" type="VARCHAR2" size="100" required="false"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> - - <index name="RHQ_PROCESS_SCAN_QUERY_INDEX" unique="true"> - <field ref="QUERY"/> - <field ref="RESOURCE_TYPE_ID"/> - </index> - </table> - - <table name="RHQ_PRD_VER"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="VERSION" type="VARCHAR2" size="100" required="true"/> - <column name="RES_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> - </table> - - <table name="RHQ_RESOURCE"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> - <column name="UUID" type="CHAR" size="36" required="true"/> - <column name="NAME" type="VARCHAR2" size="500"/> - <!-- ancestry holds the full parental ancestry, used for disambiguation --> - <column name="ANCESTRY" type="VARCHAR2" required="false" size="4000"/> - <column name="RESOURCE_KEY" type="VARCHAR2" required="true" size="500"/> - <column name="AGENT_ID" required="false" type="INTEGER" references="RHQ_AGENT(id)"/> - <column name="INVENTORY_STATUS" type="VARCHAR2" size="20"/> - <column name="CONNECTED" type="BOOLEAN"/> - <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> - <column name="VERSION" type="VARCHAR2" size="100"/> - <column name="CTIME" type="LONG"/> - <column name="MTIME" type="LONG"/> - <column name="ITIME" type="LONG"/> - <column name="RES_CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG"/> - <column name="PLUGIN_CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG"/> - <column name="MODIFIED_BY" required="false" size="100" type="VARCHAR2"/> - <column name="LOCATION" required="false" size="100" type="VARCHAR2"/> - <column name="PARENT_RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE"/> - <column name="PRODUCT_VERSION_ID" type="INTEGER" references="RHQ_PRD_VER"/> - - <index name="RHQ_RESOURCE_idx_key"> - <field ref="RESOURCE_KEY"/> - </index> - - <index name="RHQ_RESOURCE_idx_type"> - <field ref="RESOURCE_TYPE_ID"/> - </index> - - <index name="RHQ_RESOURCE_idx_agent"> - <field ref="AGENT_ID"/> - </index> - - <index name="RHQ_RESOURCE_idx_parent"> - <field ref="PARENT_RESOURCE_ID"/> - </index> - - </table> - - <table name="RHQ_RESOURCE_ERROR"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> - <column name="TIME_OCCURRED" type="LONG" required="true"/> - <column name="ERROR_TYPE" type="VARCHAR2" required="true" size="32"/> - <column name="SUMMARY" type="VARCHAR2" required="true" size="1000"/> - <column name="DETAIL" type="LONGVARCHAR" required="false"/> - - <index name="RHQ_RES_ERROR_IDX_RES_ID"> - <field ref="RESOURCE_ID"/> - </index> - </table> - - <table name="RHQ_GROUP_DEF"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" required="true" size="100" type="VARCHAR2"/> - <column name="DESCRIPTION" size="100" type="VARCHAR2"/> - <column name="CTIME" type="LONG"/> - <column name="MTIME" type="LONG"/> - <column name="CALC_TIME" type="LONG"/> - <column name="CALC_INTERVAL" type="LONG"/> - <column name="RECURSIVE" type="BOOLEAN"/> - <column name="EXPRESSION" type="VARCHAR2" size="1000"/> - - <index name="RHQ_GROUP_DEF_NAME" unique="true"> - <field ref="NAME"/> - </index> - </table> - - <table name="RHQ_RESOURCE_GROUP"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <!-- this name can be longer than the size of the GROUP_BY column, which is used to uniquely identify it --> - <!-- Max bytes for Oracle Varchar2 to accommodate large cluster keys --> - <column name="NAME" required="true" size="4000" type="VARCHAR2"/> - <column name="DESCRIPTION" size="100" type="VARCHAR2"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> - <!-- Compatible groups only --> - <column name="CTIME" type="LONG"/> - <column name="MTIME" type="LONG"/> - <column name="MODIFIED_BY" required="false" size="100" type="VARCHAR2"/> - <column name="RECURSIVE" type="BOOLEAN"/> - - <column name="GROUP_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_GROUP_DEF"/> - <column name="GROUP_BY" size="500" type="VARCHAR2"/> - - <column name="CATEGORY" type="VARCHAR2" size="20" required="true"/> - - <!-- This is only set if this is a subject-owned group (like an autogroup) --> - <column name="SUBJECT_ID" type="INTEGER" references="RHQ_SUBJECT"/> - - <!-- These two only set if this is a backing group for a resource auto-cluster --> - <column name="CLUSTER_KEY" type="VARCHAR2" size="4000" required="false"/> - <column name="CLUSTER_RESOURCE_GROUP_ID" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> - - <!-- This is only set if this is a backing group for a resource auto-group --> - <column name="AUTO_GROUP_PARENT_RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE"/> - - <column name="VISIBLE" type="BOOLEAN"/> - - <index name="RHQ_RES_GROUP_NAME" unique="false"> - <field ref="NAME"/> - </index> - </table> - - <!-- Many To Many mapping for groups to implicit resources --> - <table name="RHQ_RESOURCE_GROUP_RES_IMP_MAP"> - <column name="RESOURCE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE"/> - <column name="RESOURCE_GROUP_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> - - <!-- not using full words to fit index name length --> - <constraint name="RHQ_RES_GROUP_RES_IMP_MAP_KEY"> - <primaryKey> - <field ref="RESOURCE_ID"/> - <field ref="RESOURCE_GROUP_ID"/> - </primaryKey> - </constraint> - </table> - - <!-- Many To Many mapping for groups to explicit resources --> - <table name="RHQ_RESOURCE_GROUP_RES_EXP_MAP"> - <column name="RESOURCE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE"/> - <column name="RESOURCE_GROUP_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> - - <!-- not using full words to fit index name length --> - <constraint name="RHQ_RES_GROUP_RES_EXP_MAP_KEY"> - <primaryKey> - <field ref="RESOURCE_ID"/> - <field ref="RESOURCE_GROUP_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_CONFIG_GROUP_UPDATE"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="GROUP_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_GROUP"/> - <column name="CONFIGURATION_ID" type="INTEGER" required="true" references="RHQ_CONFIG"/> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="SUBJECT_NAME" type="VARCHAR2" required="false" size="100"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> - </table> - - <table name="RHQ_CONFIG_UPDATE"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="CONFIGURATION_ID" type="INTEGER" required="true" references="RHQ_CONFIG" ondelete="cascade"/> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="SUBJECT_NAME" type="VARCHAR2" required="false" size="100"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="CONFIG_RES_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> - <column name="PLUGIN_CONFIG_RES_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> - <column name="AGG_RES_UPDATE_ID" type="INTEGER" required="false" references="RHQ_CONFIG_GROUP_UPDATE"/> - <column name="AGG_PLUGIN_UPDATE_ID" type="INTEGER" required="false" references="RHQ_CONFIG_GROUP_UPDATE"/> - <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> - </table> - - - <table name="RHQ_TAGGING"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="NAMESPACE" type="VARCHAR2" required="false" size="20"/> - <column name="SEMANTIC" type="VARCHAR2" required="false" size="50"/> - <column name="NAME" type="VARCHAR2" required="true" size="100"/> - </table> - - <table name="RHQ_TAGGING_RESOURCE_MAP"> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> - <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> - <constraint name="RHQ_TAGGING_RESOURCE_MAP_KEY"> - <primaryKey> - <field ref="RESOURCE_ID"/> - <field ref="TAG_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_TAGGING_RES_GROUP_MAP"> - <column name="RESOURCE_GROUP_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_GROUP"/> - <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> - <constraint name="RHQ_TAGGING_RES_GROUP_MAP_KEY"> - <primaryKey> - <field ref="RESOURCE_GROUP_ID"/> - <field ref="TAG_ID"/> - </primaryKey> - </constraint> - </table> - -<!-- END: inventory-schema.xml --> -<!-- BEGIN: authz-schema.xml --> - - - <table name="RHQ_ROLE"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" required="true" size="100" type="VARCHAR2"/> - <column name="DESCRIPTION" size="100" type="VARCHAR2"/> - <column name="FSYSTEM" type="BOOLEAN" default="false"/> - - <index name="RHQ_ROLE_NAME_KEY" unique="true"> - <field ref="NAME"/> - </index> - </table> - - <table name="RHQ_ROLE_RESOURCE_GROUP_MAP"> - <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> - <column name="RESOURCE_GROUP_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> - - <constraint name="RHQ_ROLE_RES_GROUP_MAP_KEY"> - <primaryKey> - <field ref="ROLE_ID"/> - <field ref="RESOURCE_GROUP_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_ROLE_LDAP_GROUP"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> - <column name="LDAP_GROUP_NAME" size="128" required="true" type="VARCHAR2"/> - - <index name="RHQ_ROLE_LDAP_GROUP_IDX" unique="true"> - <field ref="ROLE_ID"/> - <field ref="LDAP_GROUP_NAME"/> - </index> - </table> - - <table name="RHQ_PERMISSION"> - <column name="ROLE_ID" type="INTEGER" references="RHQ_ROLE" required="true"/> - <column name="OPERATION" type="INTEGER" required="true"/> - <constraint name="RHQ_PERMISSION_PK"> - <primaryKey> - <field ref="ROLE_ID"/> - <field ref="OPERATION"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_SUBJECT_ROLE_MAP"> - <column name="SUBJECT_ID" required="true" type="INTEGER" references="RHQ_SUBJECT"/> - <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> - - <constraint name="RHQ_SUBJECT_ROLE_MAPPING_KEY"> - <primaryKey> - <field ref="SUBJECT_ID"/> - <field ref="ROLE_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_SUBJECT_ROLE_LDAP_MAP"> - <column name="SUBJECT_ID" required="true" type="INTEGER" references="RHQ_SUBJECT"/> - <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> - <constraint name="RHQ_SUBJECT_ROLE_LDAP_MAP_PK"> - <primaryKey> - <field ref="SUBJECT_ID" /> - <field ref="ROLE_ID"/> - </primaryKey> - </constraint> - </table> -<!-- END: authz-schema.xml --> -<!-- BEGIN: search-schema.xml --> - - - <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="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="GLOBAL" type="BOOLEAN" required="true"/> - </table> - -<!-- END: search-schema.xml --> -<!-- BEGIN: dashboard-schema.xml --> - - - - <table name="RHQ_DASHBOARD"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" type="VARCHAR2" size="200" required="true"/> - <column name="SUBJECT_ID" type="INTEGER" required="true" references="RHQ_SUBJECT"/> - <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> - <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_RESOURCE_GROUP"/> - <column name="CATEGORY" type="VARCHAR2" size="20" required="true"/> - <column name="SHARED" type="BOOLEAN" required="true"/> - <column name="CONFIGURATION_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> - </table> - - - <table name="RHQ_DASHBOARD_PORTLET"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" type="VARCHAR2" size="200" required="true"/> - <column name="PORTLET_KEY" type="VARCHAR2" size="200" required="true"/> - <column name="COL" type="INTEGER" required="true"/> - <column name="COL_INDEX" type="INTEGER" required="true"/> - <column name="HEIGHT" type="INTEGER" required="true"/> - <column name="CONFIGURATION_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> - <column name="DASHBOARD_ID" type="INTEGER" required="false" references="RHQ_DASHBOARD"/> - </table> - -<!-- END: dashboard-schema.xml --> -<!-- BEGIN: operation-schema.xml --> - - - <table name="RHQ_OPERATION_DEF"> - - <!-- === required columns === --> - - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE(ID)"/> - <column name="NAME" type="VARCHAR2" required="true" size="100"/> - - <!-- === optional columns === --> - - <!-- an OSGI version range - if null, the operation def applies to all versions of the associated resource type --> - <column name="RESOURCE_VERSION_RANGE" type="VARCHAR2" size="100"/> - - <!-- A parameter config definition is only required for operations that have parameters. --> - <!-- A results config definition is only required for operations that return data. --> - <column name="PARAMETER_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> - <column name="RESULTS_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> - <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> - <column name="DESCRIPTION" type="VARCHAR2" size="4000"/> - <column name="TIMEOUT" type="INTEGER"/> - - <!-- === business key (RESOURCE_TYPE_ID + NAME) === --> - <index name="RHQ_OPERATION_DEF_KEY_IDX" unique="true"> - <field ref="RESOURCE_TYPE_ID"/> - <field ref="NAME"/> - </index> - - </table> - - <table name="RHQ_OPERATION_HISTORY"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="DTYPE" type="VARCHAR2" required="true" size="8"/> - <column name="JOB_NAME" type="VARCHAR2" required="true" size="100"/> - <column name="JOB_GROUP" type="VARCHAR2" required="true" size="100"/> - <column name="OPERATION_DEF_ID" type="INTEGER" required="true" references="RHQ_OPERATION_DEF"/> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="STIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="PARAMETERS_CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> - - <!-- for resource history --> - <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> - <column name="RESULTS_CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> - <column name="GROUP_HISTORY_ID" type="INTEGER" required="false" references="RHQ_OPERATION_HISTORY"/> - - <!-- for group history --> - <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_RESOURCE_GROUP"/> - - <index name="RHQ_OPERATION_HISTORY_JOB_IDX" unique="true"> - <field ref="JOB_NAME"/> - <field ref="JOB_GROUP"/> - <field ref="CTIME"/> - </index> - - </table> - - <!-- - This table is really just to support some specific use-cases. - Specifically, to be able to get a list of histories for a specific schedule (aka quartz job) - and to be able to query a list of all schedules along with their associated resource/group IDs - possibly sorted by their next fire time. - Note that a NULL next fire time means it won't fire again and the row is probaby about to be deleted; - we can probably not even insert rows with NULL and make it a non-nullable field. But rather than - code special conditions into the session bean, we'll allow a short-lived NULL next fire time row. - --> - <table name="RHQ_OPERATION_SCHEDULE"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - - <column name="JOB_NAME" type="VARCHAR2" required="true" size="100"/> - <column name="JOB_GROUP" type="VARCHAR2" required="true" size="100"/> - <column name="DTYPE" type="VARCHAR2" required="true" size="8"/> - <column name="NEXT_FIRE_TIME" type="LONG" required="false"/> - - <!-- for resource history --> - <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> - - <!-- for group history --> - <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_RESOURCE_GROUP"/> - - <!-- - Note, this is the same as the primary key that Quartz uses for its schedules (RHQ_QRTZ_JOB_DETAILS). - We do not need to add DTYPE to the key, because we ensure the name/group are unique across resource/group - schedules - --> - <!-- === business key (JOB_NAME + JOB_GROUP) === --> - <index name="RHQ_OPERATION_SCHEDULE_KEY_IDX" unique="true"> - <field ref="JOB_NAME"/> - <field ref="JOB_GROUP"/> - </index> - </table> - -<!-- END: operation-schema.xml --> -<!-- BEGIN: event-schema.xml --> - - - <!-- metadata --> - - <table name="RHQ_EVENT_DEF"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE(ID)"/> - - <column name="NAME" type="VARCHAR2" size="100" required="true"/> - <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> - <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> - - <index name="RHQ_EVENT_DEF_IDX" unique="true"> - <field ref="RESOURCE_TYPE_ID"/> - <field ref="NAME"/> - </index> - </table> - - <!-- instance data --> - - <table name="RHQ_EVENT_SOURCE"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="EVENT_DEF_ID" type="INTEGER" required="true" references="RHQ_EVENT_DEF(ID)"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE(ID)"/> - - <column name="LOCATION" required="true" size="2000" type="VARCHAR2"/> - - <index name="RHQ_EVENT_SOURCE_IDX" unique="true"> - <field ref="EVENT_DEF_ID"/> - <field ref="RESOURCE_ID"/> - <field ref="LOCATION"/> - </index> - </table> - - <table name="RHQ_EVENT"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="EVENT_SOURCE_ID" type="INTEGER" required="true" references="RHQ_EVENT_SOURCE(ID)"/> - - <column name="TIMESTAMP" required="true" type="LONG"/> - <column name="SEVERITY" required="true" size="20" type="VARCHAR2"/> - <column name="DETAIL" required="true" size="4000" type="VARCHAR2"/> - <index name="RHQ_EVENT_IDX" unique="false"> - <field ref="EVENT_SOURCE_ID"/> - <field ref="TIMESTAMP"/> - </index> - </table> - -<!-- END: event-schema.xml --> -<!-- BEGIN: alert-schema.xml --> - - - <table name="RHQ_ALERT_DEFINITION"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" required="true" size="100" type="VARCHAR2"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="PARENT_ID" type="INTEGER" required="false"/> - <column name="GROUP_ALERT_DEF_ID" type="INTEGER" required="false"/> - <column name="DESCRIPTION" required="false" size="250" type="VARCHAR2"/> - <column name="PRIORITY" type="VARCHAR2" size="15" required="true"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE" required="false"/> - <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE" required="false"/> - <column name="RESOURCE_GROUP_ID" type="INTEGER" references="RHQ_RESOURCE_GROUP" required="false"/> - <column name="ENABLED" required="true" default="TRUE" type="BOOLEAN"/> - - <column name="REQUIRED" required="true" type="SMALLINT"/> - - <column name="RECOVERY_ID" type="INTEGER" required="true"/> - <!-- required, but 0 effectively means null --> - <column name="WILL_RECOVER" required="true" default="false" type="BOOLEAN"/> - <column name="NOTIFY_FILTERED" required="true" default="false" type="BOOLEAN"/> - <column name="CONTROL_FILTERED" required="true" default="FALSE" type="BOOLEAN"/> - - <column name="DELETED" required="true" default="FALSE" type="BOOLEAN"/> - <column name="READ_ONLY" required="true" default="FALSE" type="BOOLEAN"/> - - <column name="DAMPENING_CATEGORY" type="SMALLINT" required="true"/> - <column name="DAMPENING_VALUE" type="INTEGER"/> - <column name="DAMPENING_VALUE_UNITS" type="SMALLINT"/> - <column name="DAMPENING_PERIOD" type="INTEGER"/> - <column name="DAMPENING_PERIOD_UNITS" type="SMALLINT"/> - </table> - - <table name="RHQ_ALERT_DAMPEN_EVENT"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> - <column name="EVENT_TYPE" required="true" type="SMALLINT"/> - <column name="EVENT_TIMESTAMP" required="true" type="LONG"/> - - <index name="RHQ_DAMPENING_EVENT_TYPE_IDX"> - <field ref="EVENT_TYPE"/> - </index> - <index name="RHQ_DAMPENING_EVENT_TS_IDX"> - <field ref="EVENT_TIMESTAMP"/> - </index> - </table> - - <table name="RHQ_ALERT_CONDITION"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="TYPE" required="true" type="VARCHAR2" size="15"/> - <!-- - <column name="REQUIRED" required="true" type="BOOLEAN"/> - --> - <column name="MEASUREMENT_DEFINITION_ID" required="false" type="INTEGER"/> - <column name="NAME" required="false" size="100" type="VARCHAR2"/> - <column name="COMPARATOR" required="false" size="2" type="VARCHAR2"/> - <column name="THRESHOLD" required="false" type="DOUBLE"/> - <!-- event-based conditions use OPTION_STATUS for the string match, so should be a decent length --> - <column name="OPTION_STATUS" required="false" size="256" type="VARCHAR2"/> - <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> - <column name="TRIGGER_ID" required="false" type="INTEGER"/> - </table> - - <table name="RHQ_ALERT" tablespace="DEFAULT" - storage-options="freelists 5" cache="true"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> - <column name="CTIME" required="true" type="LONG"/> - <column name="RECOVERY_ID" type="INTEGER" required="true"/> - <!-- required, but 0 effectively means null --> - <column name="WILL_RECOVER" required="true" default="false" type="BOOLEAN"/> - <column name="ACK_TIME" required="false" type="LONG"/> - <column name="ACK_SUBJECT" required="false" size="100" type="VARCHAR2"/> - <index name="RHQ_ALERT_IDX_TIME" unique="false"> - <field ref="CTIME"/> - </index> - <index name="RHQ_ALERT_IDX_ALERTDEF" unique="false"> - <field ref="ALERT_DEFINITION_ID"/> - </index> - </table> - - <table name="RHQ_ALERT_NOTIF_LOG" tablespace="DEFAULT" - storage-options="freelists 5" cache="true"> - <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="false"> - <field ref="ALERT_ID"/> - </index> - <column name="SENDER" required="false" size="100" type="VARCHAR2"/> - <column name="RESULT_STATE" required="false" size="20" type="VARCHAR2"/> - <column name="MESSAGE" required="false" size="4000" type="VARCHAR2"/> - </table> - - <table name="RHQ_ALERT_CONDITION_LOG" tablespace="DEFAULT" - storage-options="freelists 5" cache="true"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="CTIME" required="true" type="LONG"/> - <column name="ALERT_ID" required="false" type="INTEGER" references="RHQ_ALERT(ID)"/> - <column name="CONDITION_ID" required="true" type="INTEGER" references="RHQ_ALERT_CONDITION(ID)"/> - <column name="VALUE" required="true" size="250" type="VARCHAR2"/> - <index name="RHQ_ALERT_COND_LOG_IDX_TIME"> - <field ref="CTIME" /> - </index> - <index name="RHQ_ALERT_COND_LOG_IDX_ALERT"> - <field ref="ALERT_ID"/> - </index> - <index name="RHQ_ALERT_COND_LOG_COND_IDX"> - <field ref="CONDITION_ID"/> - </index> - </table> - - <table name="RHQ_ALERT_NOTIFICATION"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> - <column name="SENDER_CONFIG_ID" required="false" type="INTEGER" references="RHQ_CONFIG(ID)"/> - <column name="EXTRA_CONFIG_ID" required="false" type="INTEGER" references="RHQ_CONFIG(ID)"/> - <column name="SENDER_NAME" required="true" size="100" type="VARCHAR2" /> - </table> - -<!-- END: alert-schema.xml --> -<!-- BEGIN: sysconfig-schema.xml --> - - - <table name="RHQ_SYSTEM_CONFIG"> - <column name="ID" default="sequence-only" initial="10001" - primarykey="true" required="true" type="INTEGER"/> - <column name="PROPERTY_KEY" type="VARCHAR2" size="80"/> - <column name="PROPERTY_VALUE" type="VARCHAR2" size="300"/> - <column name="DEFAULT_PROPERTY_VALUE" type="VARCHAR2" size="300"/> - <column name="FREAD_ONLY" type="BOOLEAN" default="FALSE"/> - - <index name="RHQ_SYSTEM_CONFIG_KEY_INDX" unique="true"> - <field ref="PROPERTY_KEY"/> - </index> - </table> - -<!-- END: sysconfig-schema.xml --> -<!-- BEGIN: scheduler-schema.xml --> - - - <table name="RHQ_QRTZ_JOB_DETAILS"> - <column name="JOB_NAME" required="true" type="VARCHAR2" size="80"/> - <column name="JOB_GROUP" required="true" type="VARCHAR2" size="80"/> - <column name="DESCRIPTION" required="false" type="VARCHAR2" size="120"/> - <column name="JOB_CLASS_NAME" required="true" type="VARCHAR2" size="128"/> - <column name="IS_DURABLE" required="true" type="BOOLEAN" default="FALSE"/> - <column name="IS_VOLATILE" required="true" type="BOOLEAN"/> - <column name="IS_STATEFUL" required="true" type="BOOLEAN" default="FALSE"/> - <column name="REQUESTS_RECOVERY" required="true" type="BOOLEAN" default="FALSE"/> - <column name="JOB_DATA" required="false" type="BLOB"/> - - <constraint name="RHQ_PK_QRTZ_JOB_DETAILS"> - <primaryKey> - <field ref="JOB_NAME"/> - <field ref="JOB_GROUP"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_QRTZ_JOB_LISTENERS"> - <column name="JOB_NAME" required="true" type="VARCHAR2" size="80"/> - <column name="JOB_GROUP" required="true" type="VARCHAR2" size="80"/> - <column name="JOB_LISTENER" required="true" type="VARCHAR2" size="80"/> - - <constraint name="RHQ_PK_QRTZ_JOB_LISTENERS"> - <primaryKey> - <field ref="JOB_NAME"/> - <field ref="JOB_GROUP"/> - <field ref="JOB_LISTENER"/> - </primaryKey> - </constraint> - <constraint name="RHQ_FK_QRTZ_JOB_LSTNRS_JN_JG"> - <foreignKey local="JOB_NAME,JOB_GROUP" - references="RHQ_QRTZ_JOB_DETAILS(JOB_NAME,JOB_GROUP)" - ondelete="cascade"/> - </constraint> - </table> - - <table name="RHQ_QRTZ_TRIGGERS"> - <column name="TRIGGER_NAME" type="VARCHAR2" required="true" size="80"/> - <column name="TRIGGER_GROUP" type="VARCHAR2" required="true" size="80"/> - <column name="JOB_NAME" type="VARCHAR2" required="true" size="80"/> - <column name="JOB_GROUP" type="VARCHAR2" required="true" size="80"/> - <column name="IS_VOLATILE" type="BOOLEAN" required="true"/> - <column name="DESCRIPTION" type="VARCHAR2" required="false" size="120"/> - <column name="NEXT_FIRE_TIME" type="LONG" required="false"/> - <column name="PREV_FIRE_TIME" type="LONG" required="false"/> - <column name="PRIORITY" type="INTEGER" required="false"/> - <column name="TRIGGER_STATE" type="VARCHAR" required="true" size="16"/> - <column name="TRIGGER_TYPE" type="VARCHAR" required="true" size="8"/> - <column name="START_TIME" type="LONG" required="true"/> - <column name="END_TIME" type="LONG" required="false"/> - <column name="CALENDAR_NAME" type="VARCHAR2" required="false" size="80"/> - <column name="MISFIRE_INSTR" type="INTEGER" required="false"/> - <column name="JOB_DATA" type="BLOB" required="false"/> - - <constraint name="RHQ_PK_QRTZ_TRIGGERS"> - <primaryKey> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </primaryKey> - </constraint> - <constraint name="RHQ_FK_QRTZ_TRIGGERS_JN_JG"> - <foreignKey local="JOB_NAME,JOB_GROUP" - references="RHQ_QRTZ_JOB_DETAILS(JOB_NAME,JOB_GROUP)" - ondelete="cascade"/> - </constraint> - - <!-- Quartz docs recommend these indexes. --> - <index name="RHQ_QRTZ_TRIGGERS_JN_JG_IDX"> - <field ref="JOB_NAME"/> - <field ref="JOB_GROUP"/> - </index> - <index name="RHQ_QRTZ_TRIGGERS_NFT_IDX"> - <field ref="NEXT_FIRE_TIME"/> - </index> - <index name="RHQ_QRTZ_TRIGGERS_TS_IDX"> - <field ref="TRIGGER_STATE"/> - </index> - <index name="RHQ_QRTZ_TRIGGERS_TS_NFT_IDX"> - <field ref="TRIGGER_STATE"/> - <field ref="NEXT_FIRE_TIME"/> - </index> - - </table> - - <table name="RHQ_QRTZ_SIMPLE_TRIGGERS"> - <column name="TRIGGER_NAME" type="VARCHAR2" required="true" size="80"/> - <column name="TRIGGER_GROUP" type="VARCHAR2" required="true" size="80"/> - <column name="REPEAT_COUNT" type="LONG" required="true"/> - <column name="REPEAT_INTERVAL" type="LONG" required="true"/> - <column name="TIMES_TRIGGERED" type="LONG" required="true"/> - - <constraint name="RHQ_PK_QRTZ_SIMPLE_TRIGGERS"> - <primaryKey> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </primaryKey> - </constraint> - <constraint name="RHQ_FK_QRTZ_SIMPLE_TRGRS_TN_TG"> - <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" - references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" - ondelete="cascade"/> - </constraint> - - <!-- Quartz docs recommend this index. --> - <!-- Commenting out, because Oracle auto-creates an index for the - primary key column(s) and fails if you try to create another - index for the same column(s) (ips, 03/29/07). - --> - <!-- - <index name="RHQ_QRTZ_SIMPLE_TRGRS_TN_TG_IDX"> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </index> - --> - </table> - - <table name="RHQ_QRTZ_CRON_TRIGGERS"> - <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> - <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> - <column name="CRON_EXPRESSION" type="VARCHAR2" size="80" required="true"/> - <column name="TIME_ZONE_ID" type="VARCHAR2" size="80" required="false"/> - - <constraint name="RHQ_PK_QRTZ_CRON_TRIGGERS"> - <primaryKey> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </primaryKey> - </constraint> - <constraint name="RHQ_FK_QRTZ_CRON_TRIG_TN_TG"> - <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" - references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" - ondelete="cascade"/> - </constraint> - - <!-- Quartz docs recommend this index. --> - <!-- Commenting out, because Oracle auto-creates an index for the - primary key column(s) and fails if you try to create another - index for the same column(s) (ips, 03/29/07). - --> - <!-- - <index name="RHQ_QRTZ_CRON_TRGRS_TN_TG_IDX"> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </index> - --> - </table> - - <table name="RHQ_QRTZ_BLOB_TRIGGERS"> - <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> - <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> - <column name="BLOB_DATA" type="BLOB" required="false"/> - - <constraint name="RHQ_PK_QRTZ_BLOB_TRIGGERS"> - <primaryKey> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </primaryKey> - </constraint> - <constraint name="RHQ_FK_QRTZ_BLOB_TRIGG_TN_TG"> - <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" - references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" - ondelete="cascade"/> - </constraint> - - <!-- Quartz docs recommend this index. --> - <!-- Commenting out, because Oracle auto-creates an index for the - primary key column(s) and fails if you try to create another - index for the same column(s) (ips, 03/29/07). - --> - <!-- - <index name="RHQ_QRTZ_BLOB_TRGRS_TN_TG_IDX"> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </index> - --> - </table> - - <table name="RHQ_QRTZ_TRIGGER_LISTENERS"> - <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> - <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> - <column name="TRIGGER_LISTENER" type="VARCHAR2" size="80" required="true"/> - - <constraint name="RHQ_PK_QRTZ_TRIGGER_LISTENERS"> - <primaryKey> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - <field ref="TRIGGER_LISTENER"/> - </primaryKey> - </constraint> - <constraint name="RHQ_FK_QRTZ_TRGR_LSTNRS_TN_TG"> - <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" - references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" - ondelete="cascade"/> - </constraint> - - <!-- Quartz docs recommend this index. --> - <index name="RHQ_QRTZ_TRGR_LSTNRS_TN_TG_IDX"> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </index> - - </table> - - <table name="RHQ_QRTZ_FIRED_TRIGGERS"> - <column name="ENTRY_ID" primarykey="true" type="VARCHAR2" size="95" required="true"/> - <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> - <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> - <column name="INSTANCE_NAME" type="VARCHAR2" size="80" required="true"/> - <column name="FIRED_TIME" type="LONG" required="true"/> - <column name="PRIORITY" type="INTEGER" required="false"/> - <column name="STATE" type="VARCHAR2" size="16" required="true"/> - <column name="IS_VOLATILE" type="BOOLEAN" required="true"/> - <column name="JOB_NAME" type="VARCHAR2" size="80" required="false"/> - <column name="JOB_GROUP" type="VARCHAR2" size="80" required="false"/> - <column name="IS_STATEFUL" type="BOOLEAN" required="false"/> - <column name="REQUESTS_RECOVERY" type="BOOLEAN" required="false"/> - - <!-- Quartz docs recommend these indexes. --> - <index name="RHQ_QRTZ_FIRED_TRGRS_TN_IDX"> - <field ref="TRIGGER_NAME"/> - </index> - <index name="RHQ_QRTZ_FIRED_TRGRS_TG_IDX"> - <field ref="TRIGGER_GROUP"/> - </index> - <index name="RHQ_QRTZ_FIRED_TRGRS_TN_TG_IDX"> - <field ref="TRIGGER_NAME"/> - <field ref="TRIGGER_GROUP"/> - </index> - <index name="RHQ_QRTZ_FIRED_TRGRS_IN_IDX"> - <field ref="INSTANCE_NAME"/> - </index> - <index name="RHQ_QRTZ_FIRED_TRGRS_JN_IDX"> - <field ref="JOB_NAME"/> - </index> - <index name="RHQ_QRTZ_FIRED_TRGRS_JG_IDX"> - <field ref="JOB_GROUP"/> - </index> - - </table> - - <table name="RHQ_QRTZ_CALENDARS"> - <column name="CALENDAR_NAME" primarykey="true" type="VARCHAR2" size="80" required="true"/> - <column name="CALENDAR" type="BLOB" required="true"/> - </table> - - <table name="RHQ_QRTZ_PAUSED_TRIGGER_GRPS"> - <column name="TRIGGER_GROUP" primarykey="true" type="VARCHAR2" size="80" required="true"/> - </table> - - <table name="RHQ_QRTZ_SCHEDULER_STATE"> - <column name="INSTANCE_NAME" primarykey="true" type="VARCHAR2" size="80" required="true"/> - <column name="LAST_CHECKIN_TIME" type="LONG" required="true"/> - <column name="CHECKIN_INTERVAL" type="LONG" required="true"/> - <column name="RECOVERER" type="VARCHAR2" size="80" required="false"/> - </table> - - <table name="RHQ_QRTZ_LOCKS"> - <column name="LOCK_NAME" primarykey="true" type="VARCHAR2" size="40" required="true"/> - <data LOCK_NAME="TRIGGER_ACCESS"/> - <data LOCK_NAME="JOB_ACCESS"/> - <data LOCK_NAME="CALENDAR_ACCESS"/> - <data LOCK_NAME="STATE_ACCESS"/> - <data LOCK_NAME="MISFIRE_ACCESS"/> - </table> - -<!-- END: scheduler-schema.xml --> -<!-- BEGIN: amps-schema.xml --> - - - <table name="RHQ_PLUGIN"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="4000" type="VARCHAR2" required="false"/> - <column name="VERSION" size="200" type="VARCHAR2" required="false"/> - <column name="AMPS_VERSION" size="16" type="VARCHAR2" required="false"/> - <column name="ENABLED" type="BOOLEAN" required="true"/> - <column name="STATUS" size="16" type="VARCHAR2" required="true"/> - <column name="HELP" type="CLOB" required="false"/> - <column name="PATH" size="500" type="VARCHAR2" required="true"/> - <column name="MD5" size="100" type="VARCHAR2" required="true"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="DEPLOYMENT" size="8" type="VARCHAR2" required="true"/> - <column name="PTYPE" size="200" type="VARCHAR2" required="false"/> - <column name="PLUGIN_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> - <column name="JOBS_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> - <column name="CONTENT" type="BLOB" required="false"/> - - <index name="RHQ_PLUGIN_NAME_DEPLOY_IDX" unique="true"> - <field ref="NAME"/> - <field ref="DEPLOYMENT"/> - </index> - </table> - -<!-- END: amps-schema.xml --> -<!-- BEGIN: measurement-schema.xml --> - - <table name="RHQ_MEASUREMENT_DEF"> - - <!-- === required columns === --> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE(ID)"/> - <column name="NAME" type="VARCHAR2" size="100" required="true"/> - - <!-- === optional columns === --> - <!-- an OSGI version range - if null, the metric def applies to all versions of the associated resource type --> - <column name="RESOURCE_VERSION_RANGE" type="VARCHAR2" size="100"/> - <column name="CATEGORY" type="SMALLINT"/> - <column name="UNITS" type="SMALLINT"/> - <column name="NUMERIC_TYPE" type="SMALLINT"/> - <column name="DISPLAY_TYPE" type="SMALLINT"/> - <column name="DATA_TYPE" type="SMALLINT"/> - <column name="RAW_NUMERIC_TYPE" type="SMALLINT"/> - <column name="DEFAULT_ON" type="BOOLEAN" default="false"/> - <column name="DEFAULT_INTERVAL" type="LONG" /> - <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> - <column name="DISPLAY_ORDER" type="INTEGER" default="1000"/> - <column name="DESCRIPTION" type="VARCHAR2" size="500"/> - <column name="DESTINATION_TYPE" type="VARCHAR2" size="100"/> - - <column name="VERSION" type="INTEGER"/> - <!-- for optimistic locking --> - - <!-- === business key (RESOURCE_TYPE_ID + NAME + RAW_NUMERIC_TYPE) === --> - <index name="RHQ_METRIC_DEF_KEY_IDX" unique="true"> - <field ref="RESOURCE_TYPE_ID"/> - <field ref="NAME"/> - <field ref="RAW_NUMERIC_TYPE"/> - </index> - <index name="RHQ_METRIC_DEF_NT_IDX"> - <field ref="NUMERIC_TYPE"/> - </index> - </table> - - - <table name="RHQ_MEASUREMENT_SCHED"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - - <column name="ENABLED" type="BOOLEAN" default="false"/> - <column name="MTIME" type="LONG" /> - <column name="DEFINITION" type="INTEGER" references="RHQ_MEASUREMENT_DEF(ID)"/> - <column name="VERSION" type="INTEGER" /> - <column name="COLL_INTERVAL" type="LONG" /> - <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE(ID)"/> - <index name="RHQ_MEAS_SCHED_UNIQ" unique="true"> - <field ref="RESOURCE_ID"/> - <field ref="DEFINITION"/> - </index> - <index name="RHQ_MEAS_SCHED_RESID_IDX"> - <field ref="RESOURCE_ID"/> - </index> - </table> - - - <table name="RHQ_MEASUREMENT_BLINE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - - <column name="BL_USER_ENTERED" type="BOOLEAN" default="false" required="true"/> - <column name="BL_MIN" type="DOUBLE" required="true"/> - <column name="BL_MAX" type="DOUBLE" required="true"/> - <column name="BL_MEAN" type="DOUBLE" required="true"/> - <column name="BL_COMPUTE_TIME" type="LONG" required="true"/> - <column name="SCHEDULE_ID" type="INTEGER" required="true" references="RHQ_MEASUREMENT_SCHED(ID)"/> - <index name="RHQ_MEAS_BASELINE_CTIME_IDX"> - <field ref="BL_COMPUTE_TIME"/> - </index> - <index name="RHQ_MEAS_BASELINE_SID_IDX"> - <field ref="SCHEDULE_ID"/> - </index> - </table> - - - <table name="RHQ_MEASUREMENT_DATA_NUM_1H" cache="true" - tablespace="DEFAULT" storage-options="freelists 20"> - - <column name="TIME_STAMP" required="true" type="LONG"/> - <column name="SCHEDULE_ID" required="true" type="INTEGER"/> - <column name="VALUE" required="false" type="DOUBLE"/> - <column name="MINVALUE" required="false" type="DOUBLE"/> - <column name="MAXVALUE" required="false" type="DOUBLE"/> - - <constraint name="RHQ_MEAS_DATA_1H_ID_TIME_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - - <index name="RHQ_MEAS_DATA_1H_TIME_IDX"> - <field ref="TIME_STAMP"/> - </index> - </table> - - - <table name="RHQ_MEASUREMENT_DATA_NUM_6H" cache="true" - tablespace="DEFAULT" storage-options="freelists 20"> - - <column name="TIME_STAMP" required="true" type="LONG"/> - <column name="SCHEDULE_ID" required="true" type="INTEGER"/> - <column name="VALUE" required="false" type="DOUBLE"/> - <column name="MINVALUE" required="false" type="DOUBLE"/> - <column name="MAXVALUE" required="false" type="DOUBLE"/> - - <constraint name="RHQ_MEAS_DATA_6H_ID_TIME_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - - <index name="RHQ_MEAS_DATA_6H_TIME_IDX"> - <field ref="TIME_STAMP"/> - </index> - </table> - - - <table name="RHQ_MEASUREMENT_DATA_NUM_1D" cache="true" - tablespace="DEFAULT" storage-options="freelists 20"> - - <column name="TIME_STAMP" required="true" type="LONG"/> - <column name="SCHEDULE_ID" required="true" type="INTEGER"/> - <column name="VALUE" required="false" type="DOUBLE"/> - <column name="MINVALUE" required="false" type="DOUBLE"/> - <column name="MAXVALUE" required="false" type="DOUBLE"/> - - <constraint name="RHQ_MEAS_DATA_1D_ID_TIME_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - - <index name="RHQ_MEAS_DATA_1D_TIME_IDX"> - <field ref="TIME_STAMP" /> - </index> - </table> - - - <table name="RHQ_MEASUREMENT_DATA_TRAIT"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER" /> - <column name="VALUE" type="VARCHAR2" size="4000" /> - <constraint name="RHQ_MEAS_DATA_TRAIT_ID_TIME_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - - - <table name="RHQ_CALLTIME_DATA_KEY"> - <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> - <column name="SCHEDULE_ID" type="INTEGER" required="true"/> - <column name="CALL_DESTINATION" type="VARCHAR2" size="4000" required="true"/> - <index name="RHQ_CALLTIME_DATA_KEY_IDX" unique="true"> - <field ref="SCHEDULE_ID"/> - <field ref="CALL_DESTINATION"/> - </index> - </table> - - - <table name="RHQ_CALLTIME_DATA_VALUE" logging="false"> - <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> - <column name="KEY_ID" type="INTEGER" references="RHQ_CALLTIME_DATA_KEY" required="true"/> - <column name="BEGIN_TIME" type="LONG" required="true"/> - <column name="END_TIME" type="LONG" required="true"/> - <column name="MINIMUM" type="DOUBLE" required="true"/> - <column name="MAXIMUM" type="DOUBLE" required="true"/> - <column name="TOTAL" type="DOUBLE" required="true"/> - <column name="COUNT" type="LONG" required="true"/> - <index name="RHQ_CT_DA_VA_END_TIM_IDX"> - <field ref="END_TIME"/> - </index> - </table> - - - <table name="RHQ_AVAILABILITY"> - <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE(ID)"/> - <column name="START_TIME" type="LONG" required="true" /> - <column name="END_TIME" type="LONG" required="false" /> - <column name="AVAILABILITY_TYPE" type="SMALLINT" required="true" /> - <index name="RHQ_AVAIL_RESOURCE_START_IDX"> - <field ref="RESOURCE_ID"/> - <field ref="START_TIME"/> - </index> - <!-- only one null row can exist for any resource --> - <index name="RHQ_AVAIL_RESOURCE_END_IDX" condition="END_TIME IS NULL"> - <field ref="RESOURCE_ID"/> - <field ref="END_TIME" /> - </index> - </table> - - <table name="RHQ_RESOURCE_AVAIL"> - <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE(ID)" ondelete="cascade"/> - <column name="AVAILABILITY_TYPE" type="SMALLINT" required="true" /> - <index name="RHQ_RESOURCE_AVAIL_IDX"> - <field ref="RESOURCE_ID" /> - </index> - </table> - - <table name="RHQ_MEASUREMENT_OOB"> - <column name="SCHEDULE_ID" type="INTEGER" references="RHQ_MEASUREMENT_SCHED(ID)" required="true"/> - <column name="TIME_STAMP" type="LONG" required="true"/> - <column name="OOB_FACTOR" type="INTEGER" required="true" /> - <constraint name="RHQ_MEAS_OOB_ID_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_MEASUREMENT_OOB_TMP"> - <column name="SCHEDULE_ID" type="INTEGER" required="true"/> - <column name="TIME_STAMP" type="LONG" required="true"/> - <column name="OOB_FACTOR" type="INTEGER" required="true" /> - <constraint name="RHQ_MEAS_OOB_TMP_ID_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_NUMBERS"> - <column name="i" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true" /> - </table> - - - <table name="RHQ_MEAS_DATA_NUM_R00" logging="false"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R00_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R00_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R01" logging="false"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R01_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R01_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R02" logging="false"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R02_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R02_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R03" logging="false"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R03_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R03_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R04" logging="false"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R04_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R04_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R05" logging="false"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R05_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R05_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R06" logging="false"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R06_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R06_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R07" logging="false"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R07_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R07_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R08" logging="false"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R08_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R08_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R09" logging="false"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R09_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R09_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R10" logging="false"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R10_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R10_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R11" logging="false"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R11_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R11_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R12" logging="false"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R12_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R12_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R13" logging="false"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R13_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R13_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - <table name="RHQ_MEAS_DATA_NUM_R14" logging="false"> - <column name="TIME_STAMP" type="LONG"/> - <column name="SCHEDULE_ID" type="INTEGER"/> - <column name="VALUE" type="DOUBLE"/> - <index name="RHQ_MEAS_DATA_R14_TS_IDX"> - <field ref="TIME_STAMP"/> - </index> - <constraint name="RHQ_MEAS_DATA_NUM_R14_ID_T_PK"> - <primaryKey> - <field ref="SCHEDULE_ID"/> - <field ref="TIME_STAMP"/> - </primaryKey> - </constraint> - </table> - -<!-- END: measurement-schema.xml --> -<!-- BEGIN: content-schema.xml --> - - - <table name="RHQ_ARCHITECTURE"> - <column name="ID" default="sequence-only" initial="100" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="50" type="VARCHAR2" required="true"/> - <index name="RHQ_ARCHITECTURE_NAME_IDX" unique="true"> - <field ref="NAME"/> - </index> - </table> - - <table name="RHQ_REPO_GROUP_TYPE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - </table> - - - <table name="RHQ_REPO_GROUP"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - - <column name="REPO_GROUP_TYPE_ID" type="INTEGER" references="RHQ_REPO_GROUP_TYPE" required="true"/> - - <index name="RHQ_REPO_GROUP_IDX" unique="true"> - <field ref="NAME"/> - <field ref="REPO_GROUP_TYPE_ID"/> - </index> - </table> - - - <table name="RHQ_CONTENT_SOURCE_TYPE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="false"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="PLUGIN_NAME" size="100" type="VARCHAR2" required="false"/> - <!-- we might want this as part of natural key --> - <column name="DEFAULT_LAZY_LOAD" type="BOOLEAN" required="true"/> - <column name="DEFAULT_DOWNLOAD_MODE" size="16" type="VARCHAR2" required="true"/> - <column name="DEFAULT_SYNC_SCHEDULE" size="64" type="VARCHAR2" required="false"/> - <column name="API_CLASS" size="100" type="VARCHAR2" required="true"/> - - <column name="SOURCE_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF" required="false"/> - - <index name="RHQ_CONTENT_SOURCE_TYPE_IDX" unique="true"> - <field ref="NAME"/> - <!-- <field ref="PLUGIN_NAME"/> --> - </index> - </table> - - <table name="RHQ_CONTENT_SOURCE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="LAZY_LOAD" type="BOOLEAN" required="true"/> - <column name="DOWNLOAD_MODE" size="16" type="VARCHAR2" required="true"/> - <column name="SYNC_SCHEDULE" size="64" type="VARCHAR2" required="false"/> - <column name="LOAD_ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="CREATION_TIME" type="LONG" required="true"/> - <column name="LAST_MODIFIED_TIME" type="LONG" required="true"/> - - <column name="CONTENT_SOURCE_TYPE_ID" type="INTEGER" references="RHQ_CONTENT_SOURCE_TYPE" required="true"/> - <column name="CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> - - <index name="RHQ_CONTENT_SOURCE_IDX" unique="true"> - <field ref="NAME"/> - <field ref="CONTENT_SOURCE_TYPE_ID"/> - </index> - </table> - - <table name="RHQ_REPO"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="CREATION_TIME" type="LONG" required="true"/> - <column name="LAST_MODIFIED_TIME" type="LONG" required="true"/> - <column name="IS_CANDIDATE" type="BOOLEAN" required="true"/> - <column name="SYNC_SCHEDULE" size="64" type="VARCHAR2" required="false"/> - <column name="OWNER_ID" type="INTEGER" required="false" references="RHQ_SUBJECT" /> - <column name="IS_PRIVATE" type="BOOLEAN" required="true" /> - - <index name="RHQ_REPO_IDX" unique="true"> - <field ref="NAME"/> - </index> - </table> - - - <table name="RHQ_REPO_RELATION_TYPE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - </table> - - - <table name="RHQ_REPO_RELATION"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="RELATED_REPO_ID" type="INTEGER" references="RHQ_REPO" required="true"/> - <column name="REPO_RELATION_TYPE_ID" type="INTEGER" references="RHQ_REPO_RELATION_TYPE" required="true"/> - </table> - - - - <table name="RHQ_PACKAGE_TYPE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="false"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="CATEGORY" size="50" type="VARCHAR2" required="false"/> - <column name="DISCOVERY_INTERVAL" type="INTEGER" required="false"/> - <column name="IS_CREATION_DATA" type="BOOLEAN" required="true"/> - <column name="SUPPORTS_ARCHITECTURE" type="BOOLEAN" required="true"/> - - <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE" required="false"/> - <column name="DEPLOYMENT_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF" required="false"/> - <column name="PACKAGE_EXTRA_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG_DEF" required="false"/> - - <index name="RHQ_PACKAGE_TYPE_IDX" unique="true"> - <field ref="NAME"/> - <field ref="RESOURCE_TYPE_ID"/> - </index> - - </table> - - <table name="RHQ_PACKAGE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="CLASSIFICATION" size="200" type="VARCHAR2" required="false"/> - - <column name="PACKAGE_TYPE_ID" type="INTEGER" references="RHQ_PACKAGE_TYPE" required="true"/> - - <index name="RHQ_PACKAGE_IDX" unique="true"> - <field ref="NAME"/> - <field ref="PACKAGE_TYPE_ID"/> - </index> - </table> - - <table name="RHQ_PACKAGE_BITS"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="BITS" type="LARGEOBJECT" required="false"/> - </table> - - <table name="RHQ_PACKAGE_VERSION"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="false"/> - <column name="SHORT_DESCRIPTION" size="10000" type="CLOB" required="false"/> - <column name="LONG_DESCRIPTION" size="50000" type="CLOB" required="false"/> - <column name="VERSION" size="500" type="VARCHAR2" required="true"/> - <column name="DISPLAY_VERSION" size="500" type="VARCHAR2" required="false"/> - <column name="FILE_NAME" size="255" type="VARCHAR2" required="false"/> - <column name="FILE_SIZE" type="LONG" required="false"/> - <column name="FILE_MD5" size="32" type="VARCHAR2" required="false"/> - <column name="FILE_SHA256" size="64" type="VARCHAR2" required="false"/> - <column name="FILE_CREATION_TIME" type="LONG" required="false"/> - <column name="LICENSE_NAME" size="255" type="VARCHAR2" required="false"/> - <column name="LICENSE_VERSION" size="20" type="VARCHAR2" required="false"/> - <column name="METADATA" type="BLOB" required="false"/> - - <column name="PACKAGE_ID" type="INTEGER" references="RHQ_PACKAGE" required="true"/> - <column name="ARCHITECTURE_ID" type="INTEGER" references="RHQ_ARCHITECTURE" required="true"/> - <column name="CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> - <column name="PACKAGE_BITS_ID" type="INTEGER" references="RHQ_PACKAGE_BITS" required="false"/> - - <index name="RHQ_PACKAGE_VERSION_IDX" unique="true"> - <field ref="PACKAGE_ID"/> - <field ref="VERSION"/> - <field ref="ARCHITECTURE_ID"/> - </index> - - </table> - - <table name="RHQ_CONTENT_REQ"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="REQUEST_TYPE" type="VARCHAR2" required="true" size="20"/> - <column name="NOTES" type="VARCHAR2" required="false" size="512"/> - </table> - - <table name="RHQ_INSTALLED_PACKAGE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="INSTALLATION_TIME" type="LONG" required="false"/> - - <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE" required="true"/> - <column name="PACKAGE_VERSION_ID" type="INTEGER" references="RHQ_PACKAGE_VERSION" required="true"/> - <column name="SUBJECT_ID" type="INTEGER" references="RHQ_SUBJECT" required="false"/> - </table> - - <table name="RHQ_INSTALLED_PKG_HIST"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="STATUS" type="VARCHAR2" size="24" required="true"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="HISTORY_TIMESTAMP" type="LONG" required="false"/> - - <column name="PACKAGE_VERSION_ID" type="INTEGER" references="RHQ_PACKAGE_VERSION" required="true"/> - <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE" required="true"/> - <column name="DEPLOYMENT_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> - <column name="CONTENT_SERVICE_REQUEST_ID" type="INTEGER" references="RHQ_CONTENT_REQ" required="false"/> - </table> - - <table name="RHQ_CONTENT_SRC_SYNC"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="STATUS" type="VARCHAR2" size="16" required="true"/> - <column name="START_TIME" type="LONG" required="true"/> - <column name="END_TIME" type="LONG" required="false"/> - <column name="RESULTS" type="LONGVARCHAR" required="false"/> - <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> - </table> - - <table name="RHQ_REPO_SYNC"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="STATUS" type="VARCHAR2" size="16" required="true"/> - <column name="START_TIME" type="LONG" required="true"/> - <column name="END_TIME" type="LONG" required="false"/> - <column name="RESULTS" type="LONGVARCHAR" required="false"/> - <column name="PERCENT_COMPLETE" type="LONG" required="false"/> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - </table> - - - <table name="RHQ_PACKAGE_INST_STEP"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="STEP_KEY" type="VARCHAR2" size="500" required="true"/> - <column name="STEP_ORDER" type="INTEGER" required="true"/> - <column name="DESCRIPTION" type="VARCHAR2" size="4000" required="true"/> - <column name="ERROR_MSG" type="LONGVARCHAR" required="false"/> - <column name="RESULT" type="VARCHAR2" size="25" required="true"/> - - <column name="INSTALLED_PKG_HIST_ID" type="INTEGER" references="RHQ_INSTALLED_PKG_HIST"/> - </table> - - <table name="RHQ_REPO_RESOURCE_MAP"> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> - <column name="CTIME" type="LONG" required="true"/> - - <constraint name="RHQ_REPO_RESOURCE_MAP_KEY"> - <primaryKey> - <field ref="REPO_ID"/> - <field ref="RESOURCE_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_REPO_CONTENT_SRC_MAP"> 1 - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> - <column name="CTIME" type="LONG" required="true"/> - - <constraint name="RHQ_REPO_CONTENT_SRC_MAP_KEY"> - <primaryKey> - <field ref="REPO_ID"/> - <field ref="CONTENT_SRC_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_REPO_REPO_GROUP_MAP"> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - <column name="REPO_GROUP_ID" type="INTEGER" required="true" references="RHQ_REPO_GROUP"/> - <column name="CTIME" type="LONG" required="true"/> - - <constraint name="RHQ_REPO_REPO_GROUP_MAP_KEY"> - <primaryKey> - <field ref="REPO_ID"/> - <field ref="REPO_GROUP_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_REPO_REPO_RELATION_MAP"> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - <column name="REPO_RELATION_ID" type="INTEGER" required="true" references="RHQ_REPO_RELATION"/> - <column name="CTIME" type="LONG" required="true"/> - - <constraint name="RHQ_REPO_REPO_RELATION_MAP_KEY"> - <primaryKey> - <field ref="REPO_ID"/> - <field ref="REPO_RELATION_ID"/> - </primaryKey> - </constraint> - </table> - - - <table name="RHQ_REPO_PKG_VERSION_MAP"> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> - <column name="CTIME" type="LONG" required="true"/> - - <constraint name="RHQ_REPO_PKG_VER_MAP_KEY"> - <primaryKey> - <field ref="REPO_ID"/> - <field ref="PACKAGE_VERSION_ID"/> - </primaryKey> - </constraint> - <index name="RHQ_REPO_PKG_VER_MAP_IDX" unique="false"> - <field ref="PACKAGE_VERSION_ID"/> - </index> - </table> - - <table name="RHQ_PKG_VER_CONTENT_SRC_MAP"> - <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> - <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> - <column name="LOCATION" type="VARCHAR2" size="4000" required="true"/> - - <constraint name="RHQ_PKG_VER_CONTENT_SRC_KEY"> - <primaryKey> - <field ref="PACKAGE_VERSION_ID"/> - <field ref="CONTENT_SRC_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_PKG_PRD_MAP"> - <column name="PKG_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> - <column name="PRD_ID" type="INTEGER" required="true" references="RHQ_PRD_VER"/> - - <constraint name="RHQ_PKG_PRD_KEY"> - <primaryKey> - <field ref="PKG_ID"/> - <field ref="PRD_ID"/> - </primaryKey> - </constraint> - - </table> - - <table name="RHQ_DISTRIBUTION_TYPE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - - </table> - - <table name="RHQ_DISTRIBUTION"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="DISTRIBUTION_TYPE_ID" type="INTEGER" required="true" references="RHQ_DISTRIBUTION_TYPE"/> - <column name="LABEL" size="64" type="VARCHAR2" required="true"/> - <column name="BASE_PATH" size="256" type="VARCHAR2" required="true"/> - <column name="LAST_MODIFIED" type="LONG" required="true"/> - - <index name="RHQ_DISTRIBUTION_IDX" unique="true"> - <field ref="LABEL"/> - <field ref="BASE_PATH"/> - </index> - - </table> - - <table name="RHQ_REPO_DISTRIBUTION"> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - <column name="DISTRIBUTION_ID" type="INTEGER" required="true" references="RHQ_DISTRIBUTION"/> - <column name="LAST_MODIFIED" type="LONG" required="true"/> - - <constraint name="RHQ_REPO_DIST_MAP_KEY"> - <primaryKey> - <field ref="REPO_ID"/> - <field ref="DISTRIBUTION_ID"/> - </primaryKey> - </constraint> - </table> - - - - <table name="RHQ_DISTRIBUTION_FILE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="DISTRIBUTION_ID" type="INTEGER" required="true" references="RHQ_DISTRIBUTION"/> - <column name="RELATIVE_FILENAME" size="256" type="VARCHAR2" required="true"/> - <!--<column name="FILE_SIZE" type="NUMBER" required="true"/>--> - <column name="MD5SUM" size="64" type="VARCHAR2" required="true"/> - <column name="LAST_MODIFIED" type="LONG" required="true"/> - <!--<column name="CTIME" type="LONG" required="true"/>--> - - <index name="RHQ_DISTRIBUTION_FILE_IDX" unique="true"> - <field ref="DISTRIBUTION_ID"/> - <field ref="RELATIVE_FILENAME"/> - </index> - </table> - - - - - <table name="RHQ_ADVISORY"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="ADVISORY" size="64" type="VARCHAR2" required="true"/> - <column name="ADVISORY_TYPE" size="64" type="VARCHAR2" required="true" /> - <column name="ADVISORY_REL" size="64" type="VARCHAR2" required="false"/> - <column name="ADVISORY_NAME" size="64" type="VARCHAR2" required="false"/> - <column name="DESCRIPTION" size="4000" type="VARCHAR2" required="false"/> - <column name="SYNOPSIS" size="4000" type="VARCHAR2" required="true"/> - <column name="TOPIC" size="4000" type="VARCHAR2" required="false"/> - <column name="SOLUTION" size="4000" type="VARCHAR2" required="false"/> - <column name="SEVERITY" size="64" type="VARCHAR2" required="false"/> - <column name="ISSUE_DATE" type="LONG" required="false"/> - <column name="UPDATE_DATE" type="LONG" required="false"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="LAST_MODIFIED" type="LONG" required="true"/> - - <index name="RHQ_ADVISORY_NAME_UQ" unique="true"> - <field ref="ADVISORY_NAME"/> - </index> - - <index name="RHQ_ADVISORY_UQ" unique="true"> - <field ref="ADVISORY"/> - </index> - - <index name="RHQ_ADVISORY_UDATE_IDX" unique="false"> - <field ref="UPDATE_DATE"/> - </index> - </table> - - <table name="RHQ_ADVISORY_PACKAGE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> - <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> - <column name="LAST_MODIFIED" type="LONG" required="true"/> - - <index name="RHQ_ADVISORY_PKG_IDX" unique="true"> - <field ref="ADVISORY_ID"/> - <field ref="PACKAGE_VERSION_ID"/> - </index> - </table> - - <table name="RHQ_CVE"> - <column name="ID" default="sequence-only" initial="101" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="64" type="VARCHAR2" required="true"/> - </table> - - <table name="RHQ_ADVISORY_CVE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> - <column name="CVE_ID" type="INTEGER" required="true" references="RHQ_CVE"/> - <column name="LAST_MODIFIED" type="LONG" required="true"/> - - <index name="RHQ_ADVISORY_CVE_IDX" unique="true"> - <field ref="ADVISORY_ID"/> - <field ref="CVE_ID"/> - </index> - - </table> - - <table name="RHQ_ADVISORY_BUGLIST"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> - <column name="BUG_ID" size="256" type="VARCHAR2" required="true"/> - <column name="LAST_MODIFIED" type="LONG" required="true"/> - - <index name="RHQ_ADVISORY_BUG_IDX" unique="true"> - <field ref="ADVISORY_ID"/> - <field ref="BUG_ID"/> - </index> - </table> - - - <table name="RHQ_REPO_ADVISORY"> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> - <column name="LAST_MODIFIED" type="LONG" required="true"/> - - <constraint name="RHQ_REPO_ADV_MAP_KEY"> - <primaryKey> - <field ref="REPO_ID"/> - <field ref="ADVISORY_ID"/> - </primaryKey> - </constraint> - </table> - - <!-- BUNDLE_TYPE is things like "Cobbler profile" or "file-based bundle" or "puppet recipe" --> - <table name="RHQ_BUNDLE_TYPE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> - - <!-- This index is for constraint, not performance --> - <index name="RHQ_BUNDLE_TYPE_UNIQUE" unique="true"> - <field ref="NAME"/> - </index> - </table> - - <!-- BUNDLE is a named piece of content that can be versioned and installed somewhere --> - <table name="RHQ_BUNDLE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="BUNDLE_TYPE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_TYPE"/> - <column name="PACKAGE_TYPE_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_TYPE"/> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - - <!-- This index is for constraint, not performance --> - <index name="RHQ_BUNDLE_UNIQUE" unique="true"> - <field ref="BUNDLE_TYPE_ID"/> - <field ref="NAME"/> - </index> - </table> - - <!-- BUNDLE_VERSION represents an actual piece of content that needs to be installed somewhere --> - <table name="RHQ_BUNDLE_VERSION"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="VERSION" size="500" type="VARCHAR2" required="true"/> - <column name="VERSION_ORDER" type="INTEGER" required="true"/> - <column name="ACTION" type="CLOB" required="true"/> - <column name="CONFIG_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_DEF" /> - <column name="BUNDLE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE"/> - - <!-- This index is for constraint, not performance --> - <index name="RHQ_BUNDLE_VERSION_UNIQUE" unique="true"> - <field ref="BUNDLE_ID"/> - <field ref="NAME"/> - <field ref="VERSION"/> - </index> - </table> - - <!-- Many-to-many table that links many repos to a particular bundle version. destination platforms --> - <!-- would be required to have associations to the specified repos (to access required content --> - <table name="RHQ_BUNDLE_VERSION_REPO"> - <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - - <constraint name="RHQ_BUNDLE_VERSION_REPO_KEY"> - <primaryKey> - <field ref="BUNDLE_VERSION_ID"/> - <field ref="REPO_ID"/> - </primaryKey> - </constraint> - </table> - - <!-- BUNDLE_FILE represents a file that is associated with (possibly bundled inside) a bundle version --> - <table name="RHQ_BUNDLE_FILE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> - <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> - </table> - - <!-- A logical destination for a bundle deployment. Defines the platforms and directory on those targets. --> - <table name="RHQ_BUNDLE_DESTINATION"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="BUNDLE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE"/> - <column name="GROUP_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_GROUP"/> - <column name="DEPLOY_DIR" size="256" type="VARCHAR2" required="true"/> - <column name="DEST_BASE_DIR_NAME" size="200" type="VARCHAR2" required="true"/> - - <!-- This index is for constraint, not performance --> - <index name="RHQ_BUNDLE_DESTINATION_UNIQUE" unique="true"> - <field ref="BUNDLE_ID"/> - <field ref="GROUP_ID"/> - <field ref="DEPLOY_DIR"/> - </index> - </table> - - <!-- An actual deployment of a bundle version to a destination, with a specific config. Bundle deployments - can differ only on ctime, which is assumed to be different --> - <table name="RHQ_BUNDLE_DEPLOYMENT"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> - <column name="BUNDLE_DESTINATION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DESTINATION"/> - <column name="CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG" /> - <column name="SUBJECT_NAME" type="VARCHAR2" required="false" size="255"/> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="IS_LIVE" type="BOOLEAN" required="true"/> - <column name="REPLACED_BUNDLE_DEPLOYMENT_ID" type="INTEGER" required="false" references="RHQ_BUNDLE_DEPLOYMENT"/> - </table> - - <!-- Represents a bundle version that is deployed on a platform resource --> - <table name="RHQ_BUNDLE_RES_DEPLOY"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="BUNDLE_DEPLOYMENT_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DEPLOYMENT" /> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE" /> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="CTIME" type="LONG" required="true"/> - - <index name="RHQ_BUNDLE_RES_DEPLOY_IDX" unique="true"> - <field ref="BUNDLE_DEPLOYMENT_ID"/> - <field ref="RESOURCE_ID"/> - </index> - </table> - - <table name="RHQ_BUNDLE_RES_DEP_HIST"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="BUNDLE_RES_DEPLOY_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_RES_DEPLOY" /> - <column name="SUBJECT_NAME" required="false" size="255" type="VARCHAR2"/> - <column name="AUDIT_TIME" required="true" type="LONG"/> - <column name="ACTION" required="true" size="128" type="VARCHAR2"/> - <column name="INFO" required="true" size="512" type="VARCHAR2"/> - <column name="CATEGORY" required="false" size="32" type="VARCHAR2"/> - <column name="STATUS" required="true" type="VARCHAR2" size="16"/> - <column name="MESSAGE" required="false" type="LONGVARCHAR"/> - <column name="ATTACHMENT" required="false" type="LONGVARCHAR"/> - </table> - - <table name="RHQ_TAGGING_BUNDLE_MAP"> - <column name="BUNDLE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE"/> - <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> - <constraint name="RHQ_TAGGING_BUNDLE_MAP_KEY"> - <primaryKey> - <field ref="BUNDLE_ID"/> - <field ref="TAG_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_TAGGING_BUNDLE_VERSION_MAP"> - <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> - <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> - <constraint name="RHQ_TAGGING_BUNDLE_VER_MAP_KEY"> - <primaryKey> - <field ref="BUNDLE_VERSION_ID"/> - <field ref="TAG_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_TAGGING_BUNDLE_DEPLOY_MAP"> - <column name="BUNDLE_DEPLOYMENT_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DEPLOYMENT"/> - <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> - <constraint name="RHQ_TAGGING_BUNDLE_DEP_MAP_KEY"> - <primaryKey> - <field ref="BUNDLE_DEPLOYMENT_ID"/> - <field ref="TAG_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_TAGGING_BUNDLE_DEST_MAP"> - <column name="BUNDLE_DESTINATION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DESTINATION"/> - <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> - <constraint name="RHQ_TAGGING_BUNDLE_DES_MAP_KEY"> - <primaryKey> - <field ref="BUNDLE_DESTINATION_ID"/> - <field ref="TAG_ID"/> - </primaryKey> - </constraint> - </table> - - <!-- Drift Management Tables --> - <table name="RHQ_DRIFT_DEF_TEMPLATE"> - <column name="ID" default="sequence-only" initial="1001" primarykey="true" required="true" type="INTEGER"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> - <column name="CONFIG_ID" type="INTEGER" required="true" references="RHQ_CONFIG"/> - <column name="NAME" type="VARCHAR2" size="128" required="true"/> - <column name="DESCRIPTION" type="VARCHAR2" size="512" required="false"/> - <!-- true if defined by user, false if provided by plugin --> - <column name="IS_USER_DEFINED" type="BOOLEAN" required="true"/> - <!-- - Change sets are managed by the drift server plugins; therefore, we cannot maintain - a FK constraint on the change set id. And the type cannot be integer because - other back ends like MongoDB use other types that are basically variants of a - UUID - - jsanda - --> - <column name="DRIFT_CHANGE_SET_ID" type="VARCHAR2" size="64" required="false"/> - <column name="CTIME" type="LONG" required="true"/> - - <index name="RHQ_DRIFT_DEF_TEMPLATE_UNIQUE" unique="true"> - <field ref="RESOURCE_TYPE_ID"/> - <field ref="NAME"/> - </index> - </table> - - <!-- Content of a file being managed for drift. Used for diff and/or remediation --> - <table name="RHQ_DRIFT_FILE"> - <column name="HASH_ID" type="VARCHAR2" size="64" primarykey="true" required="true"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="DATA" type="LARGEOBJECT" required="false"/> - <column name="DATA_SIZE" type="LONG" required="false"/> - <column name="STATUS" type="VARCHAR2" size="20" required="true"/> - </table> - - <!-- A single drift definition defining file tracking - Note: A resource or group (todo: group, other?) can have zero or more drift configurations. - Note: The name, interval and is_enabled values are also stored withing the referenced config. - This allows us to use the config editor to manipulate all fields. - Note: Name is read-only - Note: Interval unit is millis - --> - <table name="RHQ_DRIFT_DEFINITION"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="CONFIG_ID" type="INTEGER" required="true" references="RHQ_CONFIG"/> - <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> - <column name="DRIFT_DEF_TEMPLATE_ID" type="INTEGER" required="false" references="RHQ_DRIFT_DEF_TEMPLATE"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="NAME" type="VARCHAR2" size="512" required="true"/> - <column name="DESCRIPTION" type="VARCHAR2" size="512" required="false"/> - <column name="INTERVAL" type="LONG" required="true"/> - <column name="IS_ENABLED" type="BOOLEAN" required="true"/> - <column name="DRIFT_HANDLING_MODE" type="VARCHAR2" size="20" required="true"/> - <column name="IS_PINNED" type="BOOLEAN" required="true"/> - <column name="IS_ATTACHED" type="BOOLEAN" required="true"/> - <column name="COMPLIANCE_STATUS" type="INTEGER" required="true"/> - </table> - - <!-- A set of drift records (note, this is for the JPA server plugin impl only) --> - <table name="RHQ_DRIFT_SET"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - </table> - - <!-- A drift change-set report for a resource (note, this is for the JPA server plugin impl only) --> - <table name="RHQ_DRIFT_CHANGE_SET"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="DRIFT_SET_ID" type="INTEGER" required="false" references="RHQ_DRIFT_SET"/> - <column name="CTIME" type="LONG" required="true"/> - <!-- Version 0 is initial change-set --> - <column name="VERSION" type="INTEGER" required="true"/> - <column name="CATEGORY" type="VARCHAR2" size="20" required="true"/> - <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> - <column name="DRIFT_DEFINITION_ID" type="INTEGER" required="false" references="RHQ_DRIFT_DEFINITION"/> - <!-- the drift handling mode at changeset creation time --> - <column name="DRIFT_HANDLING_MODE" type="VARCHAR2" size="20" required="true"/> - </table> - - <!-- A single occurence of drift for a resource (note, this is for the JPA server plugin impl only) --> - <table name="RHQ_DRIFT"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="CATEGORY" type="VARCHAR2" size="20" required="true"/> - <column name="DRIFT_SET_ID" type="INTEGER" required="false" references="RHQ_DRIFT_SET"/> - <column name="DRIFT_CHANGE_SET_ID" type="INTEGER" required="true" references="RHQ_DRIFT_CHANGE_SET"/> - <!-- the file path not including the base directory --> - <column name="PATH" type="VARCHAR2" size="1024" required="true"/> - <!-- the same as PATH less [/]filename.ext. Redundant storage for the purpose of strict directory search. - this field can be considered transient for serialization purposes --> - <column name="PATH_DIRECTORY" type="VARCHAR2" size="1024" required="true"/> - <column name="OLD_DRIFT_FILE" type="VARCHAR2" size="64" required="false" references="RHQ_DRIFT_FILE"/> - <column name="NEW_DRIFT_FILE" type="VARCHAR2" size="64" required="false" references="RHQ_DRIFT_FILE"/> - </table> - - -<!-- END: content-schema.xml --> -<!-- BEGIN: resource-request-schema.xml --> - - - <table name="RHQ_CREATE_RES_HIST"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="PARENT_RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> - <column name="CREATED_RESOURCE_NAME" type="VARCHAR2" size="500" required="false"/> - <column name="NEW_RESOURCE_KEY" type="VARCHAR2" required="false" size="500"/> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> - <column name="CONFIGURATION_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> - <column name="INSTALLED_PACKAGE_ID" type="INTEGER" required="false" references="RHQ_INSTALLED_PACKAGE"/> - </table> - - <table name="RHQ_DELETE_RES_HIST"> - <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> - <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> - <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> - <column name="CTIME" type="LONG" required="true"/> - <column name="MTIME" type="LONG" required="true"/> - <column name="STATUS" type="VARCHAR2" required="true" size="16"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> - </table> - -<!-- END: resource-request-schema.xml --> -<!-- BEGIN: jms-schema.xml --> - -<!-- the schema matches that which would be automatically created by the JMS subsystem --> -<!-- see deploy/jms/rhq-jdbc-state-service.xml and rhq-jdbc2-service.xml --> - - - <table name="JMS_MESSAGES"> - <column name="MESSAGEID" required="true" type="INTEGER" /> - <column name="DESTINATION" required="true" type="VARCHAR2" size="255" /> - <column name="TXID" required="false" type="INTEGER" /> - <column name="TXOP" required="false" type="CHAR" size="1" /> - <column name="MESSAGEBLOB" required="false" type="BLOB" /> - - <constraint name="JMS_MESSAGES_PKEY"> - <primaryKey> - <field ref="MESSAGEID"/> - <field ref="DESTINATION"/> - </primaryKey> - </constraint> - - <index name="JMS_MESSAGES_TXOP_TXID"> - <field ref="TXOP"/> - <field ref="TXID"/> - </index> - <index name="JMS_MESSAGES_DESTINATION"> - <field ref="DESTINATION"/> - </index> - </table> - - <table name="JMS_TRANSACTIONS"> - <column name="TXID" required="true" type="INTEGER" primarykey="true" /> - </table> - - <table name="JMS_USERS"> - <column name="USERID" required="true" type="VARCHAR2" size="32" primarykey="true" /> - <column name="PASSWD" required="true" type="VARCHAR2" size="32" /> - <column name="CLIENTID" required="false" type="VARCHAR2" size="128" /> - </table> - - <table name="JMS_ROLES"> - <column name="ROLEID" required="true" type="VARCHAR2" size="32" /> - <column name="USERID" required="true" type="VARCHAR2" size="32" /> - - <constraint name="JMS_ROLES_PKEY"> - <primaryKey> - <field ref="USERID"/> - <field ref="ROLEID"/> - </primaryKey> - </constraint> - </table> - - <table name="JMS_SUBSCRIPTIONS"> - <column name="CLIENTID" required="true" type="VARCHAR2" size="128" /> - <column name="SUBNAME" required="true" type="VARCHAR2" size="128" /> - <column name="TOPIC" required="true" type="VARCHAR2" size="255" /> - <column name="SELECTOR" required="false" type="VARCHAR2" size="255" /> - - <constraint name="JMS_SUBSCRIPTIONS_PKEY"> - <primaryKey> - <field ref="CLIENTID"/> - <field ref="SUBNAME"/> - </primaryKey> - </constraint> - </table> - -<!-- END: jms-schema.xml --> -<!-- BEGIN: obsolete-schema.xml --> - - - <!-- NOTE: The tables will be dropped in the *** REVERSE ORDER *** as listed in this file! --> - <!-- NOTE: So, put the table you want dropped first at the bottom, and so on... --> - - - <!-- !!! REMOVED FROM CONTENT-SCHEMA !!!! --> - - <table name="RHQ_DRIFT_TEMPLATE_MAP" obsolete="true"> - <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> - <column name="CONFIG_TEMPLATE_ID" type="INTEGER" required="true" references="RHQ_CONFIG_TEMPLATE"/> - </table> - - <table name="RHQ_BUNDLE_CONFIG" obsolete="true"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG" /> - <!-- this probably needs a DTYPE discriminator so we know if its a bundle or a specific bundle version --> - <column name="BUNDLE_VERSION_ID" type="INTEGER" required="false" references="RHQ_BUNDLE_VERSION"/> - <column name="BUNDLE_ID" type="INTEGER" required="false" references="RHQ_BUNDLE"/> - </table> - - <table name="RHQ_CHANNEL" obsolete="true"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - <column name="CREATION_TIME" type="LONG" required="true"/> - <column name="LAST_MODIFIED_TIME" type="LONG" required="true"/> - - <index name="RHQ_CHANNEL_IDX" unique="true"> - <field ref="NAME"/> - </index> - </table> - - <table name="RHQ_CHANNEL_RESOURCE_MAP" obsolete="true"> - <column name="CHANNEL_ID" type="INTEGER" required="true" references="RHQ_CHANNEL"/> - <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> - <column name="CTIME" type="LONG" required="true"/> - - <constraint name="RHQ_CHANNEL_RESOURCE_MAP_KEY"> - <primaryKey> - <field ref="CHANNEL_ID"/> - <field ref="RESOURCE_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_CHANNEL_CONTENT_SRC_MAP" obsolete="true"> - <column name="CHANNEL_ID" type="INTEGER" required="true" references="RHQ_CHANNEL"/> - <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> - <column name="CTIME" type="LONG" required="true"/> - - <constraint name="RHQ_CHAN_CONTENT_SRC_MAP_KEY"> - <primaryKey> - <field ref="CHANNEL_ID"/> - <field ref="CONTENT_SRC_ID"/> - </primaryKey> - </constraint> - </table> - - <table name="RHQ_CHANNEL_PKG_VERSION_MAP" obsolete="true"> - <column name="CHANNEL_ID" type="INTEGER" required="true" references="RHQ_CHANNEL"/> - <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> - <column name="CTIME" type="LONG" required="true"/> - - <constraint name="RHQ_CHANNEL_PKG_VER_MAP_KEY"> - <primaryKey> - <field ref="CHANNEL_ID"/> - <field ref="PACKAGE_VERSION_ID"/> - </primaryKey> - </constraint> - </table> - - <!-- !!! REMOVED FROM MEASUREMENT-SCHEMA !!!! --> - - <table name="RHQ_MEASUREMENT_OOB" obsolete="true"> - <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> - <column name="SCHEDULE_ID" type="INTEGER" references="RHQ_MEASUREMENT_SCHED(ID)" required="true"/> - <column name="OCCURRED" type="LONG" required="true"/> - <column name="DIFF" type="DOUBLE" required="true"/> - - <index name="RHQ_MEASUREMENT_OOB_IDX" unique="true"> - <field ref="SCHEDULE_ID" /> - <field ref="OCCURRED" /> - </index> - </table> - - - <table name="RHQ_TAG" obsolete="true"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> - <column name="NAME" size="200" type="VARCHAR2" required="true"/> - <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> - </table> - - <table name="RHQ_REPO_TAG_MAP" obsolete="true"> - <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> - <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAG"/> - - <constraint name="RHQ_REPO_TAG_MAP_KEY"> - <primaryKey> - <field ref="REPO_ID"/> - <field ref="TAG_ID"/> - </primaryKey> - </constraint> - </table> - - -<!-- END: obsolete-schema.xml --> -</dbsetup> diff --git a/modules/enterprise/gui/pom.xml b/modules/enterprise/gui/pom.xml index e6e5807..003e4b6 100644 --- a/modules/enterprise/gui/pom.xml +++ b/modules/enterprise/gui/pom.xml @@ -28,7 +28,6 @@ </activation> <modules> <module>portal-war</module> - <module>installer</module> <module>content_http-war</module> <module>coregui</module> <module>rest-war</module> diff --git a/modules/enterprise/gui/portal-war/pom.xml b/modules/enterprise/gui/portal-war/pom.xml index 2436579..afe8498 100644 --- a/modules/enterprise/gui/portal-war/pom.xml +++ b/modules/enterprise/gui/portal-war/pom.xml @@ -392,7 +392,7 @@ <rhq.rootDir>../../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> <rhq.deploymentName>${project.build.finalName}.war</rhq.deploymentName> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/${rhq.deploymentName}</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.earDeployDir}/${rhq.deploymentName}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/enterprise/gui/rest-war/pom.xml b/modules/enterprise/gui/rest-war/pom.xml index 2457c92..f14c61c 100644 --- a/modules/enterprise/gui/rest-war/pom.xml +++ b/modules/enterprise/gui/rest-war/pom.xml @@ -91,7 +91,7 @@ <rhq.rootDir>../../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> <rhq.deploymentName>${project.build.finalName}.war</rhq.deploymentName> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/${rhq.deploymentName}</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.earDeployDir}/${rhq.deploymentName}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/enterprise/pom.xml b/modules/enterprise/pom.xml index 47dd08a..5f7eebd 100644 --- a/modules/enterprise/pom.xml +++ b/modules/enterprise/pom.xml @@ -28,7 +28,7 @@ <module>comm</module> <module>agent</module> <module>agentupdate</module> - <module>server/container-lib</module> + <!-- <module>server/container-lib</module> --> <!-- TODO: do we still need this? --> <module>server/xml-schemas</module> <module>server/jar</module> <module>server/safe-invoker</module> @@ -57,7 +57,7 @@ <module>comm</module> <module>agent</module> <module>agentupdate</module> - <module>server/container-lib</module> + <!-- <module>server/container-lib</module> --> <!-- TODO: do we still need this? --> <module>server/xml-schemas</module> <module>server/jar</module> <module>server/safe-invoker</module> diff --git a/modules/enterprise/remoting/cli/pom.xml b/modules/enterprise/remoting/cli/pom.xml index 7e50ff5..3c50a21 100644 --- a/modules/enterprise/remoting/cli/pom.xml +++ b/modules/enterprise/remoting/cli/pom.xml @@ -212,7 +212,7 @@ <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> <rhq.projectJar>${project.build.finalName}.zip</rhq.projectJar> <rhq.deploymentZip>rhq-remoting-cli-${project.version}.zip</rhq.deploymentZip> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-client</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.earDeployDir}/rhq-downloads/rhq-client</rhq.deploymentDir> </properties>
<build> diff --git a/modules/enterprise/scripting/api/pom.xml b/modules/enterprise/scripting/api/pom.xml index aed7401..2a705b3 100644 --- a/modules/enterprise/scripting/api/pom.xml +++ b/modules/enterprise/scripting/api/pom.xml @@ -33,7 +33,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/lib</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.earLibDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/enterprise/scripting/javascript/pom.xml b/modules/enterprise/scripting/javascript/pom.xml index 50a0ddb..c2363a5 100644 --- a/modules/enterprise/scripting/javascript/pom.xml +++ b/modules/enterprise/scripting/javascript/pom.xml @@ -79,7 +79,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/lib</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.earLibDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/enterprise/scripting/python/pom.xml b/modules/enterprise/scripting/python/pom.xml index e936d57..34e5231 100644 --- a/modules/enterprise/scripting/python/pom.xml +++ b/modules/enterprise/scripting/python/pom.xml @@ -78,7 +78,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/lib</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.earLibDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/enterprise/server/appserver/pom.xml b/modules/enterprise/server/appserver/pom.xml index 1ae6cdb..66fcc3e 100644 --- a/modules/enterprise/server/appserver/pom.xml +++ b/modules/enterprise/server/appserver/pom.xml @@ -277,10 +277,6 @@ <fileset dir="${basedir}/target/${project.build.finalName}" /> </copy>
- <property name="rhq.earDoDeploy" location="${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}.dodeploy" /> - <echo>*** Deleting ${rhq.earDoDeploy}.dodeploy...</echo> - <delete file="${rhq.earDoDeploy}" /> - <!-- Make sure shell scripts are readable and executable. --> <chmod perm="ug+x" verbose="true"> <fileset dir="${deployment.dir}/bin" includes="*.sh" /> diff --git a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml index b6dfa13..d0b86f9 100644 --- a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml +++ b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml @@ -76,12 +76,12 @@ </fail> -->
- <property name="jboss.deploy.dir" location="${jboss.home}/standalone/deployments" /> - <!-- we will put our own JBossAS modules in our own location - this will augment JBossAS's own modules --> <property name="jboss.modules.dir" location="${project.build.outputDirectory}/modules" /> <mkdir dir="${jboss.modules.dir}" />
+ <property name="rhq.ear.dir" location="${jboss.modules.dir}/org/rhq/rhq-enterprise-server-startup-subsystem/main/deployments/${rhq.earName}" /> + <condition property="use-postgres" value="true"> <contains string="${rhq.server.database.type-mapping}" substring="postgres" casesensitive="false" /> </condition> @@ -163,16 +163,6 @@ <available file="${jboss.home}/jboss-modules.jar" type="file" property="jboss.home.is.valid" /> <fail unless="jboss.home.is.valid" message="${jboss.home} does not contain a valid JBossAS installation - aborting!" />
- <!-- TODO: THESE WERE NEEDED IN THE OLD 4.2.3 CONTAINER - WE SHOULD BE ABLE TO DELETE THESE - <echo>Installing patched hibernate jar ...</echo> - <copy file="${settings.localRepository}/hibernate/hibernate3/${hibernate3.version}/hibernate3-${hibernate3.version}.jar" - tofile="${jboss.home}/server/default/lib/hibernate3.jar" verbose="true"/> - - <echo>Installing custom container library...</echo> - <copy file="${settings.localRepository}/org/rhq/rhq-container-lib/${rhq.version}/rhq-container-lib-${rhq.version}.jar" - tofile="${jboss.home}/server/default/lib/rhq-container-lib-${rhq.version}.jar" verbose="true"/> - --> - <echo>Adding main EAR app module to ${jboss.modules.dir} ...</echo> <unzip src="${settings.localRepository}/org/rhq/rhq-enterprise-server-startup-subsystem/${project.version}/rhq-enterprise-server-startup-subsystem-${project.version}.zip" dest="${jboss.modules.dir}" /> @@ -240,7 +230,7 @@ </delete> <delete dir="${jboss.home}/bin/init.d" />
- <!--TODO - this isn't working now - we need to: + <!--TODO - embedded agent isn't working now - we need to: 1) add AS7's jars jboss-as-[jmx,server]-7.x.x.Final.jar to META-INF/embedded-agent/lib 2) get the agent to successfully see that the server is started (AgentMain.waitForServer was hanging for me) So until we fix this we need to not deploy this at all. @@ -252,11 +242,8 @@ rhq.server.embedded-agent.reset-configuration=true rhq.server.embedded-agent.disable-native-system=false
- <echo>Deploying embedded agent sar ...</echo> - <mkdir dir="${jboss.deploy.dir}/rhq-agent.sar" /> <unjar src="${settings.localRepository}/org/rhq/rhq-enterprise-server-agent-sar/${rhq.version}/rhq-enterprise-server-agent-sar-${rhq.version}.sar" - dest="${jboss.deploy.dir}/rhq-agent.sar" /> - <touch file="${jboss.deploy.dir}/rhq-agent.sar.dodeploy" /> + dest="....todo..../rhq-agent.sar" /> -->
<echo>Delete docs, README, et. al. files</echo> @@ -275,37 +262,37 @@ -->
<echo>Make sure the top level downloads directory exists</echo> - <mkdir dir="${jboss.deploy.dir}/${rhq.earName}/rhq-downloads" /> + <mkdir dir="${rhq.ear.dir}/rhq-downloads" />
<echo>Deploying static downloadable content</echo> - <copy todir="${jboss.deploy.dir}/${rhq.earName}/rhq-downloads" + <copy todir="${rhq.ear.dir}/rhq-downloads" verbose="true" failonerror="false"> <fileset dir="${basedir}/src/main/downloadable-resources" /> </copy>
<echo>Make sure our downloads directories exist</echo> - <mkdir dir="${jboss.deploy.dir}/${rhq.earName}/rhq-downloads/rhq-agent" /> - <mkdir dir="${jboss.deploy.dir}/${rhq.earName}/rhq-downloads/rhq-client" /> - <mkdir dir="${jboss.deploy.dir}/${rhq.earName}/rhq-downloads/rhq-plugins" /> - <mkdir dir="${jboss.deploy.dir}/${rhq.earName}/rhq-downloads/connectors" /> - <mkdir dir="${jboss.deploy.dir}/${rhq.earName}/rhq-downloads/bundle-deployer" /> + <mkdir dir="${rhq.ear.dir}/rhq-downloads/rhq-agent" /> + <mkdir dir="${rhq.ear.dir}/rhq-downloads/rhq-client" /> + <mkdir dir="${rhq.ear.dir}/rhq-downloads/rhq-plugins" /> + <mkdir dir="${rhq.ear.dir}/rhq-downloads/connectors" /> + <mkdir dir="${rhq.ear.dir}/rhq-downloads/bundle-deployer" />
<echo>Deploying the latest agent update binary and renaming it rhq-enterprise-agent-${rhq.version}.jar</echo> <copy file="${settings.localRepository}/org/rhq/rhq-enterprise-agentupdate/${rhq.version}/rhq-enterprise-agentupdate-${rhq.version}.jar" - tofile="${jboss.deploy.dir}/${rhq.earName}/rhq-downloads/rhq-agent/rhq-enterprise-agent-${rhq.version}.jar" + tofile="${rhq.ear.dir}/rhq-downloads/rhq-agent/rhq-enterprise-agent-${rhq.version}.jar" verbose="true" failonerror="true"/>
<echo>Deploying the latest remote client binary</echo> <copy file="${settings.localRepository}/org/rhq/rhq-remoting-cli/${rhq.version}/rhq-remoting-cli-${rhq.version}.zip" - tofile="${jboss.deploy.dir}/${rhq.earName}/rhq-downloads/rhq-client/rhq-remoting-cli-${rhq.version}.zip" + tofile="${rhq.ear.dir}/rhq-downloads/rhq-client/rhq-remoting-cli-${rhq.version}.zip" verbose="true" failonerror="false"/>
<echo>Deploying the latest command-line bundle deployer to the downloads location</echo> <copy file="${settings.localRepository}/org/rhq/rhq-ant-bundle-common/${rhq.version}/rhq-ant-bundle-common-${rhq.version}.zip" - tofile="${jboss.deploy.dir}/${rhq.earName}/rhq-downloads/bundle-deployer/rhq-bundle-deployer-${rhq.version}.zip" + tofile="${rhq.ear.dir}/rhq-downloads/bundle-deployer/rhq-bundle-deployer-${rhq.version}.zip" verbose="true" failonerror="false"/>
@@ -324,8 +311,8 @@
<target name="package-connectors"> <echo>Packaging the response-time (RT) servlet filter connectors ...</echo> - <delete file="${jboss.deploy.dir}/${rhq.earName}/rhq-downloads/connectors/connector-rtfilter.zip" /> - <zip destfile="${jboss.deploy.dir}/${rhq.earName}/rhq-downloads/connectors/connector-rtfilter.zip"> + <delete file="${rhq.ear.dir}/rhq-downloads/connectors/connector-rtfilter.zip" /> + <zip destfile="${rhq.ear.dir}/rhq-downloads/connectors/connector-rtfilter.zip"> <zipfileset dir="${settings.localRepository}/org/rhq/helpers/rhq-rtfilter/${project.version}"> <include name="rhq-rtfilter-${project.version}.jar" /> </zipfileset> @@ -336,10 +323,10 @@
<!-- rtfilter AS7 modules --> <copy file="${settings.localRepository}/org/rhq/helpers/rhq-rtfilter/${project.version}/rhq-rtfilter-${project.version}.zip" - tofile="${jboss.deploy.dir}/${rhq.earName}/rhq-downloads/connectors/rhq-rtfilter-module.zip" /> + tofile="${rhq.ear.dir}/rhq-downloads/connectors/rhq-rtfilter-module.zip" />
<copy file="${settings.localRepository}/org/rhq/helpers/rhq-rtfilter-subsystem/${project.version}/rhq-rtfilter-subsystem-${project.version}.zip" - tofile="${jboss.deploy.dir}/${rhq.earName}/rhq-downloads/connectors/rhq-rtfilter-subsystem-module.zip" /> + tofile="${rhq.ear.dir}/rhq-downloads/connectors/rhq-rtfilter-subsystem-module.zip" /> </target>
<target name="prepare-bin-dir"> diff --git a/modules/enterprise/server/client-api/pom.xml b/modules/enterprise/server/client-api/pom.xml index 08ef4a1..05e5fb9 100644 --- a/modules/enterprise/server/client-api/pom.xml +++ b/modules/enterprise/server/client-api/pom.xml @@ -81,7 +81,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/lib</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.earLibDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/enterprise/server/ear/pom.xml b/modules/enterprise/server/ear/pom.xml index add3d06..7b7f6da 100644 --- a/modules/enterprise/server/ear/pom.xml +++ b/modules/enterprise/server/ear/pom.xml @@ -866,7 +866,7 @@ <rhq.rootDir>../../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> <rhq.deploymentName>${project.build.finalName}.ear</rhq.deploymentName> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.deploymentName}</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/modules/org/rhq/rhq-enterprise-server-startup-subsystem/main/deployments/${rhq.deploymentName}</rhq.deploymentDir> </properties>
<build> @@ -922,55 +922,6 @@ <property name="deployment.dir" location="${rhq.deploymentDir}" /> <echo>*** Deleting ${deployment.dir}${file.separator}...</echo> <delete dir="${deployment.dir}" /> - <property name="dodeploy.file" location="${deployment.dir}.dodeploy" /> - <delete file="${dodeploy.file}" /> - </target> - </configuration> - <goals> - <goal>run</goal> - </goals> - </execution> - - </executions> - </plugin> - </plugins> - </build> - </profile> - - <profile> - <id>create-dodeploy-file</id> - - <properties> - <!-- can't currently use these in the File activation :( --> - <rhq.rootDir>../../../..</rhq.rootDir> - <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentName>${project.build.finalName}.ear</rhq.deploymentName> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.deploymentName}</rhq.deploymentDir> - </properties> - - <activation> - <file> - <!-- TODO(jshaughn): if and when maven allows for non-local property substitution use it. --> - <missing>../../../../dev-container/jbossas/standalone/deployments/rhq.ear.skipdeploy</missing> - </file> - </activation> - - <build> - <plugins> - - <plugin> - <artifactId>maven-antrun-plugin</artifactId> - <executions> - - <execution> - <id>deploy</id> - <phase>package</phase> - <configuration> - <target> - <property name="deployment.dir" location="${rhq.deploymentDir}" /> - <property name="dodeploy.file" location="${deployment.dir}.dodeploy" /> - <echo>*** Touching ${dodeploy.file} to force redeployment of ${rhq.deploymentName}</echo> - <touch file="${dodeploy.file}" /> </target> </configuration> <goals> diff --git a/modules/enterprise/server/jar/pom.xml b/modules/enterprise/server/jar/pom.xml index dae3778..f8cde7b 100644 --- a/modules/enterprise/server/jar/pom.xml +++ b/modules/enterprise/server/jar/pom.xml @@ -91,12 +91,14 @@ <version>${project.version}</version> </dependency>
+<!-- <dependency> <groupId>org.rhq</groupId> <artifactId>rhq-container-lib</artifactId> <version>${project.version}</version> </dependency> - +--> + <dependency> <groupId>com.googlecode.java-diff-utils</groupId> <artifactId>diffutils</artifactId> @@ -785,7 +787,7 @@ <rhq.rootDir>../../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> <rhq.deploymentName>${project.build.finalName}-ejb3.jar</rhq.deploymentName> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/${rhq.deploymentName}</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.earDeployDir}/${rhq.deploymentName}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/enterprise/server/plugins/alert-cli/pom.xml b/modules/enterprise/server/plugins/alert-cli/pom.xml index b29aacb..6a9c1fd 100644 --- a/modules/enterprise/server/plugins/alert-cli/pom.xml +++ b/modules/enterprise/server/plugins/alert-cli/pom.xml @@ -44,7 +44,7 @@ <properties> <rhq.rootDir>../../../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-serverplugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.serverPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/enterprise/server/plugins/alert-email/pom.xml b/modules/enterprise/server/plugins/alert-email/pom.xml index 1f9542c..cfd0d9b 100644 --- a/modules/enterprise/server/plugins/alert-email/pom.xml +++ b/modules/enterprise/server/plugins/alert-email/pom.xml @@ -50,7 +50,7 @@ <properties> <rhq.rootDir>../../../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-serverplugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.serverPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/enterprise/server/plugins/alert-irc/pom.xml b/modules/enterprise/server/plugins/alert-irc/pom.xml index 1689ad7..67fa7a2 100644 --- a/modules/enterprise/server/plugins/alert-irc/pom.xml +++ b/modules/enterprise/server/plugins/alert-irc/pom.xml @@ -47,7 +47,7 @@ <properties> <rhq.rootDir>../../../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-serverplugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.serverPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/enterprise/server/plugins/alert-log4j/pom.xml b/modules/enterprise/server/plugins/alert-log4j/pom.xml index 4c0e8af..358861c 100644 --- a/modules/enterprise/server/plugins/alert-log4j/pom.xml +++ b/modules/enterprise/server/plugins/alert-log4j/pom.xml @@ -37,7 +37,7 @@ <properties> <rhq.rootDir>../../../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-serverplugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.serverPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/enterprise/server/plugins/alert-microblog/pom.xml b/modules/enterprise/server/plugins/alert-microblog/pom.xml index 2685c85..eecd72a 100644 --- a/modules/enterprise/server/plugins/alert-microblog/pom.xml +++ b/modules/enterprise/server/plugins/alert-microblog/pom.xml @@ -45,7 +45,7 @@ <properties> <rhq.rootDir>../../../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-serverplugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.serverPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/enterprise/server/plugins/alert-mobicents/pom.xml b/modules/enterprise/server/plugins/alert-mobicents/pom.xml index c2db13e..975858f 100644 --- a/modules/enterprise/server/plugins/alert-mobicents/pom.xml +++ b/modules/enterprise/server/plugins/alert-mobicents/pom.xml @@ -37,7 +37,7 @@ <properties> <rhq.rootDir>../../../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-serverplugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.serverPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/enterprise/server/plugins/alert-operations/pom.xml b/modules/enterprise/server/plugins/alert-operations/pom.xml index 8566724..90df568 100644 --- a/modules/enterprise/server/plugins/alert-operations/pom.xml +++ b/modules/enterprise/server/plugins/alert-operations/pom.xml @@ -93,7 +93,7 @@ <properties> <rhq.rootDir>../../../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-serverplugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.serverPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/enterprise/server/plugins/alert-roles/pom.xml b/modules/enterprise/server/plugins/alert-roles/pom.xml index 2892ee7..7ba6e6f 100644 --- a/modules/enterprise/server/plugins/alert-roles/pom.xml +++ b/modules/enterprise/server/plugins/alert-roles/pom.xml @@ -48,7 +48,7 @@ <properties> <rhq.rootDir>../../../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-serverplugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.serverPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/enterprise/server/plugins/alert-scriptlang/pom.xml b/modules/enterprise/server/plugins/alert-scriptlang/pom.xml index 7bf1c2c..f32dffd 100644 --- a/modules/enterprise/server/plugins/alert-scriptlang/pom.xml +++ b/modules/enterprise/server/plugins/alert-scriptlang/pom.xml @@ -67,7 +67,7 @@ <properties> <rhq.rootDir>../../../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-serverplugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.serverPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/enterprise/server/plugins/alert-sms/pom.xml b/modules/enterprise/server/plugins/alert-sms/pom.xml index c78efd9..ce11197 100644 --- a/modules/enterprise/server/plugins/alert-sms/pom.xml +++ b/modules/enterprise/server/plugins/alert-sms/pom.xml @@ -61,7 +61,7 @@ <properties> <rhq.rootDir>../../../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-serverplugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.serverPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/enterprise/server/plugins/alert-snmp/pom.xml b/modules/enterprise/server/plugins/alert-snmp/pom.xml index 9c6721d..dfb59aa 100644 --- a/modules/enterprise/server/plugins/alert-snmp/pom.xml +++ b/modules/enterprise/server/plugins/alert-snmp/pom.xml @@ -45,7 +45,7 @@ <properties> <rhq.rootDir>../../../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-serverplugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.serverPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/enterprise/server/plugins/alert-subject/pom.xml b/modules/enterprise/server/plugins/alert-subject/pom.xml index 07aacfe..de85cf5 100644 --- a/modules/enterprise/server/plugins/alert-subject/pom.xml +++ b/modules/enterprise/server/plugins/alert-subject/pom.xml @@ -37,7 +37,7 @@ <properties> <rhq.rootDir>../../../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-serverplugins + <rhq.deploymentDir>${rhq.containerDir}/${rhq.serverPluginDir} </rhq.deploymentDir> </properties>
diff --git a/modules/enterprise/server/plugins/ant-bundle/pom.xml b/modules/enterprise/server/plugins/ant-bundle/pom.xml index 9b6df63..6a1b367 100644 --- a/modules/enterprise/server/plugins/ant-bundle/pom.xml +++ b/modules/enterprise/server/plugins/ant-bundle/pom.xml @@ -121,7 +121,7 @@ <properties> <rhq.rootDir>../../../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-serverplugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.serverPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/enterprise/server/plugins/cloud/pom.xml b/modules/enterprise/server/plugins/cloud/pom.xml index 5afcd63..d621f38 100644 --- a/modules/enterprise/server/plugins/cloud/pom.xml +++ b/modules/enterprise/server/plugins/cloud/pom.xml @@ -65,7 +65,7 @@ <properties> <rhq.rootDir>../../../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-serverplugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.serverPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/enterprise/server/plugins/cobbler/pom.xml b/modules/enterprise/server/plugins/cobbler/pom.xml index 6a30d29..5b41896 100644 --- a/modules/enterprise/server/plugins/cobbler/pom.xml +++ b/modules/enterprise/server/plugins/cobbler/pom.xml @@ -89,7 +89,7 @@ <properties> <rhq.rootDir>../../../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-serverplugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.serverPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/enterprise/server/plugins/disk/pom.xml b/modules/enterprise/server/plugins/disk/pom.xml index a1f416c..570caa3 100644 --- a/modules/enterprise/server/plugins/disk/pom.xml +++ b/modules/enterprise/server/plugins/disk/pom.xml @@ -64,7 +64,7 @@ <properties> <rhq.rootDir>../../../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-serverplugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.serverPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/enterprise/server/plugins/drift-mongodb/pom.xml b/modules/enterprise/server/plugins/drift-mongodb/pom.xml index 42f1e14..ed72fd0 100644 --- a/modules/enterprise/server/plugins/drift-mongodb/pom.xml +++ b/modules/enterprise/server/plugins/drift-mongodb/pom.xml @@ -140,7 +140,7 @@ <properties> <rhq.rootDir>../../../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-serverplugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.serverPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/enterprise/server/plugins/drift-rhq/pom.xml b/modules/enterprise/server/plugins/drift-rhq/pom.xml index 8d6284d..0afed7e 100644 --- a/modules/enterprise/server/plugins/drift-rhq/pom.xml +++ b/modules/enterprise/server/plugins/drift-rhq/pom.xml @@ -59,7 +59,7 @@ <properties> <rhq.rootDir>../../../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-serverplugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.serverPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/enterprise/server/plugins/filetemplate-bundle/pom.xml b/modules/enterprise/server/plugins/filetemplate-bundle/pom.xml index ca5eee6..7d0ba17 100644 --- a/modules/enterprise/server/plugins/filetemplate-bundle/pom.xml +++ b/modules/enterprise/server/plugins/filetemplate-bundle/pom.xml @@ -96,7 +96,7 @@ <properties> <rhq.rootDir>../../../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-serverplugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.serverPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/enterprise/server/plugins/groovy-script/pom.xml b/modules/enterprise/server/plugins/groovy-script/pom.xml index c3f7985..e844a56 100644 --- a/modules/enterprise/server/plugins/groovy-script/pom.xml +++ b/modules/enterprise/server/plugins/groovy-script/pom.xml @@ -141,7 +141,7 @@ <properties> <rhq.rootDir>../../../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-serverplugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.serverPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/enterprise/server/plugins/jboss-software/pom.xml b/modules/enterprise/server/plugins/jboss-software/pom.xml index e463823..b2b1775 100644 --- a/modules/enterprise/server/plugins/jboss-software/pom.xml +++ b/modules/enterprise/server/plugins/jboss-software/pom.xml @@ -68,7 +68,7 @@ <properties> <rhq.rootDir>../../../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-serverplugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.serverPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/enterprise/server/plugins/packagetype-cli/pom.xml b/modules/enterprise/server/plugins/packagetype-cli/pom.xml index 7e67064..38bb3f4 100644 --- a/modules/enterprise/server/plugins/packagetype-cli/pom.xml +++ b/modules/enterprise/server/plugins/packagetype-cli/pom.xml @@ -37,7 +37,7 @@ <properties> <rhq.rootDir>../../../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-serverplugins + <rhq.deploymentDir>${rhq.containerDir}/${rhq.serverPluginDir} </rhq.deploymentDir> </properties>
diff --git a/modules/enterprise/server/plugins/url/pom.xml b/modules/enterprise/server/plugins/url/pom.xml index 835c276..c141d2a 100644 --- a/modules/enterprise/server/plugins/url/pom.xml +++ b/modules/enterprise/server/plugins/url/pom.xml @@ -73,7 +73,7 @@ <properties> <rhq.rootDir>../../../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-serverplugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.serverPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/enterprise/server/plugins/yum/pom.xml b/modules/enterprise/server/plugins/yum/pom.xml index f680d2e..75c478c 100644 --- a/modules/enterprise/server/plugins/yum/pom.xml +++ b/modules/enterprise/server/plugins/yum/pom.xml @@ -58,7 +58,7 @@ <properties> <rhq.rootDir>../../../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-serverplugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.serverPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/enterprise/server/pom.xml b/modules/enterprise/server/pom.xml index 15f3580..0813ceb 100644 --- a/modules/enterprise/server/pom.xml +++ b/modules/enterprise/server/pom.xml @@ -25,7 +25,7 @@ </activation> <modules> <module>xml-schemas</module> - <module>container-lib</module> + <!-- <module>container-lib</module> --> <!-- TODO: do we need this still? --> <module>jar</module> <module>sars</module> <module>plugins</module> @@ -47,7 +47,7 @@ </activation> <modules> <module>xml-schemas</module> - <module>container-lib</module> + <!-- <module>container-lib</module> --> <!-- TODO: do we need this still? --> <module>jar</module> <module>safe-invoker</module> </modules> diff --git a/modules/enterprise/server/safe-invoker/pom.xml b/modules/enterprise/server/safe-invoker/pom.xml index 3bde4f5..d216e87 100644 --- a/modules/enterprise/server/safe-invoker/pom.xml +++ b/modules/enterprise/server/safe-invoker/pom.xml @@ -35,7 +35,7 @@ <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> <rhq.deploymentName>${project.build.finalName}.jar</rhq.deploymentName> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/lib</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.earLibDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/enterprise/server/sars/services-sar/pom.xml b/modules/enterprise/server/sars/services-sar/pom.xml index 2bed88f..40044b2 100644 --- a/modules/enterprise/server/sars/services-sar/pom.xml +++ b/modules/enterprise/server/sars/services-sar/pom.xml @@ -57,7 +57,7 @@ <rhq.rootDir>../../../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> <rhq.deploymentName>${project.build.finalName}.sar</rhq.deploymentName> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/${rhq.deploymentName}</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.earDeployDir}/${rhq.deploymentName}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/enterprise/server/startup-subsystem/pom.xml b/modules/enterprise/server/startup-subsystem/pom.xml index 8f97035..a7ed12f 100644 --- a/modules/enterprise/server/startup-subsystem/pom.xml +++ b/modules/enterprise/server/startup-subsystem/pom.xml @@ -47,7 +47,7 @@ <groupId>org.rhq</groupId> <artifactId>rhq-enterprise-server-ear</artifactId> <type>ear</type> - <outputDirectory>${project.build.directory}/deployments/rhq.ear</outputDirectory> + <outputDirectory>${project.build.directory}/deployments/${rhq.earName}</outputDirectory> </artifactItem> </artifactItems> </configuration> diff --git a/modules/enterprise/server/xml-schemas/pom.xml b/modules/enterprise/server/xml-schemas/pom.xml index 49391a9..f2cd463 100644 --- a/modules/enterprise/server/xml-schemas/pom.xml +++ b/modules/enterprise/server/xml-schemas/pom.xml @@ -148,7 +148,7 @@ <properties> <rhq.rootDir>../../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/lib</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.earLibDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/helpers/rtfilter/pom.xml b/modules/helpers/rtfilter/pom.xml index 466208f..dcb0402 100644 --- a/modules/helpers/rtfilter/pom.xml +++ b/modules/helpers/rtfilter/pom.xml @@ -87,12 +87,10 @@ <profile> <id>dev</id>
- <!-- TODO - make this build an AS7 module and put it in the modules location --> - <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/lib</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.earLibDir}</rhq.deploymentDir> </properties>
<build> @@ -107,13 +105,10 @@ <phase>compile</phase> <configuration> <target> - <!-- TODO: this is for the old 4.2.3 container, put this in the proper AS7 location --> - <!-- <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}" /> - --> </target> </configuration> <goals> diff --git a/modules/integration-tests/mod_cluster-plugin-test/pom.xml b/modules/integration-tests/mod_cluster-plugin-test/pom.xml index fdbf4f9..ad8df87 100644 --- a/modules/integration-tests/mod_cluster-plugin-test/pom.xml +++ b/modules/integration-tests/mod_cluster-plugin-test/pom.xml @@ -270,7 +270,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/plugins/JBossOSGi/pom.xml b/modules/plugins/JBossOSGi/pom.xml index d2521b1..9cd2335 100644 --- a/modules/plugins/JBossOSGi/pom.xml +++ b/modules/plugins/JBossOSGi/pom.xml @@ -40,7 +40,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/plugins/aliases/pom.xml b/modules/plugins/aliases/pom.xml index 38974aa..edf8b01 100644 --- a/modules/plugins/aliases/pom.xml +++ b/modules/plugins/aliases/pom.xml @@ -188,7 +188,7 @@ <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> <rhq.deploymentDir> - ${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins + ${rhq.containerDir}/${rhq.agentPluginDir} </rhq.deploymentDir> </properties>
diff --git a/modules/plugins/ant-bundle/pom.xml b/modules/plugins/ant-bundle/pom.xml index 14c7d85..172cce8 100644 --- a/modules/plugins/ant-bundle/pom.xml +++ b/modules/plugins/ant-bundle/pom.xml @@ -191,7 +191,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/plugins/apache/pom.xml b/modules/plugins/apache/pom.xml index e3e0da7..13588ed 100644 --- a/modules/plugins/apache/pom.xml +++ b/modules/plugins/apache/pom.xml @@ -250,7 +250,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/plugins/augeas/pom.xml b/modules/plugins/augeas/pom.xml index 93ec635..3617648 100644 --- a/modules/plugins/augeas/pom.xml +++ b/modules/plugins/augeas/pom.xml @@ -120,7 +120,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/plugins/byteman/pom.xml b/modules/plugins/byteman/pom.xml index 2070bbe..8366602 100644 --- a/modules/plugins/byteman/pom.xml +++ b/modules/plugins/byteman/pom.xml @@ -160,7 +160,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/plugins/cobbler/pom.xml b/modules/plugins/cobbler/pom.xml index 01bfa43..67c1145 100644 --- a/modules/plugins/cobbler/pom.xml +++ b/modules/plugins/cobbler/pom.xml @@ -193,7 +193,7 @@ <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> <rhq.deploymentDir> - ${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins + ${rhq.containerDir}/${rhq.agentPluginDir} </rhq.deploymentDir> </properties>
diff --git a/modules/plugins/cron/pom.xml b/modules/plugins/cron/pom.xml index ce84e65..b248d67 100644 --- a/modules/plugins/cron/pom.xml +++ b/modules/plugins/cron/pom.xml @@ -182,7 +182,7 @@ <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> <rhq.deploymentDir> - ${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins + ${rhq.containerDir}/${rhq.agentPluginDir} </rhq.deploymentDir> </properties>
diff --git a/modules/plugins/database/pom.xml b/modules/plugins/database/pom.xml index 17307b6..eaf49b8 100644 --- a/modules/plugins/database/pom.xml +++ b/modules/plugins/database/pom.xml @@ -36,7 +36,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/plugins/filetemplate-bundle/pom.xml b/modules/plugins/filetemplate-bundle/pom.xml index 7ab38ae..70f6d22 100644 --- a/modules/plugins/filetemplate-bundle/pom.xml +++ b/modules/plugins/filetemplate-bundle/pom.xml @@ -169,7 +169,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/plugins/grub/pom.xml b/modules/plugins/grub/pom.xml index 7375911..fb03e5d 100644 --- a/modules/plugins/grub/pom.xml +++ b/modules/plugins/grub/pom.xml @@ -179,7 +179,7 @@ <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> <rhq.deploymentDir> - ${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins + ${rhq.containerDir}/${rhq.agentPluginDir} </rhq.deploymentDir> </properties>
diff --git a/modules/plugins/hadoop/pom.xml b/modules/plugins/hadoop/pom.xml index f58d726..9d488f5 100644 --- a/modules/plugins/hadoop/pom.xml +++ b/modules/plugins/hadoop/pom.xml @@ -36,7 +36,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/plugins/hibernate/pom.xml b/modules/plugins/hibernate/pom.xml index 60751b2..a0eac76 100644 --- a/modules/plugins/hibernate/pom.xml +++ b/modules/plugins/hibernate/pom.xml @@ -162,7 +162,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/plugins/hosts/pom.xml b/modules/plugins/hosts/pom.xml index 39b032e..f77421f 100644 --- a/modules/plugins/hosts/pom.xml +++ b/modules/plugins/hosts/pom.xml @@ -189,7 +189,7 @@ <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> <rhq.deploymentDir> - ${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins + ${rhq.containerDir}/${rhq.agentPluginDir} </rhq.deploymentDir> </properties>
diff --git a/modules/plugins/iis/pom.xml b/modules/plugins/iis/pom.xml index 8db75e3..b8f1f5a 100644 --- a/modules/plugins/iis/pom.xml +++ b/modules/plugins/iis/pom.xml @@ -118,7 +118,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/plugins/iptables/pom.xml b/modules/plugins/iptables/pom.xml index e4b2d40..685fca8 100644 --- a/modules/plugins/iptables/pom.xml +++ b/modules/plugins/iptables/pom.xml @@ -134,7 +134,7 @@ <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> <rhq.deploymentDir> - ${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins + ${rhq.containerDir}/${rhq.agentPluginDir} </rhq.deploymentDir> </properties>
diff --git a/modules/plugins/irc/pom.xml b/modules/plugins/irc/pom.xml index f14bad8..30a576f 100644 --- a/modules/plugins/irc/pom.xml +++ b/modules/plugins/irc/pom.xml @@ -59,7 +59,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/plugins/jboss-as-5/pom.xml b/modules/plugins/jboss-as-5/pom.xml index 365f544..0822c6c 100644 --- a/modules/plugins/jboss-as-5/pom.xml +++ b/modules/plugins/jboss-as-5/pom.xml @@ -585,7 +585,7 @@ <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> <rhq.deploymentDir> - ${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins + ${rhq.containerDir}/${rhq.agentPluginDir} </rhq.deploymentDir> </properties>
diff --git a/modules/plugins/jboss-as-7/pom.xml b/modules/plugins/jboss-as-7/pom.xml index e13b21d..c6265ae 100644 --- a/modules/plugins/jboss-as-7/pom.xml +++ b/modules/plugins/jboss-as-7/pom.xml @@ -541,7 +541,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/plugins/jboss-as/pom.xml b/modules/plugins/jboss-as/pom.xml index b491e40..53e8149 100644 --- a/modules/plugins/jboss-as/pom.xml +++ b/modules/plugins/jboss-as/pom.xml @@ -288,7 +288,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/plugins/jboss-cache-v3/pom.xml b/modules/plugins/jboss-cache-v3/pom.xml index 22c3e09..aa4f232 100644 --- a/modules/plugins/jboss-cache-v3/pom.xml +++ b/modules/plugins/jboss-cache-v3/pom.xml @@ -427,7 +427,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/plugins/jboss-cache/pom.xml b/modules/plugins/jboss-cache/pom.xml index 48a1281..35d919b 100644 --- a/modules/plugins/jboss-cache/pom.xml +++ b/modules/plugins/jboss-cache/pom.xml @@ -152,7 +152,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/plugins/jdbctrace/pom.xml b/modules/plugins/jdbctrace/pom.xml index 48d7bb8..96e2e3e 100644 --- a/modules/plugins/jdbctrace/pom.xml +++ b/modules/plugins/jdbctrace/pom.xml @@ -190,7 +190,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/plugins/jira/pom.xml b/modules/plugins/jira/pom.xml index fc021bd..a863192 100644 --- a/modules/plugins/jira/pom.xml +++ b/modules/plugins/jira/pom.xml @@ -236,7 +236,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/plugins/jmx/pom.xml b/modules/plugins/jmx/pom.xml index 6a89e56..16d4245 100644 --- a/modules/plugins/jmx/pom.xml +++ b/modules/plugins/jmx/pom.xml @@ -195,7 +195,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/plugins/kickstart/pom.xml b/modules/plugins/kickstart/pom.xml index 7b85fe3..5d85bc4 100644 --- a/modules/plugins/kickstart/pom.xml +++ b/modules/plugins/kickstart/pom.xml @@ -42,7 +42,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties> <build> <plugins> diff --git a/modules/plugins/lsof/pom.xml b/modules/plugins/lsof/pom.xml index bdf1cbc..7025fb9 100644 --- a/modules/plugins/lsof/pom.xml +++ b/modules/plugins/lsof/pom.xml @@ -160,7 +160,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/plugins/mod-cluster/pom.xml b/modules/plugins/mod-cluster/pom.xml index 7a1aa83..64620e1 100644 --- a/modules/plugins/mod-cluster/pom.xml +++ b/modules/plugins/mod-cluster/pom.xml @@ -73,7 +73,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties>
<build> @@ -179,7 +179,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/plugins/mysql/pom.xml b/modules/plugins/mysql/pom.xml index 0e32d29..9e5a24e 100644 --- a/modules/plugins/mysql/pom.xml +++ b/modules/plugins/mysql/pom.xml @@ -164,7 +164,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/plugins/netservices/pom.xml b/modules/plugins/netservices/pom.xml index 9ed5d52..db8f6ba 100644 --- a/modules/plugins/netservices/pom.xml +++ b/modules/plugins/netservices/pom.xml @@ -169,7 +169,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/plugins/noop/pom.xml b/modules/plugins/noop/pom.xml index e19a9c0..1ab336f 100644 --- a/modules/plugins/noop/pom.xml +++ b/modules/plugins/noop/pom.xml @@ -44,7 +44,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir} </rhq.deploymentDir> </properties>
diff --git a/modules/plugins/nss/pom.xml b/modules/plugins/nss/pom.xml index 7ff797a..5934200 100644 --- a/modules/plugins/nss/pom.xml +++ b/modules/plugins/nss/pom.xml @@ -26,7 +26,7 @@ <rhq.rootDir>../../..</rhq.rootDir> <rhq.defaultDevContainerPath>dev-container</rhq.defaultDevContainerPath> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/rhq.ear/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/plugins/onewire/pom.xml b/modules/plugins/onewire/pom.xml index ef3a018..097fecc 100644 --- a/modules/plugins/onewire/pom.xml +++ b/modules/plugins/onewire/pom.xml @@ -78,7 +78,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/plugins/oracle/pom.xml b/modules/plugins/oracle/pom.xml index b0545ef..5ce8144 100644 --- a/modules/plugins/oracle/pom.xml +++ b/modules/plugins/oracle/pom.xml @@ -78,7 +78,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/plugins/pattern-generator/pom.xml b/modules/plugins/pattern-generator/pom.xml index c035714..bc521f2 100644 --- a/modules/plugins/pattern-generator/pom.xml +++ b/modules/plugins/pattern-generator/pom.xml @@ -36,7 +36,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/plugins/perftest/pom.xml b/modules/plugins/perftest/pom.xml index e4bb95c..e8b68fe 100644 --- a/modules/plugins/perftest/pom.xml +++ b/modules/plugins/perftest/pom.xml @@ -133,7 +133,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/plugins/platform/pom.xml b/modules/plugins/platform/pom.xml index eb3510c..143872e 100644 --- a/modules/plugins/platform/pom.xml +++ b/modules/plugins/platform/pom.xml @@ -117,7 +117,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/plugins/postfix/pom.xml b/modules/plugins/postfix/pom.xml index 40f4e80..f3539d1 100644 --- a/modules/plugins/postfix/pom.xml +++ b/modules/plugins/postfix/pom.xml @@ -187,7 +187,7 @@ <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> <rhq.deploymentDir> - ${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins + ${rhq.containerDir}/${rhq.agentPluginDir} </rhq.deploymentDir> </properties>
diff --git a/modules/plugins/postgres/pom.xml b/modules/plugins/postgres/pom.xml index 2e83b81..c565c89 100644 --- a/modules/plugins/postgres/pom.xml +++ b/modules/plugins/postgres/pom.xml @@ -163,7 +163,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/plugins/raw-config-test/pom.xml b/modules/plugins/raw-config-test/pom.xml index 62b4f33..9a618f1 100644 --- a/modules/plugins/raw-config-test/pom.xml +++ b/modules/plugins/raw-config-test/pom.xml @@ -135,7 +135,7 @@ <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> <rhq.deploymentDir> - ${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins + ${rhq.containerDir}/${rhq.agentPluginDir} </rhq.deploymentDir> </properties>
diff --git a/modules/plugins/rhq-agent/pom.xml b/modules/plugins/rhq-agent/pom.xml index ff38dc0..1dcf822 100644 --- a/modules/plugins/rhq-agent/pom.xml +++ b/modules/plugins/rhq-agent/pom.xml @@ -130,7 +130,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/plugins/rhq-server/pom.xml b/modules/plugins/rhq-server/pom.xml index 0599f90..9d1557b 100644 --- a/modules/plugins/rhq-server/pom.xml +++ b/modules/plugins/rhq-server/pom.xml @@ -178,7 +178,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/plugins/samba/pom.xml b/modules/plugins/samba/pom.xml index 420f85f..aaf326a 100644 --- a/modules/plugins/samba/pom.xml +++ b/modules/plugins/samba/pom.xml @@ -187,7 +187,7 @@ <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> <rhq.deploymentDir> - ${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins + ${rhq.containerDir}/${rhq.agentPluginDir} </rhq.deploymentDir> </properties>
diff --git a/modules/plugins/script/pom.xml b/modules/plugins/script/pom.xml index dcca3f6..77d117e 100644 --- a/modules/plugins/script/pom.xml +++ b/modules/plugins/script/pom.xml @@ -117,7 +117,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/plugins/script2/pom.xml b/modules/plugins/script2/pom.xml index c098310..672ac51 100644 --- a/modules/plugins/script2/pom.xml +++ b/modules/plugins/script2/pom.xml @@ -65,7 +65,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/plugins/services/pom.xml b/modules/plugins/services/pom.xml index dbe5b41..381168c 100644 --- a/modules/plugins/services/pom.xml +++ b/modules/plugins/services/pom.xml @@ -33,7 +33,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/plugins/snmptrapd/pom.xml b/modules/plugins/snmptrapd/pom.xml index 42594da..45801e7 100644 --- a/modules/plugins/snmptrapd/pom.xml +++ b/modules/plugins/snmptrapd/pom.xml @@ -74,7 +74,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/plugins/sshd/pom.xml b/modules/plugins/sshd/pom.xml index 8b83302..9553b61 100644 --- a/modules/plugins/sshd/pom.xml +++ b/modules/plugins/sshd/pom.xml @@ -179,7 +179,7 @@ <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> <rhq.deploymentDir> - ${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins + ${rhq.containerDir}/${rhq.agentPluginDir} </rhq.deploymentDir> </properties>
diff --git a/modules/plugins/sudoers/pom.xml b/modules/plugins/sudoers/pom.xml index dcfb969..316e07a 100644 --- a/modules/plugins/sudoers/pom.xml +++ b/modules/plugins/sudoers/pom.xml @@ -177,7 +177,7 @@ <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> <rhq.deploymentDir> - ${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins + ${rhq.containerDir}/${rhq.agentPluginDir} </rhq.deploymentDir> </properties>
diff --git a/modules/plugins/tomcat/pom.xml b/modules/plugins/tomcat/pom.xml index b605369..52c9b13 100644 --- a/modules/plugins/tomcat/pom.xml +++ b/modules/plugins/tomcat/pom.xml @@ -144,7 +144,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/plugins/twitter/pom.xml b/modules/plugins/twitter/pom.xml index b627641..223327c 100644 --- a/modules/plugins/twitter/pom.xml +++ b/modules/plugins/twitter/pom.xml @@ -34,7 +34,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/plugins/virt/pom.xml b/modules/plugins/virt/pom.xml index dc64354..a2a48da 100644 --- a/modules/plugins/virt/pom.xml +++ b/modules/plugins/virt/pom.xml @@ -205,7 +205,7 @@ <properties> <rhq.rootDir>../../..</rhq.rootDir> <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> </properties>
<build> diff --git a/modules/pom.xml b/modules/pom.xml index e40d89a..4a0ae0c 100644 --- a/modules/pom.xml +++ b/modules/pom.xml @@ -163,7 +163,7 @@ <module>enterprise/comm</module>
<!-- These are needed for the JNDI intergration tests --> - <module>enterprise/server/container-lib</module> + <!-- <module>enterprise/server/container-lib</module> --> <!-- TODO: do we still need this? --> <module>enterprise/server/xml-schemas</module> <module>enterprise/server/safe-invoker</module> <module>enterprise/server/jar</module> diff --git a/pom.xml b/pom.xml index 9703ef0..f773395 100644 --- a/pom.xml +++ b/pom.xml @@ -40,6 +40,13 @@ <rhq.earName>rhq.ear</rhq.earName> <!-- the below path is relative to {rhq-trunk} --> <rhq.defaultDevContainerPath>dev-container</rhq.defaultDevContainerPath> + <!-- path relative to under dev container path where the EAR is deployed --> + <rhq.earDeployDir>modules/org/rhq/rhq-enterprise-server-startup-subsystem/main/deployments/${rhq.earName}</rhq.earDeployDir> + <!-- path relative to under dev container path where other things are stored --> + <rhq.agentPluginDir>${rhq.earDeployDir}/rhq-downloads/rhq-plugins</rhq.agentPluginDir> + <rhq.serverPluginDir>${rhq.earDeployDir}/rhq-serverplugins</rhq.serverPluginDir> + <rhq.earLibDir>${rhq.earDeployDir}/lib</rhq.earLibDir> + <!-- set the below prop to true to enable misc extra build output --> <rhq.debug>false</rhq.debug>
commit b93a0dce5167954358d9b8f6d19dcfb54e861437 Author: John Mazzitelli mazz@redhat.com Date: Tue Nov 27 15:30:09 2012 -0500
need this so jenkins can run DBInstallationTest properly
diff --git a/modules/enterprise/server/installer/pom.xml b/modules/enterprise/server/installer/pom.xml index 82e2705..a1b2dab 100644 --- a/modules/enterprise/server/installer/pom.xml +++ b/modules/enterprise/server/installer/pom.xml @@ -172,6 +172,24 @@ </execution> </executions> </plugin> + + <plugin> + <!-- this is needed for the DBInstallationTest --> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <systemPropertyVariables> + <rhq.test.ds.type-mapping>${rhq.test.ds.type-mapping}</rhq.test.ds.type-mapping> + <rhq.test.ds.server-name>${rhq.test.ds.server-name}</rhq.test.ds.server-name> + <rhq.test.ds.db-name>${rhq.test.ds.db-name}</rhq.test.ds.db-name> + <rhq.test.ds.connection-url>${rhq.test.ds.connection-url}</rhq.test.ds.connection-url> + <rhq.db.admin.username>${rhq.db.admin.username}</rhq.db.admin.username> + <rhq.db.admin.password>${rhq.db.admin.password}</rhq.db.admin.password> + <rhq.test.ds.user-name>${rhq.test.ds.user-name}</rhq.test.ds.user-name> + <rhq.test.ds.password>${rhq.test.ds.password}</rhq.test.ds.password> + </systemPropertyVariables> + </configuration> + </plugin> + </plugins> </build>
commit 0f190c0dbf655c6e412786131d06728d49bf3f1a Author: John Mazzitelli mazz@redhat.com Date: Tue Nov 27 13:59:38 2012 -0500
the start of the new-new installer.
diff --git a/.classpath b/.classpath index 4470eb3..5cd1dde 100644 --- a/.classpath +++ b/.classpath @@ -7,7 +7,6 @@ <classpathentry kind="src" path="modules/enterprise/scripting/python/src/main/java"/> <classpathentry kind="src" path="modules/enterprise/scripting/python/src/test/java"/> <classpathentry kind="src" path="modules/enterprise/scripting/javascript/src/test/java"/> - <classpathentry kind="src" path="modules/enterprise/gui/installer/src/test/java"/> <classpathentry kind="src" path="modules/common/jboss-as-dmr-client/src/test/java"/> <classpathentry kind="src" path="modules/common/jboss-as-dmr-client/src/main/java"/> <classpathentry kind="src" path="modules/enterprise/scripting/api/src/main/java"/> @@ -56,7 +55,10 @@ <classpathentry kind="src" path="modules/enterprise/gui/coregui/target/generated-sources/gwt"/> <classpathentry kind="src" path="modules/enterprise/gui/portal-war/src/main/java"/> <classpathentry kind="src" path="modules/enterprise/gui/portal-war/src/test/java"/> + <classpathentry kind="src" path="modules/enterprise/server/installer/src/main/java"/> + <classpathentry kind="src" path="modules/enterprise/server/installer/src/test/java"/> <classpathentry kind="src" path="modules/enterprise/gui/installer/src/main/java"/> + <classpathentry kind="src" path="modules/enterprise/gui/installer/src/test/java"/> <classpathentry kind="src" path="modules/enterprise/gui/installer/target/generated-sources/gwt"/> <classpathentry kind="src" path="modules/enterprise/gui/content_http-war/src/main/java"/> <classpathentry kind="src" path="modules/enterprise/server/client-api/src/main/java"/> diff --git a/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/CoreJBossASClient.java b/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/CoreJBossASClient.java index 8cf44e1..09e1b84 100644 --- a/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/CoreJBossASClient.java +++ b/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/CoreJBossASClient.java @@ -35,6 +35,8 @@ public class CoreJBossASClient extends JBossASClient { public static final String PLATFORM_MBEAN = "platform-mbean"; public static final String DEPLOYMENT_SCANNER = "deployment-scanner"; public static final String SCANNER = "scanner"; + public static final String EXTENSION = "extension"; + public static final String MODULE = "module";
public CoreJBossASClient(ModelControllerClient client) { super(client); @@ -190,10 +192,47 @@ public class CoreJBossASClient extends JBossASClient { }
/** + * Adds a new module extension to the core system. + * + * @param name the name of the new module extension + * @throws Exception + */ + public void addExtension(String name) throws Exception { + // /extension=<name>/:add(module=<name>) + final ModelNode request = createRequest(ADD, Address.root().add(EXTENSION, name)); + request.get(MODULE).set(name); + final ModelNode response = execute(request); + if (!isSuccess(response)) { + throw new FailureException(response, "Failed to add new module extension [" + name + "]"); + } + return; + } + + /** + * Adds a new subsystem to the core system. + * + * @param name the name of the new subsystem + * @throws Exception + */ + public void addSubsystem(String name) throws Exception { + // /subsystem=<name>:add() + final ModelNode request = createRequest(ADD, Address.root().add(SUBSYSTEM, name)); + final ModelNode response = execute(request); + if (!isSuccess(response)) { + throw new FailureException(response, "Failed to add new subsystem [" + name + "]"); + } + return; + } + + /** * Invokes the management "reload" operation which will shut down all the app server services and * restart them again. This is required for certain configuration changes to take effect. * This does not shutdown the JVM itself. * + * NOTE: once this method returns, the client is probably unusable since the server side + * will probably shutdown the connection. You will need to throw away this object and rebuild + * another one with a newly reconnected {@link #getModelControllerClient() client}. + * * @throws Exception */ public void reload() throws Exception { @@ -205,6 +244,10 @@ public class CoreJBossASClient extends JBossASClient { * restart them again potentially in admin-only mode. * This does not shutdown the JVM itself. * + * NOTE: once this method returns, the client is probably unusable since the server side + * will probably shutdown the connection. You will need to throw away this object and rebuild + * another one with a newly reconnected {@link #getModelControllerClient() client}. + * * @param adminOnly if <code>true</code>, reloads the server in admin-only mode * * @throws Exception @@ -224,7 +267,12 @@ public class CoreJBossASClient extends JBossASClient { * (see {@link #shutdown(boolean)}). * This means the app server JVM will shutdown but immediately be restarted. * Note that the caller may not be returned to since the JVM in which this call is made - * will be killed. + * will be killed and if the client is co-located with the server JVM, this client will + * also die. + * + * NOTE: even if this method returns, the client is unusable since the server side + * will shutdown the connection. You will need to throw away this object and rebuild + * another one with a newly reconnected {@link #getModelControllerClient() client}. * * @throws Exception */ @@ -237,7 +285,12 @@ public class CoreJBossASClient extends JBossASClient { * If restart is set to true, the JVM will immediately be restarted again. If restart is false, * the JVM is killed and will stay down. * Note that in either case, the caller may not be returned to since the JVM in which this call is made - * will be killed. + * will be killed and if the client is co-located with the server JVM, this client will + * also die. + * + * NOTE: even if this method returns, the client is unusable since the server side + * will shutdown the connection. You will need to throw away this object and rebuild + * another one with a newly reconnected {@link #getModelControllerClient() client}. * * @param restart if true, the JVM will be restarted * @throws Exception diff --git a/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/JBossASClient.java b/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/JBossASClient.java index 93234a8..9ceb300 100644 --- a/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/JBossASClient.java +++ b/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/JBossASClient.java @@ -235,12 +235,8 @@ public class JBossASClient { * @throws Exception */ public ModelNode execute(ModelNode request) throws Exception { - try { - return getModelControllerClient().execute(request, OperationMessageHandler.logging); - } catch (Exception e) { - log.error("Failed to execute request", e); - throw e; - } + ModelControllerClient mcc = getModelControllerClient(); + return mcc.execute(request, OperationMessageHandler.logging); }
/** diff --git a/modules/enterprise/pom.xml b/modules/enterprise/pom.xml index 4e935ec..47dd08a 100644 --- a/modules/enterprise/pom.xml +++ b/modules/enterprise/pom.xml @@ -38,6 +38,7 @@ <module>server/plugins</module> <module>server/ear</module> <module>server/startup-subsystem</module> + <module>server/installer</module> <module>binding</module> <module>scripting</module> <module>server/client-api</module> @@ -68,6 +69,7 @@ <module>server/plugins</module> <module>server/ear</module> <module>server/startup-subsystem</module> + <module>server/installer</module> <module>server/appserver</module> <module>server/client-api</module> <module>server/itests-2</module> diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-installer.sh b/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-installer.sh new file mode 100644 index 0000000..969773f --- /dev/null +++ b/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-installer.sh @@ -0,0 +1,243 @@ +#!/bin/sh + +# ============================================================================= +# RHQ Server UNIX Install Script +# +# This file is used to complete the installation of the RHQ Server on a +# UNIX platform. +# +# This script is customizable by setting the following environment variables: +# +# RHQ_SERVER_DEBUG - If this is defined, the script will emit debug +# messages. If this is not defined or set to "false" +# debug messages are not emitted. +# +# RHQ_SERVER_HOME - Defines where the server's home install directory is. +# If not defined, it will be assumed to be the parent +# directory of the directory where this script lives. +# +# RHQ_SERVER_JBOSS_HOME - The location of the AS instance that will +# host RHQ. If this is set, it overrides any +# JBOSS_HOME that might be set. If this not +# set, JBOSS_HOME is used as a fallback. If +# neither is set, it is assumed the AS bundled +# under RHQ_SERVER_HOME/jbossas is to be used. +# +# RHQ_SERVER_JAVA_HOME - The location of the JRE that the server will +# use. This will be ignored if +# RHQ_SERVER_JAVA_EXE_FILE_PATH is set. +# If this and RHQ_SERVER_JAVA_EXE_FILE_PATH are +# not set, the Server's embedded JRE will be used. +# +# RHQ_SERVER_JAVA_EXE_FILE_PATH - Defines the full path to the Java +# executable to use. If this is set, +# RHQ_SERVER_JAVA_HOME is ignored. +# If this is not set, then +# $RHQ_SERVER_JAVA_HOME/bin/java +# is used. If this and +# RHQ_SERVER_JAVA_HOME are not set, the +# Server's embedded JRE will be used. +# +# RHQ_SERVER_INSTALLER_JAVA_OPTS - Java VM command line options to be +# passed into the Java VM. If this is not defined +# this script will pass in a default set of options. +# If you only want to add options to the defaults, +# then you will want to use +# RHQ_SERVER_INSTALLER_ADDITIONAL_JAVA_OPTS instead. +# +# RHQ_SERVER_INSTALLER_ADDITIONAL_JAVA_OPTS - additional Java VM command +# line options to be passed into the VM. +# This is added to +# RHQ_SERVER_INSTALLER_JAVA_OPTS; it +# is mainly used to augment the +# default set of options. This can be +# left unset if it is not needed. +# +# If the embedded JRE is to be used but is not available, the fallback +# JRE to be used will be determined by the JAVA_HOME environment variable. +# ============================================================================= + +debug_msg () +{ + # if debug variable is set, it is assumed to be on, unless its value is false + if [ -n "$RHQ_SERVER_DEBUG" ] && [ "$RHQ_SERVER_DEBUG" != "false" ]; then + echo $1 + fi +} + +# ---------------------------------------------------------------------- +# Determine what specific platform we are running on. +# Set some platform-specific variables. +# ---------------------------------------------------------------------- + +case "`uname`" in + CYGWIN*) _CYGWIN=true + ;; + Linux*) _LINUX=true + ;; + Darwin*) _DARWIN=true + ;; + SunOS*) _SOLARIS=true + ;; + AIX*) _AIX=true + ;; +esac + +# only certain platforms support the -e argument for readlink +if [ -n "${_LINUX}${_SOLARIS}${_CYGWIN}" ]; then + _READLINK_ARG="-e" +fi + +# ---------------------------------------------------------------------- +# Determine the RHQ Server installation directory. +# If RHQ_SERVER_HOME is not defined, we will assume we are running +# directly from the server installation's bin directory. +# ---------------------------------------------------------------------- + +if [ -z "$RHQ_SERVER_HOME" ]; then + _DOLLARZERO=`readlink $_READLINK_ARG "$0" 2>/dev/null || echo "$0"` + RHQ_SERVER_HOME=`dirname "$_DOLLARZERO"`/.. +else + if [ ! -d "$RHQ_SERVER_HOME" ]; then + echo "ERROR! RHQ_SERVER_HOME is not pointing to a valid directory" + echo "RHQ_SERVER_HOME: $RHQ_SERVER_HOME" + exit 1 + fi +fi + +cd "$RHQ_SERVER_HOME" +RHQ_SERVER_HOME=`pwd` + +debug_msg "RHQ_SERVER_HOME: $RHQ_SERVER_HOME" + +# ---------------------------------------------------------------------- +# Determine what JBossAS instance to use. +# If RHQ_SERVER_JBOSS_HOME and JBOSS_HOME are both not defined, we will +# assume we are to run the embedded AS instance from the RHQ +# installation directory - RHQ_SERVER_HOME/jbossas +# ---------------------------------------------------------------------- + +if [ -z "$RHQ_SERVER_JBOSS_HOME" ]; then + if [ -z "$JBOSS_HOME" ]; then + RHQ_SERVER_JBOSS_HOME="${RHQ_SERVER_HOME}/jbossas" + else + if [ ! -d "$JBOSS_HOME" ]; then + echo "ERROR! JBOSS_HOME is not pointing to a valid AS directory" + echo "JBOSS_HOME: $JBOSS_HOME" + exit 1 + fi + RHQ_SERVER_JBOSS_HOME="${JBOSS_HOME}" + fi +else + if [ ! -d "$RHQ_SERVER_JBOSS_HOME" ]; then + echo "ERROR! RHQ_SERVER_JBOSS_HOME is not pointing to a valid AS directory" + echo "RHQ_SERVER_JBOSS_HOME: $RHQ_SERVER_JBOSS_HOME" + exit 1 + fi +fi + +cd "$RHQ_SERVER_JBOSS_HOME" +RHQ_SERVER_JBOSS_HOME=`pwd` + +debug_msg "RHQ_SERVER_JBOSS_HOME: $RHQ_SERVER_JBOSS_HOME" + +if [ ! -f "${RHQ_SERVER_JBOSS_HOME}/jboss-modules.jar" ]; then + echo "ERROR! RHQ_SERVER_JBOSS_HOME is not pointing to a valid AS instance" + echo "Missing ${RHQ_SERVER_JBOSS_HOME}/jboss-modules.jar" + exit 1 +fi + +# we want the rest of this script to be able to assume cwd is the RHQ install dir +cd "$RHQ_SERVER_HOME" + +# ---------------------------------------------------------------------- +# if we are on a Mac and JAVA_HOME is not set, then set it to /usr +# as this is the default location. +# ---------------------------------------------------------------------- + +if [ -z "$JAVA_HOME" ]; then + if [ -n "$_DARWIN" ]; then + debug_msg "Running on Mac OS X, setting JAVA_HOME to /usr" + JAVA_HOME=/usr + fi +fi + +# ---------------------------------------------------------------------- +# Create the logs directory +# ---------------------------------------------------------------------- + +_LOG_DIR_PATH="${RHQ_SERVER_HOME}/logs" +if [ -n "$_CYGWIN" ]; then + _LOG_DIR_PATH=`cygpath --windows --path "$_LOG_DIR_PATH"` +fi +if [ ! -d "${_LOG_DIR_PATH}" ]; then + mkdir "${_LOG_DIR_PATH}" +fi + +# ---------------------------------------------------------------------- +# Find the Java executable and verify we have a VM available +# ---------------------------------------------------------------------- + +if [ -z "$RHQ_SERVER_JAVA_EXE_FILE_PATH" ]; then + if [ -z "$RHQ_SERVER_JAVA_HOME" ]; then + RHQ_SERVER_JAVA_HOME="${RHQ_SERVER_HOME}/jre" + if [ -d "$RHQ_SERVER_JAVA_HOME" ]; then + debug_msg "Using the embedded JRE" + else + debug_msg "No embedded JRE found - will try to use JAVA_HOME: $JAVA_HOME" + RHQ_SERVER_JAVA_HOME="$JAVA_HOME" + fi + fi + debug_msg "RHQ_SERVER_JAVA_HOME: $RHQ_SERVER_JAVA_HOME" + RHQ_SERVER_JAVA_EXE_FILE_PATH="${RHQ_SERVER_JAVA_HOME}/bin/java" +fi +debug_msg "RHQ_SERVER_JAVA_EXE_FILE_PATH: $RHQ_SERVER_JAVA_EXE_FILE_PATH" + +if [ ! -f "$RHQ_SERVER_JAVA_EXE_FILE_PATH" ]; then + echo "There is no JVM available." + echo "Please set RHQ_SERVER_JAVA_HOME or RHQ_SERVER_JAVA_EXE_FILE_PATH appropriately." + exit 1 +fi + +# ---------------------------------------------------------------------- +# Prepare the VM command line options to be passed in +# ---------------------------------------------------------------------- + +if [ -z "$RHQ_SERVER_INSTALLER_JAVA_OPTS" ]; then + RHQ_SERVER_INSTALLER_JAVA_OPTS="-Xms512M -Xmx512M -XX:PermSize=128M -XX:MaxPermSize=128M -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true" +fi + +# Add the JVM opts that we always want to specify, whether or not the user set RHQ_SERVER_INSTALLER_JAVA_OPTS. +if [ -n "$RHQ_SERVER_DEBUG" ] && [ "$RHQ_SERVER_DEBUG" != "false" ]; then + _RHQ_LOGLEVEL="DEBUG" +else + _RHQ_LOGLEVEL="INFO" +fi + +RHQ_SERVER_INSTALLER_JAVA_OPTS="${RHQ_SERVER_INSTALLER_JAVA_OPTS} -Djava.awt.headless=true -Drhq.server.properties-file=${RHQ_SERVER_HOME}/bin/rhq-server.properties -Drhq.server.installer.logdir=${RHQ_SERVER_HOME}/logs -Drhq.server.installer.loglevel=${_RHQ_LOGLEVEL}" + +# Sample JPDA settings for remote socket debugging +#RHQ_SERVER_INSTALLER_JAVA_OPTS="${RHQ_SERVER_INSTALLER_JAVA_OPTS} -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y" + +debug_msg "RHQ_SERVER_INSTALLER_JAVA_OPTS: $RHQ_SERVER_INSTALLER_JAVA_OPTS" +debug_msg "RHQ_SERVER_INSTALLER_ADDITIONAL_JAVA_OPTS: $RHQ_SERVER_INSTALLER_ADDITIONAL_JAVA_OPTS" + +# ---------------------------------------------------------------------- +# We need to add our own modules to the core set of JBossAS modules. +# ---------------------------------------------------------------------- +_RHQ_MODULES_PATH="${RHQ_SERVER_HOME}/modules" +_INTERNAL_MODULES_PATH="${RHQ_SERVER_JBOSS_HOME}/modules" +if [ -n "$_CYGWIN" ]; then + _RHQ_MODULES_PATH=`cygpath --windows --path "$_RHQ_MODULES_PATH"` + _INTERNAL_MODULES_PATH=`cygpath --windows --path "$_INTERNAL_MODULES_PATH"` +fi +_JBOSS_MODULEPATH="${_RHQ_MODULES_PATH}:${_INTERNAL_MODULES_PATH}" +debug_msg "_JBOSS_MODULEPATH: $_JBOSS_MODULEPATH" + +echo "Starting RHQ Server installer ..." + +# start the AS instance with our main installer module +"$RHQ_SERVER_JAVA_EXE_FILE_PATH" ${RHQ_SERVER_INSTALLER_JAVA_OPTS} ${RHQ_SERVER_INSTALLER_ADDITIONAL_JAVA_OPTS} -jar "${RHQ_SERVER_JBOSS_HOME}/jboss-modules.jar" -mp "$_JBOSS_MODULEPATH" org.rhq.rhq-installer-util "$@" + +_EXIT_STATUS=$? +exit $_EXIT_STATUS diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-server.sh b/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-server.sh index 95a42e9..dc93347 100644 --- a/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-server.sh +++ b/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-server.sh @@ -296,7 +296,7 @@ fi
# Add the JVM opts that we always want to specify, whether or not the user set RHQ_SERVER_JAVA_OPTS. # Note that the double equals for the policy file specification IS INTENTIONAL -RHQ_SERVER_JAVA_OPTS="-Dapp.name=rhq-server ${RHQ_SERVER_JAVA_OPTS} -Djboss.server.log.dir=${_LOG_DIR_PATH} -Djava.awt.headless=true -Dsun.lang.ClassLoader.allowArraySyntax=true -Djboss.server.default.config=standalone-full.xml -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.security.manager -Djava.security.policy==${RHQ_SERVER_HOME}/bin/rhq-server.security-policy ${_JBOSS_DEBUG_LOGGING}" +RHQ_SERVER_JAVA_OPTS="-Dapp.name=rhq-server ${RHQ_SERVER_JAVA_OPTS} -Drhq.server.home=${RHQ_SERVER_HOME} -Djboss.server.log.dir=${_LOG_DIR_PATH} -Djava.awt.headless=true -Dsun.lang.ClassLoader.allowArraySyntax=true -Djboss.server.default.config=standalone-full.xml -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.security.manager -Djava.security.policy==${RHQ_SERVER_HOME}/bin/rhq-server.security-policy ${_JBOSS_DEBUG_LOGGING}"
debug_msg "RHQ_SERVER_JAVA_OPTS: $RHQ_SERVER_JAVA_OPTS" debug_msg "RHQ_SERVER_ADDITIONAL_JAVA_OPTS: $RHQ_SERVER_ADDITIONAL_JAVA_OPTS" diff --git a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml index 5922afb..b6dfa13 100644 --- a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml +++ b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml @@ -127,7 +127,7 @@ </not> </condition>
- <!-- when predeploying, don't make people go to the installer - turn on the auto-installer --> + <!-- when predeploying, don't make people edit rhq-server.properties - turn on the auto-installer now --> <condition property="rhq.autoinstall.enabled" value="true"> <equals arg1="${predeploy}" arg2="true" /> </condition> @@ -173,6 +173,14 @@ tofile="${jboss.home}/server/default/lib/rhq-container-lib-${rhq.version}.jar" verbose="true"/> -->
+ <echo>Adding main EAR app module to ${jboss.modules.dir} ...</echo> + <unzip src="${settings.localRepository}/org/rhq/rhq-enterprise-server-startup-subsystem/${project.version}/rhq-enterprise-server-startup-subsystem-${project.version}.zip" + dest="${jboss.modules.dir}" /> + + <echo>Adding installer module to ${jboss.modules.dir} ...</echo> + <unzip src="${settings.localRepository}/org/rhq/rhq-installer-util/${project.version}/rhq-installer-util-${project.version}.zip" + dest="${jboss.modules.dir}" /> + <echo>Adding JDBC modules to ${jboss.modules.dir} ...</echo> <copy file="${settings.localRepository}/com/oracle/ojdbc6/${ojdbc6.version}/ojdbc6-${ojdbc6.version}.jar" toDir="${jboss.modules.dir}/org/rhq/oracle/main" failonerror="false" verbose="true" /> @@ -232,18 +240,6 @@ </delete> <delete dir="${jboss.home}/bin/init.d" />
- <echo>Deploying ${rhq.earName} ...</echo> - <mkdir dir="${jboss.deploy.dir}/${rhq.earName}" /> - <unjar src="${settings.localRepository}/org/rhq/rhq-enterprise-server-ear/${rhq.version}/rhq-enterprise-server-ear-${rhq.version}.ear" - dest="${jboss.deploy.dir}/${rhq.earName}" /> - <touch file="${jboss.deploy.dir}/${rhq.earName}.skipdeploy" /> - - <echo>Deploying installer webapp ...</echo> - <mkdir dir="${jboss.deploy.dir}/rhq-installer.war" /> - <unwar src="${settings.localRepository}/org/rhq/rhq-installer/${rhq.version}/rhq-installer-${rhq.version}.war" - dest="${jboss.deploy.dir}/rhq-installer.war" /> - <touch file="${jboss.deploy.dir}/rhq-installer.war.dodeploy" /> - <!--TODO - this isn't working now - we need to: 1) add AS7's jars jboss-as-[jmx,server]-7.x.x.Final.jar to META-INF/embedded-agent/lib 2) get the agent to successfully see that the server is started (AgentMain.waitForServer was hanging for me) @@ -502,12 +498,13 @@ rhq.sync.endpoint-address=false # files that are not known binary types. # rhq.server.drift.store-binary-content=${rhq.server.drift.store-binary-content}
-# Auto-Install Pre-Configuration Settings -# If you wish to circumvent the installer webapp and auto-install the server -# immediately upon first startup, make sure all of the settings above are -# correctly set for your server's deployment environment. Then make sure the -# following rhq.autoinstall properties are defined appropriately: -# rhq.autoinstall.enabled: must be true to trigger the automatic install +# Auto-Install Setup +# You normally want to install automatically when starting for the first time. +# To do so, first ensure all values in this properties file are appropriately +# set for your environment. Once you are sure all values are as you want them, +# set rhq.autoinstall.enabled=true and run the server. +# +# rhq.autoinstall.enabled: must be true to trigger the automatic install. # rhq.autoinstall.database: allowed values: auto, overwrite, skip # "auto" will create a new schema if one does not # yet exist or, if a schema does exist, will simply @@ -563,12 +560,10 @@ rhq.autoinstall.public-endpoint-address= description="If this is a release build, make sure it is properly prepared." depends="initialize, fix-perms, - prepare-postinstaller-war, developer-release-message, copy-dev-resources, deploy-postgres-ds, - deploy-oracle-ds, - undeploy-ear"> + deploy-oracle-ds">
<echo>Adding license files...</echo> <copy todir="${project.build.outputDirectory}"> @@ -582,17 +577,8 @@ rhq.autoinstall.public-endpoint-address= <chmod dir="${jboss.home}/bin" includes="*.sh" perm="ug+x" verbose="true" /> </target>
- <target name="prepare-postinstaller-war"> - <!-- nothing to do here - leaving in case we need to perform things in the future --> - </target> - <target name="developer-release-message" if="predeploy"> - <echo>!!THIS IS A DEVELOPER CONTAINER BUILD - PRE-DEPLOYING RHQ SERVER!!</echo> - </target> - - <target name="undeploy-ear" unless="predeploy"> - <echo>Preparing for release - telling AS to skip ear deployment</echo> - <touch file="${jboss.deploy.dir}/${rhq.earName}.skipdeploy" /> + <echo>!!THIS IS A DEVELOPER CONTAINER BUILD !!</echo> </target>
<target name="deploy-postgres-ds" if="predeploy-postgres"> diff --git a/modules/enterprise/server/installer/pom.xml b/modules/enterprise/server/installer/pom.xml new file mode 100644 index 0000000..82e2705 --- /dev/null +++ b/modules/enterprise/server/installer/pom.xml @@ -0,0 +1,232 @@ +<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%22%3E + + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.rhq</groupId> + <artifactId>rhq-parent</artifactId> + <version>4.6.0-SNAPSHOT</version> + <relativePath>../../../../pom.xml</relativePath> + </parent> + + <groupId>org.rhq</groupId> + <artifactId>rhq-installer-util</artifactId> + <packaging>jar</packaging> + + <name>RHQ Enterprise Installer Utility</name> + <description>The RHQ Enterprise Installer Utility</description> + + <properties> + <moduleName>org.rhq.${project.artifactId}</moduleName> + <moduleDir>org/rhq/${project.artifactId}</moduleDir> + <ant.version>1.6.5</ant.version> <!-- the version used by dbutils that we need to depend on --> + </properties> + + <dependencies> + <dependency> + <groupId>org.rhq</groupId> + <artifactId>rhq-core-util</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>org.rhq</groupId> + <artifactId>rhq-core-dbutils</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <!-- need this solely for SecurityUtils --> + <groupId>org.rhq</groupId> + <artifactId>rhq-enterprise-comm</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>org.rhq</groupId> + <artifactId>rhq-jboss-as-dmr-client</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>gnu-getopt</groupId> + <artifactId>getopt</artifactId> + </dependency> + + <!-- rhq-jboss-as-dmr-client has this as provided dep - but we need it too --> + <dependency> + <groupId>org.jboss.as</groupId> + <artifactId>jboss-as-controller-client</artifactId> + <version>${jboss.version}</version> + </dependency> + + <!-- we need to package this (and ant) in our module --> + <dependency> + <groupId>ant</groupId> + <artifactId>ant-launcher</artifactId> + <version>${ant.version}</version> + </dependency> + + <dependency> + <groupId>ant</groupId> + <artifactId>ant</artifactId> + <version>${ant.version}</version> + </dependency> + + <dependency> + <groupId>i18nlog</groupId> + <artifactId>i18nlog</artifactId> + </dependency> + + <!-- test deps --> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <version>1.9.0</version> + <scope>test</scope> + </dependency> + + </dependencies> + + <build> + <resources> + <resource> + <directory>src/main/resources</directory> + <filtering>true</filtering> + </resource> + </resources> + + <plugins> + <plugin> + <artifactId>maven-jar-plugin</artifactId> + <configuration> + <archive> + <manifest> + <mainClass>org.rhq.enterprise.server.installer.Installer</mainClass> + </manifest> + </archive> + </configuration> + </plugin> + + <plugin> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>copy-deps</id> + <phase>process-resources</phase> + <goals> + <goal>copy</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>org.rhq</groupId> + <artifactId>rhq-core-util</artifactId> + </artifactItem> + <artifactItem> + <groupId>org.rhq</groupId> + <artifactId>rhq-core-dbutils</artifactId> + </artifactItem> + <artifactItem> + <groupId>org.rhq</groupId> + <artifactId>rhq-enterprise-comm</artifactId> + </artifactItem> + <artifactItem> + <groupId>org.rhq</groupId> + <artifactId>rhq-jboss-as-dmr-client</artifactId> + </artifactItem> + <artifactItem> + <groupId>ant</groupId> + <artifactId>ant-launcher</artifactId> + </artifactItem> + <artifactItem> + <groupId>ant</groupId> + <artifactId>ant</artifactId> + </artifactItem> + <artifactItem> + <groupId>i18nlog</groupId> + <artifactId>i18nlog</artifactId> + </artifactItem> + </artifactItems> + <outputDirectory>${project.build.directory}/installer-deps</outputDirectory> + </configuration> + </execution> + </executions> + </plugin> + + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <configuration> + <descriptors> + <descriptor>src/main/scripts/module-assembly.xml</descriptor> + </descriptors> + </configuration> + <executions> + <execution> + <id>module-assembly</id> + <phase>package</phase> + <goals> + <goal>single</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + + <profiles> + <profile> + <id>dev</id> + + <properties> + <rhq.rootDir>../../../..</rhq.rootDir> + <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> + <rhq.deploymentName>${project.build.finalName}.zip</rhq.deploymentName> + <rhq.deploymentDir>${rhq.containerDir}/modules/</rhq.deploymentDir> + </properties> + + <build> + <plugins> + + <plugin> + <artifactId>maven-antrun-plugin</artifactId> + <executions> + + <execution> + <id>deploy</id> + <phase>package</phase> + <configuration> + <target> + <echo>*** Deploying installer module to ${rhq.deploymentDir} ...</echo> + <unzip src="target/${rhq.deploymentName}" + dest="${rhq.deploymentDir}"/> + </target> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + + <execution> + <id>undeploy</id> + <phase>clean</phase> + <configuration> + <target> + <echo>*** Deleting installer module ${rhq.deploymentDir}/${moduleDir} ...</echo> + <delete dir="${rhq.deploymentDir}/${moduleDir}" /> + </target> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + + </executions> + </plugin> + + </plugins> + </build> + </profile> + </profiles> +</project> diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java new file mode 100644 index 0000000..8c3812b --- /dev/null +++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java @@ -0,0 +1,195 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.installer; + +import gnu.getopt.Getopt; +import gnu.getopt.LongOpt; + +import java.util.HashMap; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * The entry point to the RHQ Installer. + * + * @author John Mazzitelli + */ +public class Installer { + private static final Log LOG = LogFactory.getLog(Installer.class); + + private InstallerConfiguration installerConfig; + + public static void main(String[] args) { + try { + LOG.info("Starting installer..."); + final Installer installer = new Installer(); + installer.doInstall(args); + } catch (Exception e) { + LOG.error("An error occurred", e); + System.exit(100); + } + + System.exit(0); + } + + public Installer() { + this.installerConfig = new InstallerConfiguration(); + } + + public InstallerConfiguration getInstallerConfiguration() { + return this.installerConfig; + } + + public void doInstall(String[] args) throws Exception { + + try { + processArguments(args); + } catch (DisplayUsageRequestedException dure) { + displayUsage(); + return; + } catch (TestRequestedException vre) { + new InstallerServiceImpl(installerConfig).test(); + return; + } + + final InstallerService installerService = new InstallerServiceImpl(installerConfig); + HashMap<String, String> serverProperties = installerService.preInstall(); + if (serverProperties == null) { + LOG.error("Auto-installation is disabled. Please fully configure rhq-server.properties"); + System.exit(1); + } + + String result = installerService.getInstallationResults(); + if (result == null) { + installerService.install(serverProperties, null, null); + LOG.info("Installation is complete. The server should be ready shortly."); + } else if (result.length() == 0) { + LOG.info("Already installed."); + System.exit(0); + } else { + LOG.error("Not properly installed: " + result); + System.exit(2); + } + + return; + } + + private void displayUsage() { + StringBuilder usage = new StringBuilder("RHQ Installer\n"); + usage.append("\t--help, -H: this help text").append("\n"); + usage.append("\t-Dname=value: set system properties for the Installer VM").append("\n"); + usage.append("\t--host=<hostname>, -h: hostname where the app server is running").append("\n"); + usage.append("\t--port=<port>, -p: talk to the app server over this management port").append("\n"); + usage.append("\t--test, -t: test the validity of the server properties (install not performed)").append("\n"); + LOG.info(usage); + } + + private void processArguments(String[] args) throws Exception { + String sopts = "-:HD:h:p:t"; + LongOpt[] lopts = { new LongOpt("help", LongOpt.NO_ARGUMENT, null, 'H'), + new LongOpt("host", LongOpt.REQUIRED_ARGUMENT, null, 'h'), + new LongOpt("port", LongOpt.REQUIRED_ARGUMENT, null, 'p'), + new LongOpt("test", LongOpt.NO_ARGUMENT, null, 't') }; + + boolean test = false; + + Getopt getopt = new Getopt("installer", args, sopts, lopts); + int code; + + while ((code = getopt.getopt()) != -1) { + switch (code) { + case ':': + case '?': { + // for now both of these should exit + displayUsage(); + throw new IllegalArgumentException(); + } + + case 1: { + // this will catch non-option arguments (which we don't currently care about) + LOG.warn("Unknown option" + getopt.getOptarg()); + break; + } + + case 'H': { + throw new DisplayUsageRequestedException(); + } + + case 'D': { + // set a system property + String sysprop = getopt.getOptarg(); + int i = sysprop.indexOf("="); + String name; + String value; + + if (i == -1) { + name = sysprop; + value = "true"; + } else { + name = sysprop.substring(0, i); + value = sysprop.substring(i + 1, sysprop.length()); + } + + System.setProperty(name, value); + LOG.info("System property set: " + name + "=" + value); + + break; + } + + case 'h': { + String hostString = getopt.getOptarg(); + if (hostString == null) { + throw new IllegalArgumentException("Missing host value"); + } + this.installerConfig.setManagementHost(hostString); + break; + } + + case 'p': { + String portString = getopt.getOptarg(); + if (portString == null) { + throw new IllegalArgumentException("Missing port value"); + } + this.installerConfig.setManagementPort(Integer.parseInt(portString)); + break; + } + + case 't': { + test = true; + break; + } + } + } + + if (test) { + throw new TestRequestedException(); + } + + return; + } + + private class DisplayUsageRequestedException extends Exception { + private static final long serialVersionUID = 1L; + } + + private class TestRequestedException extends Exception { + private static final long serialVersionUID = 1L; + } +} diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerConfiguration.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerConfiguration.java new file mode 100644 index 0000000..0852b78 --- /dev/null +++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerConfiguration.java @@ -0,0 +1,62 @@ +/* + * RHQ Management Platform + * Copyright 2012, Red Hat, Inc., and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +package org.rhq.enterprise.server.installer; + +/** + * Provides settings for the installer itself. + * + * @author John Mazzitelli + */ +public class InstallerConfiguration { + private String managementHost = "127.0.0.1"; + private int managementPort = 9999; // this is the default AS port + + public InstallerConfiguration() { + } + + // copy-constructor + public InstallerConfiguration(InstallerConfiguration orig) { + this.managementHost = orig.managementHost; + this.managementPort = orig.managementPort; + } + + public String getManagementHost() { + return managementHost; + } + + public void setManagementHost(String host) { + if (host == null || host.length() == 0) { + host = "127.0.0.1"; + } + this.managementHost = host; + } + + public int getManagementPort() { + return managementPort; + } + + public void setManagementPort(int port) { + if (port <= 0) { + port = 9999; + } + this.managementPort = port; + } +} diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerService.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerService.java new file mode 100644 index 0000000..deb8eb6 --- /dev/null +++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerService.java @@ -0,0 +1,144 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.installer; + +import java.util.ArrayList; +import java.util.HashMap; + + +/** + * @author John Mazzitelli + */ +public interface InstallerService { + + /** + * This simply verifies the server configuration but doesn't perform the actual install. + * You can use this to see if, for example, the database settings are correct or the installer + * can successfully connect to the running AS instance where RHQ is to be installed. + * + * @throws Exception if the test fails meaning something in the server configuration is not valid + */ + void test() throws Exception; + + /** + * Call this prior to installing to see if we are ready to install. + * This will do some pre-install checks - if the installation should proceed, the map of server properties is returned. + * If null is returned, the install should not proceed. + * + * @return properties if the caller should next call {@link #install(HashMap, ServerDetails, String)}. + */ + HashMap<String, String> preInstall(); + + /** + * Use this to determine if the server has already been completely installed or not. + * This returns a String to indicate the last installation attempt. If this returns null, + * then the installer has not done anything yet - you need to complete the installation. + * If an empty string is returned, it means the installer ran and it appears the application + * has successfully installed. If a non-empty string is returned, it means the installer attempted + * to complete the installation, but an error occurred. When a non-empty string is returned, + * it means that an administrator probably has to do some manual intervention because something + * went wrong with the application deployment. + * + * @return indicating of the last installation attempt (see above) + * @throws Exception if it cannot be determined if the server has been fully installed. + */ + String getInstallationResults() throws Exception; + + /** + * Starts the installation process. Once complete, the installer has nothing more it needs to do. + * + * @param serverProperties the server's settings to use. These will be persisted to + * the server's .properties file. + * @param serverDetails details on the server being installed. + * If in auto-install mode, this value is ignored and can be anything. + * @param existingSchemaOption if not in auto-install mode, this tells the installer what to do with any + * existing schema. Must be one of the names of the + * {@link ServerInstallUtil.ExistingSchemaOption} enum. + * If in auto-install mode, this value is ignored and can be anything. + * @throws Exception + */ + void install(HashMap<String, String> serverProperties, ServerDetails serverDetails, String existingSchemaOption) + throws Exception; + + /** + * Returns a list of all registered servers in the database. + * + * @param connectionUrl + * @param username + * @param password + * @return list of all existing servers registered in the database. + * @throws Exception + */ + ArrayList<String> getServerNames(String connectionUrl, String username, String password) throws Exception; + + /** + * Returns details on a specific server that is registered in the database. + * + * @param connectionUrl + * @param username + * @param password + * @param serverName the name of the server whose details are to be retrieved + * @return the details of the server or null if the server does not exist + * @throws Exception + */ + ServerDetails getServerDetails(String connectionUrl, String username, String password, String serverName) + throws Exception; + + /** + * Tests to see if there is already a schema installed. + * + * @param connectionUrl + * @param username + * @param password + * @return <code>true</code> if there appears to be a schema installed in the database already. + * @throws Exception + */ + boolean isDatabaseSchemaExist(String connectionUrl, String username, String password) throws Exception; + + /** + * Tests that the database can be connected to with the given URL and credentials. + * @param connectionUrl + * @param username + * @param password + * @return <code>null</code> if the connection succeeded; this will be an error message if failed + * @throws Exception + */ + String testConnection(String connectionUrl, String username, String password) throws Exception; + + /** + * Returns the rhq-server.properties values in a map. + * @return server properties + * @throws Exception + */ + HashMap<String, String> getServerProperties() throws Exception; + + /** + * Returns the version string for the app server itself (e.g. "7.1.2.Final"). + * @return version string of app server + * @throws Exception + */ + String getAppServerVersion() throws Exception; + + /** + * Returns the general type of operating system the server is running on (e.g. "Linux"). + * @return os type name + * @throws Exception + */ + String getOperatingSystem() throws Exception; +} diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java new file mode 100644 index 0000000..0cd8669 --- /dev/null +++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java @@ -0,0 +1,896 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.installer; + +import java.io.File; +import java.io.IOException; +import java.net.InetAddress; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; +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.as.controller.client.ModelControllerClient; + +import org.rhq.common.jbossas.client.controller.CoreJBossASClient; +import org.rhq.common.jbossas.client.controller.DeploymentJBossASClient; +import org.rhq.common.jbossas.client.controller.WebJBossASClient; +import org.rhq.core.db.DatabaseTypeFactory; +import org.rhq.core.util.PropertiesFileUpdate; +import org.rhq.core.util.exception.ThrowableUtil; +import org.rhq.enterprise.server.installer.ServerInstallUtil.ExistingSchemaOption; +import org.rhq.enterprise.server.installer.ServerInstallUtil.SupportedDatabaseType; + +/** + * @author John Mazzitelli + */ +public class InstallerServiceImpl implements InstallerService { + + private static final String EAR_NAME = "rhq.ear"; + private static final String SYSPROP_PROPFILE = "rhq.server.properties-file"; + + private final Log log = LogFactory.getLog(InstallerServiceImpl.class); + private final InstallerConfiguration installerConfiguration; + + private void log(String s) { + log.info(s); + } + + private void log(String s, Throwable t) { + log.warn(s, t); + } + + public InstallerServiceImpl(InstallerConfiguration config) { + this.installerConfiguration = config; + } + + @Override + public void test() throws Exception { + // checks to make sure we can read rhq-server.properties and auto-install is turned on + // checks to make sure we aren't already installed + // checks to make sure we can successfully connect to the AS instance + HashMap<String, String> serverProperties = preInstall(); + if (serverProperties == null) { + throw new Exception("Auto-installation is disabled. Please fully configure rhq-server.properties"); + } + + // make sure the data is valid + verifyDataFormats(serverProperties); + + // checks to make sure we can connect to the DB + final String dbUrl = serverProperties.get(ServerProperties.PROP_DATABASE_CONNECTION_URL); + final String dbUsername = serverProperties.get(ServerProperties.PROP_DATABASE_USERNAME); + String obfuscatedDbPassword = serverProperties.get(ServerProperties.PROP_DATABASE_PASSWORD); + String clearTextDbPassword = ServerInstallUtil.deobfuscatePassword(obfuscatedDbPassword); + String dbErrorStr = testConnection(dbUrl, dbUsername, clearTextDbPassword); + if (dbErrorStr != null) { + throw new Exception(dbErrorStr); + } + + // check the server details configuration + ServerDetails detailsFromProps = getServerDetailsFromPropertiesOnly(serverProperties); + ServerDetails detailsFromDb = getServerDetails(dbUrl, dbUsername, clearTextDbPassword, + detailsFromProps.getName()); + if (detailsFromDb == null) { + log.info("This will be considered a new server: " + detailsFromProps); + } else { + log.info("This [" + detailsFromProps + "] will be considered a reinstallation of an existing server [" + + detailsFromDb + "]"); + } + + // just warns if the schema will be overwritten + ExistingSchemaOption existingSchemaOption = getAutoinstallExistingSchemaOption(serverProperties); + if (existingSchemaOption == ExistingSchemaOption.OVERWRITE) { + log.warn("The installer has been configured to OVERWRITE any existing data in the database. " + + "If you do install with this configuration, realize that all existing data in the database " + + "will be lost."); + } + + // just logs the location of the AS instance where RHQ will be installed + String appServerHomeDir = getAppServerHomeDir(); + log.info("The app server where the installation will go is found at: " + appServerHomeDir); + + // give some message to indicate everything looks OK and the user can start the real install + log.info("It looks like everything is OK and you can start the installation."); + } + + @Override + public HashMap<String, String> preInstall() { + // first, make sure auto-install mode has been enabled, this at least tells us + // the user edited the server properties for their environment. + final boolean autoInstallMode; + final HashMap<String, String> serverProperties; + + try { + serverProperties = getServerProperties(); + autoInstallMode = ServerInstallUtil.isAutoinstallEnabled(serverProperties); + } catch (Throwable t) { + log("Cannot determine if in auto-install mode", t); + return null; + } + + if (autoInstallMode) { + log("The server is preconfigured and ready for auto-install."); + } else { + log("User must complete the installation configuration."); + return null; + } + + // make an attempt to connect to the app server - we must make sure its running and we can connect to it + final String asVersion = testModelControllerClient(serverProperties); + log("Installing into app server version [" + asVersion + "]"); + + try { + // If we are already fully installed, we don't have to do anything. Just return false immediately. + final String installationResults = getInstallationResults(); + if (installationResults != null) { + if (installationResults.length() == 0) { + log("The installer has already been told to perform its work. The server should be ready soon."); + } else { + log("The installer has already attempted to install the server but errors occurred:\n" + + installationResults); + } + return null; + } + } catch (Throwable t) { + log("Cannot determine if server has already been installed.", t); + return null; + } + + // ready for installation + return serverProperties; + } + + @Override + public String getInstallationResults() throws Exception { + ModelControllerClient mcc = null; + try { + mcc = getModelControllerClient(); + DeploymentJBossASClient client = new DeploymentJBossASClient(mcc); + if (client.isDeployment(EAR_NAME)) { + return ""; // everything looks OK and the ear either has been successfully deployed or is deploying + } + return null; + } finally { + safeClose(mcc); + } + } + + @Override + public void install(HashMap<String, String> serverProperties, ServerDetails serverDetails, + String existingSchemaOption) throws Exception { + + verifyDataFormats(serverProperties); + + // if we are in auto-install mode, ignore the server details passed in and build our own using the given server properties + // if not in auto-install mode, make sure user gave us the server details that we will need + final boolean autoInstallMode = ServerInstallUtil.isAutoinstallEnabled(serverProperties); + if (autoInstallMode) { + serverDetails = getServerDetailsFromPropertiesOnly(serverProperties); + } else { + if (ServerInstallUtil.isEmpty(serverDetails.getName())) { + throw new Exception("Please enter a server name"); + } + if (ServerInstallUtil.isEmpty(serverDetails.getEndpointAddress())) { + try { + serverDetails.setEndpointAddress(InetAddress.getLocalHost().getCanonicalHostName()); + } catch (Exception e) { + throw new Exception("Could not assign a server public address automatically - please specify one."); + } + } + } + + // its possible the JDBC URL was changed, clear the factory cache in case the DB version is different now + DatabaseTypeFactory.clearDatabaseTypeCache(); + + // determine the type of database to connect to + final String databaseType = serverProperties.get(ServerProperties.PROP_DATABASE_TYPE); + if (ServerInstallUtil.isEmpty(databaseType)) { + throw new Exception("Please indicate the type of database to connect to"); + } + + SupportedDatabaseType supportedDbType = ServerInstallUtil.getSupportedDatabaseType(databaseType); + if (supportedDbType == null) { + throw new IllegalArgumentException("Invalid database type: " + databaseType); + } + + // parse the database connection URL to extract the servername/port/dbname; this is needed for the XA datasource + try { + final String url = serverProperties.get(ServerProperties.PROP_DATABASE_CONNECTION_URL); + Pattern pattern = null; + if (supportedDbType == SupportedDatabaseType.POSTGRES) { + pattern = Pattern.compile(".*://(.*):([0123456789]+)/(.*)"); // jdbc:postgresql://host.name:5432/rhq + } else if (supportedDbType == SupportedDatabaseType.ORACLE) { + // if we ever find that we'll need these props set, uncomment below and it should all work + //pattern = Pattern.compile(".*@(.*):([0123456789]+)[:/](.*)"); // jdbc:oracle:thin:@host.name:1521:rhq (or /rhq) + } + + if (pattern != null) { + final Matcher match = pattern.matcher(url); + if (match.find() && (match.groupCount() == 3)) { + final String serverName = match.group(1); + final String port = match.group(2); + final String dbName = match.group(3); + serverProperties.put(ServerProperties.PROP_DATABASE_SERVER_NAME, serverName); + serverProperties.put(ServerProperties.PROP_DATABASE_PORT, port); + serverProperties.put(ServerProperties.PROP_DATABASE_DB_NAME, dbName); + } else { + throw new Exception("Cannot get server, port or db name from connection URL: " + url); + } + } else { + serverProperties.put(ServerProperties.PROP_DATABASE_SERVER_NAME, ""); + serverProperties.put(ServerProperties.PROP_DATABASE_PORT, ""); + serverProperties.put(ServerProperties.PROP_DATABASE_DB_NAME, ""); + } + } catch (Exception e) { + throw new Exception("JDBC connection URL seems to be invalid: " + ThrowableUtil.getAllMessages(e)); + } + + // make sure the internal database related settings are correct + try { + String dialect = null; + String quartzDriverDelegateClass = "org.quartz.impl.jdbcjobstore.StdJDBCDelegate"; + String quartzSelectWithLockSQL = "SELECT * FROM {0}LOCKS ROWLOCK WHERE LOCK_NAME = ? FOR UPDATE"; + String quartzLockHandlerClass = "org.quartz.impl.jdbcjobstore.StdRowLockSemaphore"; + + if (supportedDbType == SupportedDatabaseType.POSTGRES) { + dialect = "org.hibernate.dialect.PostgreSQLDialect"; + quartzDriverDelegateClass = "org.quartz.impl.jdbcjobstore.PostgreSQLDelegate"; + } else if (supportedDbType == SupportedDatabaseType.ORACLE) { + dialect = "org.hibernate.dialect.Oracle10gDialect"; + quartzDriverDelegateClass = "org.quartz.impl.jdbcjobstore.oracle.OracleDelegate"; + } + + serverProperties.put(ServerProperties.PROP_DATABASE_HIBERNATE_DIALECT, dialect); + serverProperties.put(ServerProperties.PROP_QUARTZ_DRIVER_DELEGATE_CLASS, quartzDriverDelegateClass); + serverProperties.put(ServerProperties.PROP_QUARTZ_SELECT_WITH_LOCK_SQL, quartzSelectWithLockSQL); + serverProperties.put(ServerProperties.PROP_QUARTZ_LOCK_HANDLER_CLASS, quartzLockHandlerClass); + + } catch (Exception e) { + throw new Exception("Cannot configure internal database settings: " + ThrowableUtil.getAllMessages(e)); + } + + // test the connection to make sure everything is OK - note that if we are in auto-install mode, + // the password will have been obfuscated, so we need to de-obfucate it in order to use it. + // make sure the server properties map itself has an obfuscated password + final String dbUrl = serverProperties.get(ServerProperties.PROP_DATABASE_CONNECTION_URL); + final String dbUsername = serverProperties.get(ServerProperties.PROP_DATABASE_USERNAME); + String clearTextDbPassword; + String obfuscatedDbPassword; + if (autoInstallMode) { + obfuscatedDbPassword = serverProperties.get(ServerProperties.PROP_DATABASE_PASSWORD); + clearTextDbPassword = ServerInstallUtil.deobfuscatePassword(obfuscatedDbPassword); + } else { + clearTextDbPassword = serverProperties.get(ServerProperties.PROP_DATABASE_PASSWORD); + obfuscatedDbPassword = ServerInstallUtil.obfuscatePassword(clearTextDbPassword); + serverProperties.put(ServerProperties.PROP_DATABASE_PASSWORD, obfuscatedDbPassword); + } + final String testConnectionErrorMessage = testConnection(dbUrl, dbUsername, clearTextDbPassword); + if (testConnectionErrorMessage != null) { + throw new Exception("Cannot connect to the database: " + testConnectionErrorMessage); + } + + // write the new properties to the rhq-server.properties file + saveServerProperties(serverProperties); + + // Prepare the db schema. + // existingSchemaOption is either overwrite, keep or skip. + // If in auto-install mode, we can be told to overwrite, skip or auto (meaning "keep" if schema exists) + ExistingSchemaOption existingSchemaOptionEnum; + if (autoInstallMode) { + existingSchemaOptionEnum = getAutoinstallExistingSchemaOption(serverProperties); + } else { + if (existingSchemaOption == null) { + throw new Exception("Don't know what to do with the database schema"); + } + existingSchemaOptionEnum = ExistingSchemaOption.valueOf(existingSchemaOption); + } + + if (ExistingSchemaOption.SKIP != existingSchemaOptionEnum) { + if (isDatabaseSchemaExist(dbUrl, dbUsername, clearTextDbPassword)) { + if (ExistingSchemaOption.OVERWRITE == existingSchemaOptionEnum) { + log("Database schema exists but installer was told to overwrite it - a new schema will be created now."); + ServerInstallUtil.createNewDatabaseSchema(serverProperties, serverDetails, clearTextDbPassword, + getLogDir()); + } else { + log("Database schema exists - it will now be updated."); + ServerInstallUtil.upgradeExistingDatabaseSchema(serverProperties, serverDetails, + clearTextDbPassword, getLogDir()); + } + } else { + log("Database schema does not yet exist - it will now be created."); + ServerInstallUtil.createNewDatabaseSchema(serverProperties, serverDetails, clearTextDbPassword, + getLogDir()); + } + } else { + log("Ignoring database schema - installer will assume it exists and is already up-to-date."); + } + + // ensure the server info is up to date and stored in the DB + ServerInstallUtil.storeServerDetails(serverProperties, clearTextDbPassword, serverDetails); + + String appServerConfigDir = getAppServerConfigDir(); + + // create a keystore whose cert has a CN of this server's public endpoint address + ServerInstallUtil.createKeystore(serverDetails, appServerConfigDir); + + // create an rhqadmin/rhqadmin management user so when discovered, the AS7 plugin can immediately + // connect to the RHQ Server. + ServerInstallUtil.createDefaultManagementUser(serverDetails, appServerConfigDir); + + // perform stuff that has to get done via the JBossAS management client + ModelControllerClient mcc = null; + try { + mcc = getModelControllerClient(); + + // ensure the server info is up to date and stored in the DB + ServerInstallUtil.setSocketBindings(mcc, serverProperties); + + // Make sure our deployment scanner is configured as we need it + ServerInstallUtil.configureDeploymentScanner(mcc); + } finally { + safeClose(mcc); + } + + // now create our deployment services and our main EAR + deployServices(serverProperties); + + // deploy the main EAR app startup module extension + deployAppExtension(); + + // some of the changes we made require the app server container to reload before we can deploy the app + reloadConfiguration(); + + // we need to wait for the reload to finish - wait until we can connect again + testModelControllerClient(60); + + // deploy the main EAR app subsystem - this is the thing that contains and actually deploys the EAR + deployAppSubsystem(); + + return; + } + + @Override + public ArrayList<String> getServerNames(String connectionUrl, String username, String password) throws Exception { + try { + return ServerInstallUtil.getServerNames(connectionUrl, username, password); + } catch (Exception e) { + log("Could not get the list of registered server names", e); + return null; + } + } + + @Override + public ServerDetails getServerDetails(String connectionUrl, String username, String password, String serverName) + throws Exception { + try { + final ServerDetails sd = ServerInstallUtil.getServerDetails(connectionUrl, username, password, serverName); + if (sd != null) { + if (ServerInstallUtil.isEmpty(sd.getName())) { + try { + sd.setEndpointAddress(InetAddress.getLocalHost().getCanonicalHostName()); + } catch (Exception ignore) { + // oh well.. we'll have to expect the user to set the name they want to use + } + } + if (ServerInstallUtil.isEmpty(sd.getEndpointAddress())) { + try { + sd.setEndpointAddress(InetAddress.getLocalHost().getHostAddress()); + } catch (Exception ignore) { + // oh well.. we'll have to expect the user to set the address they want to use + } + } + } + return sd; + } catch (Exception e) { + log("Could not get server details for [" + serverName + "]", e); + return null; + } + } + + @Override + public boolean isDatabaseSchemaExist(String connectionUrl, String username, String password) throws Exception { + try { + return ServerInstallUtil.isDatabaseSchemaExist(connectionUrl, username, password); + } catch (Exception e) { + log("Could not determine database existence", e); + return false; + } + } + + @Override + public String testConnection(String connectionUrl, String username, String password) throws Exception { + final String results = ServerInstallUtil.testConnection(connectionUrl, username, password); + return results; + } + + @Override + public HashMap<String, String> getServerProperties() throws Exception { + final File serverPropertiesFile = getServerPropertiesFile(); + final PropertiesFileUpdate propsFile = new PropertiesFileUpdate(serverPropertiesFile.getAbsolutePath()); + final Properties props = propsFile.loadExistingProperties(); + + // force some hardcoded defaults for IBM JVMs that must have specific values + final boolean isIBM = System.getProperty("java.vendor", "").contains("IBM"); + if (isIBM) { + for (String algPropName : ServerProperties.IBM_ALGOROTHM_SETTINGS) { + props.setProperty(algPropName, "IbmX509"); + } + } + + // GWT can't handle Properties - convert to HashMap + final HashMap<String, String> map = new HashMap<String, String>(props.size()); + for (Object property : props.keySet()) { + map.put(property.toString(), props.getProperty(property.toString())); + } + return map; + } + + /** + * Makes sure the data is at least in the correct format (booleans are true/false, integers are valid numbers). + * + * @param serverProperties the server properties to check for correctness + * + * @throws Exception if the data was invalid + */ + private void verifyDataFormats(HashMap<String, String> serverProperties) throws Exception { + final StringBuilder dataErrors = new StringBuilder(); + for (Map.Entry<String, String> entry : serverProperties.entrySet()) { + final String name = entry.getKey(); + if (ServerProperties.BOOLEAN_PROPERTIES.contains(name)) { + final String newValue = entry.getValue(); + if (!(newValue.equals("true") || newValue.equals("false"))) { + dataErrors.append("[" + name + "] must be 'true' or 'false' : [" + newValue + "]\n"); + } + } else if (ServerProperties.INTEGER_PROPERTIES.contains(name)) { + final String newValue = entry.getValue(); + try { + Integer.parseInt(newValue); + } catch (NumberFormatException e) { + if (ServerInstallUtil.isEmpty(newValue) && name.equals(ServerProperties.PROP_CONNECTOR_BIND_PORT)) { + // this is a special setting and is allowed to be empty + } else { + dataErrors.append("[" + name + "] must be a number : [" + newValue + "]\n"); + } + } + } + } + if (dataErrors.length() > 0) { + throw new Exception("Cannot install due to data errors:\n" + dataErrors.toString()); + } + } + + /** + * Save the given properties to the server's .properties file. + * + * Note that this is private - it is not exposed to the installer UI. It should have no need to save + * this data outside of the normal installation process (see {@link #install()}). + * + * @param serverProperties the server properties to save + * + * @throws Exception if failed to save the properties to the .properties file + */ + private void saveServerProperties(HashMap<String, String> serverProperties) throws Exception { + final File serverPropertiesFile = getServerPropertiesFile(); + final PropertiesFileUpdate propsFile = new PropertiesFileUpdate(serverPropertiesFile.getAbsolutePath()); + + // GWT can't handle Properties - so we use HashMap but convert to Properties internally + final Properties props = new Properties(); + for (Map.Entry<String, String> entry : serverProperties.entrySet()) { + props.setProperty(entry.getKey(), entry.getValue()); + } + + propsFile.update(props); + + // we need to put them as system properties now so when we hot deploy, + // the replacement variables in the config files pick up the new values + for (Map.Entry<String, String> entry : serverProperties.entrySet()) { + System.setProperty(entry.getKey(), entry.getValue()); + } + + return; + } + + @Override + public String getAppServerVersion() throws Exception { + ModelControllerClient mcc = null; + try { + mcc = getModelControllerClient(); + final CoreJBossASClient client = new CoreJBossASClient(mcc); + final String version = client.getAppServerVersion(); + return version; + } finally { + safeClose(mcc); + } + } + + @Override + public String getOperatingSystem() throws Exception { + ModelControllerClient mcc = null; + try { + mcc = getModelControllerClient(); + final CoreJBossASClient client = new CoreJBossASClient(mcc); + final String osName = client.getOperatingSystem(); + return osName; + } finally { + safeClose(mcc); + } + } + + private String getAppServerHomeDir() throws Exception { + ModelControllerClient mcc = null; + try { + mcc = getModelControllerClient(); + final CoreJBossASClient client = new CoreJBossASClient(mcc); + final String dir = client.getAppServerHomeDir(); + return dir; + } finally { + safeClose(mcc); + } + } + + private String getAppServerConfigDir() throws Exception { + ModelControllerClient mcc = null; + try { + mcc = getModelControllerClient(); + final CoreJBossASClient client = new CoreJBossASClient(mcc); + final String dir = client.getAppServerConfigDir(); + return dir; + } finally { + safeClose(mcc); + } + } + + private String getLogDir() throws Exception { + ModelControllerClient mcc = null; + try { + mcc = getModelControllerClient(); + final CoreJBossASClient client = new CoreJBossASClient(mcc); + final String dir = client.getAppServerLogDir(); + return dir; + } finally { + safeClose(mcc); + } + } + + private File getServerPropertiesFile() throws Exception { + // first see if we have a rhq-server.properties system property - if so, use it. + final String sysprop = System.getProperty(SYSPROP_PROPFILE); + if (sysprop != null) { + final File propFile = new File(sysprop); + if (propFile.isFile()) { + return propFile; + } else { + throw new IllegalArgumentException("System property [" + SYSPROP_PROPFILE + + "] pointing to invalid file: " + propFile); + } + } + + // otherwise, let's try to find it based on the app server location (we'll assume + // its the app server bundled with RHQ) + final File appServerHomeDir = new File(getAppServerHomeDir()); + final File serverPropertiesFile = new File(appServerHomeDir, "../bin/rhq-server.properties"); + return serverPropertiesFile; + } + + private ExistingSchemaOption getAutoinstallExistingSchemaOption(HashMap<String, String> serverProperties) { + ExistingSchemaOption existingSchemaOptionEnum; + final String s = serverProperties.get(ServerProperties.PROP_AUTOINSTALL_DATABASE); + if (s == null || s.equalsIgnoreCase("auto")) { + existingSchemaOptionEnum = ExistingSchemaOption.KEEP; + } else { + existingSchemaOptionEnum = ExistingSchemaOption.valueOf(s.toUpperCase()); + } + return existingSchemaOptionEnum; + } + + /** + * Returns server details based on information found solely in the given server properties. + * It does not rely on any database access. + * + * This is used by the auto-installation process. + * + * @param serverProperties the server properties + * @throws Exception + */ + private ServerDetails getServerDetailsFromPropertiesOnly(HashMap<String, String> serverProperties) throws Exception { + + String highAvailabilityName = serverProperties.get(ServerProperties.PROP_HIGH_AVAILABILITY_NAME); + String publicEndpoint = serverProperties.get(ServerProperties.PROP_AUTOINSTALL_PUBLIC_ADDR); + int port; + int securePort; + + if (ServerInstallUtil.isEmpty(highAvailabilityName)) { + try { + highAvailabilityName = InetAddress.getLocalHost().getCanonicalHostName(); + } catch (Exception e) { + log("Could not determine default server name: ", e); + throw new Exception("Server name is not preconfigured and could not be determined automatically"); + } + } + + // the public endpoint address is one that can be preconfigured in the special autoinstall property. + // if that is not specified, then we use either the connector's bind address or the server bind address. + // if nothing was specified, we'll default to the canonical host name. + if (ServerInstallUtil.isEmpty(publicEndpoint)) { + String connBindAddress = serverProperties.get(ServerProperties.PROP_CONNECTOR_BIND_ADDRESS); + + if ((!ServerInstallUtil.isEmpty(connBindAddress)) && (!"0.0.0.0".equals(connBindAddress.trim()))) { + // the server-side connector bind address is explicitly set, use that + publicEndpoint = connBindAddress.trim(); + + } else { + String serverBindAddress = serverProperties.get(ServerProperties.PROP_JBOSS_BIND_ADDRESS); + if ((!ServerInstallUtil.isEmpty(serverBindAddress)) && (!"0.0.0.0".equals(serverBindAddress.trim()))) { + // the main JBossAS server bind address is set and it isn't 0.0.0.0, use that + publicEndpoint = serverBindAddress.trim(); + + } else { + try { + publicEndpoint = InetAddress.getLocalHost().getCanonicalHostName(); + } catch (Exception e) { + log("Could not determine default public endpoint address: ", e); + throw new Exception( + "Public endpoint address not preconfigured and could not be determined automatically"); + } + } + } + } + + // define the public endpoint ports. + // note that if using a different transport other than (ssl)servlet, we'll + // take the connector's bind port and use it for both ports. This is to support a special deployment + // use-case - 99% of the time, the agents will go through the web/tomcat connector and thus we'll use + // the http/https ports for the public endpoints. + String connectorTransport = serverProperties.get(ServerProperties.PROP_CONNECTOR_TRANSPORT); + if (connectorTransport != null && connectorTransport.contains("socket")) { + // we aren't using the (ssl)servlet protocol, take the connector bind port and use it for the public endpoint ports + String connectorBindPort = serverProperties.get(ServerProperties.PROP_CONNECTOR_BIND_PORT); + if (ServerInstallUtil.isEmpty(connectorBindPort) || "0".equals(connectorBindPort.trim())) { + throw new Exception("Using non-servlet transport [" + connectorTransport + "] but didn't define a port"); + } + port = Integer.parseInt(connectorBindPort); + securePort = Integer.parseInt(connectorBindPort); + } else { + // this is the typical use-case - the transport is probably (ssl)servlet so use the web http/https ports + try { + port = Integer.parseInt(serverProperties.get(ServerProperties.PROP_WEB_HTTP_PORT)); + } catch (Exception e) { + log("Could not determine port, will use default: " + e); + port = ServerDetails.DEFAULT_ENDPOINT_PORT; + } + try { + securePort = Integer.parseInt(serverProperties.get(ServerProperties.PROP_WEB_HTTPS_PORT)); + } catch (Exception e) { + log("Could not determine secure port, will use default: " + e); + securePort = ServerDetails.DEFAULT_ENDPOINT_SECURE_PORT; + } + } + + // everything looks good + ServerDetails serverDetails = new ServerDetails(highAvailabilityName, publicEndpoint, port, securePort); + return serverDetails; + } + + /** + * This will attempt to determine if we can get a client using our current installer configuration. + * If we can't (i.e. the connection attempt throws an exception), this method retries periodically + * until the given number of seconds expires. If it still fails, an exception is thrown. + * + * @param secsToWait the number of seconds to wait before aborting the test + * @return the app server version that we are connected to + * + * @throws RuntimeException if the connection attempts fail + */ + private String testModelControllerClient(int secsToWait) throws RuntimeException { + final long start = System.currentTimeMillis(); + final long end = start + (secsToWait * 1000L); + RuntimeException error = null; + + while (System.currentTimeMillis() < end) { + try { + return testModelControllerClient(null); + } catch (RuntimeException e) { + error = e; + try { + Thread.sleep(1000L); + } catch (InterruptedException ignore) { + } + } + } + + throw new RuntimeException("Timed out before being able to successfully connect to the server", error); + } + + /** + * This will attempt to determine if we can get a client using our current installer configuration. + * If we can't (i.e. the connection attempt throws an exception), this method looks at the fallback + * props for the management host and port values and will re-try using those values. If the retry + * succeeds, the host/port it used to successfully connect will be stored in the {@link #installerConfiguration} + * object. If it still fails, an exception is thrown. + * + * @param fallbackProps contains jboss.bind.address.management and/or jboss.native.management.port to use + * if the initial connection attempt fails. If null, will be ignored. + * @return the app server version that we are connected to + * + * @throws RuntimeException if the connection attempts fail + */ + private String testModelControllerClient(HashMap<String, String> fallbackProps) throws RuntimeException { + String host = this.installerConfiguration.getManagementHost(); + int port = this.installerConfiguration.getManagementPort(); + ModelControllerClient mcc = null; + CoreJBossASClient client; + String asVersion; + + try { + mcc = ModelControllerClient.Factory.create(host, port); + client = new CoreJBossASClient(mcc); + asVersion = client.getAppServerVersion(); + return asVersion; + } catch (Exception e) { + try { + mcc.close(); // so we don't leak threads + mcc = null; + } catch (IOException ignore) { + } + + // if the caller didn't give us any fallback props, just immediately fail + if (fallbackProps == null) { + throw new RuntimeException("Cannot obtain client connection to the app server", e); + } + + try { + // try the host/port as specified in the fallbackProps + // if the host/port in the fallbackProps are the sames as the ones we tried above, + // don't bother trying again + boolean differentValues = false; + String hostStr = fallbackProps.get("jboss.bind.address.management"); + if (hostStr != null && !hostStr.equals(host)) { + host = hostStr; + differentValues = true; + } + String portStr = fallbackProps.get("jboss.management.native.port"); + if (portStr != null && !portStr.equals(String.valueOf(port))) { + port = Integer.parseInt(portStr); + differentValues = true; + } + if (!differentValues) { + throw new RuntimeException("Cannot obtain client connection to the app server", e); + } + + mcc = ModelControllerClient.Factory.create(host, port); + client = new CoreJBossASClient(mcc); + asVersion = client.getAppServerVersion(); + this.installerConfiguration.setManagementHost(host); + this.installerConfiguration.setManagementPort(port); + return asVersion; + } catch (Exception e2) { + // make the cause the very first exception in case it was something other than bad host/port as the problem + throw new RuntimeException("Cannot obtain client connection to the app server!", e); + } finally { + safeClose(mcc); + } + } finally { + safeClose(mcc); + } + } + + private ModelControllerClient getModelControllerClient() { + ModelControllerClient client; + try { + String host = this.installerConfiguration.getManagementHost(); + int port = this.installerConfiguration.getManagementPort(); + client = ModelControllerClient.Factory.create(host, port); + } catch (Exception e) { + throw new RuntimeException("Cannot obtain client connection to the app server", e); + } + return client; + } + + private void deployServices(HashMap<String, String> serverProperties) throws Exception { + + ModelControllerClient mcc = null; + try { + mcc = getModelControllerClient(); + + // create the security domain needed by the datasources + ServerInstallUtil.createDatasourceSecurityDomain(mcc, serverProperties); + + // create the security domain needed by REST + ServerInstallUtil.createRESTSecurityDomain(mcc, serverProperties); + + // set up REST cache + ServerInstallUtil.createNewCaches(mcc, serverProperties); + + // create the JDBC driver configurations for use by datasources + ServerInstallUtil.createNewJdbcDrivers(mcc, serverProperties); + + // create the datasources + ServerInstallUtil.createNewDatasources(mcc, serverProperties); + + // create the JMS queues + ServerInstallUtil.createNewJMSQueues(mcc, serverProperties); + + // setup the email service + ServerInstallUtil.setupMailService(mcc, serverProperties); + + // we don't want to the JBossAS welcome screen; turn it off + new WebJBossASClient(mcc).setEnableWelcomeRoot(false); + + } catch (Exception e) { + log("deployServices failed", e); + throw new Exception("Failed to deploy services: " + ThrowableUtil.getAllMessages(e)); + } finally { + safeClose(mcc); + } + } + + private void deployAppExtension() throws Exception { + ModelControllerClient mcc = null; + try { + mcc = getModelControllerClient(); + CoreJBossASClient client = new CoreJBossASClient(mcc); + log("Installing RHQ EAR startup subsystem extension"); + client.addExtension("org.rhq.rhq-enterprise-server-startup-subsystem"); + } finally { + safeClose(mcc); + } + } + + private void deployAppSubsystem() throws Exception { + ModelControllerClient mcc = null; + try { + mcc = getModelControllerClient(); + CoreJBossASClient client = new CoreJBossASClient(mcc); + log("Installing RHQ EAR subsystem"); + client.addSubsystem("rhq-startup"); + } finally { + safeClose(mcc); + } + } + + private static void safeClose(final ModelControllerClient mcc) { + if (null != mcc) { + try { + mcc.close(); + } catch (Exception e) { + } + } + } + + private void reloadConfiguration() throws Exception { + log("Will now ask the app server to reload its configuration"); + ModelControllerClient mcc = null; + try { + mcc = getModelControllerClient(); + final CoreJBossASClient client = new CoreJBossASClient(mcc); + client.reload(); + log("App server has been successfully asked to reload its configuration"); + } catch (Exception e) { + log("reloadConfiguration failed - restart the server to complete the installation", e); + } finally { + safeClose(mcc); + } + } +} diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/LoggerAntBuildListener.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/LoggerAntBuildListener.java new file mode 100644 index 0000000..7c325f7 --- /dev/null +++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/LoggerAntBuildListener.java @@ -0,0 +1,103 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.installer; + +import java.io.PrintWriter; +import java.util.Date; + +import org.apache.tools.ant.BuildEvent; +import org.apache.tools.ant.BuildListener; +import org.apache.tools.ant.Target; +import org.apache.tools.ant.Task; + +/** + * Listens for ANT build events and logs them to a log stream. + * + * @author John Mazzitelli + */ +public class LoggerAntBuildListener implements BuildListener { + private PrintWriter output; + + public LoggerAntBuildListener(PrintWriter logFile) { + output = logFile; + + // just output our first line with the date this was started + output.println(new Date().toString()); + } + + public void buildFinished(BuildEvent event) { + logEvent(event, "FINISHED!"); + } + + public void buildStarted(BuildEvent event) { + logEvent(event, "STARTED!"); + } + + public void messageLogged(BuildEvent event) { + logEvent(event, null); + } + + public void targetFinished(BuildEvent event) { + logEvent(event, null); + } + + public void targetStarted(BuildEvent event) { + logEvent(event, null); + } + + public void taskFinished(BuildEvent event) { + logEvent(event, null); + } + + public void taskStarted(BuildEvent event) { + logEvent(event, null); + } + + private void logEvent(BuildEvent event, String additionalMessage) { + String message = event.getMessage(); + Throwable exception = event.getException(); + Target target = event.getTarget(); + Task task = event.getTask(); + + if (additionalMessage != null) { + output.println(additionalMessage); + } + + if (target != null) { + output.print("[" + target.getName() + "] "); + } + + if (task != null) { + output.print("[" + task.getTaskName() + "] "); + } + + if (message != null) { + output.print(message); + } + + if (exception != null) { + output.println(); + exception.printStackTrace(output); + } + + output.println(); + + return; + } +} \ No newline at end of file diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ManagementService.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ManagementService.java new file mode 100644 index 0000000..6b9ef78 --- /dev/null +++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ManagementService.java @@ -0,0 +1,40 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.installer; + +import org.jboss.as.controller.client.ModelControllerClient; + +/** + * @author John Mazzitelli + */ +public class ManagementService { + + /** + * The caller should call ModelControllerClient.close() when finished with the client. + * + * @return the ModelControllerClient + */ + public static ModelControllerClient getClient() { + try { + return ModelControllerClient.Factory.create("127.0.0.1", 9999); + } catch (Exception e) { + throw new RuntimeException("Cannot obtain client connection to the app server", e); + } + } +} diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerDetails.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerDetails.java new file mode 100644 index 0000000..1b26558 --- /dev/null +++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerDetails.java @@ -0,0 +1,105 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.installer; + +import java.io.Serializable; + +/** + * Provides details about the server if it is already a known one (by "known" meaning it is + * in the database already). + * + * @author John Mazzitelli + */ +public class ServerDetails implements Serializable { + private static final long serialVersionUID = 1L; + + public static final String DEFAULT_AFFINITY_GROUP = ""; + public static final int DEFAULT_ENDPOINT_PORT = 7080; + public static final int DEFAULT_ENDPOINT_SECURE_PORT = 7443; + + private String name; + private String endpointAddress; + private int endpointPort; + private int endpointSecurePort; + + public ServerDetails(String name, String endpointAddress, int port, int securePort) { + this.name = name; + this.endpointAddress = endpointAddress; + this.endpointPort = port; + this.endpointSecurePort = securePort; + } + + public String getName() { + return name; + } + + public void setName(String name) { + if ((null != name) && (!"".equals(name.trim()))) { + this.name = name; + } + } + + public String getEndpointAddress() { + return endpointAddress; + } + + public void setEndpointAddress(String endpointAddress) { + if ((null != endpointAddress) && (!"".equals(endpointAddress.trim()))) { + this.endpointAddress = endpointAddress; + } + } + + public int getEndpointPort() { + return endpointPort; + } + + public void setEndpointPort(int endpointPort) { + this.endpointPort = endpointPort; + } + + public String getEndpointPortString() { + return (String.valueOf(endpointPort)); + } + + public void setEndpointPortString(String endpointPort) { + this.endpointPort = Integer.valueOf(endpointPort).intValue(); + } + + public int getEndpointSecurePort() { + return endpointSecurePort; + } + + public void setEndpointSecurePort(int endpointSecurePort) { + this.endpointSecurePort = endpointSecurePort; + } + + public String getEndpointSecurePortString() { + return (String.valueOf(endpointSecurePort)); + } + + public void setEndpointSecurePortString(String endpointSecurePort) { + this.endpointSecurePort = Integer.valueOf(endpointSecurePort).intValue(); + } + + @Override + public String toString() { + return "[name=" + name + ", address=" + endpointAddress + ", port=" + endpointPort + ", secureport=" + + endpointSecurePort + "]"; + } +} diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java new file mode 100644 index 0000000..516dca6 --- /dev/null +++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java @@ -0,0 +1,1260 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.installer; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.PrintWriter; +import java.lang.reflect.Method; +import java.net.InetAddress; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.tools.ant.Project; +import org.apache.tools.ant.helper.ProjectHelper2; + +import org.jboss.as.controller.client.ModelControllerClient; +import org.jboss.dmr.ModelNode; + +import org.rhq.common.jbossas.client.controller.Address; +import org.rhq.common.jbossas.client.controller.CoreJBossASClient; +import org.rhq.common.jbossas.client.controller.DatasourceJBossASClient; +import org.rhq.common.jbossas.client.controller.FailureException; +import org.rhq.common.jbossas.client.controller.InfinispanJBossASClient; +import org.rhq.common.jbossas.client.controller.JBossASClient; +import org.rhq.common.jbossas.client.controller.MessagingJBossASClient; +import org.rhq.common.jbossas.client.controller.SecurityDomainJBossASClient; +import org.rhq.common.jbossas.client.controller.SocketBindingJBossASClient; +import org.rhq.core.db.DatabaseType; +import org.rhq.core.db.DatabaseTypeFactory; +import org.rhq.core.db.DbUtil; +import org.rhq.core.db.OracleDatabaseType; +import org.rhq.core.db.PostgresqlDatabaseType; +import org.rhq.core.db.setup.DBSetup; +import org.rhq.core.util.exception.ThrowableUtil; +import org.rhq.core.util.stream.StreamUtil; +import org.rhq.enterprise.communications.util.SecurityUtil; + +/** + * Provides utility methods necessary to complete the server installation. + * + * @author John Mazzitelli + */ +public class ServerInstallUtil { + private static final Log LOG = LogFactory.getLog(ServerInstallUtil.class); + + public enum ExistingSchemaOption { + OVERWRITE, KEEP, SKIP + }; + + public enum SupportedDatabaseType { + POSTGRES, ORACLE + }; + + private static class SocketBindingInfo { + public String name; + public String sysprop; + public int port; + + public SocketBindingInfo(String n, String s, int p) { + name = n; + sysprop = s; + port = p; + } + } + + private static final ArrayList<SocketBindingInfo> defaultSocketBindings; + static { + // all ports are -1000 from out-of-box AS7 defaults + // except for the jboss.management ones - those are -3000 from their out-of-box defaults + defaultSocketBindings = new ArrayList<SocketBindingInfo>(); + defaultSocketBindings.add(new SocketBindingInfo(SocketBindingJBossASClient.DEFAULT_BINDING_AJP, + "rhq.server.socket.binding.port.ajp", 7009)); + defaultSocketBindings.add(new SocketBindingInfo(SocketBindingJBossASClient.DEFAULT_BINDING_HTTP, + "rhq.server.socket.binding.port.http", 7080)); + defaultSocketBindings.add(new SocketBindingInfo(SocketBindingJBossASClient.DEFAULT_BINDING_HTTPS, + "rhq.server.socket.binding.port.https", 7443)); + defaultSocketBindings.add(new SocketBindingInfo(SocketBindingJBossASClient.DEFAULT_BINDING_JACORB, + "rhq.server.socket.binding.port.jacorb", 2528)); + defaultSocketBindings.add(new SocketBindingInfo(SocketBindingJBossASClient.DEFAULT_BINDING_JACORB_SSL, + "rhq.server.socket.binding.port.jacorb-ssl", 2529)); + defaultSocketBindings.add(new SocketBindingInfo(SocketBindingJBossASClient.DEFAULT_BINDING_MESSAGING, + "rhq.server.socket.binding.port.messaging", 4445)); + defaultSocketBindings.add(new SocketBindingInfo(SocketBindingJBossASClient.DEFAULT_BINDING_MESSAGING_THRUPUT, + "rhq.server.socket.binding.port.messaging-throughput", 4455)); + defaultSocketBindings.add(new SocketBindingInfo(SocketBindingJBossASClient.DEFAULT_BINDING_MGMT_HTTP, + "jboss.management.http.port", 6990)); + defaultSocketBindings.add(new SocketBindingInfo(SocketBindingJBossASClient.DEFAULT_BINDING_MGMT_HTTPS, + "jboss.management.https.port", 6443)); + defaultSocketBindings.add(new SocketBindingInfo(SocketBindingJBossASClient.DEFAULT_BINDING_MGMT_NATIVE, + "jboss.management.native.port", 6999)); + defaultSocketBindings.add(new SocketBindingInfo(SocketBindingJBossASClient.DEFAULT_BINDING_OSGI_HTTP, + "rhq.server.socket.binding.port.osgi-http", 7090)); + defaultSocketBindings.add(new SocketBindingInfo(SocketBindingJBossASClient.DEFAULT_BINDING_REMOTING, + "rhq.server.socket.binding.port.remoting", 3447)); + defaultSocketBindings.add(new SocketBindingInfo(SocketBindingJBossASClient.DEFAULT_BINDING_TXN_RECOVERY_ENV, + "rhq.server.socket.binding.port.txn-recovery-environment", 3712)); + defaultSocketBindings.add(new SocketBindingInfo(SocketBindingJBossASClient.DEFAULT_BINDING_TXN_STATUS_MGR, + "rhq.server.socket.binding.port.txn-status-manager", 3713)); + } + + private static final String RHQ_DATASOURCE_NAME_NOTX = "NoTxRHQDS"; + private static final String RHQ_DATASOURCE_NAME_XA = "RHQDS"; + private static final String RHQ_DS_SECURITY_DOMAIN = "RHQDSSecurityDomain"; + private static final String RHQ_REST_SECURITY_DOMAIN = "RHQRESTSecurityDomain"; + private static final String JDBC_DRIVER_POSTGRES = "postgres"; + private static final String JDBC_DRIVER_ORACLE = "oracle"; + private static final String JMS_ALERT_CONDITION_QUEUE = "AlertConditionQueue"; + private static final String JMS_DRIFT_CHANGESET_QUEUE = "DriftChangesetQueue"; + private static final String JMS_DRIFT_FILE_QUEUE = "DriftFileQueue"; + private static final String RHQ_CACHE_CONTAINER = "rhq"; + private static final String RHQ_CACHE = "rhqCache"; + + /** + * Configure the deployment scanner to get ready to deploy the application. + * @param mcc JBossAS management client + * @throws Exception + */ + public static void configureDeploymentScanner(ModelControllerClient mcc) throws Exception { + CoreJBossASClient client = new CoreJBossASClient(mcc); + + // we do not want our RHQ Server to support hot deployments via the scanner + client.setAppServerDefaultDeploymentScanEnabled(false); + } + + /** + * Prepares the mail service by configuring the SMTP settings. + * + * @param mcc JBossAS management client + * @param serverProperties the server's properties + * @throws Exception + */ + public static void setupMailService(ModelControllerClient mcc, HashMap<String, String> serverProperties) + throws Exception { + + String fromAddressExpr = "${" + ServerProperties.PROP_EMAIL_FROM_ADDRESS + ":rhqadmin@localhost.com}"; + //String smtpHostExpr = "${" + ServerProperties.PROP_EMAIL_SMTP_HOST + ":localhost}"; + String smtpPortExpr = "${" + ServerProperties.PROP_EMAIL_SMTP_PORT + ":25}"; + + // Tweek the mail configuration that comes out of box. Setup a batch request to write the proper attributes. + + // First, the from address (TODO: there is also a "ssl", "username" and "password" attribute we could set for authz) + Address addr = Address.root().add(JBossASClient.SUBSYSTEM, "mail", "mail-session", "java:jboss/mail/Default"); + ModelNode writeFromAddr = JBossASClient.createRequest(JBossASClient.WRITE_ATTRIBUTE, addr); + writeFromAddr.get(JBossASClient.NAME).set("from"); + writeFromAddr.get(JBossASClient.VALUE).setExpression(fromAddressExpr); + + // now the SMTP host + addr = Address.root().add("socket-binding-group", "standard-sockets", + "remote-destination-outbound-socket-binding", "mail-smtp"); + ModelNode writeHost = JBossASClient.createRequest(JBossASClient.WRITE_ATTRIBUTE, addr); + writeHost.get(JBossASClient.NAME).set("host"); + // TODO: see https://issues.jboss.org/browse/AS7-5321 - that must be fixed before supporting expressions + //writeHost.get(JBossASClient.VALUE).setExpression(smtpHostExpr); + writeHost.get(JBossASClient.VALUE).set(serverProperties.get(ServerProperties.PROP_EMAIL_SMTP_HOST)); // remove when AS7-5321 is fixed + + // now the SMTP port + addr = Address.root().add("socket-binding-group", "standard-sockets", + "remote-destination-outbound-socket-binding", "mail-smtp"); + ModelNode writePort = JBossASClient.createRequest(JBossASClient.WRITE_ATTRIBUTE, addr); + writePort.get(JBossASClient.NAME).set("port"); + writePort.get(JBossASClient.VALUE).setExpression(smtpPortExpr); + + ModelNode batch = JBossASClient.createBatchRequest(writeFromAddr, writeHost, writePort); + JBossASClient client = new JBossASClient(mcc); + ModelNode response = client.execute(batch); + if (!JBossASClient.isSuccess(response)) { + throw new FailureException(response, "Failed to setup mail service"); + } + LOG.info("Mail service has been configured."); + return; + } + + /** + * Give the server properties, this returns the type of database that will be connected to. + * + * @param serverProperties + * @return the type of DB + */ + public static SupportedDatabaseType getSupportedDatabaseType(HashMap<String, String> serverProperties) { + return getSupportedDatabaseType(serverProperties.get(ServerProperties.PROP_DATABASE_TYPE)); + } + + /** + * Give the database type string, this returns the type of database that it refers to. + * + * @param dbType the database type string + * @return the type of DB + */ + public static SupportedDatabaseType getSupportedDatabaseType(String dbType) { + if (dbType == null) { + return null; + } + if (dbType.toLowerCase().indexOf("postgres") > -1) { + return SupportedDatabaseType.POSTGRES; + } else if (dbType.toLowerCase().indexOf("oracle") > -1) { + return SupportedDatabaseType.ORACLE; + } + return null; + } + + /** + * Creates the security domain for the datasources. This is needed to support + * obfuscation of the password in the configuration file. + * + * @param mcc the JBossAS management client + * @param serverProperties contains the obfuscated password to store in the security domain + * @throws Exception + */ + public static void createDatasourceSecurityDomain(ModelControllerClient mcc, + HashMap<String, String> serverProperties) throws Exception { + + final String dbUsername = serverProperties.get(ServerProperties.PROP_DATABASE_USERNAME); + final String obfuscatedPassword = serverProperties.get(ServerProperties.PROP_DATABASE_PASSWORD); + final SecurityDomainJBossASClient client = new SecurityDomainJBossASClient(mcc); + final String securityDomain = RHQ_DS_SECURITY_DOMAIN; + if (!client.isSecurityDomain(securityDomain)) { + client.createNewSecureIdentitySecurityDomainRequest(securityDomain, dbUsername, obfuscatedPassword); + LOG.info("Security domain [" + securityDomain + "] created"); + } else { + LOG.info("Security domain [" + securityDomain + "] already exists, skipping the creation request"); + } + } + + /** + * Creates the JMS Queues required for Drift and Alerting. + * + * @param mcc the JBossAS management client + * @param serverProperties contains the obfuscated password to store in the security domain + * @throws Exception + */ + public static void createNewJMSQueues(ModelControllerClient mcc, HashMap<String, String> serverProperties) + throws Exception { + + final MessagingJBossASClient client = new MessagingJBossASClient(mcc); + final List<String> entryNames = new ArrayList<String>(); + + // TODO (jshaughn): Prior to HornetQ we set recoveryRetries to 0: "don't redeliver messages on failure. It + // just causes more failures. just go straight to the dead messages by setting recoveryRetries to 0. + // This is equivalent to setting the dLQMaxResent property to 0 in the MessageDriven annotation in + // the class definition." + // HornetQ has different semantics, and may behave well with default settings. If not, we'll + // likely need to add specific <address-setting> elements for our queues, which set + // max-delivery-attempts to 0. The documented default is 10. + + String queueName = JMS_ALERT_CONDITION_QUEUE; + if (!client.isQueue(queueName)) { + entryNames.clear(); + entryNames.add("queue/" + queueName); + ModelNode request = client.createNewQueueRequest(queueName, true, entryNames); + ModelNode results = client.execute(request); + if (!MessagingJBossASClient.isSuccess(results)) { + throw new FailureException(results, "Failed to create JMS Queue [" + queueName + "]"); + } else { + LOG.info("JMS queue [" + queueName + "] created"); + } + } else { + LOG.info("JMS Queue [" + queueName + "] already exists, skipping the creation request"); + } + + queueName = JMS_DRIFT_CHANGESET_QUEUE; + if (!client.isQueue(queueName)) { + entryNames.clear(); + entryNames.add("queue/" + queueName); + ModelNode request = client.createNewQueueRequest(queueName, true, entryNames); + ModelNode results = client.execute(request); + if (!MessagingJBossASClient.isSuccess(results)) { + throw new FailureException(results, "Failed to create JMS Queue [" + queueName + "]"); + } else { + LOG.info("JMS queue [" + queueName + "] created"); + } + } else { + LOG.info("JMS Queue [" + queueName + "] already exists, skipping the creation request"); + } + + queueName = JMS_DRIFT_FILE_QUEUE; + if (!client.isQueue(queueName)) { + entryNames.clear(); + entryNames.add("queue/" + queueName); + ModelNode request = client.createNewQueueRequest(queueName, true, entryNames); + ModelNode results = client.execute(request); + if (!MessagingJBossASClient.isSuccess(results)) { + throw new FailureException(results, "Failed to create JMS Queue [" + queueName + "]"); + } else { + LOG.info("JMS queue [" + queueName + "] created"); + } + } else { + LOG.info("JMS Queue [" + queueName + "] already exists, skipping the creation request"); + } + + } + + /** + * Creates the security domain for REST. + * + * @param mcc the JBossAS management client + * @param serverProperties contains the obfuscated password to store in the security domain + * @throws Exception + */ + public static void createRESTSecurityDomain(ModelControllerClient mcc, HashMap<String, String> serverProperties) + throws Exception { + + final SecurityDomainJBossASClient client = new SecurityDomainJBossASClient(mcc); + final String securityDomain = RHQ_REST_SECURITY_DOMAIN; + if (!client.isSecurityDomain(securityDomain)) { + client.createNewDatabaseServerSecurityDomainRequest(securityDomain, "java:jboss/datasources/RHQDS", + "SELECT PASSWORD FROM RHQ_PRINCIPAL WHERE principal=?", + "SELECT 'all', 'Roles' FROM RHQ_PRINCIPAL WHERE principal=?", null, null); + LOG.info("Security domain [" + securityDomain + "] created"); + } else { + LOG.info("Security domain [" + securityDomain + "] already exists, skipping the creation request"); + } + } + + /** + * Creates the Infinispan caches for RHQ. + * + * @param mcc the JBossAS management client + * @param serverProperties contains the obfuscated password to store in the security domain + * @throws Exception + */ + public static void createNewCaches(ModelControllerClient mcc, HashMap<String, String> serverProperties) + throws Exception { + + final InfinispanJBossASClient client = new InfinispanJBossASClient(mcc); + final String cacheContainerName = RHQ_CACHE_CONTAINER; + final String localCacheName = RHQ_CACHE; + if (!client.isCacheContainer(cacheContainerName)) { + ModelNode request = client.createNewCacheContainerRequest(cacheContainerName, localCacheName); + ModelNode results = client.execute(request); + if (!MessagingJBossASClient.isSuccess(results)) { + throw new FailureException(results, "Failed to create Cache container [" + cacheContainerName + "]"); + } else { + LOG.info("Cache container [" + cacheContainerName + "] created"); + } + + } else { + LOG.info("Cache container [" + cacheContainerName + "] already exists, skipping the creation request"); + } + + if (!client.isLocalCache(cacheContainerName, localCacheName)) { + ModelNode request = client.createNewLocalCacheRequest(cacheContainerName, localCacheName, null, null, null, + null, null); + ModelNode results = client.execute(request); + if (!MessagingJBossASClient.isSuccess(results)) { + throw new FailureException(results, "Failed to create Local Cache [" + localCacheName + "]"); + } else { + LOG.info("Local Cache [" + localCacheName + "] created"); + } + + } else { + LOG.info("Local Cache [" + localCacheName + "] already exists, skipping the creation request"); + } + } + + /** + * Creates JDBC driver configurations so the datasources can properly connect to the backend databases. + * This will attempt to create drivers for all supported databases, not just for the database type that + * is currently configured. + * + * @param mcc + * @param serverProperties + * @throws Exception + */ + public static void createNewJdbcDrivers(ModelControllerClient mcc, HashMap<String, String> serverProperties) + throws Exception { + + final DatasourceJBossASClient client = new DatasourceJBossASClient(mcc); + + final ModelNode postgresDriverRequest = client.createNewJdbcDriverRequest(JDBC_DRIVER_POSTGRES, + "org.rhq.postgres", "org.postgresql.xa.PGXADataSource"); + final ModelNode oracleDriverRequest = client.createNewJdbcDriverRequest(JDBC_DRIVER_ORACLE, "org.rhq.oracle", + "oracle.jdbc.xa.client.OracleXADataSource"); + + // if we are to use Oracle, we throw an exception if we can't create the Oracle datasource. We also try to + // create the Postgres datasource but because it isn't needed, we don't throw exceptions if that fails, we + // just log a warning. + // The reverse is true if we are to use Postgres (that is, we ensure Postgres driver is created, but not Oracle). + ModelNode results; + final SupportedDatabaseType supportedDbType = getSupportedDatabaseType(serverProperties); + switch (supportedDbType) { + case POSTGRES: { + if (client.isJDBCDriver(JDBC_DRIVER_POSTGRES)) { + LOG.info("Postgres JDBC driver is already deployed"); + } else { + results = client.execute(postgresDriverRequest); + if (!DatasourceJBossASClient.isSuccess(results)) { + throw new FailureException(results, "Failed to create postgres database driver"); + } else { + LOG.info("Deployed Postgres JDBC driver"); + } + } + + if (client.isJDBCDriver(JDBC_DRIVER_ORACLE)) { + LOG.info("Oracle JDBC driver is already deployed"); + } else { + results = client.execute(oracleDriverRequest); + if (!DatasourceJBossASClient.isSuccess(results)) { + LOG.warn("Could not create Oracle JDBC Driver - you will not be able to switch to an Oracle DB later: " + + JBossASClient.getFailureDescription(results)); + } else { + LOG.info("Deployed Oracle JDBC driver for future use"); + } + } + break; + } + case ORACLE: { + if (client.isJDBCDriver(JDBC_DRIVER_ORACLE)) { + LOG.info("Oracle JDBC driver is already deployed"); + } else { + results = client.execute(oracleDriverRequest); + if (!DatasourceJBossASClient.isSuccess(results)) { + throw new FailureException(results, "Failed to create oracle database driver"); + } else { + LOG.info("Deployed Oracle JDBC driver"); + } + } + if (client.isJDBCDriver(JDBC_DRIVER_POSTGRES)) { + LOG.info("Postgres JDBC driver is already deployed"); + } else { + results = client.execute(postgresDriverRequest); + if (!DatasourceJBossASClient.isSuccess(results)) { + LOG.warn("Could not create Postgres JDBC Driver - you will not be able to switch to a Postgres DB later: " + + JBossASClient.getFailureDescription(results)); + } else { + LOG.info("Deployed Postgres JDBC driver for future use"); + } + } + break; + } + default: + throw new RuntimeException("bad db type"); // this should never happen; should have never gotten to this point with a bad type + } + + } + + /** + * Creates the datasources needed by the RHQ Server. + * + * @param mcc the JBossAS management client + * @param serverProperties properties to help determine the properties of the datasources to be created + * @throws Exception + */ + public static void createNewDatasources(ModelControllerClient mcc, HashMap<String, String> serverProperties) + throws Exception { + + final SupportedDatabaseType supportedDbType = getSupportedDatabaseType(serverProperties); + switch (supportedDbType) { + case POSTGRES: { + createNewDatasources_Postgres(mcc); + break; + } + case ORACLE: { + createNewDatasources_Oracle(mcc); + break; + } + default: + throw new RuntimeException("bad db type"); // this should never happen; should have never gotten to this point with a bad type + } + + LOG.info("Created datasources"); + + final DatasourceJBossASClient client = new DatasourceJBossASClient(mcc); + client.enableDatasource(RHQ_DATASOURCE_NAME_NOTX); + client.enableXADatasource(RHQ_DATASOURCE_NAME_XA); + LOG.info("Enabled datasources"); + + } + + private static void createNewDatasources_Postgres(ModelControllerClient mcc) throws Exception { + final HashMap<String, String> props = new HashMap<String, String>(4); + final DatasourceJBossASClient client = new DatasourceJBossASClient(mcc); + + ModelNode noTxDsRequest = null; + ModelNode xaDsRequest = null; + + if (!client.isDatasource(RHQ_DATASOURCE_NAME_NOTX)) { + props.put("char.encoding", "UTF-8"); + + noTxDsRequest = client.createNewDatasourceRequest(RHQ_DATASOURCE_NAME_NOTX, 30000, + "${rhq.server.database.connection-url:jdbc:postgres://127.0.0.1:5432/rhq}", JDBC_DRIVER_POSTGRES, + "org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter", 15, false, 2, 5, 75, + RHQ_DS_SECURITY_DOMAIN, "-unused-stale-conn-checker-", "TRANSACTION_READ_COMMITTED", + "org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker", props); + noTxDsRequest.get("steps").get(0).remove("stale-connection-checker-class-name"); // we don't have one of these for postgres + } else { + LOG.info("Postgres datasource [" + RHQ_DATASOURCE_NAME_NOTX + "] already exists"); + } + + if (!client.isXADatasource(RHQ_DATASOURCE_NAME_XA)) { + props.clear(); + props.put("ServerName", "${rhq.server.database.server-name:127.0.0.1}"); + props.put("PortNumber", "${rhq.server.database.port:5432}"); + props.put("DatabaseName", "${rhq.server.database.db-name:rhq}"); + + xaDsRequest = client.createNewXADatasourceRequest(RHQ_DATASOURCE_NAME_XA, 30000, JDBC_DRIVER_POSTGRES, + "org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter", 15, 5, 50, 75, + RHQ_DS_SECURITY_DOMAIN, "-unused-stale-conn-checker-", "TRANSACTION_READ_COMMITTED", + "org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker", props); + xaDsRequest.get("steps").get(0).remove("stale-connection-checker-class-name"); // we don't have one of these for postgres + } else { + LOG.info("Postgres XA datasource [" + RHQ_DATASOURCE_NAME_XA + "] already exists"); + } + + if (noTxDsRequest != null || xaDsRequest != null) { + ModelNode batch = DatasourceJBossASClient.createBatchRequest(noTxDsRequest, xaDsRequest); + ModelNode results = client.execute(batch); + if (!DatasourceJBossASClient.isSuccess(results)) { + throw new FailureException(results, "Failed to create Postgres datasources"); + } + } + } + + private static void createNewDatasources_Oracle(ModelControllerClient mcc) throws Exception { + final HashMap<String, String> props = new HashMap<String, String>(2); + final DatasourceJBossASClient client = new DatasourceJBossASClient(mcc); + + ModelNode noTxDsRequest = null; + ModelNode xaDsRequest = null; + + if (!client.isDatasource(RHQ_DATASOURCE_NAME_NOTX)) { + props.put("char.encoding", "UTF-8"); + props.put("SetBigStringTryClob", "true"); + + noTxDsRequest = client.createNewDatasourceRequest(RHQ_DATASOURCE_NAME_NOTX, 30000, + "${rhq.server.database.connection-url:jdbc:oracle:thin:@127.0.0.1:1521:rhq}", JDBC_DRIVER_ORACLE, + "org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter", 15, false, 2, 5, 75, + RHQ_DS_SECURITY_DOMAIN, "org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker", + "TRANSACTION_READ_COMMITTED", + "org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker", props); + } else { + LOG.info("Oracle datasource [" + RHQ_DATASOURCE_NAME_NOTX + "] already exists"); + } + + if (!client.isDatasource(RHQ_DATASOURCE_NAME_XA)) { + props.clear(); + props.put("URL", "${rhq.server.database.connection-url:jdbc:oracle:thin:@127.0.0.1:1521:rhq}"); + props.put("ConnectionProperties", "SetBigStringTryClob=true"); + + xaDsRequest = client.createNewXADatasourceRequest(RHQ_DATASOURCE_NAME_XA, 30000, JDBC_DRIVER_ORACLE, + "org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter", 15, 5, 50, 75, + RHQ_DS_SECURITY_DOMAIN, "org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker", + "TRANSACTION_READ_COMMITTED", + "org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker", props); + } else { + LOG.info("Oracle XA datasource [" + RHQ_DATASOURCE_NAME_XA + "] already exists"); + } + + if (noTxDsRequest != null || xaDsRequest != null) { + ModelNode batch = DatasourceJBossASClient.createBatchRequest(noTxDsRequest, xaDsRequest); + ModelNode results = client.execute(batch); + if (!DatasourceJBossASClient.isSuccess(results)) { + throw new FailureException(results, "Failed to create Oracle datasources"); + } + } + } + + /** + * Determines if we are in auto-install mode. This means the properties file is + * fully configured and the installation can begin without asking the user + * for more input. + * + * @param serverProperties the full set of server properties + * + * @return true if we are in auto-install mode; false if the user must give us more + * information before we can complete the installation. + */ + public static boolean isAutoinstallEnabled(HashMap<String, String> serverProperties) { + String enableProp = serverProperties.get(ServerProperties.PROP_AUTOINSTALL_ENABLE); + if (enableProp != null) { + return Boolean.parseBoolean(enableProp); + } + return false; + } + + /** + * Returns <code>true</code> if the database already has the database schema created for it. It will not be known + * what version of schema or if its the latest, all this method tells you is that some RHQ database schema exists. + * + * @param connectionUrl + * @param username + * @param password + * @return <code>true</code> if the database can be connected to + * + * @throws Exception if failed to communicate with the database + */ + public static boolean isDatabaseSchemaExist(String connectionUrl, String username, String password) + throws Exception { + + Connection conn = getDatabaseConnection(connectionUrl, username, password); + DatabaseType db = DatabaseTypeFactory.getDatabaseType(conn); + + try { + return db.checkTableExists(conn, "RHQ_PRINCIPAL"); + } catch (IllegalStateException e) { + return false; + } finally { + db.closeConnection(conn); + } + } + + /** + * Get the list of existing servers from an existing schema. + * + * @param connectionUrl + * @param username + * @param password + * @return List of server names registered in the database. Empty list if the table does not exist or there are no entries in the table. + * + * @throws Exception if failed to communicate with the database + */ + public static ArrayList<String> getServerNames(String connectionUrl, String username, String password) + throws Exception { + DatabaseType db = null; + Connection conn = null; + Statement stm = null; + ResultSet rs = null; + ArrayList<String> result = new ArrayList<String>(); + + try { + conn = getDatabaseConnection(connectionUrl, username, password); + db = DatabaseTypeFactory.getDatabaseType(conn); + + if (db.checkTableExists(conn, "rhq_server")) { + + stm = conn.createStatement(); + rs = stm.executeQuery("SELECT name FROM rhq_server ORDER BY name asc"); + + while (rs.next()) { + result.add(rs.getString(1)); + } + } + } catch (IllegalStateException e) { + // table does not exist + } catch (SQLException e) { + LOG.info("Unable to fetch existing server info: " + e.getMessage()); + } finally { + if (null != db) { + db.closeJDBCObjects(conn, stm, rs); + } + } + + return result; + } + + /** + * Returns information on the server as found in the database (port numbers, affinity group, etc). + * + * @param connectionUrl + * @param username + * @param password + * @param serverName the server whose details are to be returned + * @return the information on the named server + */ + public static ServerDetails getServerDetails(String connectionUrl, String username, String password, + String serverName) { + + DatabaseType db = null; + Connection conn = null; + ServerDetails result = null; + + try { + conn = getDatabaseConnection(connectionUrl, username, password); + db = DatabaseTypeFactory.getDatabaseType(conn); + + result = getServerDetails(db, conn, serverName); + + } catch (Exception e) { + LOG.info("Unable to get server detail: " + e.getMessage()); + } finally { + if (null != db) { + db.closeConnection(conn); + } + } + + return result; + } + + private static ServerDetails getServerDetails(DatabaseType db, Connection conn, String serverName) { + PreparedStatement stm = null; + ResultSet rs = null; + ServerDetails result = null; + + if (null == serverName) { + return result; + } + + try { + stm = conn.prepareStatement("" // + + "SELECT s.address, s.port, s.secure_port " // + + " FROM rhq_server s " // + + " WHERE s.name = ?"); + stm.setString(1, serverName.trim()); + + rs = stm.executeQuery(); + + if (rs.next()) { + result = new ServerDetails(serverName, rs.getString(1), rs.getInt(2), rs.getInt(3)); + } + } catch (SQLException e) { + LOG.info("Unable to get server details for server [" + serverName + "]: " + e.getMessage()); + } finally { + if (null != db) { + db.closeResultSet(rs); + db.closeStatement(stm); + } + } + + return result; + } + + /** + * Tests to make sure the server can be connected to with the given settings. + * If the test is successful, <code>null</code>. If the test fails, the returned string + * will be the error message to indicate the problem. + * + * @param connectionUrl + * @param username + * @param password + * @return error message if test failed; <code>null</code> if test succeeded + */ + public static String testConnection(String connectionUrl, String username, String password) { + + // its possible the JDBC URL was changed, clear the factory cache in case the DB version is different now + DatabaseTypeFactory.clearDatabaseTypeCache(); + + try { + ensureDatabaseIsSupported(connectionUrl, username, password); + return null; + } catch (Exception e) { + LOG.warn("Installer failed to test connection", e); + return ThrowableUtil.getAllMessages(e); + } + } + + /** + * Call this when you need to confirm that the database is supported. + * + * @param connectionUrl + * @param username + * @param password + * + * @throws Exception if the database is not supported + */ + public static void ensureDatabaseIsSupported(String connectionUrl, String username, String password) + throws Exception { + Connection conn = null; + DatabaseType db = null; + + try { + conn = getDatabaseConnection(connectionUrl, username, password); + db = DatabaseTypeFactory.getDatabaseType(conn); + + String version = db.getVersion(); + + if (DatabaseTypeFactory.isPostgres(db)) { + if (version.startsWith("7") || version.equals("8") || version.startsWith("8.0") + || version.startsWith("8.1")) { + throw new Exception("Unsupported PostgreSQL [" + db + "]"); + } + } else if (DatabaseTypeFactory.isOracle(db)) { + if (version.startsWith("8") || version.startsWith("9")) { + throw new Exception("Unsupported Oracle [" + db + "]"); + } + } else { + throw new Exception("Unsupported DB [" + db + "]"); + } + + LOG.info("Database is supported: " + db); + } finally { + if (db != null) { + db.closeConnection(conn); + } + } + + return; + } + + /** + * Returns a database connection with the given set of properties providing the settings that allow for a successful + * database connection. If <code>props</code> is <code>null</code>, it will use the server properties from + * {@link #getServerProperties()}. + * + * @param connectionUrl + * @param userName + * @param password + * @return the database connection + * + * @throws SQLException if cannot successfully connect to the database + */ + public static Connection getDatabaseConnection(String connectionUrl, String userName, String password) + throws SQLException { + return DbUtil.getConnection(connectionUrl, userName, password); + } + + /** + * Use the internal JBossAS mechanism to obfuscate a password. This is not true encryption. + * + * @param password the clear text of the password to obfuscate + * @return the obfuscated password + */ + public static String obfuscatePassword(String password) { + + // We need to do some mumbo jumbo, as the interesting method is private + // in SecureIdentityLoginModule + + try { + String className = "org.picketbox.datasource.security.SecureIdentityLoginModule"; + Class<?> clazz = Class.forName(className); + Object object = clazz.newInstance(); + Method method = clazz.getDeclaredMethod("encode", String.class); + method.setAccessible(true); + String result = method.invoke(object, password).toString(); + return result; + } catch (Exception e) { + throw new RuntimeException("obfuscating db password failed: ", e); + } + } + + /** + * Use the internal JBossAS mechanism to de-obfuscate a password back to its + * clear text form. This is not true encryption. + * + * @param obfuscatedPasswordd the obfuscated password + * @return the clear-text password + */ + public static String deobfuscatePassword(String obfuscatedPassword) { + + // We need to do some mumbo jumbo, as the interesting method is private + // in SecureIdentityLoginModule + + try { + String className = "org.picketbox.datasource.security.SecureIdentityLoginModule"; + Class<?> clazz = Class.forName(className); + Object object = clazz.newInstance(); + Method method = clazz.getDeclaredMethod("decode", String.class); + method.setAccessible(true); + char[] result = (char[]) method.invoke(object, obfuscatedPassword); + return new String(result); + } catch (Exception e) { + throw new RuntimeException("de-obfuscating db password failed: ", e); + } + } + + /** + * Stores the server details (such as the public endpoint) in the database. If the server definition already + * exists, it will be updated; otherwise, a new server will be added to the HA cloud. + * + * @param serverProperties the server properties + * @param password clear text password to connect to the database + * @param serverDetails the details of the server to put into the database + * @throws Exception + */ + public static void storeServerDetails(HashMap<String, String> serverProperties, String password, + ServerDetails serverDetails) throws Exception { + + DatabaseType db = null; + Connection conn = null; + + try { + String dbUrl = serverProperties.get(ServerProperties.PROP_DATABASE_CONNECTION_URL); + String userName = serverProperties.get(ServerProperties.PROP_DATABASE_USERNAME); + conn = getDatabaseConnection(dbUrl, userName, password); + db = DatabaseTypeFactory.getDatabaseType(conn); + + updateOrInsertServer(db, conn, serverDetails); + + } catch (SQLException e) { + // TODO: should we throw an exception here? This would abort the rest of the installation + LOG.info("Unable to store server entry in the database: " + ThrowableUtil.getAllMessages(e)); + } finally { + if (null != db) { + db.closeConnection(conn); + } + } + } + + private static void updateOrInsertServer(DatabaseType db, Connection conn, ServerDetails serverDetails) { + PreparedStatement stm = null; + ResultSet rs = null; + + if (null == serverDetails || isEmpty(serverDetails.getName())) { + return; + } + + try { + stm = conn.prepareStatement("UPDATE rhq_server SET address=?, port=?, secure_port=? WHERE name=?"); + stm.setString(1, serverDetails.getEndpointAddress()); + stm.setInt(2, serverDetails.getEndpointPort()); + stm.setInt(3, serverDetails.getEndpointSecurePort()); + stm.setString(4, serverDetails.getName()); + if (0 == stm.executeUpdate()) { + stm.close(); + + // set all new servers to operation_mode=INSTALLED + int i = 1; + if (db instanceof PostgresqlDatabaseType || db instanceof OracleDatabaseType) { + stm = conn.prepareStatement("INSERT INTO rhq_server " // + + " ( id, name, address, port, secure_port, ctime, mtime, operation_mode, compute_power ) " // + + "VALUES ( ?, ?, ?, ?, ?, ?, ?, 'INSTALLED', 1 )"); + stm.setInt(i++, db.getNextSequenceValue(conn, "rhq_server", "id")); + } else { + throw new IllegalArgumentException("Unknown database type, can't continue: " + db); + } + + stm.setString(i++, serverDetails.getName()); + stm.setString(i++, serverDetails.getEndpointAddress()); + stm.setInt(i++, serverDetails.getEndpointPort()); + stm.setInt(i++, serverDetails.getEndpointSecurePort()); + long now = System.currentTimeMillis(); + stm.setLong(i++, now); + stm.setLong(i++, now); + stm.executeUpdate(); + } + + } catch (SQLException e) { + LOG.info("Unable to put the server details in the database: " + ThrowableUtil.getAllMessages(e)); + } finally { + if (null != db) { + db.closeResultSet(rs); + db.closeStatement(stm); + } + } + } + + /** + * This will create the database schema in the database. <code>props</code> define the connection to the database - + * + * <p>Note that if the {@link #isDatabaseSchemaExist(Properties) schema already exists}, it will be purged of all + * data/tables and recreated.</p> + * + * @param props the full set of server properties + * @param serverDetails additional information about the server being installed + * @param password the database password in clear text + * @param logDir a directory where the db schema upgrade logs can be written + * + * @throws Exception if failed to create the new schema for some reason + */ + public static void createNewDatabaseSchema(HashMap<String, String> props, ServerDetails serverDetails, + String password, String logDir) throws Exception { + String dbUrl = props.get(ServerProperties.PROP_DATABASE_CONNECTION_URL); + String userName = props.get(ServerProperties.PROP_DATABASE_USERNAME); + + try { + // extract the dbsetup files which are located in the dbutils jar + String dbsetupSchemaXmlFile = extractDatabaseXmlFile("db-schema-combined.xml", props, serverDetails, logDir); + String dbsetupDataXmlFile = extractDatabaseXmlFile("db-data-combined.xml", props, serverDetails, logDir); + + // first uninstall any old existing schema, then create the tables then insert the data + DBSetup dbsetup = new DBSetup(dbUrl, userName, password); + dbsetup.uninstall(dbsetupSchemaXmlFile); + dbsetup.setup(dbsetupSchemaXmlFile); + dbsetup.setup(dbsetupDataXmlFile, null, true, false); + } catch (Exception e) { + LOG.fatal("Cannot install the database schema - the server will not run properly.", e); + throw e; + } + + return; + } + + /** + * This will update an existing database schema so it can be upgraded to the latest schema version. + * + * <p>Note that if the {@link #isDatabaseSchemaExist(Properties) schema does not already exist}, errors will + * occur.</p> + * + * @param props the full set of server properties + * @param serverDetails additional information about the server being installed + * @param password the database password in clear text + * @param logDir a directory where the db schema upgrade logs can be written + * + * @throws Exception if the upgrade failed for some reason + */ + public static void upgradeExistingDatabaseSchema(HashMap<String, String> props, ServerDetails serverDetails, + String password, String logDir) throws Exception { + String dbUrl = props.get(ServerProperties.PROP_DATABASE_CONNECTION_URL); + String userName = props.get(ServerProperties.PROP_DATABASE_USERNAME); + + File logfile = new File(logDir, "rhq-installer-dbupgrade.log"); + + logfile.delete(); // do not keep logs from previous dbupgrade runs + + try { + // extract the dbupgrade ANT script which is located in the dbutils jar + String dbupgradeXmlFile = extractDatabaseXmlFile("db-upgrade.xml", props, serverDetails, logDir); + + Properties antProps = new Properties(); + antProps.setProperty("jdbc.url", dbUrl); + antProps.setProperty("jdbc.user", userName); + antProps.setProperty("jdbc.password", password); + antProps.setProperty("target.schema.version", "LATEST"); + + startAnt(new File(dbupgradeXmlFile), "db-ant-tasks.properties", antProps, logfile); + } catch (Exception e) { + LOG.fatal("Cannot upgrade the database schema - the server will not run properly.", e); + throw e; + } + + return; + } + + /** + * Given a server property value string, returns true if it is not specified. + * + * @param s the property string value + * + * @return true if it is null or empty + */ + public static boolean isEmpty(String s) { + return s == null || s.trim().length() == 0; + } + + /** + * Takes the named XML file from the classloader and writes the file to the log directory. This is meant to extract + * the schema/data xml files from the dbutils jar file. It can also be used to extract the db upgrade XML file. + * + * @param xmlFileName the name of the XML file, as found in the classloader + * @param props properties whose values are used to replace the replacement strings found in the XML file + * @param serverDetails additional information about the server being installed + * @param logDir a directory where the db schema upgrade logs can be written + * + * @return the absolute path to the extracted file + * + * @throws IOException if failed to extract the file to the log directory + */ + private static String extractDatabaseXmlFile(String xmlFileName, HashMap<String, String> props, + ServerDetails serverDetails, String logDir) throws IOException { + + // first slurp the file contents in memory + InputStream resourceInStream = ServerInstallUtil.class.getClassLoader().getResourceAsStream(xmlFileName); + ByteArrayOutputStream contentOutStream = new ByteArrayOutputStream(); + StreamUtil.copy(resourceInStream, contentOutStream); + + // now replace their replacement strings with values from the properties + String emailFromAddress = props.get(ServerProperties.PROP_EMAIL_FROM_ADDRESS); + if (isEmpty(emailFromAddress)) { + emailFromAddress = "rhqadmin@localhost"; + } + + String httpPort = props.get(ServerProperties.PROP_WEB_HTTP_PORT); + if (isEmpty(httpPort)) { + httpPort = String.valueOf(ServerDetails.DEFAULT_ENDPOINT_PORT); + } + + String publicEndpoint = serverDetails.getEndpointAddress(); + if (isEmpty(publicEndpoint)) { + try { + publicEndpoint = props.get(ServerProperties.PROP_JBOSS_BIND_ADDRESS); + if (isEmpty(publicEndpoint) || ("0.0.0.0".equals(publicEndpoint))) { + publicEndpoint = InetAddress.getLocalHost().getHostAddress(); + } + } catch (Exception e) { + publicEndpoint = "127.0.0.1"; + } + } + + String content = contentOutStream.toString(); + content = content.replaceAll("@@@LARGE_TABLESPACE_FOR_DATA@@@", "DEFAULT"); + content = content.replaceAll("@@@LARGE_TABLESPACE_FOR_INDEX@@@", "DEFAULT"); + content = content.replaceAll("@@@ADMINUSERNAME@@@", "rhqadmin"); + content = content.replaceAll("@@@ADMINPASSWORD@@@", "x1XwrxKuPvYUILiOnOZTLg=="); // rhqadmin + content = content.replaceAll("@@@ADMINEMAIL@@@", emailFromAddress); + content = content.replaceAll("@@@BASEURL@@@", "http://" + publicEndpoint + ":" + httpPort + "/"); + content = content.replaceAll("@@@JAASPROVIDER@@@", "JDBC"); + content = content.replaceAll("@@@LDAPURL@@@", "ldap://localhost/"); + content = content.replaceAll("@@@LDAPPROTOCOL@@@", ""); + content = content.replaceAll("@@@LDAPLOGINPROP@@@", "cn"); + content = content.replaceAll("@@@LDAPBASEDN@@@", "o=JBoss,c=US"); + content = content.replaceAll("@@@LDAPSEARCHFILTER@@@", ""); + content = content.replaceAll("@@@LDAPBINDDN@@@", ""); + content = content.replaceAll("@@@LDAPBINDPW@@@", ""); + content = content.replaceAll("@@@MULTICAST_ADDR@@@", ""); + content = content.replaceAll("@@@MULTICAST_PORT@@@", ""); + + // we now have the finished XML content - write out the file to the log directory + File xmlFile = new File(logDir, xmlFileName); + FileOutputStream xmlFileOutStream = new FileOutputStream(xmlFile); + ByteArrayInputStream contentInStream = new ByteArrayInputStream(content.getBytes()); + StreamUtil.copy(contentInStream, xmlFileOutStream); + + return xmlFile.getAbsolutePath(); + } + + /** + * Launches ANT and runs the default target in the given build file. + * + * @param buildFile the build file that ANT will run + * @param customTaskDefs the properties file found in classloader that contains all the taskdef definitions + * @param properties set of properties to set for the ANT task to access + * @param logFile where ANT messages will be logged (in addition to the app server's log file) + * + * @throws RuntimeException + */ + private static void startAnt(File buildFile, String customTaskDefs, Properties properties, File logFile) { + PrintWriter logFileOutput = null; + + try { + logFileOutput = new PrintWriter(new FileOutputStream(logFile)); + + ClassLoader classLoader = ServerInstallUtil.class.getClassLoader(); + + Properties taskDefs = new Properties(); + InputStream taskDefsStream = classLoader.getResourceAsStream(customTaskDefs); + try { + taskDefs.load(taskDefsStream); + } finally { + taskDefsStream.close(); + } + + Project project = new Project(); + project.setCoreLoader(classLoader); + project.init(); + + for (Map.Entry<Object, Object> property : properties.entrySet()) { + project.setProperty(property.getKey().toString(), property.getValue().toString()); + } + + // notice we add our listener after we set the properties - we do not want the password to be in the log file + // our dbupgrade script will echo the property settings, so we can still get the other values + project.addBuildListener(new LoggerAntBuildListener(logFileOutput)); + + for (Map.Entry<Object, Object> taskDef : taskDefs.entrySet()) { + project.addTaskDefinition(taskDef.getKey().toString(), + Class.forName(taskDef.getValue().toString(), true, classLoader)); + } + + new ProjectHelper2().parse(project, buildFile); + project.executeTarget(project.getDefaultTarget()); + + } catch (Exception e) { + throw new RuntimeException("Cannot run ANT on script [" + buildFile + "]. Cause: " + e, e); + } finally { + if (logFileOutput != null) { + logFileOutput.close(); + } + } + } + + /** + * Creates a keystore whose cert has a CN of this server's public endpoint address. + * + * @param serverDetails details of the server being installed + * @param configDirStr location of a configuration directory where the keystore is to be stored + */ + public static void createKeystore(ServerDetails serverDetails, String configDirStr) { + File confDir = new File(configDirStr); + 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=" + serverDetails.getEndpointAddress() + ", 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 + "]"); + } + } + } + + /** + * Create an rhqadmin/rhqadmin management user so when discovered, the AS7 plugin can immediately + * connect to the RHQ Server. + * + * @param serverDetails details of the server being installed + * @param configDirStr location of a configuration directory where the mgmt-users.properties file lives + */ + public static void createDefaultManagementUser(ServerDetails serverDetails, String configDirStr) { + File confDir = new File(configDirStr); + File mgmtUsers = new File(confDir, "mgmt-users.properties"); + + // Add the default admin user, or if for some reason this file does not exist, just log the issue + if (mgmtUsers.exists()) { + FileOutputStream fos = null; + + try { + fos = new FileOutputStream(mgmtUsers, true); + fos.write("\nrhqadmin=35c160c1f841a889d4cda53f0bfc94b6\n".getBytes()); + + } catch (Exception e) { + LOG.warn("Could not create default management user in file: [" + mgmtUsers.getPath() + "] : ", e); + + } finally { + StreamUtil.safeClose(fos); + } + } else { + LOG.warn("Could not create default management user. Could not find file: [" + mgmtUsers.getPath() + "]"); + } + } + + public static void setSocketBindings(ModelControllerClient mcc, HashMap<String, String> serverProperties) + throws Exception { + final SocketBindingJBossASClient client = new SocketBindingJBossASClient(mcc); + for (SocketBindingInfo binding : defaultSocketBindings) { + // use the port defined by the server's properties if set, otherwise, just use our hardcoded default + int newPort = binding.port; + String overrideValue = serverProperties.get(binding.sysprop); + if (overrideValue != null) { + try { + newPort = Integer.parseInt(overrideValue); + } catch (Exception e) { + LOG.warn("Invalid port in system property [" + binding.sysprop + "]: " + overrideValue); + } + } + LOG.info(String.format("Setting socket binding [%s] to [${%s:%d}]", binding.name, binding.sysprop, newPort)); + client.setStandardSocketBindingPortExpression(binding.name, binding.sysprop, newPort); + } + } + +} diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerProperties.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerProperties.java new file mode 100644 index 0000000..f8f297c --- /dev/null +++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerProperties.java @@ -0,0 +1,174 @@ +/* + * 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.installer; + +import java.util.HashSet; +import java.util.Set; + +/** + * Settings found in the rhq-server.properties file that controls the startup configuration of the server. + * + * @author John Mazzitelli + */ +public class ServerProperties { + public static final String PROP_DATABASE_TYPE = "rhq.server.database.type-mapping"; + public static final String PROP_DATABASE_CONNECTION_URL = "rhq.server.database.connection-url"; + public static final String PROP_DATABASE_USERNAME = "rhq.server.database.user-name"; + public static final String PROP_DATABASE_PASSWORD = "rhq.server.database.password"; + public static final String PROP_DATABASE_SERVER_NAME = "rhq.server.database.server-name"; + public static final String PROP_DATABASE_PORT = "rhq.server.database.port"; + public static final String PROP_DATABASE_DB_NAME = "rhq.server.database.db-name"; + public static final String PROP_DATABASE_HIBERNATE_DIALECT = "hibernate.dialect"; + + public static final String PROP_QUARTZ_DRIVER_DELEGATE_CLASS = "rhq.server.quartz.driverDelegateClass"; + public static final String PROP_QUARTZ_SELECT_WITH_LOCK_SQL = "rhq.server.quartz.selectWithLockSQL"; + public static final String PROP_QUARTZ_LOCK_HANDLER_CLASS = "rhq.server.quartz.lockHandlerClass"; + + public static final String PROP_WEB_HTTP_PORT = "rhq.server.socket.binding.port.http"; + public static final String PROP_WEB_HTTPS_PORT = "rhq.server.socket.binding.port.https"; + + public static final String PROP_EMAIL_SMTP_HOST = "rhq.server.email.smtp-host"; + public static final String PROP_EMAIL_SMTP_PORT = "rhq.server.email.smtp-port"; + public static final String PROP_EMAIL_FROM_ADDRESS = "rhq.server.email.from-address"; + + public static final String PROP_AUTOINSTALL_ENABLE = "rhq.autoinstall.enabled"; + public static final String PROP_AUTOINSTALL_DATABASE = "rhq.autoinstall.database"; + public static final String PROP_AUTOINSTALL_PUBLIC_ADDR = "rhq.autoinstall.public-endpoint-address"; + + public static final String PROP_TOMCAT_SECURITY_CLIENT_AUTH_MOD = "rhq.server.tomcat.security.client-auth-mode"; + public static final String PROP_TOMCAT_SECURITY_SSL_PROTOCOL = "rhq.server.tomcat.security.secure-socket-protocol"; + public static final String PROP_TOMCAT_SECURITY_ALGORITHM = "rhq.server.tomcat.security.algorithm"; + public static final String PROP_TOMCAT_SECURITY_KEYSTORE_ALIAS = "rhq.server.tomcat.security.keystore.alias"; + public static final String PROP_TOMCAT_SECURITY_KEYSTORE_FILENAME = "rhq.server.tomcat.security.keystore.file"; + public static final String PROP_TOMCAT_SECURITY_KEYSTORE_PASSWORD = "rhq.server.tomcat.security.keystore.password"; + public static final String PROP_TOMCAT_SECURITY_KEYSTORE_TYPE = "rhq.server.tomcat.security.keystore.type"; + public static final String PROP_TOMCAT_SECURITY_TRUSTSTORE_FILENAME = "rhq.server.tomcat.security.truststore.file"; + public static final String PROP_TOMCAT_SECURITY_TRUSTSTORE_PASSWORD = "rhq.server.tomcat.security.truststore.password"; + public static final String PROP_TOMCAT_SECURITY_TRUSTSTORE_TYPE = "rhq.server.tomcat.security.truststore.type"; + + public static final String PROP_CONNECTOR_TRANSPORT = "rhq.communications.connector.transport"; + public static final String PROP_CONNECTOR_BIND_ADDRESS = "rhq.communications.connector.bind-address"; + public static final String PROP_CONNECTOR_BIND_PORT = "rhq.communications.connector.bind-port"; + public static final String PROP_CONNECTOR_TRANSPORT_PARAMS = "rhq.communications.connector.transport-params"; + + public static final String PROP_SECURITY_SERVER_SECURE_SOCKET_PROTOCOL = "rhq.communications.connector.security.secure-socket-protocol"; + public static final String PROP_SECURITY_SERVER_KEYSTORE_FILE = "rhq.communications.connector.security.keystore.file"; + public static final String PROP_SECURITY_SERVER_KEYSTORE_ALGORITHM = "rhq.communications.connector.security.keystore.algorithm"; + public static final String PROP_SECURITY_SERVER_KEYSTORE_TYPE = "rhq.communications.connector.security.keystore.type"; + public static final String PROP_SECURITY_SERVER_KEYSTORE_PASSWORD = "rhq.communications.connector.security.keystore.password"; + public static final String PROP_SECURITY_SERVER_KEYSTORE_KEY_PASSWORD = "rhq.communications.connector.security.keystore.key-password"; + public static final String PROP_SECURITY_SERVER_KEYSTORE_ALIAS = "rhq.communications.connector.security.keystore.alias"; + public static final String PROP_SECURITY_SERVER_TRUSTSTORE_FILE = "rhq.communications.connector.security.truststore.file"; + public static final String PROP_SECURITY_SERVER_TRUSTSTORE_ALGORITHM = "rhq.communications.connector.security.truststore.algorithm"; + public static final String PROP_SECURITY_SERVER_TRUSTSTORE_TYPE = "rhq.communications.connector.security.truststore.type"; + public static final String PROP_SECURITY_SERVER_TRUSTSTORE_PASSWORD = "rhq.communications.connector.security.truststore.password"; + public static final String PROP_SECURITY_SERVER_CLIENT_AUTH_MODE = "rhq.communications.connector.security.client-auth-mode"; + + public static final String PROP_SECURITY_CLIENT_SECURE_SOCKET_PROTOCOL = "rhq.server.client.security.secure-socket-protocol"; + public static final String PROP_SECURITY_CLIENT_KEYSTORE_FILE = "rhq.server.client.security.keystore.file"; + public static final String PROP_SECURITY_CLIENT_KEYSTORE_ALGORITHM = "rhq.server.client.security.keystore.algorithm"; + public static final String PROP_SECURITY_CLIENT_KEYSTORE_TYPE = "rhq.server.client.security.keystore.type"; + public static final String PROP_SECURITY_CLIENT_KEYSTORE_PASSWORD = "rhq.server.client.security.keystore.password"; + public static final String PROP_SECURITY_CLIENT_KEYSTORE_KEY_PASSWORD = "rhq.server.client.security.keystore.key-password"; + public static final String PROP_SECURITY_CLIENT_KEYSTORE_ALIAS = "rhq.server.client.security.keystore.alias"; + public static final String PROP_SECURITY_CLIENT_TRUSTSTORE_FILE = "rhq.server.client.security.truststore.file"; + public static final String PROP_SECURITY_CLIENT_TRUSTSTORE_ALGORITHM = "rhq.server.client.security.truststore.algorithm"; + public static final String PROP_SECURITY_CLIENT_TRUSTSTORE_TYPE = "rhq.server.client.security.truststore.type"; + public static final String PROP_SECURITY_CLIENT_TRUSTSTORE_PASSWORD = "rhq.server.client.security.truststore.password"; + public static final String PROP_SECURITY_CLIENT_SERVER_AUTH_MODE_ENABLED = "rhq.server.client.security.server-auth-mode-enabled"; + + public static final String PROP_AGENT_MULTICAST_DETECTOR_ENABLED = "rhq.communications.multicast-detector.enabled"; + public static final String PROP_AGENT_MULTICAST_DETECTOR_BIND_ADDRESS = "rhq.communications.multicast-detector.bind-address"; + public static final String PROP_AGENT_MULTICAST_DETECTOR_MULTICAST_ADDRESS = "rhq.communications.multicast-detector.multicast-address"; + public static final String PROP_AGENT_MULTICAST_DETECTOR_PORT = "rhq.communications.multicast-detector.port"; + + public static final String PROP_CONCURRENCY_LIMIT_WEBCONNS = "rhq.server.startup.web.max-connections"; + public static final String PROP_CONCURRENCY_LIMIT_GLOBAL = "rhq.communications.global-concurrency-limit"; + public static final String PROP_CONCURRENCY_LIMIT_INV_REPORT = "rhq.server.concurrency-limit.inventory-report"; + public static final String PROP_CONCURRENCY_LIMIT_AVAIL_REPORT = "rhq.server.concurrency-limit.availability-report"; + public static final String PROP_CONCURRENCY_LIMIT_INV_SYNC = "rhq.server.concurrency-limit.inventory-sync"; + public static final String PROP_CONCURRENCY_LIMIT_CONTENT_REPORT = "rhq.server.concurrency-limit.content-report"; + public static final String PROP_CONCURRENCY_LIMIT_CONTENT_DOWNLOAD = "rhq.server.concurrency-limit.content-download"; + public static final String PROP_CONCURRENCY_LIMIT_MEAS_REPORT = "rhq.server.concurrency-limit.measurement-report"; + public static final String PROP_CONCURRENCY_LIMIT_MEASSCHED_REQ = "rhq.server.concurrency-limit.measurement-schedule-request"; + + public static final String PROP_JBOSS_BIND_ADDRESS = "jboss.bind.address"; + public static final String PROP_HIGH_AVAILABILITY_NAME = "rhq.server.high-availability.name"; + public static final String PROP_MM_AT_START = "rhq.server.maintenance-mode-at-startup"; + public static final String PROP_OPERATION_TIMEOUT = "rhq.server.operation-timeout"; + + // this list contains all the properties that are to have boolean values (true | false) + public static final Set<String> BOOLEAN_PROPERTIES; + static { + BOOLEAN_PROPERTIES = new HashSet<String>(); + BOOLEAN_PROPERTIES.add(PROP_SECURITY_CLIENT_SERVER_AUTH_MODE_ENABLED); + BOOLEAN_PROPERTIES.add(PROP_MM_AT_START); + BOOLEAN_PROPERTIES.add(PROP_AUTOINSTALL_ENABLE); + BOOLEAN_PROPERTIES.add(PROP_AGENT_MULTICAST_DETECTOR_ENABLED); + } + + // this list contains all the properties that are to have integer values + public static final Set<String> INTEGER_PROPERTIES; + static { + INTEGER_PROPERTIES = new HashSet<String>(); + INTEGER_PROPERTIES.add(PROP_WEB_HTTP_PORT); + INTEGER_PROPERTIES.add(PROP_WEB_HTTPS_PORT); + INTEGER_PROPERTIES.add(PROP_CONNECTOR_BIND_PORT); + INTEGER_PROPERTIES.add(PROP_EMAIL_SMTP_PORT); + INTEGER_PROPERTIES.add(PROP_OPERATION_TIMEOUT); + INTEGER_PROPERTIES.add(PROP_CONCURRENCY_LIMIT_AVAIL_REPORT); + INTEGER_PROPERTIES.add(PROP_CONCURRENCY_LIMIT_CONTENT_DOWNLOAD); + INTEGER_PROPERTIES.add(PROP_CONCURRENCY_LIMIT_CONTENT_REPORT); + INTEGER_PROPERTIES.add(PROP_CONCURRENCY_LIMIT_GLOBAL); + INTEGER_PROPERTIES.add(PROP_CONCURRENCY_LIMIT_INV_REPORT); + INTEGER_PROPERTIES.add(PROP_CONCURRENCY_LIMIT_INV_SYNC); + INTEGER_PROPERTIES.add(PROP_CONCURRENCY_LIMIT_MEAS_REPORT); + INTEGER_PROPERTIES.add(PROP_CONCURRENCY_LIMIT_MEASSCHED_REQ); + INTEGER_PROPERTIES.add(PROP_CONCURRENCY_LIMIT_WEBCONNS); + INTEGER_PROPERTIES.add(PROP_AGENT_MULTICAST_DETECTOR_PORT); + } + + public static final Set<String> CLIENT_AUTH_MODES; + static { + CLIENT_AUTH_MODES = new HashSet<String>(); + CLIENT_AUTH_MODES.add("none"); + CLIENT_AUTH_MODES.add("want"); + CLIENT_AUTH_MODES.add("need"); + } + + public static final Set<String> TOMCAT_CLIENT_AUTH_MODES; + static { + TOMCAT_CLIENT_AUTH_MODES = new HashSet<String>(); + TOMCAT_CLIENT_AUTH_MODES.add("false"); + TOMCAT_CLIENT_AUTH_MODES.add("want"); + TOMCAT_CLIENT_AUTH_MODES.add("true"); + } + + // all of the settings in this list have to be hardcoded to a specific IBM security algorithm + // if we are installing a server that is running in an IBM JVM + public static final Set<String> IBM_ALGOROTHM_SETTINGS; + static { + IBM_ALGOROTHM_SETTINGS = new HashSet<String>(); + IBM_ALGOROTHM_SETTINGS.add(PROP_TOMCAT_SECURITY_ALGORITHM); + IBM_ALGOROTHM_SETTINGS.add(PROP_SECURITY_SERVER_KEYSTORE_ALGORITHM); + IBM_ALGOROTHM_SETTINGS.add(PROP_SECURITY_SERVER_TRUSTSTORE_ALGORITHM); + IBM_ALGOROTHM_SETTINGS.add(PROP_SECURITY_CLIENT_KEYSTORE_ALGORITHM); + IBM_ALGOROTHM_SETTINGS.add(PROP_SECURITY_CLIENT_TRUSTSTORE_ALGORITHM); + } +} \ No newline at end of file diff --git a/modules/enterprise/server/installer/src/main/resources/logging.properties b/modules/enterprise/server/installer/src/main/resources/logging.properties new file mode 100644 index 0000000..6a48b2b --- /dev/null +++ b/modules/enterprise/server/installer/src/main/resources/logging.properties @@ -0,0 +1,27 @@ +# Additional logger names to configure (root logger is always configured) +loggers=org.rhq + +# Root logger level +logger.level=${rhq.server.installer.loglevel:DEBUG} +# Root logger handlers +logger.handlers=FILE,CONSOLE + +# Console handler configuration +handler.CONSOLE=org.jboss.logmanager.handlers.ConsoleHandler +handler.CONSOLE.properties=autoFlush +handler.CONSOLE.level=${rhq.server.installer.loglevel:DEBUG} +handler.CONSOLE.autoFlush=true +handler.CONSOLE.formatter=PATTERN + +# File handler configuration +handler.FILE=org.jboss.logmanager.handlers.FileHandler +handler.FILE.level=${rhq.server.installer.loglevel:DEBUG} +handler.FILE.properties=autoFlush,fileName +handler.FILE.autoFlush=true +handler.FILE.fileName=${rhq.server.installer.logdir:.}/rhq-installer.log +handler.FILE.formatter=PATTERN + +# Formatter pattern configuration +formatter.PATTERN=org.jboss.logmanager.formatters.PatternFormatter +formatter.PATTERN.properties=pattern +formatter.PATTERN.pattern=%d{HH:mm:ss,SSS} %-5p [%c] %s%E%n diff --git a/modules/enterprise/server/installer/src/main/resources/module/main/module.xml b/modules/enterprise/server/installer/src/main/resources/module/main/module.xml new file mode 100644 index 0000000..fcc5cc0 --- /dev/null +++ b/modules/enterprise/server/installer/src/main/resources/module/main/module.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<module xmlns="urn:jboss:module:1.0" name="${moduleName}"> + + <main-class name="org.rhq.enterprise.server.installer.Installer"/> + + <resources> + <resource-root path="${project.build.finalName}.jar"/> + <resource-root path="rhq-core-dbutils-${project.version}.jar"/> + <resource-root path="rhq-core-util-${project.version}.jar"/> + <resource-root path="rhq-enterprise-comm-${project.version}.jar"/> + <resource-root path="rhq-jboss-as-dmr-client-${project.version}.jar"/> + <resource-root path="ant-${ant.version}.jar"/> + <resource-root path="ant-launcher-${ant.version}.jar"/> + <resource-root path="i18nlog-${i18nlog.version}.jar"/> + </resources> + + <dependencies> + <module name="gnu.getopt"/> + <module name="org.apache.commons.logging"/> + <module name="org.apache.log4j"/> + <module name="org.jboss.logmanager" services="import"/> + <module name="org.jboss.as.controller-client"/> + <module name="org.jboss.logging"/> + <module name="org.jboss.as.protocol"/> + <module name="org.jboss.dmr"/> + <module name="org.jboss.sasl"/> + <module name="org.jboss.staxmapper"/> + <module name="org.picketbox"/> + <module name="org.rhq.postgres"/> + <module name="org.rhq.oracle"/> + <module name="javax.api"/> + </dependencies> + +</module> diff --git a/modules/enterprise/server/installer/src/main/scripts/module-assembly.xml b/modules/enterprise/server/installer/src/main/scripts/module-assembly.xml new file mode 100644 index 0000000..6339f2e --- /dev/null +++ b/modules/enterprise/server/installer/src/main/scripts/module-assembly.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<assembly> + <id>module-assembly</id> + <formats> + <format>zip</format> + </formats> + <includeBaseDirectory>false</includeBaseDirectory> + <baseDirectory>${project.build.finalName}-module</baseDirectory> + <fileSets> + <fileSet> + <directory>${project.build.outputDirectory}/module</directory> + <outputDirectory>/org/rhq/${artifactId}</outputDirectory> + <includes> + <include>main/module.xml</include> + </includes> + <fileMode>0644</fileMode> + <directoryMode>0755</directoryMode> + </fileSet> + <fileSet> + <directory>${project.build.directory}</directory> + <outputDirectory>/org/rhq/${artifactId}/main</outputDirectory> + <includes> + <include>${project.build.finalName}.jar</include> + </includes> + <fileMode>0644</fileMode> + <directoryMode>0755</directoryMode> + </fileSet> + <fileSet> + <directory>${project.build.directory}/installer-deps</directory> + <outputDirectory>/org/rhq/${artifactId}/main</outputDirectory> + <fileMode>0644</fileMode> + <directoryMode>0755</directoryMode> + </fileSet> + </fileSets> +</assembly> + diff --git a/modules/enterprise/server/installer/src/test/java/org/rhq/enterprise/server/installer/DBInstallationTest.java b/modules/enterprise/server/installer/src/test/java/org/rhq/enterprise/server/installer/DBInstallationTest.java new file mode 100644 index 0000000..7342e45 --- /dev/null +++ b/modules/enterprise/server/installer/src/test/java/org/rhq/enterprise/server/installer/DBInstallationTest.java @@ -0,0 +1,213 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.installer; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.util.HashMap; + +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; + +import org.rhq.core.db.reset.DBReset; +import org.rhq.core.db.setup.DBSetup; +import org.rhq.core.util.stream.StreamUtil; + +/** + * The tests in this class exercise the dbsetup/dbupgrade code that is run in the installer. The tests currently only + * run against postgresql. Support needs to be added for oracle. The tests do not do any post-install/upgrade + * verification at the time of this writing. They just simply exercise the dbsetup/dbupgrade scripts to ensure that + * they do not contain any errors. + * + * @author John Sanda + */ +public class DBInstallationTest { + + private final String LOG_DIRECTORY = System.getProperty("java.io.tmpdir", "rhq/installer-test"); + private final String DB_NAME = System.getProperty("rhq.test.ds.db-name", "rhq_installer_test_db"); + private final String USERNAME = System.getProperty("rhq.test.ds.user-name", "rhqadmin"); + private final String PASSWORD = System.getProperty("rhq.test.ds.password", "rhqadmin"); + private final String SERVER = System.getProperty("rhq.test.ds.server-name", "127.0.0.1"); + private final String DB_URL = System.getProperty("rhq.test.ds.connection-url", "jdbc:postgresql://" + SERVER + + ":5432/" + DB_NAME); + private final String ADMIN_USERNAME = System.getProperty("rhq.db.admin.username", "postgres"); + private final String ADMIN_PASSWORD = System.getProperty("rhq.db.admin.password", "postgres"); + private static final String DB_TYPE_MAPPING = System.getProperty("rhq.test.ds.type-mapping", "PostgreSQL"); + + private String logDir; + private ServerDetails serverDetails; + + @BeforeMethod + public void prepareForInstallation() throws Exception { + serverDetails = new ServerDetails("testserver", "127.0.0.1", 7080, 7443); + initLogDirectory(); + recreateTestDatabase(); + } + + @AfterMethod + public void afterInstallation() throws Exception { + recreateTestDatabase(); + ServerInstallUtil.createNewDatabaseSchema(getInstallProperties(), serverDetails, PASSWORD, logDir); + } + + @Test + public void overwriteJON240Schema() throws Exception { + installSchemaAndData("2.4.0"); + ServerInstallUtil.createNewDatabaseSchema(getInstallProperties(), serverDetails, PASSWORD, logDir); + } + + @Test + public void upgradeJON240Schema() throws Exception { + installSchemaAndData("2.4.0"); + ServerInstallUtil.upgradeExistingDatabaseSchema(getInstallProperties(), serverDetails, PASSWORD, logDir); + } + + @Test + public void overwriteJON300Schema() throws Exception { + installSchemaAndData("3.0.0"); + ServerInstallUtil.createNewDatabaseSchema(getInstallProperties(), serverDetails, PASSWORD, logDir); + } + + @Test + public void upgradeJON300Schema() throws Exception { + installSchemaAndData("3.0.0"); + ServerInstallUtil.upgradeExistingDatabaseSchema(getInstallProperties(), serverDetails, PASSWORD, logDir); + } + + @Test + public void upgradeRHQ420Schema() throws Exception { + installSchemaAndData("rhq-4.2.0"); + ServerInstallUtil.upgradeExistingDatabaseSchema(getInstallProperties(), serverDetails, PASSWORD, logDir); + } + + @Test + public void upgradeRHQ430Schema() throws Exception { + installSchemaAndData("rhq-4.3.0"); + ServerInstallUtil.upgradeExistingDatabaseSchema(getInstallProperties(), serverDetails, PASSWORD, logDir); + } + + @Test + public void upgradeRHQ440Schema() throws Exception { + installSchemaAndData("rhq-4.4.0"); + ServerInstallUtil.upgradeExistingDatabaseSchema(getInstallProperties(), serverDetails, PASSWORD, logDir); + } + + private void initLogDirectory() { + File logDirFile = new File(LOG_DIRECTORY); + if (logDirFile.exists()) { + logDirFile.delete(); + } + logDirFile.mkdirs(); + this.logDir = logDirFile.getAbsolutePath(); + } + + private void recreateTestDatabase() throws Exception { + DBReset dbReset = new DBReset(); + dbReset.performDBReset(DB_TYPE_MAPPING, DB_URL, DB_NAME, USERNAME, ADMIN_USERNAME, ADMIN_PASSWORD); + } + + private void installSchemaAndData(String jonVersion) throws Exception { + DBSetup dbsetup = new DBSetup(DB_URL, USERNAME, PASSWORD); + File schemaFile = getSchemaFile(jonVersion); + dbsetup.setup(schemaFile.getAbsolutePath()); + File dataFile = getDataFile(jonVersion); + dbsetup.setup(dataFile.getAbsolutePath()); + } + + private File getSchemaFile(String version) throws Exception { + URL url = getClass().getResource("db-schema-combined-" + version + ".xml"); + + if (url == null) { + throw new RuntimeException("Failed to find schema file for version " + version); + } + + File file = new File(url.toURI().getPath()); + File filteredFile = filterXmlFile(file, getInstallProperties()); + + return filteredFile; + } + + private File getDataFile(String version) throws Exception { + URL url = getClass().getResource("db-data-combined-" + version + ".xml"); + + if (url == null) { + throw new RuntimeException("Failed to find data file for version " + version); + } + + File file = new File(url.toURI().getPath()); + File filteredFile = filterXmlFile(file, getInstallProperties()); + + return filteredFile; + } + + private HashMap<String, String> getInstallProperties() { + HashMap<String, String> dbProperties = new HashMap<String, String>(); + dbProperties.put(ServerProperties.PROP_DATABASE_CONNECTION_URL, DB_URL); + dbProperties.put(ServerProperties.PROP_DATABASE_USERNAME, USERNAME); + dbProperties.put(ServerProperties.PROP_DATABASE_PASSWORD, PASSWORD); + dbProperties.put(ServerProperties.PROP_EMAIL_FROM_ADDRESS, "rhqadmin@localhost.com"); + return dbProperties; + } + + private static File filterXmlFile(File xmlFile, HashMap<String, String> props) throws IOException { + // first slurp the file contents in memory + InputStream fileInStream = new FileInputStream(xmlFile); + ByteArrayOutputStream contentOutStream = new ByteArrayOutputStream(); + StreamUtil.copy(fileInStream, contentOutStream); + + // now replace their replacement strings with values from the properties + String content = contentOutStream.toString(); + content = content.replaceAll("@@@LARGE_TABLESPACE_FOR_DATA@@@", "DEFAULT"); + content = content.replaceAll("@@@LARGE_TABLESPACE_FOR_INDEX@@@", "DEFAULT"); + content = content.replaceAll("@@@ADMINUSERNAME@@@", "rhqadmin"); + content = content.replaceAll("@@@ADMINPASSWORD@@@", "x1XwrxKuPvYUILiOnOZTLg=="); // rhqadmin + content = content.replaceAll("@@@ADMINEMAIL@@@", "rhqadmin@localhost"); + content = content.replaceAll("@@@BASEURL@@@", "http://localhost:7080/"); + content = content.replaceAll("@@@JAASPROVIDER@@@", "JDBC"); + content = content.replaceAll("@@@LDAPURL@@@", "ldap://localhost/"); + content = content.replaceAll("@@@LDAPPROTOCOL@@@", ""); + content = content.replaceAll("@@@LDAPLOGINPROP@@@", "cn"); + content = content.replaceAll("@@@LDAPBASEDN@@@", "o=JBoss,c=US"); + content = content.replaceAll("@@@LDAPSEARCHFILTER@@@", ""); + content = content.replaceAll("@@@LDAPBINDDN@@@", ""); + content = content.replaceAll("@@@LDAPBINDPW@@@", ""); + content = content.replaceAll("@@@MULTICAST_ADDR@@@", ""); + content = content.replaceAll("@@@MULTICAST_PORT@@@", ""); + + // we now have the finished XML content - write out the file to the tmp directory + File filteredXmlFile = File.createTempFile("rhq", xmlFile.getName()); + FileOutputStream xmlFileOutStream = new FileOutputStream(filteredXmlFile); + ByteArrayInputStream contentInStream = new ByteArrayInputStream(content.getBytes()); + StreamUtil.copy(contentInStream, xmlFileOutStream); + + return filteredXmlFile.getAbsoluteFile(); + } + +} diff --git a/modules/enterprise/server/installer/src/test/java/org/rhq/enterprise/server/installer/client/DatasourceJBossASClientTest.java b/modules/enterprise/server/installer/src/test/java/org/rhq/enterprise/server/installer/client/DatasourceJBossASClientTest.java new file mode 100644 index 0000000..f2dd7bc --- /dev/null +++ b/modules/enterprise/server/installer/src/test/java/org/rhq/enterprise/server/installer/client/DatasourceJBossASClientTest.java @@ -0,0 +1,118 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2012 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.installer.client; + +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.util.HashMap; + +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; +import org.testng.annotations.Test; + +import org.jboss.as.controller.client.ModelControllerClient; +import org.jboss.as.controller.client.OperationMessageHandler; +import org.jboss.dmr.ModelNode; + +import org.rhq.common.jbossas.client.controller.DatasourceJBossASClient; +import org.rhq.common.jbossas.client.controller.JBossASClient; +import org.rhq.enterprise.server.installer.ServerInstallUtil; +import org.rhq.enterprise.server.installer.ServerProperties; + +@Test +public class DatasourceJBossASClientTest { + private static final ModelNode mockSuccess; + static { + mockSuccess = new ModelNode(); + mockSuccess.get(JBossASClient.OUTCOME).set(JBossASClient.OUTCOME_SUCCESS); + } + + public void testCreateDatasourcesDMR() throws Exception { + ModelControllerClient mcc = mock(ModelControllerClient.class); + + // note that this doesn't test actually creating anything - it just tests the DMR can be parsed successfully + when(mcc.execute(any(ModelNode.class), any(OperationMessageHandler.class))).thenAnswer(new Answer<ModelNode>() { + public ModelNode answer(InvocationOnMock invocation) throws Throwable { + System.out.println("~~~~~~~\n" + invocation.getArguments()[0]); + ModelNode retNode = mockSuccess.clone(); + ModelNode resultNode = retNode.get(JBossASClient.RESULT); + resultNode.get(DatasourceJBossASClient.DATA_SOURCE).setEmptyList(); + resultNode.get(DatasourceJBossASClient.XA_DATA_SOURCE).setEmptyList(); + return retNode; + } + }); + + HashMap<String, String> serverProperties = new HashMap<String, String>(); + serverProperties.put(ServerProperties.PROP_DATABASE_TYPE, "Oracle"); + ServerInstallUtil.createNewDatasources(mcc, serverProperties); + + serverProperties.put(ServerProperties.PROP_DATABASE_TYPE, "PostgreSQL"); + ServerInstallUtil.createNewDatasources(mcc, serverProperties); + } + + public void testCreateNewDatasourceDMR() throws Exception { + ModelControllerClient mcc = mock(ModelControllerClient.class); + + // note that this doesn't test actually creating anything - it just tests the DMR can be parsed successfully + when(mcc.execute(any(ModelNode.class), any(OperationMessageHandler.class))).thenReturn(mockSuccess); + + DatasourceJBossASClient client = new DatasourceJBossASClient(mcc); + + HashMap<String, String> connProps = new HashMap<String, String>(2); + connProps.put("char.encoding", "UTF-8"); + connProps.put("SetBigStringTryClob", "true"); + + ModelNode request = client.createNewDatasourceRequest("NoTxRHQDS", 30000, + "${rhq.server.database.connection-url:jdbc:oracle:thin:@127.0.0.1:1521:rhq}", "oracle", + "org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter", 15, false, 2, 5, 75, + "RHQDSSecurityDomain", "org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker", + "TRANSACTION_READ_COMMITTED", "org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker", + connProps); + + System.out.println("==============\n" + request); + + ModelNode results = client.execute(request); + assert JBossASClient.isSuccess(results); + } + + public void testCreateNewXADatasourceDMR() throws Exception { + ModelControllerClient mcc = mock(ModelControllerClient.class); + + // note that this doesn't test actually creating anything - it just tests the DMR can be parsed successfully + when(mcc.execute(any(ModelNode.class), any(OperationMessageHandler.class))).thenReturn(mockSuccess); + + DatasourceJBossASClient client = new DatasourceJBossASClient(mcc); + + HashMap<String, String> xaDSProps = new HashMap<String, String>(2); + xaDSProps.put("URL", "${rhq.server.database.connection-url:jdbc:oracle:thin:@127.0.0.1:1521:rhq}"); + xaDSProps.put("ConnectionProperties", "SetBigStringTryClob=true"); + + ModelNode request = client.createNewXADatasourceRequest("RHQDS", 30000, "oracle", + "org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter", 15, 2, 5, 75, "RHQDSSecurityDomain", + "org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker", "TRANSACTION_READ_COMMITTED", + "org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker", xaDSProps); + + System.out.println("==============\n" + request); + + ModelNode results = client.execute(request); + assert JBossASClient.isSuccess(results); + } +} diff --git a/modules/enterprise/server/installer/src/test/resources/org/rhq/enterprise/server/installer/db-data-combined-2.4.0.xml b/modules/enterprise/server/installer/src/test/resources/org/rhq/enterprise/server/installer/db-data-combined-2.4.0.xml new file mode 100644 index 0000000..15978a6 --- /dev/null +++ b/modules/enterprise/server/installer/src/test/resources/org/rhq/enterprise/server/installer/db-data-combined-2.4.0.xml @@ -0,0 +1,669 @@ +<?xml version="1.0" encoding="UTF-8"?> +<dbsetup name="data.xml"> +<!-- BEGIN: rhq-data.xml --> +<!-- BEGIN: auth-data.xml --> + + + <table name="RHQ_PRINCIPAL"> + <data id="2" PRINCIPAL="rhqadmin" PASSWORD="x1XwrxKuPvYUILiOnOZTLg=="/> + </table> + +<!-- END: auth-data.xml --> +<!-- BEGIN: authz-data.xml --> + + + <!-- the overlord user --> + <table name="RHQ_SUBJECT"> + <data ID="1" + NAME="admin" + FIRST_NAME="Super" + LAST_NAME="User" + FSYSTEM="TRUE"/> + </table> + + <!-- the initial rhqadmin user --> + <table name="RHQ_SUBJECT"> + <data ID="2" + NAME="rhqadmin" + FIRST_NAME="RHQ" + LAST_NAME="Administrator" + EMAIL_ADDRESS="rhqadmin@localhost" + FSYSTEM="FALSE"/> + </table> + + <!-- Define the system root role which includes our overlord and rhqadmin users --> + <table name="RHQ_ROLE"> + <data ID="1" + NAME="Super User Role" + FSYSTEM="TRUE" + DESCRIPTION="System superuser role that provides full access to everything. This role cannot be modified."/> + <data ID="2" + NAME="All Resources Role" + FSYSTEM="FALSE" + DESCRIPTION="Provides full access to all resources in inventory. Cannot modify users, roles or server settings."/> + </table> + + <!-- associate the root users with all security permissions --> + <table name="RHQ_SUBJECT_ROLE_MAP"> + <data SUBJECT_ID="1" ROLE_ID="1"/> + <!-- overlord user --> + <data SUBJECT_ID="2" ROLE_ID="1"/> + <!-- rhqadmin user --> + </table> + + <table name="RHQ_PERMISSION"> + <!-- give super-user-role all permissions (resource perms is mainly just to show on view-role page) --> + <data ROLE_ID="1" OPERATION="0"/> <!-- Permission.MANAGE_SECURITY --> + <data ROLE_ID="1" OPERATION="1"/> <!-- Permission.MANAGE_INVENTORY --> + <data ROLE_ID="1" OPERATION="2"/> <!-- Permission.MANAGE_SETTINGS --> + <data ROLE_ID="1" OPERATION="12"/> <!-- Permission.MANAGE_BUNDLE --> + <!-- resource permissions start here--> + <data ROLE_ID="1" OPERATION="3"/> <!-- Permission.VIEW_RESOURCE --> + <data ROLE_ID="1" OPERATION="4"/> <!-- Permission.MODIFY_RESOURCE --> + <data ROLE_ID="1" OPERATION="5"/> <!-- Permission.DELETE_RESOURCE --> + <data ROLE_ID="1" OPERATION="6"/> <!-- Permission.CREATE_CHILD_RESOURCES --> + <data ROLE_ID="1" OPERATION="7"/> <!-- Permission.MANAGE_ALERTS --> + <data ROLE_ID="1" OPERATION="8"/> <!-- Permission.MANAGE_MEASUREMENTS --> + <data ROLE_ID="1" OPERATION="9"/> <!-- Permission.MANAGE_CONTENT --> + <data ROLE_ID="1" OPERATION="10"/> <!-- Permission.CONTROL --> + <data ROLE_ID="1" OPERATION="11"/> <!-- Permission.CONFIGURE --> + + <!-- give all-resources-role all permissions (resource perms is mainly just to show on view-role page) --> + <data ROLE_ID="2" OPERATION="1"/> <!-- Permission.MANAGE_INVENTORY --> + <data ROLE_ID="2" OPERATION="12"/> <!-- Permission.MANAGE_BUNDLE --> + <!-- resource permissions start here--> + <data ROLE_ID="2" OPERATION="3"/> <!-- Permission.VIEW_RESOURCE --> + <data ROLE_ID="2" OPERATION="4"/> <!-- Permission.MODIFY_RESOURCE --> + <data ROLE_ID="2" OPERATION="5"/> <!-- Permission.DELETE_RESOURCE --> + <data ROLE_ID="2" OPERATION="6"/> <!-- Permission.CREATE_CHILD_RESOURCES --> + <data ROLE_ID="2" OPERATION="7"/> <!-- Permission.MANAGE_ALERTS --> + <data ROLE_ID="2" OPERATION="8"/> <!-- Permission.MANAGE_MEASUREMENTS --> + <data ROLE_ID="2" OPERATION="9"/> <!-- Permission.MANAGE_CONTENT --> + <data ROLE_ID="2" OPERATION="10"/> <!-- Permission.CONTROL --> + <data ROLE_ID="2" OPERATION="11"/> <!-- Permission.CONFIGURE --> + </table> + +<!-- END: authz-data.xml --> +<!-- BEGIN: 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="availability=down category=platform" + LAST_COMPUTE_TIME="0" + SUBJECT_ID="1" + GLOBAL="TRUE" /> + <data ID="2" + CONTEXT="RESOURCE" + NAME="Downed Servers" + DESCRIPTION="All downed servers across the entire enterprise" + PATTERN="availability=down category=server" + LAST_COMPUTE_TIME="0" + SUBJECT_ID="1" + GLOBAL="TRUE" /> + </table> + +<!-- END: search-data.xml --> +<!-- BEGIN: sysconfig-data.xml --> + + + <!-- + This file contains the seed data for the configuration table. + All keys mentioned here should be referenced via the RHQConstants class + --> + <table name="RHQ_SYSTEM_CONFIG"> + <data ID="1" PROPERTY_KEY="SERVER_VERSION" PROPERTY_VALUE="3.0.0.GA" + DEFAULT_PROPERTY_VALUE="3.0.0.GA" FREAD_ONLY="TRUE"/> + <data ID="2" PROPERTY_KEY="DB_SCHEMA_VERSION" PROPERTY_VALUE="2.91" + DEFAULT_PROPERTY_VALUE="2.91" FREAD_ONLY="TRUE"/> + <data ID="3" PROPERTY_KEY="CAM_JAAS_PROVIDER" PROPERTY_VALUE="JDBC" + DEFAULT_PROPERTY_VALUE="JDBC" FREAD_ONLY="FALSE"/> + <data ID="4" PROPERTY_KEY="CAM_BASE_URL" PROPERTY_VALUE="http://127.0.0.1:7080/" + DEFAULT_PROPERTY_VALUE="http://127.0.0.1:7080/" FREAD_ONLY="FALSE"/> + <data ID="9" PROPERTY_KEY="CAM_HELP_USER" PROPERTY_VALUE="web" + DEFAULT_PROPERTY_VALUE="web" FREAD_ONLY="FALSE"/> + <data ID="10" PROPERTY_KEY="CAM_HELP_PASSWORD" PROPERTY_VALUE="user" + DEFAULT_PROPERTY_VALUE="user" FREAD_ONLY="FALSE"/> + + <!-- default LDAP configuration options --> + <data ID="11" PROPERTY_KEY="CAM_LDAP_NAMING_FACTORY_INITIAL" + PROPERTY_VALUE="com.sun.jndi.ldap.LdapCtxFactory" + DEFAULT_PROPERTY_VALUE="com.sun.jndi.ldap.LdapCtxFactory" + FREAD_ONLY="FALSE"/> + <data ID="12" PROPERTY_KEY="CAM_LDAP_NAMING_PROVIDER_URL" + PROPERTY_VALUE="ldap://localhost/" + DEFAULT_PROPERTY_VALUE="ldap://localhost/" + FREAD_ONLY="FALSE"/> + <data ID="13" PROPERTY_KEY="CAM_LDAP_LOGIN_PROPERTY" + PROPERTY_VALUE="cn" + DEFAULT_PROPERTY_VALUE="cn" FREAD_ONLY="FALSE"/> + <data ID="14" PROPERTY_KEY="CAM_LDAP_BASE_DN" + PROPERTY_VALUE="o=JBoss,c=US" + DEFAULT_PROPERTY_VALUE="o=JBoss,c=US" + FREAD_ONLY="FALSE"/> + <data ID="15" PROPERTY_KEY="CAM_LDAP_BIND_DN" + PROPERTY_VALUE="" + DEFAULT_PROPERTY_VALUE="" FREAD_ONLY="FALSE"/> + <data ID="16" PROPERTY_KEY="CAM_LDAP_BIND_PW" + PROPERTY_VALUE="" + DEFAULT_PROPERTY_VALUE="" FREAD_ONLY="FALSE"/> + <data ID="17" PROPERTY_KEY="CAM_LDAP_PROTOCOL" + PROPERTY_VALUE="" DEFAULT_PROPERTY_VALUE="" + FREAD_ONLY="FALSE"/> + <data ID="18" PROPERTY_KEY="CAM_LDAP_FILTER" + PROPERTY_VALUE="" DEFAULT_PROPERTY_VALUE="" + FREAD_ONLY="FALSE"/> + + <!-- Does this build support Syslog actions? --> + <data ID="21" PROPERTY_KEY="CAM_SYSLOG_ACTIONS_ENABLED" + PROPERTY_VALUE="false" DEFAULT_PROPERTY_VALUE="false" + FREAD_ONLY="FALSE"/> + <data ID="23" PROPERTY_KEY="CAM_GUIDE_ENABLED" + PROPERTY_VALUE="true" + DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> + <data ID="24" PROPERTY_KEY="CAM_RT_COLLECT_IP_ADDRS" + PROPERTY_VALUE="true" + DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> + + <!-- Default data storage options --> + <!-- Default 14 days --> + <data ID="26" PROPERTY_KEY="CAM_DATA_PURGE_1H" + PROPERTY_VALUE="1209600000" DEFAULT_PROPERTY_VALUE="1209600000" + FREAD_ONLY="FALSE"/> + <!-- Default 31 days --> + <data ID="27" PROPERTY_KEY="CAM_DATA_PURGE_6H" + PROPERTY_VALUE="2678400000" DEFAULT_PROPERTY_VALUE="2678400000" + FREAD_ONLY="FALSE"/> + <!-- Default 1 year --> + <data ID="28" PROPERTY_KEY="CAM_DATA_PURGE_1D" + PROPERTY_VALUE="31536000000" DEFAULT_PROPERTY_VALUE="31536000000" + FREAD_ONLY="FALSE"/> + + <!-- Baseline options --> + <!-- How often to calculate, default 3 days; if 0, never calculate them automatically --> + <data ID="29" PROPERTY_KEY="CAM_BASELINE_FREQUENCY" + PROPERTY_VALUE="259200000" DEFAULT_PROPERTY_VALUE="259200000" + FREAD_ONLY="FALSE"/> + <!-- How much data to include in the calulation, default 7 days --> + <data ID="30" PROPERTY_KEY="CAM_BASELINE_DATASET" + PROPERTY_VALUE="604800000" DEFAULT_PROPERTY_VALUE="604800000" + FREAD_ONLY="FALSE"/> + + <!-- ID 31 has been deleted --> + + <!-- How often to run database maintainence routines --> + <data ID="32" PROPERTY_KEY="CAM_DATA_MAINTENANCE" + PROPERTY_VALUE="3600000" DEFAULT_PROPERTY_VALUE="3600000" FREAD_ONLY="FALSE"/> + + <!-- How long to keep RT data around --> + <data ID="34" PROPERTY_KEY="RT_DATA_PURGE" PROPERTY_VALUE="2678400000" + DEFAULT_PROPERTY_VALUE="2678400000" FREAD_ONLY="FALSE"/> + + <!-- Whether to reindex the data tables nightly --> + <data ID="35" PROPERTY_KEY="DATA_REINDEX_NIGHTLY" PROPERTY_VALUE="true" + DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> + + <!-- How long to keep alerts around --> + <data ID="36" PROPERTY_KEY="ALERT_PURGE" PROPERTY_VALUE="2678400000" + DEFAULT_PROPERTY_VALUE="2678400000" FREAD_ONLY="FALSE"/> + + <!-- How long to keep events around (1209600000 millis == 14 days) --> + <data ID="51" PROPERTY_KEY="EVENT_PURGE" PROPERTY_VALUE="1209600000" + DEFAULT_PROPERTY_VALUE="1209600000" FREAD_ONLY="FALSE"/> + + <!-- How long an agent is allowed to be quiet before we consider it down and backfill it --> + <data ID="52" PROPERTY_KEY="AGENT_MAX_QUIET_TIME_ALLOWED" PROPERTY_VALUE="900000" + DEFAULT_PROPERTY_VALUE="900000" FREAD_ONLY="FALSE"/> + + <!-- Will our server-cloud support agents auto-updating themselves? --> + <data ID="53" PROPERTY_KEY="ENABLE_AGENT_AUTO_UPDATE" PROPERTY_VALUE="true" + DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> + + <!-- How old does a trait have to be in order to get purged --> + <data ID="54" PROPERTY_KEY="TRAIT_PURGE" PROPERTY_VALUE="31536000000" + DEFAULT_PROPERTY_VALUE="31536000000" FREAD_ONLY="FALSE"/> + + <!-- How old does availability have to be in order to get purged --> + <data ID="55" PROPERTY_KEY="AVAILABILITY_PURGE" PROPERTY_VALUE="31536000000" + DEFAULT_PROPERTY_VALUE="31536000000" FREAD_ONLY="FALSE"/> + + </table> + +<!-- END: sysconfig-data.xml --> +<!-- BEGIN: measurement-data.xml --> + + <table name="RHQ_NUMBERS"> + <data i="0"/> + <data i="1"/> + <data i="2"/> + <data i="3"/> + <data i="4"/> + <data i="5"/> + <data i="6"/> + <data i="7"/> + <data i="8"/> + <data i="9"/> + <data i="10"/> + <data i="11"/> + <data i="12"/> + <data i="13"/> + <data i="14"/> + <data i="15"/> + <data i="16"/> + <data i="17"/> + <data i="18"/> + <data i="19"/> + <data i="20"/> + <data i="21"/> + <data i="22"/> + <data i="23"/> + <data i="24"/> + <data i="25"/> + <data i="26"/> + <data i="27"/> + <data i="28"/> + <data i="29"/> + <data i="30"/> + <data i="31"/> + <data i="32"/> + <data i="33"/> + <data i="34"/> + <data i="35"/> + <data i="36"/> + <data i="37"/> + <data i="38"/> + <data i="39"/> + <data i="40"/> + <data i="41"/> + <data i="42"/> + <data i="43"/> + <data i="44"/> + <data i="45"/> + <data i="46"/> + <data i="47"/> + <data i="48"/> + <data i="49"/> + <data i="50"/> + <data i="51"/> + <data i="52"/> + <data i="53"/> + <data i="54"/> + <data i="55"/> + <data i="56"/> + <data i="57"/> + <data i="58"/> + <data i="59"/> + </table> + +<!-- END: measurement-data.xml --> +<!-- BEGIN: content-data.xml --> + + <table name="RHQ_ARCHITECTURE"> + <data id="1" name="noarch"/> + <data id="2" name="i386"/> + <data id="3" name="i486"/> + <data id="4" name="i586"/> + <data id="5" name="i686"/> + <data id="6" name="alpha"/> + <data id="7" name="alphaev6"/> + <data id="8" name="ia64"/> + <data id="9" name="sparc"/> + <data id="10" name="sparcv9"/> + <data id="11" name="sparc64"/> + <data id="12" name="src"/> + <data id="13" name="s390"/> + <data id="14" name="athlon"/> + <data id="15" name="s390x"/> + <data id="16" name="ppc"/> + <data id="17" name="ppc64"/> + <data id="18" name="pSeries"/> + <data id="19" name="iSeries"/> + <data id="20" name="x86_64"/> + <data id="21" name="ppc64iseries"/> + <data id="22" name="ppc64pseries"/> + <data id="23" name="sparc-solaris"/> + <data id="24" name="sparc.sun4u-solaris"/> + <data id="25" name="tar"/> + <data id="26" name="ia32e"/> + <data id="27" name="amd64"/> + <data id="28" name="i386-solaris"/> + <data id="29" name="nosrc"/> + <data id="30" name="sparc-solaris-patch"/> + <data id="31" name="i386-solaris-patch"/> + <data id="32" name="sparc-solaris-patch-cluster"/> + <data id="33" name="i386-solaris-patch-cluster"/> + <data id="34" name="noarch-solaris"/> + <data id="35" name="noarch-solaris-patch"/> + <data id="36" name="noarch-solaris-patch-cluster"/> + <data id="37" name="solaris-patch"/> + <data id="38" name="solaris-patch-cluster"/> + </table> + + <table name="RHQ_REPO_GROUP_TYPE"> + <data id="1" name="family"/> + </table> + + <table name="RHQ_REPO_RELATION_TYPE"> + <data id="1" name="parent"/> + <data id="2" name="clone"/> + </table> + + <table name="RHQ_DISTRIBUTION_TYPE"> + <data id="1" name="kickstart" description="Linux kickstart distribution"/> + <data id="2" name="jumpstart" description="solaris jumpstart distribution"/> + </table> + +<!-- END: content-data.xml --> +<!-- BEGIN: jms-data.xml --> + +<!-- the schema matches that which would be automatically created by the JMS subsystem --> +<!-- see deploy/jms/rhq-jdbc-state-service.xml and rhq-jdbc2-service.xml --> +<!-- the data must match that which is expected in conf/login-config.xml --> + + + <table name="JMS_USERS"> + <data USERID="guest" PASSWD="guest" /> + </table> + + <table name="JMS_ROLES"> + <data ROLEID="guest" USERID="guest" /> + </table> + +<!-- END: jms-data.xml --> +<!-- END: rhq-data.xml --> +<!-- BEGIN: jon-data.xml --> + +<!-- This dbsetup config file defines a content source and + associated repo for the JBoss CSP RSS patch feed. --> + + + <!-- ********* metadata (the content source type and its config def) ********* --> + + <table name="RHQ_CONFIG_DEF"> + <data ID="101" + NAME="JBoss CSP Patch Feed Content Source"/> + </table> + + <table name="RHQ_CONFIG_PROP_DEF"> + <data ID="101" + NAME="url" + DISPLAY_NAME="Feed URL" + DESCRIPTION="URL of the feed (e.g. https://support.redhat.com/jbossnetwork/restricted/feed/software.html?produc...)." + REQUIRED="1" + READONLY="0" + SUMMARY="0" + ACTIVATION_POLICY="IMMEDIATE" + ORDER_INDEX="0" + SIMPLE_TYPE="STRING" + ALLOW_CUSTOM_ENUM_VALUE="0" + DTYPE="property" + CONFIG_DEF_ID="101" + UNITS="0"/> + <data ID="102" + NAME="username" + DISPLAY_NAME="Username" + DESCRIPTION="Username used to access the feed URL." + REQUIRED="1" + READONLY="0" + SUMMARY="0" + ACTIVATION_POLICY="IMMEDIATE" + ORDER_INDEX="1" + SIMPLE_TYPE="STRING" + ALLOW_CUSTOM_ENUM_VALUE="0" + DTYPE="property" + CONFIG_DEF_ID="101" + UNITS="0"/> + <data ID="103" + NAME="password" + DISPLAY_NAME="Password" + DESCRIPTION="Password used to access the feed URL." + REQUIRED="1" + READONLY="0" + SUMMARY="0" + ACTIVATION_POLICY="IMMEDIATE" + ORDER_INDEX="2" + SIMPLE_TYPE="PASSWORD" + ALLOW_CUSTOM_ENUM_VALUE="0" + DTYPE="property" + CONFIG_DEF_ID="101" + UNITS="0"/> + <data ID="104" + NAME="active" + DISPLAY_NAME="Active" + DESCRIPTION="Indicates if the feed should be checked for new patches." + REQUIRED="1" + READONLY="0" + SUMMARY="0" + ACTIVATION_POLICY="IMMEDIATE" + ORDER_INDEX="3" + SIMPLE_TYPE="BOOLEAN" + ALLOW_CUSTOM_ENUM_VALUE="0" + DTYPE="property" + CONFIG_DEF_ID="101" + UNITS="0"/> + <data ID="105" + NAME="proxyUrl" + DISPLAY_NAME="Proxy URL" + REQUIRED="0" + READONLY="0" + SUMMARY="0" + ACTIVATION_POLICY="IMMEDIATE" + ORDER_INDEX="4" + SIMPLE_TYPE="STRING" + ALLOW_CUSTOM_ENUM_VALUE="0" + DTYPE="property" + CONFIG_DEF_ID="101" + UNITS="0"/> + <data ID="106" + NAME="proxyPort" + DISPLAY_NAME="Proxy Port" + REQUIRED="0" + READONLY="0" + SUMMARY="0" + ACTIVATION_POLICY="IMMEDIATE" + ORDER_INDEX="5" + SIMPLE_TYPE="STRING" + ALLOW_CUSTOM_ENUM_VALUE="0" + DTYPE="property" + CONFIG_DEF_ID="101" + UNITS="0"/> + <data ID="107" + NAME="proxyUsername" + DISPLAY_NAME="Proxy Username" + REQUIRED="0" + READONLY="0" + SUMMARY="0" + ACTIVATION_POLICY="IMMEDIATE" + ORDER_INDEX="6" + SIMPLE_TYPE="STRING" + ALLOW_CUSTOM_ENUM_VALUE="0" + DTYPE="property" + CONFIG_DEF_ID="101" + UNITS="0"/> + <data ID="108" + NAME="proxyPassword" + DISPLAY_NAME="Proxy Password" + REQUIRED="0" + READONLY="0" + SUMMARY="0" + ACTIVATION_POLICY="IMMEDIATE" + ORDER_INDEX="7" + SIMPLE_TYPE="STRING" + ALLOW_CUSTOM_ENUM_VALUE="0" + DTYPE="property" + CONFIG_DEF_ID="101" + UNITS="0"/> + </table> + + <!-- NOTE: The values of the NAME, PLUGIN_NAME, and API_CLASS columns must match what is + defined in RHQ/modules/enterprise/server/plugins/jboss-software/src/main/resources/META-INF/rhq-serverplugin.xml. --> + <!-- default sync chedule: 1st of every month at 12am --> + <table name="RHQ_CONTENT_SOURCE_TYPE"> + <data ID="101" + NAME="JBossASPatchSource" + DISPLAY_NAME="JBoss Patch Content Source" + DESCRIPTION="a content source that retrieves package metadata from an RSS feed; the feed must be in the format used by the JBoss CSP" + PLUGIN_NAME="JBossASPatchContentSourcePlugin" + DEFAULT_LAZY_LOAD="1" + DEFAULT_DOWNLOAD_MODE="DATABASE" + DEFAULT_SYNC_SCHEDULE="0 0 0 1 * ?" + API_CLASS="org.rhq.enterprise.server.plugins.jboss.software.JBossSoftwareContentSourceAdapter" + SOURCE_CONFIG_DEF_ID="101"/> + </table> + + + <!-- the default template --> + <table name="RHQ_CONFIG"> + <data ID="101" + VERSION="0" + CTIME="1270066600000" + MTIME="1270066600000"/> + </table> + + <table name="RHQ_CONFIG_PROPERTY"> + <data ID="101" + NAME="url" + CONFIGURATION_ID="101" + STRING_VALUE="" + OVERRIDE="0" + DTYPE="property"/> + <data ID="102" + NAME="username" + CONFIGURATION_ID="101" + OVERRIDE="0" + DTYPE="property"/> + <data ID="103" + NAME="password" + CONFIGURATION_ID="101" + OVERRIDE="0" + DTYPE="property"/> + <data ID="104" + NAME="proxyUrl" + CONFIGURATION_ID="101" + OVERRIDE="0" + DTYPE="property"/> + <data ID="105" + NAME="proxyPort" + CONFIGURATION_ID="101" + OVERRIDE="0" + DTYPE="property"/> + <data ID="106" + NAME="active" + CONFIGURATION_ID="101" + STRING_VALUE="true" + OVERRIDE="0" + DTYPE="property"/> + <data ID="107" + NAME="proxyUsername" + CONFIGURATION_ID="101" + OVERRIDE="0" + DTYPE="property"/> + <data ID="108" + NAME="proxyPassword" + CONFIGURATION_ID="101" + OVERRIDE="0" + DTYPE="property"/> + </table> + + <table name="RHQ_CONFIG_TEMPLATE"> + <data ID="101" + NAME="default" + DESCRIPTION="the default initial values for the configuration of a JBossASPatchSource content source" + CONFIG_ID="101" + CONFIG_DEF_ID="101" + IS_DEFAULT="1"/> + </table> + + + <!-- ********* data (the content source and its config) ********* --> + + <table name="RHQ_CONFIG"> + <data ID="102" + VERSION="0" + CTIME="1270066600000" + MTIME="1270066600000"/> + </table> + + <table name="RHQ_CONFIG_PROPERTY"> + <data ID="111" + NAME="url" + CONFIGURATION_ID="102" + STRING_VALUE="https://support.redhat.com/jbossnetwork/restricted/feed/software.html?produc..." + OVERRIDE="0" + DTYPE="property"/> + <data ID="112" + NAME="username" + CONFIGURATION_ID="102" + OVERRIDE="0" + DTYPE="property"/> + <data ID="113" + NAME="password" + CONFIGURATION_ID="102" + OVERRIDE="0" + DTYPE="property"/> + <data ID="114" + NAME="proxyUrl" + CONFIGURATION_ID="102" + OVERRIDE="0" + DTYPE="property"/> + <data ID="115" + NAME="proxyPort" + CONFIGURATION_ID="102" + OVERRIDE="0" + DTYPE="property"/> + <data ID="116" + NAME="active" + CONFIGURATION_ID="102" + STRING_VALUE="false" + OVERRIDE="0" + DTYPE="property"/> + <data ID="117" + NAME="proxyUsername" + CONFIGURATION_ID="102" + OVERRIDE="0" + DTYPE="property"/> + <data ID="118" + NAME="proxyPassword" + CONFIGURATION_ID="102" + OVERRIDE="0" + DTYPE="property"/> + </table> + + <!-- sync chedule: 1st of every month at 12am --> + <table name="RHQ_CONTENT_SOURCE"> + <data ID="101" + NAME="JBoss CSP Patch Feed" + DESCRIPTION="an RSS feed published by the JBoss Customer Service Portal (CSP) website which provides a list of all JBoss product patches available for the subscription of a given CSP user; the feed entries for most cumulative patches (CPs) include automated install instructions that can be used by JON to install those CPs to inventoried server Resources (e.g. JBoss EAP servers)" + LAZY_LOAD="1" + DOWNLOAD_MODE="DATABASE" + SYNC_SCHEDULE="0 0 0 1 * ?" + CREATION_TIME="1270066600000" + LAST_MODIFIED_TIME="1270066600000" + CONTENT_SOURCE_TYPE_ID="101" + CONFIGURATION_ID="102"/> + </table> + + <!-- sync chedule: every Mon at 1am --> + <table name="RHQ_REPO"> + <data ID="101" + NAME="JBoss Patches" + DESCRIPTION="the patches obtained from the JBoss CSP patch feed" + SYNC_SCHEDULE="0 0 1 ? * 1" + CREATION_TIME="1270066600000" + LAST_MODIFIED_TIME="1270066600000" + IS_CANDIDATE="0"/> + </table> + + <table name="RHQ_REPO_CONTENT_SRC_MAP"> + <data REPO_ID="101" + CONTENT_SRC_ID="101" + CTIME="1270066600000"/> + </table> + + +<!-- END: jon-data.xml --> +</dbsetup> diff --git a/modules/enterprise/server/installer/src/test/resources/org/rhq/enterprise/server/installer/db-data-combined-3.0.0.xml b/modules/enterprise/server/installer/src/test/resources/org/rhq/enterprise/server/installer/db-data-combined-3.0.0.xml new file mode 100644 index 0000000..060f241 --- /dev/null +++ b/modules/enterprise/server/installer/src/test/resources/org/rhq/enterprise/server/installer/db-data-combined-3.0.0.xml @@ -0,0 +1,690 @@ +<?xml version="1.0" encoding="UTF-8"?> +<dbsetup name="data.xml"> +<!-- BEGIN: rhq-data.xml --> +<!-- BEGIN: auth-data.xml --> + + + <table name="RHQ_PRINCIPAL"> + <data id="2" PRINCIPAL="@@@ADMINUSERNAME@@@" PASSWORD="@@@ADMINPASSWORD@@@"/> + </table> + +<!-- END: auth-data.xml --> +<!-- BEGIN: authz-data.xml --> + + + <!-- the overlord user --> + <table name="RHQ_SUBJECT"> + <data ID="1" + NAME="admin" + FIRST_NAME="Super" + LAST_NAME="User" + FSYSTEM="TRUE"/> + </table> + + <!-- the initial rhqadmin user --> + <table name="RHQ_SUBJECT"> + <data ID="2" + NAME="@@@ADMINUSERNAME@@@" + FIRST_NAME="RHQ" + LAST_NAME="Administrator" + EMAIL_ADDRESS="@@@ADMINEMAIL@@@" + FSYSTEM="FALSE"/> + </table> + + <!-- Define the system root role which includes our overlord and rhqadmin users --> + <table name="RHQ_ROLE"> + <data ID="1" + NAME="Super User Role" + FSYSTEM="TRUE" + DESCRIPTION="System superuser role that provides full access to everything. This role cannot be modified."/> + <data ID="2" + NAME="All Resources Role" + FSYSTEM="FALSE" + DESCRIPTION="Provides full access to all resources in inventory. Cannot modify users, roles or server settings."/> + </table> + + <!-- associate the root users with all security permissions --> + <table name="RHQ_SUBJECT_ROLE_MAP"> + <!-- overlord user --> + <data SUBJECT_ID="1" ROLE_ID="1"/> + <!-- rhqadmin user --> + <data SUBJECT_ID="2" ROLE_ID="1"/> + </table> + + <table name="RHQ_PERMISSION"> + <!-- give super-user-role all permissions + (explicitly add resource perms, even though they are implied by MANAGE_INVENTORY) --> + <data ROLE_ID="1" OPERATION="0"/> <!-- Permission.MANAGE_SECURITY --> + <data ROLE_ID="1" OPERATION="1"/> <!-- Permission.MANAGE_INVENTORY --> + <data ROLE_ID="1" OPERATION="2"/> <!-- Permission.MANAGE_SETTINGS --> + <data ROLE_ID="1" OPERATION="12"/> <!-- Permission.MANAGE_BUNDLE --> + <data ROLE_ID="1" OPERATION="15"/> <!-- Permission.MANAGE_REPOSITORIES --> + <!-- resource permissions start here--> + <data ROLE_ID="1" OPERATION="3"/> <!-- Permission.VIEW_RESOURCE --> + <data ROLE_ID="1" OPERATION="4"/> <!-- Permission.MODIFY_RESOURCE --> + <data ROLE_ID="1" OPERATION="5"/> <!-- Permission.DELETE_RESOURCE --> + <data ROLE_ID="1" OPERATION="6"/> <!-- Permission.CREATE_CHILD_RESOURCES --> + <data ROLE_ID="1" OPERATION="7"/> <!-- Permission.MANAGE_ALERTS --> + <data ROLE_ID="1" OPERATION="8"/> <!-- Permission.MANAGE_MEASUREMENTS --> + <data ROLE_ID="1" OPERATION="9"/> <!-- Permission.MANAGE_CONTENT --> + <data ROLE_ID="1" OPERATION="10"/> <!-- Permission.CONTROL --> + <data ROLE_ID="1" OPERATION="11"/> <!-- Permission.CONFIGURE_WRITE --> + <data ROLE_ID="1" OPERATION="13"/> <!-- Permission.CONFIGURE_READ --> + <data ROLE_ID="1" OPERATION="14"/> <!-- Permission.MANAGE_EVENTS --> + <data ROLE_ID="1" OPERATION="16"/> <!-- Permission.MANAGE_DRIFT --> + + <!-- give all-resources-role MANAGE_INVENTORY and MANAGE_BUNDLE permissions + (explicitly add resource perms as well, even though they are implied by MANAGE_INVENTORY) --> + <data ROLE_ID="2" OPERATION="1"/> <!-- Permission.MANAGE_INVENTORY --> + <data ROLE_ID="2" OPERATION="12"/> <!-- Permission.MANAGE_BUNDLE --> + <!-- resource permissions start here--> + <data ROLE_ID="2" OPERATION="3"/> <!-- Permission.VIEW_RESOURCE --> + <data ROLE_ID="2" OPERATION="4"/> <!-- Permission.MODIFY_RESOURCE --> + <data ROLE_ID="2" OPERATION="5"/> <!-- Permission.DELETE_RESOURCE --> + <data ROLE_ID="2" OPERATION="6"/> <!-- Permission.CREATE_CHILD_RESOURCES --> + <data ROLE_ID="2" OPERATION="7"/> <!-- Permission.MANAGE_ALERTS --> + <data ROLE_ID="2" OPERATION="8"/> <!-- Permission.MANAGE_MEASUREMENTS --> + <data ROLE_ID="2" OPERATION="9"/> <!-- Permission.MANAGE_CONTENT --> + <data ROLE_ID="2" OPERATION="10"/> <!-- Permission.CONTROL --> + <data ROLE_ID="2" OPERATION="11"/> <!-- Permission.CONFIGURE_WRITE --> + <data ROLE_ID="2" OPERATION="13"/> <!-- Permission.CONFIGURE_READ --> + <data ROLE_ID="2" OPERATION="14"/> <!-- Permission.MANAGE_EVENTS --> + <data ROLE_ID="2" OPERATION="16"/> <!-- Permission.MANAGE_DRIFT --> + </table> + +<!-- END: authz-data.xml --> +<!-- BEGIN: 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="availability=down category=platform" + LAST_COMPUTE_TIME="0" + SUBJECT_ID="1" + GLOBAL="TRUE" /> + <data ID="2" + CONTEXT="RESOURCE" + NAME="Downed Servers" + DESCRIPTION="All downed servers across the entire enterprise" + PATTERN="availability=down category=server" + LAST_COMPUTE_TIME="0" + SUBJECT_ID="1" + GLOBAL="TRUE" /> + </table> + +<!-- END: search-data.xml --> +<!-- BEGIN: sysconfig-data.xml --> + + + <!-- + This file contains the seed data for the configuration table. + All keys mentioned here should be referenced via the RHQConstants class + --> + <table name="RHQ_SYSTEM_CONFIG"> + <data ID="1" PROPERTY_KEY="SERVER_VERSION" PROPERTY_VALUE="4.2.0.JON300.GA" + DEFAULT_PROPERTY_VALUE="4.2.0.JON300.GA" FREAD_ONLY="TRUE"/> + <data ID="2" PROPERTY_KEY="DB_SCHEMA_VERSION" PROPERTY_VALUE="2.116" + DEFAULT_PROPERTY_VALUE="2.116" FREAD_ONLY="TRUE"/> + <data ID="3" PROPERTY_KEY="CAM_JAAS_PROVIDER" PROPERTY_VALUE="@@@JAASPROVIDER@@@" + DEFAULT_PROPERTY_VALUE="JDBC" FREAD_ONLY="FALSE"/> + <data ID="4" PROPERTY_KEY="CAM_BASE_URL" PROPERTY_VALUE="@@@BASEURL@@@" + DEFAULT_PROPERTY_VALUE="@@@BASEURL@@@" FREAD_ONLY="FALSE"/> + <data ID="9" PROPERTY_KEY="CAM_HELP_USER" PROPERTY_VALUE="web" + DEFAULT_PROPERTY_VALUE="web" FREAD_ONLY="FALSE"/> + <data ID="10" PROPERTY_KEY="CAM_HELP_PASSWORD" PROPERTY_VALUE="user" + DEFAULT_PROPERTY_VALUE="user" FREAD_ONLY="FALSE"/> + + <!-- default LDAP configuration options --> + <data ID="11" PROPERTY_KEY="CAM_LDAP_NAMING_FACTORY_INITIAL" + PROPERTY_VALUE="com.sun.jndi.ldap.LdapCtxFactory" + DEFAULT_PROPERTY_VALUE="com.sun.jndi.ldap.LdapCtxFactory" + FREAD_ONLY="FALSE"/> + <data ID="12" PROPERTY_KEY="CAM_LDAP_NAMING_PROVIDER_URL" + PROPERTY_VALUE="@@@LDAPURL@@@" + DEFAULT_PROPERTY_VALUE="ldap://localhost/" + FREAD_ONLY="FALSE"/> + <data ID="13" PROPERTY_KEY="CAM_LDAP_LOGIN_PROPERTY" + PROPERTY_VALUE="@@@LDAPLOGINPROP@@@" + DEFAULT_PROPERTY_VALUE="cn" FREAD_ONLY="FALSE"/> + <data ID="14" PROPERTY_KEY="CAM_LDAP_BASE_DN" + PROPERTY_VALUE="@@@LDAPBASEDN@@@" + DEFAULT_PROPERTY_VALUE="o=JBoss,c=US" + FREAD_ONLY="FALSE"/> + <data ID="15" PROPERTY_KEY="CAM_LDAP_BIND_DN" + PROPERTY_VALUE="@@@LDAPBINDDN@@@" + DEFAULT_PROPERTY_VALUE="" FREAD_ONLY="FALSE"/> + <data ID="16" PROPERTY_KEY="CAM_LDAP_BIND_PW" + PROPERTY_VALUE="@@@LDAPBINDPW@@@" + DEFAULT_PROPERTY_VALUE="" FREAD_ONLY="FALSE"/> + <data ID="17" PROPERTY_KEY="CAM_LDAP_PROTOCOL" + PROPERTY_VALUE="@@@LDAPPROTOCOL@@@" DEFAULT_PROPERTY_VALUE="" + FREAD_ONLY="FALSE"/> + <data ID="18" PROPERTY_KEY="CAM_LDAP_FILTER" + PROPERTY_VALUE="@@@LDAPSEARCHFILTER@@@" DEFAULT_PROPERTY_VALUE="" + FREAD_ONLY="FALSE"/> + + <!-- Does this build support Syslog actions? --> + <data ID="21" PROPERTY_KEY="CAM_SYSLOG_ACTIONS_ENABLED" + PROPERTY_VALUE="false" DEFAULT_PROPERTY_VALUE="false" + FREAD_ONLY="FALSE"/> + <data ID="23" PROPERTY_KEY="CAM_GUIDE_ENABLED" + PROPERTY_VALUE="true" + DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> + <data ID="24" PROPERTY_KEY="CAM_RT_COLLECT_IP_ADDRS" + PROPERTY_VALUE="true" + DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> + + <!-- Default data storage options --> + <!-- Default 14 days --> + <data ID="26" PROPERTY_KEY="CAM_DATA_PURGE_1H" + PROPERTY_VALUE="1209600000" DEFAULT_PROPERTY_VALUE="1209600000" + FREAD_ONLY="FALSE"/> + <!-- Default 31 days --> + <data ID="27" PROPERTY_KEY="CAM_DATA_PURGE_6H" + PROPERTY_VALUE="2678400000" DEFAULT_PROPERTY_VALUE="2678400000" + FREAD_ONLY="FALSE"/> + <!-- Default 1 year --> + <data ID="28" PROPERTY_KEY="CAM_DATA_PURGE_1D" + PROPERTY_VALUE="31536000000" DEFAULT_PROPERTY_VALUE="31536000000" + FREAD_ONLY="FALSE"/> + + <!-- Baseline options --> + <!-- How often to calculate, default 3 days; if 0, never calculate them automatically --> + <data ID="29" PROPERTY_KEY="CAM_BASELINE_FREQUENCY" + PROPERTY_VALUE="259200000" DEFAULT_PROPERTY_VALUE="259200000" + FREAD_ONLY="FALSE"/> + <!-- How much data to include in the calulation, default 7 days --> + <data ID="30" PROPERTY_KEY="CAM_BASELINE_DATASET" + PROPERTY_VALUE="604800000" DEFAULT_PROPERTY_VALUE="604800000" + FREAD_ONLY="FALSE"/> + + <!-- ID 31 has been deleted --> + + <!-- How often to run database maintainence routines --> + <data ID="32" PROPERTY_KEY="CAM_DATA_MAINTENANCE" + PROPERTY_VALUE="3600000" DEFAULT_PROPERTY_VALUE="3600000" FREAD_ONLY="FALSE"/> + + <!-- How long to keep RT data around --> + <data ID="34" PROPERTY_KEY="RT_DATA_PURGE" PROPERTY_VALUE="2678400000" + DEFAULT_PROPERTY_VALUE="2678400000" FREAD_ONLY="FALSE"/> + + <!-- Whether to reindex the data tables nightly --> + <data ID="35" PROPERTY_KEY="DATA_REINDEX_NIGHTLY" PROPERTY_VALUE="true" + DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> + + <!-- How long to keep alerts around --> + <data ID="36" PROPERTY_KEY="ALERT_PURGE" PROPERTY_VALUE="2678400000" + DEFAULT_PROPERTY_VALUE="2678400000" FREAD_ONLY="FALSE"/> + + <!-- How long to keep events around (1209600000 millis == 14 days) --> + <data ID="51" PROPERTY_KEY="EVENT_PURGE" PROPERTY_VALUE="1209600000" + DEFAULT_PROPERTY_VALUE="1209600000" FREAD_ONLY="FALSE"/> + + <!-- How long an agent is allowed to be quiet before we consider it down and backfill it --> + <data ID="52" PROPERTY_KEY="AGENT_MAX_QUIET_TIME_ALLOWED" PROPERTY_VALUE="900000" + DEFAULT_PROPERTY_VALUE="900000" FREAD_ONLY="FALSE"/> + + <!-- Will our server-cloud support agents auto-updating themselves? --> + <data ID="53" PROPERTY_KEY="ENABLE_AGENT_AUTO_UPDATE" PROPERTY_VALUE="true" + DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> + + <!-- How old does a trait have to be in order to get purged --> + <data ID="54" PROPERTY_KEY="TRAIT_PURGE" PROPERTY_VALUE="31536000000" + DEFAULT_PROPERTY_VALUE="31536000000" FREAD_ONLY="FALSE"/> + + <!-- How old does availability have to be in order to get purged --> + <data ID="55" PROPERTY_KEY="AVAILABILITY_PURGE" PROPERTY_VALUE="31536000000" + DEFAULT_PROPERTY_VALUE="31536000000" FREAD_ONLY="FALSE"/> + + <data ID="56" PROPERTY_KEY="RESOURCE_GENERIC_PROPERTIES_UPGRADE" PROPERTY_VALUE="false" + DEFAULT_PROPERTY_VALUE="false" FREAD_ONLY="FALSE"/> + + <!-- default drift server plugin settings --> + <data ID="57" PROPERTY_KEY="ACTIVE_DRIFT_PLUGIN" PROPERTY_VALUE="drift-jpa" + DEFAULT_PROPERTY_VALUE="drift-jpa" FREAD_ONLY="FALSE"/> + + <!-- purge drift files older than 31 days by default --> + <data ID="58" PROPERTY_KEY="DRIFT_FILE_PURGE" PROPERTY_VALUE="2678400000" + DEFAULT_PROPERTY_VALUE="2678400000" FREAD_ONLY="FALSE"/> + + </table> + +<!-- END: sysconfig-data.xml --> +<!-- BEGIN: measurement-data.xml --> + + <table name="RHQ_NUMBERS"> + <data i="0"/> + <data i="1"/> + <data i="2"/> + <data i="3"/> + <data i="4"/> + <data i="5"/> + <data i="6"/> + <data i="7"/> + <data i="8"/> + <data i="9"/> + <data i="10"/> + <data i="11"/> + <data i="12"/> + <data i="13"/> + <data i="14"/> + <data i="15"/> + <data i="16"/> + <data i="17"/> + <data i="18"/> + <data i="19"/> + <data i="20"/> + <data i="21"/> + <data i="22"/> + <data i="23"/> + <data i="24"/> + <data i="25"/> + <data i="26"/> + <data i="27"/> + <data i="28"/> + <data i="29"/> + <data i="30"/> + <data i="31"/> + <data i="32"/> + <data i="33"/> + <data i="34"/> + <data i="35"/> + <data i="36"/> + <data i="37"/> + <data i="38"/> + <data i="39"/> + <data i="40"/> + <data i="41"/> + <data i="42"/> + <data i="43"/> + <data i="44"/> + <data i="45"/> + <data i="46"/> + <data i="47"/> + <data i="48"/> + <data i="49"/> + <data i="50"/> + <data i="51"/> + <data i="52"/> + <data i="53"/> + <data i="54"/> + <data i="55"/> + <data i="56"/> + <data i="57"/> + <data i="58"/> + <data i="59"/> + </table> + +<!-- END: measurement-data.xml --> +<!-- BEGIN: content-data.xml --> + + <table name="RHQ_ARCHITECTURE"> + <data id="1" name="noarch"/> + <data id="2" name="i386"/> + <data id="3" name="i486"/> + <data id="4" name="i586"/> + <data id="5" name="i686"/> + <data id="6" name="alpha"/> + <data id="7" name="alphaev6"/> + <data id="8" name="ia64"/> + <data id="9" name="sparc"/> + <data id="10" name="sparcv9"/> + <data id="11" name="sparc64"/> + <data id="12" name="src"/> + <data id="13" name="s390"/> + <data id="14" name="athlon"/> + <data id="15" name="s390x"/> + <data id="16" name="ppc"/> + <data id="17" name="ppc64"/> + <data id="18" name="pSeries"/> + <data id="19" name="iSeries"/> + <data id="20" name="x86_64"/> + <data id="21" name="ppc64iseries"/> + <data id="22" name="ppc64pseries"/> + <data id="23" name="sparc-solaris"/> + <data id="24" name="sparc.sun4u-solaris"/> + <data id="25" name="tar"/> + <data id="26" name="ia32e"/> + <data id="27" name="amd64"/> + <data id="28" name="i386-solaris"/> + <data id="29" name="nosrc"/> + <data id="30" name="sparc-solaris-patch"/> + <data id="31" name="i386-solaris-patch"/> + <data id="32" name="sparc-solaris-patch-cluster"/> + <data id="33" name="i386-solaris-patch-cluster"/> + <data id="34" name="noarch-solaris"/> + <data id="35" name="noarch-solaris-patch"/> + <data id="36" name="noarch-solaris-patch-cluster"/> + <data id="37" name="solaris-patch"/> + <data id="38" name="solaris-patch-cluster"/> + </table> + + <table name="RHQ_REPO_GROUP_TYPE"> + <data id="1" name="family"/> + </table> + + <table name="RHQ_REPO_RELATION_TYPE"> + <data id="1" name="parent"/> + <data id="2" name="clone"/> + </table> + + <table name="RHQ_DISTRIBUTION_TYPE"> + <data id="1" name="kickstart" description="Linux kickstart distribution"/> + <data id="2" name="jumpstart" description="solaris jumpstart distribution"/> + </table> + +<!-- END: content-data.xml --> +<!-- BEGIN: jms-data.xml --> + +<!-- the schema matches that which would be automatically created by the JMS subsystem --> +<!-- see deploy/jms/rhq-jdbc-state-service.xml and rhq-jdbc2-service.xml --> +<!-- the data must match that which is expected in conf/login-config.xml --> + + + <table name="JMS_USERS"> + <data USERID="guest" PASSWD="guest" /> + </table> + + <table name="JMS_ROLES"> + <data ROLEID="guest" USERID="guest" /> + </table> + +<!-- END: jms-data.xml --> +<!-- END: rhq-data.xml --> +<!-- BEGIN: jon-data.xml --> + +<!-- This dbsetup config file defines a content source and + associated repo for the JBoss CP RSS patch feed. --> + + + <!-- ********* metadata (the content source type and its config def) ********* --> + + <table name="RHQ_CONFIG_DEF"> + <data ID="101" + NAME="JBoss CP Patch Feed Content Source"/> + </table> + + <table name="RHQ_CONFIG_PROP_DEF"> + <data ID="101" + NAME="url" + DISPLAY_NAME="Feed URL" + DESCRIPTION="URL of the feed (e.g. https://access.redhat.com/jbossnetwork/restricted/feed/software.html?product...)." + REQUIRED="1" + READONLY="0" + SUMMARY="0" + ACTIVATION_POLICY="IMMEDIATE" + ORDER_INDEX="0" + SIMPLE_TYPE="STRING" + ALLOW_CUSTOM_ENUM_VALUE="0" + DTYPE="property" + CONFIG_DEF_ID="101" + UNITS="0"/> + <data ID="102" + NAME="username" + DISPLAY_NAME="Username" + DESCRIPTION="Username used to access the feed URL." + REQUIRED="1" + READONLY="0" + SUMMARY="0" + ACTIVATION_POLICY="IMMEDIATE" + ORDER_INDEX="1" + SIMPLE_TYPE="STRING" + ALLOW_CUSTOM_ENUM_VALUE="0" + DTYPE="property" + CONFIG_DEF_ID="101" + UNITS="0"/> + <data ID="103" + NAME="password" + DISPLAY_NAME="Password" + DESCRIPTION="Password used to access the feed URL." + REQUIRED="1" + READONLY="0" + SUMMARY="0" + ACTIVATION_POLICY="IMMEDIATE" + ORDER_INDEX="2" + SIMPLE_TYPE="PASSWORD" + ALLOW_CUSTOM_ENUM_VALUE="0" + DTYPE="property" + CONFIG_DEF_ID="101" + UNITS="0"/> + <data ID="104" + NAME="active" + DISPLAY_NAME="Active" + DESCRIPTION="Indicates if the feed should be checked for new patches." + REQUIRED="1" + READONLY="0" + SUMMARY="0" + ACTIVATION_POLICY="IMMEDIATE" + ORDER_INDEX="3" + SIMPLE_TYPE="BOOLEAN" + ALLOW_CUSTOM_ENUM_VALUE="0" + DTYPE="property" + CONFIG_DEF_ID="101" + UNITS="0"/> + <data ID="105" + NAME="proxyUrl" + DISPLAY_NAME="Proxy URL" + REQUIRED="0" + READONLY="0" + SUMMARY="0" + ACTIVATION_POLICY="IMMEDIATE" + ORDER_INDEX="4" + SIMPLE_TYPE="STRING" + ALLOW_CUSTOM_ENUM_VALUE="0" + DTYPE="property" + CONFIG_DEF_ID="101" + UNITS="0"/> + <data ID="106" + NAME="proxyPort" + DISPLAY_NAME="Proxy Port" + REQUIRED="0" + READONLY="0" + SUMMARY="0" + ACTIVATION_POLICY="IMMEDIATE" + ORDER_INDEX="5" + SIMPLE_TYPE="STRING" + ALLOW_CUSTOM_ENUM_VALUE="0" + DTYPE="property" + CONFIG_DEF_ID="101" + UNITS="0"/> + <data ID="107" + NAME="proxyUsername" + DISPLAY_NAME="Proxy Username" + REQUIRED="0" + READONLY="0" + SUMMARY="0" + ACTIVATION_POLICY="IMMEDIATE" + ORDER_INDEX="6" + SIMPLE_TYPE="STRING" + ALLOW_CUSTOM_ENUM_VALUE="0" + DTYPE="property" + CONFIG_DEF_ID="101" + UNITS="0"/> + <data ID="108" + NAME="proxyPassword" + DISPLAY_NAME="Proxy Password" + REQUIRED="0" + READONLY="0" + SUMMARY="0" + ACTIVATION_POLICY="IMMEDIATE" + ORDER_INDEX="7" + SIMPLE_TYPE="STRING" + ALLOW_CUSTOM_ENUM_VALUE="0" + DTYPE="property" + CONFIG_DEF_ID="101" + UNITS="0"/> + </table> + + <!-- NOTE: The values of the NAME, PLUGIN_NAME, and API_CLASS columns must match what is + defined in RHQ/modules/enterprise/server/plugins/jboss-software/src/main/resources/META-INF/rhq-serverplugin.xml. --> + <!-- default sync chedule: 1st of every month at 12am --> + <table name="RHQ_CONTENT_SOURCE_TYPE"> + <data ID="101" + NAME="JBossASPatchSource" + DISPLAY_NAME="JBoss Patch Content Source" + DESCRIPTION="a content source that retrieves package metadata from an RSS feed; the feed must be in the format used by the JBoss CP" + PLUGIN_NAME="JBossASPatchContentSourcePlugin" + DEFAULT_LAZY_LOAD="1" + DEFAULT_DOWNLOAD_MODE="DATABASE" + DEFAULT_SYNC_SCHEDULE="0 0 0 1 * ?" + API_CLASS="org.rhq.enterprise.server.plugins.jboss.software.JBossSoftwareContentSourceAdapter" + SOURCE_CONFIG_DEF_ID="101"/> + </table> + + + <!-- the default template --> + <table name="RHQ_CONFIG"> + <data ID="101" + VERSION="0" + CTIME="1270066600000" + MTIME="1270066600000"/> + </table> + + <table name="RHQ_CONFIG_PROPERTY"> + <data ID="101" + NAME="url" + CONFIGURATION_ID="101" + STRING_VALUE="" + OVERRIDE="0" + DTYPE="property"/> + <data ID="102" + NAME="username" + CONFIGURATION_ID="101" + OVERRIDE="0" + DTYPE="property"/> + <data ID="103" + NAME="password" + CONFIGURATION_ID="101" + OVERRIDE="0" + DTYPE="property"/> + <data ID="104" + NAME="proxyUrl" + CONFIGURATION_ID="101" + OVERRIDE="0" + DTYPE="property"/> + <data ID="105" + NAME="proxyPort" + CONFIGURATION_ID="101" + OVERRIDE="0" + DTYPE="property"/> + <data ID="106" + NAME="active" + CONFIGURATION_ID="101" + STRING_VALUE="true" + OVERRIDE="0" + DTYPE="property"/> + <data ID="107" + NAME="proxyUsername" + CONFIGURATION_ID="101" + OVERRIDE="0" + DTYPE="property"/> + <data ID="108" + NAME="proxyPassword" + CONFIGURATION_ID="101" + OVERRIDE="0" + DTYPE="property"/> + </table> + + <table name="RHQ_CONFIG_TEMPLATE"> + <data ID="101" + NAME="default" + DESCRIPTION="the default initial values for the configuration of a JBossASPatchSource content source" + CONFIG_ID="101" + CONFIG_DEF_ID="101" + IS_DEFAULT="1"/> + </table> + + + <!-- ********* data (the content source and its config) ********* --> + + <table name="RHQ_CONFIG"> + <data ID="102" + VERSION="0" + CTIME="1270066600000" + MTIME="1270066600000"/> + </table> + + <table name="RHQ_CONFIG_PROPERTY"> + <data ID="111" + NAME="url" + CONFIGURATION_ID="102" + STRING_VALUE="https://access.redhat.com/jbossnetwork/restricted/feed/software.html?product..." + OVERRIDE="0" + DTYPE="property"/> + <data ID="112" + NAME="username" + CONFIGURATION_ID="102" + OVERRIDE="0" + DTYPE="property"/> + <data ID="113" + NAME="password" + CONFIGURATION_ID="102" + OVERRIDE="0" + DTYPE="property"/> + <data ID="114" + NAME="proxyUrl" + CONFIGURATION_ID="102" + OVERRIDE="0" + DTYPE="property"/> + <data ID="115" + NAME="proxyPort" + CONFIGURATION_ID="102" + OVERRIDE="0" + DTYPE="property"/> + <data ID="116" + NAME="active" + CONFIGURATION_ID="102" + STRING_VALUE="false" + OVERRIDE="0" + DTYPE="property"/> + <data ID="117" + NAME="proxyUsername" + CONFIGURATION_ID="102" + OVERRIDE="0" + DTYPE="property"/> + <data ID="118" + NAME="proxyPassword" + CONFIGURATION_ID="102" + OVERRIDE="0" + DTYPE="property"/> + </table> + + <!-- sync chedule: 1st of every month at 12am --> + <table name="RHQ_CONTENT_SOURCE"> + <data ID="101" + NAME="JBoss CP Patch Feed" + DESCRIPTION="an RSS feed published by the JBoss Customer Portal (CP) website which provides a list of all JBoss product patches available for the subscription of a given CP user; the feed entries for most cumulative patches (CPs) include automated install instructions that can be used by JON to install those CPs to inventoried server Resources (e.g. JBoss EAP servers)" + LAZY_LOAD="1" + DOWNLOAD_MODE="DATABASE" + SYNC_SCHEDULE="0 0 0 1 * ?" + CREATION_TIME="1270066600000" + LAST_MODIFIED_TIME="1270066600000" + CONTENT_SOURCE_TYPE_ID="101" + CONFIGURATION_ID="102"/> + </table> + + <!-- sync chedule: every Mon at 1am --> + <table name="RHQ_REPO"> + <data ID="101" + NAME="JBoss Patches" + DESCRIPTION="the patches obtained from the JBoss CP patch feed" + SYNC_SCHEDULE="0 0 1 ? * 1" + CREATION_TIME="1270066600000" + LAST_MODIFIED_TIME="1270066600000" + IS_PRIVATE="0" + IS_CANDIDATE="0"/> + </table> + + <table name="RHQ_REPO_CONTENT_SRC_MAP"> + <data REPO_ID="101" + CONTENT_SRC_ID="101" + CTIME="1270066600000"/> + </table> + + +<!-- END: jon-data.xml --> +</dbsetup> diff --git a/modules/enterprise/server/installer/src/test/resources/org/rhq/enterprise/server/installer/db-data-combined-rhq-4.2.0.xml b/modules/enterprise/server/installer/src/test/resources/org/rhq/enterprise/server/installer/db-data-combined-rhq-4.2.0.xml new file mode 100644 index 0000000..7e5c38b --- /dev/null +++ b/modules/enterprise/server/installer/src/test/resources/org/rhq/enterprise/server/installer/db-data-combined-rhq-4.2.0.xml @@ -0,0 +1,396 @@ +<?xml version="1.0" encoding="UTF-8"?> +<dbsetup name="data.xml"> +<!-- BEGIN: auth-data.xml --> + + + <table name="RHQ_PRINCIPAL"> + <data id="2" PRINCIPAL="rhqadmin" PASSWORD="x1XwrxKuPvYUILiOnOZTLg=="/> + </table> + +<!-- END: auth-data.xml --> +<!-- BEGIN: authz-data.xml --> + + + <!-- the overlord user --> + <table name="RHQ_SUBJECT"> + <data ID="1" + NAME="admin" + FIRST_NAME="Super" + LAST_NAME="User" + FSYSTEM="TRUE"/> + </table> + + <!-- the initial rhqadmin user --> + <table name="RHQ_SUBJECT"> + <data ID="2" + NAME="rhqadmin" + FIRST_NAME="RHQ" + LAST_NAME="Administrator" + EMAIL_ADDRESS="rhqadmin@localhost" + FSYSTEM="FALSE"/> + </table> + + <!-- Define the system root role which includes our overlord and rhqadmin users --> + <table name="RHQ_ROLE"> + <data ID="1" + NAME="Super User Role" + FSYSTEM="TRUE" + DESCRIPTION="System superuser role that provides full access to everything. This role cannot be modified."/> + <data ID="2" + NAME="All Resources Role" + FSYSTEM="FALSE" + DESCRIPTION="Provides full access to all resources in inventory. Cannot modify users, roles or server settings."/> + </table> + + <!-- associate the root users with all security permissions --> + <table name="RHQ_SUBJECT_ROLE_MAP"> + <!-- overlord user --> + <data SUBJECT_ID="1" ROLE_ID="1"/> + <!-- rhqadmin user --> + <data SUBJECT_ID="2" ROLE_ID="1"/> + </table> + + <table name="RHQ_PERMISSION"> + <!-- give super-user-role all permissions + (explicitly add resource perms, even though they are implied by MANAGE_INVENTORY) --> + <data ROLE_ID="1" OPERATION="0"/> <!-- Permission.MANAGE_SECURITY --> + <data ROLE_ID="1" OPERATION="1"/> <!-- Permission.MANAGE_INVENTORY --> + <data ROLE_ID="1" OPERATION="2"/> <!-- Permission.MANAGE_SETTINGS --> + <data ROLE_ID="1" OPERATION="12"/> <!-- Permission.MANAGE_BUNDLE --> + <data ROLE_ID="1" OPERATION="15"/> <!-- Permission.MANAGE_REPOSITORIES --> + <!-- resource permissions start here--> + <data ROLE_ID="1" OPERATION="3"/> <!-- Permission.VIEW_RESOURCE --> + <data ROLE_ID="1" OPERATION="4"/> <!-- Permission.MODIFY_RESOURCE --> + <data ROLE_ID="1" OPERATION="5"/> <!-- Permission.DELETE_RESOURCE --> + <data ROLE_ID="1" OPERATION="6"/> <!-- Permission.CREATE_CHILD_RESOURCES --> + <data ROLE_ID="1" OPERATION="7"/> <!-- Permission.MANAGE_ALERTS --> + <data ROLE_ID="1" OPERATION="8"/> <!-- Permission.MANAGE_MEASUREMENTS --> + <data ROLE_ID="1" OPERATION="9"/> <!-- Permission.MANAGE_CONTENT --> + <data ROLE_ID="1" OPERATION="10"/> <!-- Permission.CONTROL --> + <data ROLE_ID="1" OPERATION="11"/> <!-- Permission.CONFIGURE_WRITE --> + <data ROLE_ID="1" OPERATION="13"/> <!-- Permission.CONFIGURE_READ --> + <data ROLE_ID="1" OPERATION="14"/> <!-- Permission.MANAGE_EVENTS --> + <data ROLE_ID="1" OPERATION="16"/> <!-- Permission.MANAGE_DRIFT --> + + <!-- give all-resources-role MANAGE_INVENTORY and MANAGE_BUNDLE permissions + (explicitly add resource perms as well, even though they are implied by MANAGE_INVENTORY) --> + <data ROLE_ID="2" OPERATION="1"/> <!-- Permission.MANAGE_INVENTORY --> + <data ROLE_ID="2" OPERATION="12"/> <!-- Permission.MANAGE_BUNDLE --> + <!-- resource permissions start here--> + <data ROLE_ID="2" OPERATION="3"/> <!-- Permission.VIEW_RESOURCE --> + <data ROLE_ID="2" OPERATION="4"/> <!-- Permission.MODIFY_RESOURCE --> + <data ROLE_ID="2" OPERATION="5"/> <!-- Permission.DELETE_RESOURCE --> + <data ROLE_ID="2" OPERATION="6"/> <!-- Permission.CREATE_CHILD_RESOURCES --> + <data ROLE_ID="2" OPERATION="7"/> <!-- Permission.MANAGE_ALERTS --> + <data ROLE_ID="2" OPERATION="8"/> <!-- Permission.MANAGE_MEASUREMENTS --> + <data ROLE_ID="2" OPERATION="9"/> <!-- Permission.MANAGE_CONTENT --> + <data ROLE_ID="2" OPERATION="10"/> <!-- Permission.CONTROL --> + <data ROLE_ID="2" OPERATION="11"/> <!-- Permission.CONFIGURE_WRITE --> + <data ROLE_ID="2" OPERATION="13"/> <!-- Permission.CONFIGURE_READ --> + <data ROLE_ID="2" OPERATION="14"/> <!-- Permission.MANAGE_EVENTS --> + <data ROLE_ID="2" OPERATION="16"/> <!-- Permission.MANAGE_DRIFT --> + </table> + +<!-- END: authz-data.xml --> +<!-- BEGIN: 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="availability=down category=platform" + LAST_COMPUTE_TIME="0" + SUBJECT_ID="1" + GLOBAL="TRUE" /> + <data ID="2" + CONTEXT="RESOURCE" + NAME="Downed Servers" + DESCRIPTION="All downed servers across the entire enterprise" + PATTERN="availability=down category=server" + LAST_COMPUTE_TIME="0" + SUBJECT_ID="1" + GLOBAL="TRUE" /> + </table> + +<!-- END: search-data.xml --> +<!-- BEGIN: sysconfig-data.xml --> + + + <!-- + This file contains the seed data for the configuration table. + All keys mentioned here should be referenced via the RHQConstants class + --> + <table name="RHQ_SYSTEM_CONFIG"> + <data ID="1" PROPERTY_KEY="SERVER_VERSION" PROPERTY_VALUE="4.2.0" + DEFAULT_PROPERTY_VALUE="4.2.0" FREAD_ONLY="TRUE"/> + <data ID="2" PROPERTY_KEY="DB_SCHEMA_VERSION" PROPERTY_VALUE="2.115" + DEFAULT_PROPERTY_VALUE="2.115" FREAD_ONLY="TRUE"/> + <data ID="3" PROPERTY_KEY="CAM_JAAS_PROVIDER" PROPERTY_VALUE="JDBC" + DEFAULT_PROPERTY_VALUE="JDBC" FREAD_ONLY="FALSE"/> + <data ID="4" PROPERTY_KEY="CAM_BASE_URL" PROPERTY_VALUE="http://10.16.88.220:7080/" + DEFAULT_PROPERTY_VALUE="http://10.16.88.220:7080/" FREAD_ONLY="FALSE"/> + <data ID="9" PROPERTY_KEY="CAM_HELP_USER" PROPERTY_VALUE="web" + DEFAULT_PROPERTY_VALUE="web" FREAD_ONLY="FALSE"/> + <data ID="10" PROPERTY_KEY="CAM_HELP_PASSWORD" PROPERTY_VALUE="user" + DEFAULT_PROPERTY_VALUE="user" FREAD_ONLY="FALSE"/> + + <!-- default LDAP configuration options --> + <data ID="11" PROPERTY_KEY="CAM_LDAP_NAMING_FACTORY_INITIAL" + PROPERTY_VALUE="com.sun.jndi.ldap.LdapCtxFactory" + DEFAULT_PROPERTY_VALUE="com.sun.jndi.ldap.LdapCtxFactory" + FREAD_ONLY="FALSE"/> + <data ID="12" PROPERTY_KEY="CAM_LDAP_NAMING_PROVIDER_URL" + PROPERTY_VALUE="ldap://localhost/" + DEFAULT_PROPERTY_VALUE="ldap://localhost/" + FREAD_ONLY="FALSE"/> + <data ID="13" PROPERTY_KEY="CAM_LDAP_LOGIN_PROPERTY" + PROPERTY_VALUE="cn" + DEFAULT_PROPERTY_VALUE="cn" FREAD_ONLY="FALSE"/> + <data ID="14" PROPERTY_KEY="CAM_LDAP_BASE_DN" + PROPERTY_VALUE="o=JBoss,c=US" + DEFAULT_PROPERTY_VALUE="o=JBoss,c=US" + FREAD_ONLY="FALSE"/> + <data ID="15" PROPERTY_KEY="CAM_LDAP_BIND_DN" + PROPERTY_VALUE="" + DEFAULT_PROPERTY_VALUE="" FREAD_ONLY="FALSE"/> + <data ID="16" PROPERTY_KEY="CAM_LDAP_BIND_PW" + PROPERTY_VALUE="" + DEFAULT_PROPERTY_VALUE="" FREAD_ONLY="FALSE"/> + <data ID="17" PROPERTY_KEY="CAM_LDAP_PROTOCOL" + PROPERTY_VALUE="" DEFAULT_PROPERTY_VALUE="" + FREAD_ONLY="FALSE"/> + <data ID="18" PROPERTY_KEY="CAM_LDAP_FILTER" + PROPERTY_VALUE="" DEFAULT_PROPERTY_VALUE="" + FREAD_ONLY="FALSE"/> + + <!-- Does this build support Syslog actions? --> + <data ID="21" PROPERTY_KEY="CAM_SYSLOG_ACTIONS_ENABLED" + PROPERTY_VALUE="false" DEFAULT_PROPERTY_VALUE="false" + FREAD_ONLY="FALSE"/> + <data ID="23" PROPERTY_KEY="CAM_GUIDE_ENABLED" + PROPERTY_VALUE="true" + DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> + <data ID="24" PROPERTY_KEY="CAM_RT_COLLECT_IP_ADDRS" + PROPERTY_VALUE="true" + DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> + + <!-- Default data storage options --> + <!-- Default 14 days --> + <data ID="26" PROPERTY_KEY="CAM_DATA_PURGE_1H" + PROPERTY_VALUE="1209600000" DEFAULT_PROPERTY_VALUE="1209600000" + FREAD_ONLY="FALSE"/> + <!-- Default 31 days --> + <data ID="27" PROPERTY_KEY="CAM_DATA_PURGE_6H" + PROPERTY_VALUE="2678400000" DEFAULT_PROPERTY_VALUE="2678400000" + FREAD_ONLY="FALSE"/> + <!-- Default 1 year --> + <data ID="28" PROPERTY_KEY="CAM_DATA_PURGE_1D" + PROPERTY_VALUE="31536000000" DEFAULT_PROPERTY_VALUE="31536000000" + FREAD_ONLY="FALSE"/> + + <!-- Baseline options --> + <!-- How often to calculate, default 3 days; if 0, never calculate them automatically --> + <data ID="29" PROPERTY_KEY="CAM_BASELINE_FREQUENCY" + PROPERTY_VALUE="259200000" DEFAULT_PROPERTY_VALUE="259200000" + FREAD_ONLY="FALSE"/> + <!-- How much data to include in the calulation, default 7 days --> + <data ID="30" PROPERTY_KEY="CAM_BASELINE_DATASET" + PROPERTY_VALUE="604800000" DEFAULT_PROPERTY_VALUE="604800000" + FREAD_ONLY="FALSE"/> + + <!-- ID 31 has been deleted --> + + <!-- How often to run database maintainence routines --> + <data ID="32" PROPERTY_KEY="CAM_DATA_MAINTENANCE" + PROPERTY_VALUE="3600000" DEFAULT_PROPERTY_VALUE="3600000" FREAD_ONLY="FALSE"/> + + <!-- How long to keep RT data around --> + <data ID="34" PROPERTY_KEY="RT_DATA_PURGE" PROPERTY_VALUE="2678400000" + DEFAULT_PROPERTY_VALUE="2678400000" FREAD_ONLY="FALSE"/> + + <!-- Whether to reindex the data tables nightly --> + <data ID="35" PROPERTY_KEY="DATA_REINDEX_NIGHTLY" PROPERTY_VALUE="true" + DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> + + <!-- How long to keep alerts around --> + <data ID="36" PROPERTY_KEY="ALERT_PURGE" PROPERTY_VALUE="2678400000" + DEFAULT_PROPERTY_VALUE="2678400000" FREAD_ONLY="FALSE"/> + + <!-- How long to keep events around (1209600000 millis == 14 days) --> + <data ID="51" PROPERTY_KEY="EVENT_PURGE" PROPERTY_VALUE="1209600000" + DEFAULT_PROPERTY_VALUE="1209600000" FREAD_ONLY="FALSE"/> + + <!-- How long an agent is allowed to be quiet before we consider it down and backfill it --> + <data ID="52" PROPERTY_KEY="AGENT_MAX_QUIET_TIME_ALLOWED" PROPERTY_VALUE="900000" + DEFAULT_PROPERTY_VALUE="900000" FREAD_ONLY="FALSE"/> + + <!-- Will our server-cloud support agents auto-updating themselves? --> + <data ID="53" PROPERTY_KEY="ENABLE_AGENT_AUTO_UPDATE" PROPERTY_VALUE="true" + DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> + + <!-- How old does a trait have to be in order to get purged --> + <data ID="54" PROPERTY_KEY="TRAIT_PURGE" PROPERTY_VALUE="31536000000" + DEFAULT_PROPERTY_VALUE="31536000000" FREAD_ONLY="FALSE"/> + + <!-- How old does availability have to be in order to get purged --> + <data ID="55" PROPERTY_KEY="AVAILABILITY_PURGE" PROPERTY_VALUE="31536000000" + DEFAULT_PROPERTY_VALUE="31536000000" FREAD_ONLY="FALSE"/> + + <data ID="56" PROPERTY_KEY="RESOURCE_GENERIC_PROPERTIES_UPGRADE" PROPERTY_VALUE="false" + DEFAULT_PROPERTY_VALUE="false" FREAD_ONLY="FALSE"/> + + <!-- default drift server plugin settings --> + <data ID="57" PROPERTY_KEY="ACTIVE_DRIFT_PLUGIN" PROPERTY_VALUE="drift-jpa" + DEFAULT_PROPERTY_VALUE="drift-jpa" FREAD_ONLY="FALSE"/> + + <!-- purge drift files older than 31 days by default --> + <data ID="58" PROPERTY_KEY="DRIFT_FILE_PURGE" PROPERTY_VALUE="2678400000" + DEFAULT_PROPERTY_VALUE="2678400000" FREAD_ONLY="FALSE"/> + + </table> + +<!-- END: sysconfig-data.xml --> +<!-- BEGIN: measurement-data.xml --> + + <table name="RHQ_NUMBERS"> + <data i="0"/> + <data i="1"/> + <data i="2"/> + <data i="3"/> + <data i="4"/> + <data i="5"/> + <data i="6"/> + <data i="7"/> + <data i="8"/> + <data i="9"/> + <data i="10"/> + <data i="11"/> + <data i="12"/> + <data i="13"/> + <data i="14"/> + <data i="15"/> + <data i="16"/> + <data i="17"/> + <data i="18"/> + <data i="19"/> + <data i="20"/> + <data i="21"/> + <data i="22"/> + <data i="23"/> + <data i="24"/> + <data i="25"/> + <data i="26"/> + <data i="27"/> + <data i="28"/> + <data i="29"/> + <data i="30"/> + <data i="31"/> + <data i="32"/> + <data i="33"/> + <data i="34"/> + <data i="35"/> + <data i="36"/> + <data i="37"/> + <data i="38"/> + <data i="39"/> + <data i="40"/> + <data i="41"/> + <data i="42"/> + <data i="43"/> + <data i="44"/> + <data i="45"/> + <data i="46"/> + <data i="47"/> + <data i="48"/> + <data i="49"/> + <data i="50"/> + <data i="51"/> + <data i="52"/> + <data i="53"/> + <data i="54"/> + <data i="55"/> + <data i="56"/> + <data i="57"/> + <data i="58"/> + <data i="59"/> + </table> + +<!-- END: measurement-data.xml --> +<!-- BEGIN: content-data.xml --> + + <table name="RHQ_ARCHITECTURE"> + <data id="1" name="noarch"/> + <data id="2" name="i386"/> + <data id="3" name="i486"/> + <data id="4" name="i586"/> + <data id="5" name="i686"/> + <data id="6" name="alpha"/> + <data id="7" name="alphaev6"/> + <data id="8" name="ia64"/> + <data id="9" name="sparc"/> + <data id="10" name="sparcv9"/> + <data id="11" name="sparc64"/> + <data id="12" name="src"/> + <data id="13" name="s390"/> + <data id="14" name="athlon"/> + <data id="15" name="s390x"/> + <data id="16" name="ppc"/> + <data id="17" name="ppc64"/> + <data id="18" name="pSeries"/> + <data id="19" name="iSeries"/> + <data id="20" name="x86_64"/> + <data id="21" name="ppc64iseries"/> + <data id="22" name="ppc64pseries"/> + <data id="23" name="sparc-solaris"/> + <data id="24" name="sparc.sun4u-solaris"/> + <data id="25" name="tar"/> + <data id="26" name="ia32e"/> + <data id="27" name="amd64"/> + <data id="28" name="i386-solaris"/> + <data id="29" name="nosrc"/> + <data id="30" name="sparc-solaris-patch"/> + <data id="31" name="i386-solaris-patch"/> + <data id="32" name="sparc-solaris-patch-cluster"/> + <data id="33" name="i386-solaris-patch-cluster"/> + <data id="34" name="noarch-solaris"/> + <data id="35" name="noarch-solaris-patch"/> + <data id="36" name="noarch-solaris-patch-cluster"/> + <data id="37" name="solaris-patch"/> + <data id="38" name="solaris-patch-cluster"/> + </table> + + <table name="RHQ_REPO_GROUP_TYPE"> + <data id="1" name="family"/> + </table> + + <table name="RHQ_REPO_RELATION_TYPE"> + <data id="1" name="parent"/> + <data id="2" name="clone"/> + </table> + + <table name="RHQ_DISTRIBUTION_TYPE"> + <data id="1" name="kickstart" description="Linux kickstart distribution"/> + <data id="2" name="jumpstart" description="solaris jumpstart distribution"/> + </table> + +<!-- END: content-data.xml --> +<!-- BEGIN: jms-data.xml --> + +<!-- the schema matches that which would be automatically created by the JMS subsystem --> +<!-- see deploy/jms/rhq-jdbc-state-service.xml and rhq-jdbc2-service.xml --> +<!-- the data must match that which is expected in conf/login-config.xml --> + + + <table name="JMS_USERS"> + <data USERID="guest" PASSWD="guest" /> + </table> + + <table name="JMS_ROLES"> + <data ROLEID="guest" USERID="guest" /> + </table> + +<!-- END: jms-data.xml --> +</dbsetup> diff --git a/modules/enterprise/server/installer/src/test/resources/org/rhq/enterprise/server/installer/db-data-combined-rhq-4.3.0.xml b/modules/enterprise/server/installer/src/test/resources/org/rhq/enterprise/server/installer/db-data-combined-rhq-4.3.0.xml new file mode 100644 index 0000000..a927334 --- /dev/null +++ b/modules/enterprise/server/installer/src/test/resources/org/rhq/enterprise/server/installer/db-data-combined-rhq-4.3.0.xml @@ -0,0 +1,398 @@ +<?xml version="1.0" encoding="UTF-8"?> +<dbsetup name="data.xml"> +<!-- BEGIN: auth-data.xml --> + + + <table name="RHQ_PRINCIPAL"> + <data id="2" PRINCIPAL="rhqadmin" PASSWORD="x1XwrxKuPvYUILiOnOZTLg=="/> + </table> + +<!-- END: auth-data.xml --> +<!-- BEGIN: authz-data.xml --> + + + <!-- the overlord user --> + <table name="RHQ_SUBJECT"> + <data ID="1" + NAME="admin" + FIRST_NAME="Super" + LAST_NAME="User" + FSYSTEM="TRUE"/> + </table> + + <!-- the initial rhqadmin user --> + <table name="RHQ_SUBJECT"> + <data ID="2" + NAME="rhqadmin" + FIRST_NAME="RHQ" + LAST_NAME="Administrator" + EMAIL_ADDRESS="rhqadmin@localhost" + FSYSTEM="FALSE"/> + </table> + + <!-- Define the system root role which includes our overlord and rhqadmin users --> + <table name="RHQ_ROLE"> + <data ID="1" + NAME="Super User Role" + FSYSTEM="TRUE" + DESCRIPTION="System superuser role that provides full access to everything. This role cannot be modified."/> + <data ID="2" + NAME="All Resources Role" + FSYSTEM="FALSE" + DESCRIPTION="Provides full access to all resources in inventory. Cannot modify users, roles or server settings."/> + </table> + + <!-- associate the root users with all security permissions --> + <table name="RHQ_SUBJECT_ROLE_MAP"> + <!-- overlord user --> + <data SUBJECT_ID="1" ROLE_ID="1"/> + <!-- rhqadmin user --> + <data SUBJECT_ID="2" ROLE_ID="1"/> + </table> + + <table name="RHQ_PERMISSION"> + <!-- give super-user-role all permissions + (explicitly add resource perms, even though they are implied by MANAGE_INVENTORY) --> + <data ROLE_ID="1" OPERATION="0"/> <!-- Permission.MANAGE_SECURITY --> + <data ROLE_ID="1" OPERATION="1"/> <!-- Permission.MANAGE_INVENTORY --> + <data ROLE_ID="1" OPERATION="2"/> <!-- Permission.MANAGE_SETTINGS --> + <data ROLE_ID="1" OPERATION="12"/> <!-- Permission.MANAGE_BUNDLE --> + <data ROLE_ID="1" OPERATION="15"/> <!-- Permission.MANAGE_REPOSITORIES --> + <data ROLE_ID="1" OPERATION="17"/> <!-- Permission.VIEW_USERS --> + <!-- resource permissions start here--> + <data ROLE_ID="1" OPERATION="3"/> <!-- Permission.VIEW_RESOURCE --> + <data ROLE_ID="1" OPERATION="4"/> <!-- Permission.MODIFY_RESOURCE --> + <data ROLE_ID="1" OPERATION="5"/> <!-- Permission.DELETE_RESOURCE --> + <data ROLE_ID="1" OPERATION="6"/> <!-- Permission.CREATE_CHILD_RESOURCES --> + <data ROLE_ID="1" OPERATION="7"/> <!-- Permission.MANAGE_ALERTS --> + <data ROLE_ID="1" OPERATION="8"/> <!-- Permission.MANAGE_MEASUREMENTS --> + <data ROLE_ID="1" OPERATION="9"/> <!-- Permission.MANAGE_CONTENT --> + <data ROLE_ID="1" OPERATION="10"/> <!-- Permission.CONTROL --> + <data ROLE_ID="1" OPERATION="11"/> <!-- Permission.CONFIGURE_WRITE --> + <data ROLE_ID="1" OPERATION="13"/> <!-- Permission.CONFIGURE_READ --> + <data ROLE_ID="1" OPERATION="14"/> <!-- Permission.MANAGE_EVENTS --> + <data ROLE_ID="1" OPERATION="16"/> <!-- Permission.MANAGE_DRIFT --> + + <!-- give all-resources-role MANAGE_INVENTORY and MANAGE_BUNDLE permissions + (explicitly add resource perms as well, even though they are implied by MANAGE_INVENTORY) --> + <data ROLE_ID="2" OPERATION="1"/> <!-- Permission.MANAGE_INVENTORY --> + <data ROLE_ID="2" OPERATION="12"/> <!-- Permission.MANAGE_BUNDLE --> + <data ROLE_ID="2" OPERATION="17"/> <!-- Permission.VIEW_USERS --> + <!-- resource permissions start here--> + <data ROLE_ID="2" OPERATION="3"/> <!-- Permission.VIEW_RESOURCE --> + <data ROLE_ID="2" OPERATION="4"/> <!-- Permission.MODIFY_RESOURCE --> + <data ROLE_ID="2" OPERATION="5"/> <!-- Permission.DELETE_RESOURCE --> + <data ROLE_ID="2" OPERATION="6"/> <!-- Permission.CREATE_CHILD_RESOURCES --> + <data ROLE_ID="2" OPERATION="7"/> <!-- Permission.MANAGE_ALERTS --> + <data ROLE_ID="2" OPERATION="8"/> <!-- Permission.MANAGE_MEASUREMENTS --> + <data ROLE_ID="2" OPERATION="9"/> <!-- Permission.MANAGE_CONTENT --> + <data ROLE_ID="2" OPERATION="10"/> <!-- Permission.CONTROL --> + <data ROLE_ID="2" OPERATION="11"/> <!-- Permission.CONFIGURE_WRITE --> + <data ROLE_ID="2" OPERATION="13"/> <!-- Permission.CONFIGURE_READ --> + <data ROLE_ID="2" OPERATION="14"/> <!-- Permission.MANAGE_EVENTS --> + <data ROLE_ID="2" OPERATION="16"/> <!-- Permission.MANAGE_DRIFT --> + </table> + +<!-- END: authz-data.xml --> +<!-- BEGIN: 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="availability=down category=platform" + LAST_COMPUTE_TIME="0" + SUBJECT_ID="1" + GLOBAL="TRUE" /> + <data ID="2" + CONTEXT="RESOURCE" + NAME="Downed Servers" + DESCRIPTION="All downed servers across the entire enterprise" + PATTERN="availability=down category=server" + LAST_COMPUTE_TIME="0" + SUBJECT_ID="1" + GLOBAL="TRUE" /> + </table> + +<!-- END: search-data.xml --> +<!-- BEGIN: sysconfig-data.xml --> + + + <!-- + This file contains the seed data for the configuration table. + All keys mentioned here should be referenced via the RHQConstants class + --> + <table name="RHQ_SYSTEM_CONFIG"> + <data ID="1" PROPERTY_KEY="SERVER_VERSION" PROPERTY_VALUE="4.3.0" + DEFAULT_PROPERTY_VALUE="4.3.0" FREAD_ONLY="TRUE"/> + <data ID="2" PROPERTY_KEY="DB_SCHEMA_VERSION" PROPERTY_VALUE="2.119" + DEFAULT_PROPERTY_VALUE="2.119" FREAD_ONLY="TRUE"/> + <data ID="3" PROPERTY_KEY="CAM_JAAS_PROVIDER" PROPERTY_VALUE="JDBC" + DEFAULT_PROPERTY_VALUE="JDBC" FREAD_ONLY="FALSE"/> + <data ID="4" PROPERTY_KEY="CAM_BASE_URL" PROPERTY_VALUE="http://localhost:7080/" + DEFAULT_PROPERTY_VALUE="http://localhost:7080/" FREAD_ONLY="FALSE"/> + <data ID="9" PROPERTY_KEY="CAM_HELP_USER" PROPERTY_VALUE="web" + DEFAULT_PROPERTY_VALUE="web" FREAD_ONLY="FALSE"/> + <data ID="10" PROPERTY_KEY="CAM_HELP_PASSWORD" PROPERTY_VALUE="user" + DEFAULT_PROPERTY_VALUE="user" FREAD_ONLY="FALSE"/> + + <!-- default LDAP configuration options --> + <data ID="11" PROPERTY_KEY="CAM_LDAP_NAMING_FACTORY_INITIAL" + PROPERTY_VALUE="com.sun.jndi.ldap.LdapCtxFactory" + DEFAULT_PROPERTY_VALUE="com.sun.jndi.ldap.LdapCtxFactory" + FREAD_ONLY="FALSE"/> + <data ID="12" PROPERTY_KEY="CAM_LDAP_NAMING_PROVIDER_URL" + PROPERTY_VALUE="ldap://localhost/" + DEFAULT_PROPERTY_VALUE="ldap://localhost/" + FREAD_ONLY="FALSE"/> + <data ID="13" PROPERTY_KEY="CAM_LDAP_LOGIN_PROPERTY" + PROPERTY_VALUE="cn" + DEFAULT_PROPERTY_VALUE="cn" FREAD_ONLY="FALSE"/> + <data ID="14" PROPERTY_KEY="CAM_LDAP_BASE_DN" + PROPERTY_VALUE="o=JBoss,c=US" + DEFAULT_PROPERTY_VALUE="o=JBoss,c=US" + FREAD_ONLY="FALSE"/> + <data ID="15" PROPERTY_KEY="CAM_LDAP_BIND_DN" + PROPERTY_VALUE="" + DEFAULT_PROPERTY_VALUE="" FREAD_ONLY="FALSE"/> + <data ID="16" PROPERTY_KEY="CAM_LDAP_BIND_PW" + PROPERTY_VALUE="" + DEFAULT_PROPERTY_VALUE="" FREAD_ONLY="FALSE"/> + <data ID="17" PROPERTY_KEY="CAM_LDAP_PROTOCOL" + PROPERTY_VALUE="" DEFAULT_PROPERTY_VALUE="" + FREAD_ONLY="FALSE"/> + <data ID="18" PROPERTY_KEY="CAM_LDAP_FILTER" + PROPERTY_VALUE="" DEFAULT_PROPERTY_VALUE="" + FREAD_ONLY="FALSE"/> + + <!-- Does this build support Syslog actions? --> + <data ID="21" PROPERTY_KEY="CAM_SYSLOG_ACTIONS_ENABLED" + PROPERTY_VALUE="false" DEFAULT_PROPERTY_VALUE="false" + FREAD_ONLY="FALSE"/> + <data ID="23" PROPERTY_KEY="CAM_GUIDE_ENABLED" + PROPERTY_VALUE="true" + DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> + <data ID="24" PROPERTY_KEY="CAM_RT_COLLECT_IP_ADDRS" + PROPERTY_VALUE="true" + DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> + + <!-- Default data storage options --> + <!-- Default 14 days --> + <data ID="26" PROPERTY_KEY="CAM_DATA_PURGE_1H" + PROPERTY_VALUE="1209600000" DEFAULT_PROPERTY_VALUE="1209600000" + FREAD_ONLY="FALSE"/> + <!-- Default 31 days --> + <data ID="27" PROPERTY_KEY="CAM_DATA_PURGE_6H" + PROPERTY_VALUE="2678400000" DEFAULT_PROPERTY_VALUE="2678400000" + FREAD_ONLY="FALSE"/> + <!-- Default 1 year --> + <data ID="28" PROPERTY_KEY="CAM_DATA_PURGE_1D" + PROPERTY_VALUE="31536000000" DEFAULT_PROPERTY_VALUE="31536000000" + FREAD_ONLY="FALSE"/> + + <!-- Baseline options --> + <!-- How often to calculate, default 3 days; if 0, never calculate them automatically --> + <data ID="29" PROPERTY_KEY="CAM_BASELINE_FREQUENCY" + PROPERTY_VALUE="259200000" DEFAULT_PROPERTY_VALUE="259200000" + FREAD_ONLY="FALSE"/> + <!-- How much data to include in the calulation, default 7 days --> + <data ID="30" PROPERTY_KEY="CAM_BASELINE_DATASET" + PROPERTY_VALUE="604800000" DEFAULT_PROPERTY_VALUE="604800000" + FREAD_ONLY="FALSE"/> + + <!-- ID 31 has been deleted --> + + <!-- How often to run database maintainence routines --> + <data ID="32" PROPERTY_KEY="CAM_DATA_MAINTENANCE" + PROPERTY_VALUE="3600000" DEFAULT_PROPERTY_VALUE="3600000" FREAD_ONLY="FALSE"/> + + <!-- How long to keep RT data around --> + <data ID="34" PROPERTY_KEY="RT_DATA_PURGE" PROPERTY_VALUE="2678400000" + DEFAULT_PROPERTY_VALUE="2678400000" FREAD_ONLY="FALSE"/> + + <!-- Whether to reindex the data tables nightly --> + <data ID="35" PROPERTY_KEY="DATA_REINDEX_NIGHTLY" PROPERTY_VALUE="true" + DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> + + <!-- How long to keep alerts around --> + <data ID="36" PROPERTY_KEY="ALERT_PURGE" PROPERTY_VALUE="2678400000" + DEFAULT_PROPERTY_VALUE="2678400000" FREAD_ONLY="FALSE"/> + + <!-- How long to keep events around (1209600000 millis == 14 days) --> + <data ID="51" PROPERTY_KEY="EVENT_PURGE" PROPERTY_VALUE="1209600000" + DEFAULT_PROPERTY_VALUE="1209600000" FREAD_ONLY="FALSE"/> + + <!-- How long an agent is allowed to be quiet before we consider it down and backfill it --> + <data ID="52" PROPERTY_KEY="AGENT_MAX_QUIET_TIME_ALLOWED" PROPERTY_VALUE="900000" + DEFAULT_PROPERTY_VALUE="900000" FREAD_ONLY="FALSE"/> + + <!-- Will our server-cloud support agents auto-updating themselves? --> + <data ID="53" PROPERTY_KEY="ENABLE_AGENT_AUTO_UPDATE" PROPERTY_VALUE="true" + DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> + + <!-- How old does a trait have to be in order to get purged --> + <data ID="54" PROPERTY_KEY="TRAIT_PURGE" PROPERTY_VALUE="31536000000" + DEFAULT_PROPERTY_VALUE="31536000000" FREAD_ONLY="FALSE"/> + + <!-- How old does availability have to be in order to get purged --> + <data ID="55" PROPERTY_KEY="AVAILABILITY_PURGE" PROPERTY_VALUE="31536000000" + DEFAULT_PROPERTY_VALUE="31536000000" FREAD_ONLY="FALSE"/> + + <data ID="56" PROPERTY_KEY="RESOURCE_GENERIC_PROPERTIES_UPGRADE" PROPERTY_VALUE="false" + DEFAULT_PROPERTY_VALUE="false" FREAD_ONLY="FALSE"/> + + <!-- default drift server plugin settings --> + <data ID="57" PROPERTY_KEY="ACTIVE_DRIFT_PLUGIN" PROPERTY_VALUE="drift-jpa" + DEFAULT_PROPERTY_VALUE="drift-jpa" FREAD_ONLY="FALSE"/> + + <!-- purge drift files older than 31 days by default --> + <data ID="58" PROPERTY_KEY="DRIFT_FILE_PURGE" PROPERTY_VALUE="2678400000" + DEFAULT_PROPERTY_VALUE="2678400000" FREAD_ONLY="FALSE"/> + + </table> + +<!-- END: sysconfig-data.xml --> +<!-- BEGIN: measurement-data.xml --> + + <table name="RHQ_NUMBERS"> + <data i="0"/> + <data i="1"/> + <data i="2"/> + <data i="3"/> + <data i="4"/> + <data i="5"/> + <data i="6"/> + <data i="7"/> + <data i="8"/> + <data i="9"/> + <data i="10"/> + <data i="11"/> + <data i="12"/> + <data i="13"/> + <data i="14"/> + <data i="15"/> + <data i="16"/> + <data i="17"/> + <data i="18"/> + <data i="19"/> + <data i="20"/> + <data i="21"/> + <data i="22"/> + <data i="23"/> + <data i="24"/> + <data i="25"/> + <data i="26"/> + <data i="27"/> + <data i="28"/> + <data i="29"/> + <data i="30"/> + <data i="31"/> + <data i="32"/> + <data i="33"/> + <data i="34"/> + <data i="35"/> + <data i="36"/> + <data i="37"/> + <data i="38"/> + <data i="39"/> + <data i="40"/> + <data i="41"/> + <data i="42"/> + <data i="43"/> + <data i="44"/> + <data i="45"/> + <data i="46"/> + <data i="47"/> + <data i="48"/> + <data i="49"/> + <data i="50"/> + <data i="51"/> + <data i="52"/> + <data i="53"/> + <data i="54"/> + <data i="55"/> + <data i="56"/> + <data i="57"/> + <data i="58"/> + <data i="59"/> + </table> + +<!-- END: measurement-data.xml --> +<!-- BEGIN: content-data.xml --> + + <table name="RHQ_ARCHITECTURE"> + <data id="1" name="noarch"/> + <data id="2" name="i386"/> + <data id="3" name="i486"/> + <data id="4" name="i586"/> + <data id="5" name="i686"/> + <data id="6" name="alpha"/> + <data id="7" name="alphaev6"/> + <data id="8" name="ia64"/> + <data id="9" name="sparc"/> + <data id="10" name="sparcv9"/> + <data id="11" name="sparc64"/> + <data id="12" name="src"/> + <data id="13" name="s390"/> + <data id="14" name="athlon"/> + <data id="15" name="s390x"/> + <data id="16" name="ppc"/> + <data id="17" name="ppc64"/> + <data id="18" name="pSeries"/> + <data id="19" name="iSeries"/> + <data id="20" name="x86_64"/> + <data id="21" name="ppc64iseries"/> + <data id="22" name="ppc64pseries"/> + <data id="23" name="sparc-solaris"/> + <data id="24" name="sparc.sun4u-solaris"/> + <data id="25" name="tar"/> + <data id="26" name="ia32e"/> + <data id="27" name="amd64"/> + <data id="28" name="i386-solaris"/> + <data id="29" name="nosrc"/> + <data id="30" name="sparc-solaris-patch"/> + <data id="31" name="i386-solaris-patch"/> + <data id="32" name="sparc-solaris-patch-cluster"/> + <data id="33" name="i386-solaris-patch-cluster"/> + <data id="34" name="noarch-solaris"/> + <data id="35" name="noarch-solaris-patch"/> + <data id="36" name="noarch-solaris-patch-cluster"/> + <data id="37" name="solaris-patch"/> + <data id="38" name="solaris-patch-cluster"/> + </table> + + <table name="RHQ_REPO_GROUP_TYPE"> + <data id="1" name="family"/> + </table> + + <table name="RHQ_REPO_RELATION_TYPE"> + <data id="1" name="parent"/> + <data id="2" name="clone"/> + </table> + + <table name="RHQ_DISTRIBUTION_TYPE"> + <data id="1" name="kickstart" description="Linux kickstart distribution"/> + <data id="2" name="jumpstart" description="solaris jumpstart distribution"/> + </table> + +<!-- END: content-data.xml --> +<!-- BEGIN: jms-data.xml --> + +<!-- the schema matches that which would be automatically created by the JMS subsystem --> +<!-- see deploy/jms/rhq-jdbc-state-service.xml and rhq-jdbc2-service.xml --> +<!-- the data must match that which is expected in conf/login-config.xml --> + + + <table name="JMS_USERS"> + <data USERID="guest" PASSWD="guest" /> + </table> + + <table name="JMS_ROLES"> + <data ROLEID="guest" USERID="guest" /> + </table> + +<!-- END: jms-data.xml --> +</dbsetup> diff --git a/modules/enterprise/server/installer/src/test/resources/org/rhq/enterprise/server/installer/db-data-combined-rhq-4.4.0.xml b/modules/enterprise/server/installer/src/test/resources/org/rhq/enterprise/server/installer/db-data-combined-rhq-4.4.0.xml new file mode 100644 index 0000000..1c2fbb1 --- /dev/null +++ b/modules/enterprise/server/installer/src/test/resources/org/rhq/enterprise/server/installer/db-data-combined-rhq-4.4.0.xml @@ -0,0 +1,398 @@ +<?xml version="1.0" encoding="UTF-8"?> +<dbsetup name="data.xml"> +<!-- BEGIN: auth-data.xml --> + + + <table name="RHQ_PRINCIPAL"> + <data id="2" PRINCIPAL="rhqadmin" PASSWORD="x1XwrxKuPvYUILiOnOZTLg=="/> + </table> + +<!-- END: auth-data.xml --> +<!-- BEGIN: authz-data.xml --> + + + <!-- the overlord user --> + <table name="RHQ_SUBJECT"> + <data ID="1" + NAME="admin" + FIRST_NAME="Super" + LAST_NAME="User" + FSYSTEM="TRUE"/> + </table> + + <!-- the initial rhqadmin user --> + <table name="RHQ_SUBJECT"> + <data ID="2" + NAME="rhqadmin" + FIRST_NAME="RHQ" + LAST_NAME="Administrator" + EMAIL_ADDRESS="rhqadmin@localhost" + FSYSTEM="FALSE"/> + </table> + + <!-- Define the system root role which includes our overlord and rhqadmin users --> + <table name="RHQ_ROLE"> + <data ID="1" + NAME="Super User Role" + FSYSTEM="TRUE" + DESCRIPTION="System superuser role that provides full access to everything. This role cannot be modified."/> + <data ID="2" + NAME="All Resources Role" + FSYSTEM="FALSE" + DESCRIPTION="Provides full access to all resources in inventory. Cannot modify users, roles or server settings."/> + </table> + + <!-- associate the root users with all security permissions --> + <table name="RHQ_SUBJECT_ROLE_MAP"> + <!-- overlord user --> + <data SUBJECT_ID="1" ROLE_ID="1"/> + <!-- rhqadmin user --> + <data SUBJECT_ID="2" ROLE_ID="1"/> + </table> + + <table name="RHQ_PERMISSION"> + <!-- give super-user-role all permissions + (explicitly add resource perms, even though they are implied by MANAGE_INVENTORY) --> + <data ROLE_ID="1" OPERATION="0"/> <!-- Permission.MANAGE_SECURITY --> + <data ROLE_ID="1" OPERATION="1"/> <!-- Permission.MANAGE_INVENTORY --> + <data ROLE_ID="1" OPERATION="2"/> <!-- Permission.MANAGE_SETTINGS --> + <data ROLE_ID="1" OPERATION="12"/> <!-- Permission.MANAGE_BUNDLE --> + <data ROLE_ID="1" OPERATION="15"/> <!-- Permission.MANAGE_REPOSITORIES --> + <data ROLE_ID="1" OPERATION="17"/> <!-- Permission.VIEW_USERS --> + <!-- resource permissions start here--> + <data ROLE_ID="1" OPERATION="3"/> <!-- Permission.VIEW_RESOURCE --> + <data ROLE_ID="1" OPERATION="4"/> <!-- Permission.MODIFY_RESOURCE --> + <data ROLE_ID="1" OPERATION="5"/> <!-- Permission.DELETE_RESOURCE --> + <data ROLE_ID="1" OPERATION="6"/> <!-- Permission.CREATE_CHILD_RESOURCES --> + <data ROLE_ID="1" OPERATION="7"/> <!-- Permission.MANAGE_ALERTS --> + <data ROLE_ID="1" OPERATION="8"/> <!-- Permission.MANAGE_MEASUREMENTS --> + <data ROLE_ID="1" OPERATION="9"/> <!-- Permission.MANAGE_CONTENT --> + <data ROLE_ID="1" OPERATION="10"/> <!-- Permission.CONTROL --> + <data ROLE_ID="1" OPERATION="11"/> <!-- Permission.CONFIGURE_WRITE --> + <data ROLE_ID="1" OPERATION="13"/> <!-- Permission.CONFIGURE_READ --> + <data ROLE_ID="1" OPERATION="14"/> <!-- Permission.MANAGE_EVENTS --> + <data ROLE_ID="1" OPERATION="16"/> <!-- Permission.MANAGE_DRIFT --> + + <!-- give all-resources-role MANAGE_INVENTORY and MANAGE_BUNDLE permissions + (explicitly add resource perms as well, even though they are implied by MANAGE_INVENTORY) --> + <data ROLE_ID="2" OPERATION="1"/> <!-- Permission.MANAGE_INVENTORY --> + <data ROLE_ID="2" OPERATION="12"/> <!-- Permission.MANAGE_BUNDLE --> + <data ROLE_ID="2" OPERATION="17"/> <!-- Permission.VIEW_USERS --> + <!-- resource permissions start here--> + <data ROLE_ID="2" OPERATION="3"/> <!-- Permission.VIEW_RESOURCE --> + <data ROLE_ID="2" OPERATION="4"/> <!-- Permission.MODIFY_RESOURCE --> + <data ROLE_ID="2" OPERATION="5"/> <!-- Permission.DELETE_RESOURCE --> + <data ROLE_ID="2" OPERATION="6"/> <!-- Permission.CREATE_CHILD_RESOURCES --> + <data ROLE_ID="2" OPERATION="7"/> <!-- Permission.MANAGE_ALERTS --> + <data ROLE_ID="2" OPERATION="8"/> <!-- Permission.MANAGE_MEASUREMENTS --> + <data ROLE_ID="2" OPERATION="9"/> <!-- Permission.MANAGE_CONTENT --> + <data ROLE_ID="2" OPERATION="10"/> <!-- Permission.CONTROL --> + <data ROLE_ID="2" OPERATION="11"/> <!-- Permission.CONFIGURE_WRITE --> + <data ROLE_ID="2" OPERATION="13"/> <!-- Permission.CONFIGURE_READ --> + <data ROLE_ID="2" OPERATION="14"/> <!-- Permission.MANAGE_EVENTS --> + <data ROLE_ID="2" OPERATION="16"/> <!-- Permission.MANAGE_DRIFT --> + </table> + +<!-- END: authz-data.xml --> +<!-- BEGIN: 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="availability=down category=platform" + LAST_COMPUTE_TIME="0" + SUBJECT_ID="1" + GLOBAL="TRUE" /> + <data ID="2" + CONTEXT="RESOURCE" + NAME="Downed Servers" + DESCRIPTION="All downed servers across the entire enterprise" + PATTERN="availability=down category=server" + LAST_COMPUTE_TIME="0" + SUBJECT_ID="1" + GLOBAL="TRUE" /> + </table> + +<!-- END: search-data.xml --> +<!-- BEGIN: sysconfig-data.xml --> + + + <!-- + This file contains the seed data for the configuration table. + All keys mentioned here should be referenced via the RHQConstants class + --> + <table name="RHQ_SYSTEM_CONFIG"> + <data ID="1" PROPERTY_KEY="SERVER_VERSION" PROPERTY_VALUE="4.4.0" + DEFAULT_PROPERTY_VALUE="4.4.0" FREAD_ONLY="TRUE"/> + <data ID="2" PROPERTY_KEY="DB_SCHEMA_VERSION" PROPERTY_VALUE="2.121" + DEFAULT_PROPERTY_VALUE="2.121" FREAD_ONLY="TRUE"/> + <data ID="3" PROPERTY_KEY="CAM_JAAS_PROVIDER" PROPERTY_VALUE="JDBC" + DEFAULT_PROPERTY_VALUE="JDBC" FREAD_ONLY="FALSE"/> + <data ID="4" PROPERTY_KEY="CAM_BASE_URL" PROPERTY_VALUE="http://localhost:7080/" + DEFAULT_PROPERTY_VALUE="http://localhost:7080/" FREAD_ONLY="FALSE"/> + <data ID="9" PROPERTY_KEY="CAM_HELP_USER" PROPERTY_VALUE="web" + DEFAULT_PROPERTY_VALUE="web" FREAD_ONLY="FALSE"/> + <data ID="10" PROPERTY_KEY="CAM_HELP_PASSWORD" PROPERTY_VALUE="user" + DEFAULT_PROPERTY_VALUE="user" FREAD_ONLY="FALSE"/> + + <!-- default LDAP configuration options --> + <data ID="11" PROPERTY_KEY="CAM_LDAP_NAMING_FACTORY_INITIAL" + PROPERTY_VALUE="com.sun.jndi.ldap.LdapCtxFactory" + DEFAULT_PROPERTY_VALUE="com.sun.jndi.ldap.LdapCtxFactory" + FREAD_ONLY="FALSE"/> + <data ID="12" PROPERTY_KEY="CAM_LDAP_NAMING_PROVIDER_URL" + PROPERTY_VALUE="ldap://localhost/" + DEFAULT_PROPERTY_VALUE="ldap://localhost/" + FREAD_ONLY="FALSE"/> + <data ID="13" PROPERTY_KEY="CAM_LDAP_LOGIN_PROPERTY" + PROPERTY_VALUE="cn" + DEFAULT_PROPERTY_VALUE="cn" FREAD_ONLY="FALSE"/> + <data ID="14" PROPERTY_KEY="CAM_LDAP_BASE_DN" + PROPERTY_VALUE="o=JBoss,c=US" + DEFAULT_PROPERTY_VALUE="o=JBoss,c=US" + FREAD_ONLY="FALSE"/> + <data ID="15" PROPERTY_KEY="CAM_LDAP_BIND_DN" + PROPERTY_VALUE="" + DEFAULT_PROPERTY_VALUE="" FREAD_ONLY="FALSE"/> + <data ID="16" PROPERTY_KEY="CAM_LDAP_BIND_PW" + PROPERTY_VALUE="" + DEFAULT_PROPERTY_VALUE="" FREAD_ONLY="FALSE"/> + <data ID="17" PROPERTY_KEY="CAM_LDAP_PROTOCOL" + PROPERTY_VALUE="" DEFAULT_PROPERTY_VALUE="" + FREAD_ONLY="FALSE"/> + <data ID="18" PROPERTY_KEY="CAM_LDAP_FILTER" + PROPERTY_VALUE="" DEFAULT_PROPERTY_VALUE="" + FREAD_ONLY="FALSE"/> + + <!-- Does this build support Syslog actions? --> + <data ID="21" PROPERTY_KEY="CAM_SYSLOG_ACTIONS_ENABLED" + PROPERTY_VALUE="false" DEFAULT_PROPERTY_VALUE="false" + FREAD_ONLY="FALSE"/> + <data ID="23" PROPERTY_KEY="CAM_GUIDE_ENABLED" + PROPERTY_VALUE="true" + DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> + <data ID="24" PROPERTY_KEY="CAM_RT_COLLECT_IP_ADDRS" + PROPERTY_VALUE="true" + DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> + + <!-- Default data storage options --> + <!-- Default 14 days --> + <data ID="26" PROPERTY_KEY="CAM_DATA_PURGE_1H" + PROPERTY_VALUE="1209600000" DEFAULT_PROPERTY_VALUE="1209600000" + FREAD_ONLY="FALSE"/> + <!-- Default 31 days --> + <data ID="27" PROPERTY_KEY="CAM_DATA_PURGE_6H" + PROPERTY_VALUE="2678400000" DEFAULT_PROPERTY_VALUE="2678400000" + FREAD_ONLY="FALSE"/> + <!-- Default 1 year --> + <data ID="28" PROPERTY_KEY="CAM_DATA_PURGE_1D" + PROPERTY_VALUE="31536000000" DEFAULT_PROPERTY_VALUE="31536000000" + FREAD_ONLY="FALSE"/> + + <!-- Baseline options --> + <!-- How often to calculate, default 3 days; if 0, never calculate them automatically --> + <data ID="29" PROPERTY_KEY="CAM_BASELINE_FREQUENCY" + PROPERTY_VALUE="259200000" DEFAULT_PROPERTY_VALUE="259200000" + FREAD_ONLY="FALSE"/> + <!-- How much data to include in the calulation, default 7 days --> + <data ID="30" PROPERTY_KEY="CAM_BASELINE_DATASET" + PROPERTY_VALUE="604800000" DEFAULT_PROPERTY_VALUE="604800000" + FREAD_ONLY="FALSE"/> + + <!-- ID 31 has been deleted --> + + <!-- How often to run database maintainence routines --> + <data ID="32" PROPERTY_KEY="CAM_DATA_MAINTENANCE" + PROPERTY_VALUE="3600000" DEFAULT_PROPERTY_VALUE="3600000" FREAD_ONLY="FALSE"/> + + <!-- How long to keep RT data around --> + <data ID="34" PROPERTY_KEY="RT_DATA_PURGE" PROPERTY_VALUE="2678400000" + DEFAULT_PROPERTY_VALUE="2678400000" FREAD_ONLY="FALSE"/> + + <!-- Whether to reindex the data tables nightly --> + <data ID="35" PROPERTY_KEY="DATA_REINDEX_NIGHTLY" PROPERTY_VALUE="true" + DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> + + <!-- How long to keep alerts around --> + <data ID="36" PROPERTY_KEY="ALERT_PURGE" PROPERTY_VALUE="2678400000" + DEFAULT_PROPERTY_VALUE="2678400000" FREAD_ONLY="FALSE"/> + + <!-- How long to keep events around (1209600000 millis == 14 days) --> + <data ID="51" PROPERTY_KEY="EVENT_PURGE" PROPERTY_VALUE="1209600000" + DEFAULT_PROPERTY_VALUE="1209600000" FREAD_ONLY="FALSE"/> + + <!-- How long an agent is allowed to be quiet before we consider it down and backfill it --> + <data ID="52" PROPERTY_KEY="AGENT_MAX_QUIET_TIME_ALLOWED" PROPERTY_VALUE="300000" + DEFAULT_PROPERTY_VALUE="300000" FREAD_ONLY="FALSE"/> + + <!-- Will our server-cloud support agents auto-updating themselves? --> + <data ID="53" PROPERTY_KEY="ENABLE_AGENT_AUTO_UPDATE" PROPERTY_VALUE="true" + DEFAULT_PROPERTY_VALUE="true" FREAD_ONLY="FALSE"/> + + <!-- How old does a trait have to be in order to get purged --> + <data ID="54" PROPERTY_KEY="TRAIT_PURGE" PROPERTY_VALUE="31536000000" + DEFAULT_PROPERTY_VALUE="31536000000" FREAD_ONLY="FALSE"/> + + <!-- How old does availability have to be in order to get purged --> + <data ID="55" PROPERTY_KEY="AVAILABILITY_PURGE" PROPERTY_VALUE="31536000000" + DEFAULT_PROPERTY_VALUE="31536000000" FREAD_ONLY="FALSE"/> + + <data ID="56" PROPERTY_KEY="RESOURCE_GENERIC_PROPERTIES_UPGRADE" PROPERTY_VALUE="false" + DEFAULT_PROPERTY_VALUE="false" FREAD_ONLY="FALSE"/> + + <!-- default drift server plugin settings --> + <data ID="57" PROPERTY_KEY="ACTIVE_DRIFT_PLUGIN" PROPERTY_VALUE="drift-jpa" + DEFAULT_PROPERTY_VALUE="drift-jpa" FREAD_ONLY="FALSE"/> + + <!-- purge drift files older than 31 days by default --> + <data ID="58" PROPERTY_KEY="DRIFT_FILE_PURGE" PROPERTY_VALUE="2678400000" + DEFAULT_PROPERTY_VALUE="2678400000" FREAD_ONLY="FALSE"/> + + </table> + +<!-- END: sysconfig-data.xml --> +<!-- BEGIN: measurement-data.xml --> + + <table name="RHQ_NUMBERS"> + <data i="0"/> + <data i="1"/> + <data i="2"/> + <data i="3"/> + <data i="4"/> + <data i="5"/> + <data i="6"/> + <data i="7"/> + <data i="8"/> + <data i="9"/> + <data i="10"/> + <data i="11"/> + <data i="12"/> + <data i="13"/> + <data i="14"/> + <data i="15"/> + <data i="16"/> + <data i="17"/> + <data i="18"/> + <data i="19"/> + <data i="20"/> + <data i="21"/> + <data i="22"/> + <data i="23"/> + <data i="24"/> + <data i="25"/> + <data i="26"/> + <data i="27"/> + <data i="28"/> + <data i="29"/> + <data i="30"/> + <data i="31"/> + <data i="32"/> + <data i="33"/> + <data i="34"/> + <data i="35"/> + <data i="36"/> + <data i="37"/> + <data i="38"/> + <data i="39"/> + <data i="40"/> + <data i="41"/> + <data i="42"/> + <data i="43"/> + <data i="44"/> + <data i="45"/> + <data i="46"/> + <data i="47"/> + <data i="48"/> + <data i="49"/> + <data i="50"/> + <data i="51"/> + <data i="52"/> + <data i="53"/> + <data i="54"/> + <data i="55"/> + <data i="56"/> + <data i="57"/> + <data i="58"/> + <data i="59"/> + </table> + +<!-- END: measurement-data.xml --> +<!-- BEGIN: content-data.xml --> + + <table name="RHQ_ARCHITECTURE"> + <data id="1" name="noarch"/> + <data id="2" name="i386"/> + <data id="3" name="i486"/> + <data id="4" name="i586"/> + <data id="5" name="i686"/> + <data id="6" name="alpha"/> + <data id="7" name="alphaev6"/> + <data id="8" name="ia64"/> + <data id="9" name="sparc"/> + <data id="10" name="sparcv9"/> + <data id="11" name="sparc64"/> + <data id="12" name="src"/> + <data id="13" name="s390"/> + <data id="14" name="athlon"/> + <data id="15" name="s390x"/> + <data id="16" name="ppc"/> + <data id="17" name="ppc64"/> + <data id="18" name="pSeries"/> + <data id="19" name="iSeries"/> + <data id="20" name="x86_64"/> + <data id="21" name="ppc64iseries"/> + <data id="22" name="ppc64pseries"/> + <data id="23" name="sparc-solaris"/> + <data id="24" name="sparc.sun4u-solaris"/> + <data id="25" name="tar"/> + <data id="26" name="ia32e"/> + <data id="27" name="amd64"/> + <data id="28" name="i386-solaris"/> + <data id="29" name="nosrc"/> + <data id="30" name="sparc-solaris-patch"/> + <data id="31" name="i386-solaris-patch"/> + <data id="32" name="sparc-solaris-patch-cluster"/> + <data id="33" name="i386-solaris-patch-cluster"/> + <data id="34" name="noarch-solaris"/> + <data id="35" name="noarch-solaris-patch"/> + <data id="36" name="noarch-solaris-patch-cluster"/> + <data id="37" name="solaris-patch"/> + <data id="38" name="solaris-patch-cluster"/> + </table> + + <table name="RHQ_REPO_GROUP_TYPE"> + <data id="1" name="family"/> + </table> + + <table name="RHQ_REPO_RELATION_TYPE"> + <data id="1" name="parent"/> + <data id="2" name="clone"/> + </table> + + <table name="RHQ_DISTRIBUTION_TYPE"> + <data id="1" name="kickstart" description="Linux kickstart distribution"/> + <data id="2" name="jumpstart" description="solaris jumpstart distribution"/> + </table> + +<!-- END: content-data.xml --> +<!-- BEGIN: jms-data.xml --> + +<!-- the schema matches that which would be automatically created by the JMS subsystem --> +<!-- see deploy/jms/rhq-jdbc-state-service.xml and rhq-jdbc2-service.xml --> +<!-- the data must match that which is expected in conf/login-config.xml --> + + + <table name="JMS_USERS"> + <data USERID="guest" PASSWD="guest" /> + </table> + + <table name="JMS_ROLES"> + <data ROLEID="guest" USERID="guest" /> + </table> + +<!-- END: jms-data.xml --> +</dbsetup> diff --git a/modules/enterprise/server/installer/src/test/resources/org/rhq/enterprise/server/installer/db-schema-combined-2.4.0.xml b/modules/enterprise/server/installer/src/test/resources/org/rhq/enterprise/server/installer/db-schema-combined-2.4.0.xml new file mode 100644 index 0000000..8ac0762 --- /dev/null +++ b/modules/enterprise/server/installer/src/test/resources/org/rhq/enterprise/server/installer/db-schema-combined-2.4.0.xml @@ -0,0 +1,2494 @@ +<?xml version="1.0" encoding="UTF-8"?> +<dbsetup name="schema"> +<!-- BEGIN: config-schema.xml --> + + + <!-- Definition or Metadata tables --> + + <table name="RHQ_CONFIG_DEF"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="NAME" type="VARCHAR2" required="true" size="100"/> + <column name="DESCRIPTION" type="VARCHAR2" required="false" size="250"/> + <column name="VERSION" type="VARCHAR2" required="false" size="50"/> + <column name="CONFIG_FORMAT" type="VARCHAR2" required="false" size="32"/> + </table> + + <table name="RHQ_CONFIG_PROP_GRP_DEF"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="NAME" type="VARCHAR2" required="true" size="100"/> + <column name="DISPLAY_NAME" type="VARCHAR2" required="false" size="100"/> + <column name="DESCRIPTION" type="VARCHAR2" required="false" size="250"/> + <column name="DEFAULT_HIDDEN" type="BOOLEAN" required="false"/> + <column name="ORDER_INDEX" type="INTEGER" required="false"/> + </table> + + <table name="RHQ_CONFIG_PROP_DEF"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="NAME" type="VARCHAR2" required="false" size="255"/> + <column name="DISPLAY_NAME" type="VARCHAR2" required="false" size="100"/> + <column name="DESCRIPTION" type="VARCHAR2" required="false" size="1000"/> + <column name="DEFAULT_VALUE" type="VARCHAR2" required="false" size="2000"/> + <column name="REQUIRED" type="BOOLEAN" required="false"/> + <column name="READONLY" type="BOOLEAN" required="false"/> + <column name="SUMMARY" type="BOOLEAN" required="false"/> + <column name="ACTIVATION_POLICY" type="VARCHAR2" required="false" size="20"/> + <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_GRP_DEF"/> + <column name="ORDER_INDEX" type="INTEGER" required="false"/> + <column name="VERSION" type="VARCHAR2" required="false" size="50"/> + <column name="PARENT_MAP_DEFINITION_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> + <column name="PARENT_LIST_DEFINITION_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> + <column name="SIMPLE_TYPE" type="VARCHAR2" required="false" size="20"/> + <column name="ALLOW_CUSTOM_ENUM_VALUE" type="BOOLEAN" required="false"/> + <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> + <column name="CONFIG_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_DEF"/> + + <!-- only simple properties (not lists and maps) have this --> + <column name="UNITS" type="SMALLINT" required="false"/> + + <!-- only dynamic properties (not simple) have this --> + <column name="DYNAMIC_TYPE" type="VARCHAR2" size="20" required="false"/> + <column name="DYNAMIC_KEY" type="VARCHAR2" size="128" required="false"/> + </table> + + <table name="RHQ_CONF_PROP_DEF_ENUM"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="STRING_VALUE" type="VARCHAR2" required="false" size="500"/> + <column name="ORDER_INDEX" type="INTEGER" required="false"/> + <column name="IS_DEFAULT" type="BOOLEAN" required="false"/> + <column name="NAME" type="VARCHAR2" required="false" size="100"/> + <column name="PROPERTY_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> + </table> + + <table name="RHQ_CONFIG_PROP_CONSTR"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="DTYPE" type="VARCHAR2" required="true" size="15"/> + <column name="DETAILS" type="VARCHAR2" required="false" size="250"/> + <column name="CONFIG_PROP_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> + <column name="ORDER_INDEX" type="INTEGER" required="false"/> + </table> + + + <!-- Content or value tables --> + + <table name="RHQ_CONFIG"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="NOTES" type="VARCHAR2" required="false" size="512"/> + <column name="VERSION" type="VARCHAR2" required="false" size="50"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + </table> + + <table name="RHQ_CONFIG_PROPERTY"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="CONFIGURATION_ID" type="INTEGER" required="false" references="RHQ_CONFIG" ondelete="cascade"/> + <column name="STRING_VALUE" type="VARCHAR2" required="false" size="2000"/> + <column name="OVERRIDE" type="BOOLEAN" required="false"/> + <column name="NAME" type="VARCHAR2" required="true" size="255"/> + <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> + <!-- Recursive cascade path to RHQ_CONFIG_PROPERTY causes constraint creation errors on SQL Server, see + http://support.microsoft.com/kb/321843 --> + <column name="PARENT_LIST_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROPERTY" ondelete="cascade" /> + <column name="PARENT_MAP_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROPERTY" ondelete="cascade" /> + <column name="LIST_INDEX" type="INTEGER"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <index name="RHQ_CONFIG_PROP_idx_prop_key" unique="false"> + <field ref="CONFIGURATION_ID"/> + <field ref="NAME"/> + </index> + <index name="RHQ_CONFIG_PROP_idx_map_key" unique="false"> + <field ref="PARENT_MAP_ID"/> + <field ref="NAME"/> + </index> + <index name="RHQ_CONFIG_PROP_idx_list_key" unique="false"> + <field ref="PARENT_LIST_ID"/> + </index> + <!-- List entries all have the same name --> + </table> + + <table name="RHQ_CONFIG_TEMPLATE"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="NAME" type="VARCHAR2" required="false" size="100"/> + <column name="DESCRIPTION" type="VARCHAR2" required="false" size="500"/> + <column name="CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> + <column name="CONFIG_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_DEF"/> + <column name="IS_DEFAULT" type="BOOLEAN" required="false"/> + </table> + + <table name="RHQ_RAW_CONFIG"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="CONFIG_ID" type="INTEGER" required="true" references="RHQ_CONFIG(ID)"/> + <column name="PATH" type="VARCHAR2" required="false" size="512"/> + <column name="CONTENTS" type="CLOB" required="true"/> + <column name="SHA256" type="VARCHAR2" size="64" required="true"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + </table> + +<!-- END: config-schema.xml --> +<!-- BEGIN: cluster-schema.xml --> + + <table name="RHQ_AFFINITY_GROUP"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" required="true" size="255" type="VARCHAR2"/> + </table> + + <table name="RHQ_SERVER"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" required="true" size="255" type="VARCHAR2"/> + <column name="ADDRESS" required="true" size="255" type="VARCHAR2"/> + <column name="PORT" required="true" type="INTEGER"/> + <column name="SECURE_PORT" required="true" type="INTEGER"/> + <column name="CTIME" required="true" type="LONG"/> + <column name="MTIME" required="true" type="LONG"/> + <column name="AFFINITY_GROUP_ID" type="INTEGER" references="RHQ_AFFINITY_GROUP" required="false"/> + <column name="COMPUTE_POWER" required="true" type="INTEGER"/> + <column name="OPERATION_MODE" required="true" size="32" type="VARCHAR2"/> + <column name="STATUS" type="INTEGER" required="false" default="0" /> + + <!-- This index is for constraint, not performance --> + <index name="RHQ_SERVER_NAME_UNIQUE" unique="true"> + <field ref="NAME"/> + </index> + </table> + + <!-- new agent --> + <table name="RHQ_AGENT"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" required="true" size="255" type="VARCHAR2"/> + <column name="ADDRESS" required="true" size="255" type="VARCHAR2"/> + <column name="PORT" required="true" type="INTEGER"/> + <column name="AGENTTOKEN" required="true" size="100" type="VARCHAR2"/> + <column name="REMOTE_ENDPOINT" required="false" size="4000" type="VARCHAR2"/> + <column name="CTIME" required="true" type="LONG"/> + <column name="MTIME" required="true" type="LONG"/> + <column name="LAST_AVAILABILITY_REPORT" required="false" type="LONG"/> + <column name="AFFINITY_GROUP_ID" type="INTEGER" references="RHQ_AFFINITY_GROUP" required="false"/> + <column name="SERVER_ID" type="INTEGER" references="RHQ_SERVER" required="false"/> + <column name="STATUS" type="INTEGER" required="false" default="0" /> + <column name="BACKFILLED" type="BOOLEAN" required="true" /> + + <index name="RHQ_AGENT_NAME_UNIQUE" unique="true"> + <field ref="NAME"/> + </index> + + <index name="RHQ_AGENT_ADDRESS_PORT" unique="true"> + <field ref="ADDRESS"/> + <field ref="PORT"/> + </index> + + <index name="RHQ_AGENT_TOKEN_UNIQUE" unique="true"> + <field ref="AGENTTOKEN"/> + </index> + </table> + + <table name="RHQ_PARTITION_EVENT"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="SUBJECT_NAME" required="true" size="255" type="VARCHAR2"/> + <column name="CTIME" required="true" type="LONG"/> + <column name="EVENT_TYPE" required="true" size="50" type="VARCHAR2"/> + <column name="EVENT_DETAIL" required="false" size="512" type="VARCHAR2"/> + <column name="EXECUTION_STATUS" required="true" size="32" type="VARCHAR2"/> + </table> + + <table name="RHQ_PARTITION_DETAILS"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="PARTITION_EVENT_ID" type="INTEGER" references="RHQ_PARTITION_EVENT" required="true"/> + <column name="AGENT_NAME" type="VARCHAR2" size="255" required="true"/> + <column name="SERVER_NAME" type="VARCHAR2" size="255" required="true"/> + </table> + + <table name="RHQ_FAILOVER_LIST"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="PARTITION_EVENT_ID" type="INTEGER" references="RHQ_PARTITION_EVENT" required="true"/> + <column name="AGENT_ID" type="INTEGER" references="RHQ_AGENT" required="true"/> + <column name="CTIME" required="true" type="LONG"/> + </table> + + <table name="RHQ_FAILOVER_DETAILS"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="FAILOVER_LIST_ID" type="INTEGER" references="RHQ_FAILOVER_LIST" required="true"/> + <column name="SERVER_ID" type="INTEGER" references="RHQ_SERVER" required="true"/> + <column name="ORDINAL" type = "INTEGER" required="true"/> + </table> + +<!-- END: cluster-schema.xml --> +<!-- BEGIN: inventory-schema.xml --> + + + <!-- NEW RESOURCE TYPES --> + <table name="RHQ_RESOURCE_TYPE"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" type="VARCHAR2" size="100" required="true"/> + <column name="CATEGORY" type="VARCHAR2" size="16" required="true"/> + <column name="CREATION_DATA_TYPE" type="VARCHAR2" size="16" required="true"/> + <column name="CREATE_DELETE_POLICY" type="VARCHAR2" size="16" required="true"/> + <column name="SINGLETON" type="BOOLEAN" required="true"/> + <column name="SUPPORTS_MANUAL_ADD" type="BOOLEAN" required="true"/> + <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> + <column name="PLUGIN" type="VARCHAR2" size="100"/> + <column name="CTIME" type="LONG"/> + <column name="MTIME" type="LONG"/> + <column name="SUBCATEGORY_ID" type="INTEGER"/> + <!-- + TODO add support to DB setup for tables with circular dependencies and then add back this RI + <column name="SUBCATEGORY_ID" type="INTEGER" references="RHQ_RESOURCE_SUBCAT" /> + --> + <column name="PLUGIN_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> + <column name="RES_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> + + <index name="RHQ_RES_TYPE_IDX_PLG_NAME" unique="true"> + <field ref="NAME"/> + <field ref="PLUGIN"/> + </index> + </table> + + <!-- NEW RESOURCE SUBCATEGORIES --> + <table name="RHQ_RESOURCE_SUBCAT"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" type="VARCHAR2" size="100"/> + <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> + <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> + <column name="CTIME" type="LONG"/> + <column name="MTIME" type="LONG"/> + <column name="PARENT_SUBCATEGORY_ID" type="INTEGER" references="RHQ_RESOURCE_SUBCAT"/> + <!-- resourceTypeId is not required on child sub categories --> + <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> + </table> + + <!-- Many To Many mapping for resource type to its parents --> + <table name="RHQ_RESOURCE_TYPE_PARENTS"> + <column name="RESOURCE_TYPE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> + <column name="PARENT_RESOURCE_TYPE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> + + <!-- not using full words to fit index name length --> + <constraint name="RHQ_RES_TYPE_PARENTS_KEY"> + <primaryKey> + <field ref="RESOURCE_TYPE_ID"/> + <field ref="PARENT_RESOURCE_TYPE_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_PROCESS_SCAN"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="QUERY" type="VARCHAR2" size="256" required="true"/> + <column name="NAME" type="VARCHAR2" size="100" required="false"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> + + <index name="RHQ_PROCESS_SCAN_QUERY_INDEX" unique="true"> + <field ref="QUERY"/> + <field ref="RESOURCE_TYPE_ID"/> + </index> + </table> + + <table name="RHQ_PRD_VER"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="VERSION" type="VARCHAR2" size="50" required="true"/> + <column name="RES_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> + </table> + + <table name="RHQ_RESOURCE"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> + <column name="UUID" type="CHAR" size="36" required="true"/> + <column name="NAME" type="VARCHAR2" size="500"/> + <column name="RESOURCE_KEY" type="VARCHAR2" required="true" size="500"/> + <column name="AGENT_ID" required="false" type="INTEGER" references="RHQ_AGENT(id)"/> + <column name="INVENTORY_STATUS" type="VARCHAR2" size="20"/> + <column name="CONNECTED" type="BOOLEAN"/> + <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> + <column name="VERSION" type="VARCHAR2" size="50"/> + <column name="CTIME" type="LONG"/> + <column name="MTIME" type="LONG"/> + <column name="ITIME" type="LONG"/> + <column name="RES_CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG"/> + <column name="PLUGIN_CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG"/> + <column name="MODIFIED_BY" required="false" type="INTEGER"/> + <column name="LOCATION" required="false" size="100" type="VARCHAR2"/> + <column name="PARENT_RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE"/> + <column name="PRODUCT_VERSION_ID" type="INTEGER" references="RHQ_PRD_VER"/> + + <index name="RHQ_RESOURCE_idx_key"> + <field ref="RESOURCE_KEY"/> + </index> + + <index name="RHQ_RESOURCE_idx_type"> + <field ref="RESOURCE_TYPE_ID"/> + </index> + + <index name="RHQ_RESOURCE_idx_agent"> + <field ref="AGENT_ID"/> + </index> + + <index name="RHQ_RESOURCE_idx_parent"> + <field ref="PARENT_RESOURCE_ID"/> + </index> + + </table> + + <table name="RHQ_RESOURCE_ERROR"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> + <column name="TIME_OCCURRED" type="LONG" required="true"/> + <column name="ERROR_TYPE" type="VARCHAR2" required="true" size="32"/> + <column name="SUMMARY" type="VARCHAR2" required="true" size="1000"/> + <column name="DETAIL" type="LONGVARCHAR" required="false"/> + + <index name="RHQ_RES_ERROR_IDX_RES_ID"> + <field ref="RESOURCE_ID"/> + </index> + </table> + + <table name="RHQ_GROUP_DEF"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" required="true" size="100" type="VARCHAR2"/> + <column name="DESCRIPTION" size="100" type="VARCHAR2"/> + <column name="CTIME" type="LONG"/> + <column name="MTIME" type="LONG"/> + <column name="CALC_TIME" type="LONG"/> + <column name="CALC_INTERVAL" type="LONG"/> + <column name="RECURSIVE" type="BOOLEAN"/> + <column name="EXPRESSION" type="VARCHAR2" size="1000"/> + + <index name="RHQ_GROUP_DEF_NAME" unique="true"> + <field ref="NAME"/> + </index> + </table> + + <table name="RHQ_RESOURCE_GROUP"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <!-- this name can be longer than the size of the GROUP_BY column, which is used to uniquely identify it --> + <!-- Max bytes for Oracle Varchar2 to accommodate large cluster keys --> + <column name="NAME" required="true" size="4000" type="VARCHAR2"/> + <column name="DESCRIPTION" size="100" type="VARCHAR2"/> + <column name="LOCATION" required="false" size="100" type="VARCHAR2"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> + <!-- Compatible groups only --> + <column name="CTIME" type="LONG"/> + <column name="MTIME" type="LONG"/> + <column name="MODIFIED_BY" required="false" type="INTEGER"/> + <!-- TODO: Reorder to allow this references="RHQ_SUBJECT" --> + <column name="RECURSIVE" type="BOOLEAN"/> + + <column name="GROUP_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_GROUP_DEF"/> + <column name="GROUP_BY" size="500" type="VARCHAR2"/> + + <column name="CATEGORY" type="VARCHAR2" size="20" required="true"/> + + <column name="CLUSTER_KEY" type="VARCHAR2" size="4000" required="false"/> + + <!-- These two only set if this is a backing group for a resource cluster --> + <column name="CLUSTER_RESOURCE_GROUP_ID" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> + + <column name="VISIBLE" type="BOOLEAN"/> + + <index name="RHQ_RES_GROUP_NAME" unique="false"> + <field ref="NAME"/> + </index> + </table> + + <!-- Many To Many mapping for groups to implicit resources --> + <table name="RHQ_RESOURCE_GROUP_RES_IMP_MAP"> + <column name="RESOURCE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE"/> + <column name="RESOURCE_GROUP_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> + + <!-- not using full words to fit index name length --> + <constraint name="RHQ_RES_GROUP_RES_IMP_MAP_KEY"> + <primaryKey> + <field ref="RESOURCE_ID"/> + <field ref="RESOURCE_GROUP_ID"/> + </primaryKey> + </constraint> + </table> + + <!-- Many To Many mapping for groups to explicit resources --> + <table name="RHQ_RESOURCE_GROUP_RES_EXP_MAP"> + <column name="RESOURCE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE"/> + <column name="RESOURCE_GROUP_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> + + <!-- not using full words to fit index name length --> + <constraint name="RHQ_RES_GROUP_RES_EXP_MAP_KEY"> + <primaryKey> + <field ref="RESOURCE_ID"/> + <field ref="RESOURCE_GROUP_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_CONFIG_GROUP_UPDATE"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="GROUP_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_GROUP"/> + <column name="CONFIGURATION_ID" type="INTEGER" required="true" references="RHQ_CONFIG"/> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="SUBJECT_NAME" type="VARCHAR2" required="false" size="100"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> + </table> + + <table name="RHQ_CONFIG_UPDATE"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="CONFIGURATION_ID" type="INTEGER" required="true" references="RHQ_CONFIG" ondelete="cascade"/> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="SUBJECT_NAME" type="VARCHAR2" required="false" size="100"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="CONFIG_RES_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> + <column name="PLUGIN_CONFIG_RES_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> + <column name="AGG_RES_UPDATE_ID" type="INTEGER" required="false" references="RHQ_CONFIG_GROUP_UPDATE"/> + <column name="AGG_PLUGIN_UPDATE_ID" type="INTEGER" required="false" references="RHQ_CONFIG_GROUP_UPDATE"/> + <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> + </table> + + + <table name="RHQ_TAGGING"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="NAMESPACE" type="VARCHAR2" required="false" size="20"/> + <column name="SEMANTIC" type="VARCHAR2" required="false" size="50"/> + <column name="NAME" type="VARCHAR2" required="true" size="100"/> + </table> + + <table name="RHQ_TAGGING_RESOURCE_MAP"> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> + <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> + <constraint name="RHQ_TAGGING_RESOURCE_MAP_KEY"> + <primaryKey> + <field ref="RESOURCE_ID"/> + <field ref="TAG_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_TAGGING_RES_GROUP_MAP"> + <column name="RESOURCE_GROUP_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_GROUP"/> + <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> + <constraint name="RHQ_TAGGING_RES_GROUP_MAP_KEY"> + <primaryKey> + <field ref="RESOURCE_GROUP_ID"/> + <field ref="TAG_ID"/> + </primaryKey> + </constraint> + </table> + +<!-- END: inventory-schema.xml --> +<!-- BEGIN: auth-schema.xml --> + + + <table name="RHQ_PRINCIPAL"> + + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="PRINCIPAL" required="true" type="VARCHAR2" size="100"/> + <column name="PASSWORD" required="true" type="VARCHAR2" size="64"/> + + <!-- ensure that principals are unique --> + <index name="RHQ_PRINCIPAL_PRINCIPAL_KEY" unique="true"> + <field ref="PRINCIPAL"/> + </index> + + </table> + +<!-- END: auth-schema.xml --> +<!-- BEGIN: authz-schema.xml --> + + + <table name="RHQ_ROLE"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" required="true" size="100" type="VARCHAR2"/> + <column name="DESCRIPTION" size="100" type="VARCHAR2"/> + <column name="FSYSTEM" type="BOOLEAN" default="false"/> + + <index name="RHQ_ROLE_NAME_KEY" unique="true"> + <field ref="NAME"/> + </index> + </table> + + <table name="RHQ_ROLE_RESOURCE_GROUP_MAP"> + <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> + <column name="RESOURCE_GROUP_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> + + <constraint name="RHQ_ROLE_RES_GROUP_MAP_KEY"> + <primaryKey> + <field ref="ROLE_ID"/> + <field ref="RESOURCE_GROUP_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_ROLE_LDAP_GROUP"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> + <column name="LDAP_GROUP_NAME" size="128" required="true" type="VARCHAR2"/> + + <index name="RHQ_ROLE_LDAP_GROUP_IDX" unique="true"> + <field ref="ROLE_ID"/> + <field ref="LDAP_GROUP_NAME"/> + </index> + </table> + + <table name="RHQ_PERMISSION"> + <column name="ROLE_ID" type="INTEGER" references="RHQ_ROLE" required="true"/> + <column name="OPERATION" type="INTEGER" required="true"/> + <constraint name="RHQ_PERMISSION_PK"> + <primaryKey> + <field ref="ROLE_ID"/> + <field ref="OPERATION"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_SUBJECT"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" required="true" size="100" type="VARCHAR2"/> + <column name="CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG"/> + <column name="FIRST_NAME" required="false" size="100" type="VARCHAR2"/> + <column name="LAST_NAME" required="false" size="100" type="VARCHAR2"/> + <column name="EMAIL_ADDRESS" size="100" type="VARCHAR2"/> + <column name="SMS_ADDRESS" size="100" type="VARCHAR2"/> + <column name="PHONE_NUMBER" size="100" type="VARCHAR2"/> + <column name="DEPARTMENT" size="100" type="VARCHAR2"/> + <column name="FACTIVE" required="true" type="BOOLEAN" default="true"/> + <column name="FSYSTEM" required="true" type="BOOLEAN" default="false"/> + + <index name="RHQ_SUBJECT_AUTH_KEY" unique="true"> + <field ref="NAME"/> + </index> + </table> + + <table name="RHQ_SUBJECT_ROLE_MAP"> + <column name="SUBJECT_ID" required="true" type="INTEGER" references="RHQ_SUBJECT"/> + <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> + + <constraint name="RHQ_SUBJECT_ROLE_MAPPING_KEY"> + <primaryKey> + <field ref="SUBJECT_ID"/> + <field ref="ROLE_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_SUBJECT_ROLE_LDAP_MAP"> + <column name="SUBJECT_ID" required="true" type="INTEGER" references="RHQ_SUBJECT"/> + <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> + <constraint name="RHQ_SUBJECT_ROLE_LDAP_MAP_PK"> + <primaryKey> + <field ref="SUBJECT_ID" /> + <field ref="ROLE_ID"/> + </primaryKey> + </constraint> + </table> +<!-- END: authz-schema.xml --> +<!-- BEGIN: search-schema.xml --> + + + <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="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="GLOBAL" type="BOOLEAN" required="true"/> + </table> + +<!-- END: search-schema.xml --> +<!-- BEGIN: operation-schema.xml --> + + + <table name="RHQ_OPERATION_DEF"> + + <!-- === required columns === --> + + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE(ID)"/> + <column name="NAME" type="VARCHAR2" required="true" size="100"/> + + <!-- === optional columns === --> + + <!-- an OSGI version range - if null, the operation def applies to all versions of the associated resource type --> + <column name="RESOURCE_VERSION_RANGE" type="VARCHAR2" size="100"/> + + <!-- A parameter config definition is only required for operations that have parameters. --> + <!-- A results config definition is only required for operations that return data. --> + <column name="PARAMETER_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> + <column name="RESULTS_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> + <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> + <column name="DESCRIPTION" type="VARCHAR2" size="4000"/> + <column name="TIMEOUT" type="INTEGER"/> + + <!-- === business key (RESOURCE_TYPE_ID + NAME) === --> + <index name="RHQ_OPERATION_DEF_KEY_IDX" unique="true"> + <field ref="RESOURCE_TYPE_ID"/> + <field ref="NAME"/> + </index> + + </table> + + <table name="RHQ_OPERATION_HISTORY"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="DTYPE" type="VARCHAR2" required="true" size="8"/> + <column name="JOB_NAME" type="VARCHAR2" required="true" size="100"/> + <column name="JOB_GROUP" type="VARCHAR2" required="true" size="100"/> + <column name="OPERATION_DEF_ID" type="INTEGER" required="true" references="RHQ_OPERATION_DEF"/> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="STIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="PARAMETERS_CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> + + <!-- for resource history --> + <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> + <column name="RESULTS_CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> + <column name="GROUP_HISTORY_ID" type="INTEGER" required="false" references="RHQ_OPERATION_HISTORY"/> + + <!-- for group history --> + <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_RESOURCE_GROUP"/> + + <index name="RHQ_OPERATION_HISTORY_JOB_IDX" unique="true"> + <field ref="JOB_NAME"/> + <field ref="JOB_GROUP"/> + <field ref="CTIME"/> + </index> + + </table> + + <!-- + This table is really just to support some specific use-cases. + Specifically, to be able to get a list of histories for a specific schedule (aka quartz job) + and to be able to query a list of all schedules along with their associated resource/group IDs + possibly sorted by their next fire time. + Note that a NULL next fire time means it won't fire again and the row is probaby about to be deleted; + we can probably not even insert rows with NULL and make it a non-nullable field. But rather than + code special conditions into the session bean, we'll allow a short-lived NULL next fire time row. + --> + <table name="RHQ_OPERATION_SCHEDULE"> + <column name="JOB_NAME" type="VARCHAR2" required="true" size="100"/> + <column name="JOB_GROUP" type="VARCHAR2" required="true" size="100"/> + <column name="DTYPE" type="VARCHAR2" required="true" size="8"/> + <column name="NEXT_FIRE_TIME" type="LONG" required="false"/> + + <!-- for resource history --> + <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> + + <!-- for group history --> + <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_RESOURCE_GROUP"/> + + <!-- + Note that this is the same primary key that Quartz uses for its schedules (RHQ_qrtz_job_details). + We do not need to add DTYPE to the key, because we ensure the name/group are unique + across resource/group schedules + --> + <constraint name="RHQ_OPERATION_SCHEDULE_KEY"> + <primaryKey> + <field ref="JOB_NAME"/> + <field ref="JOB_GROUP"/> + </primaryKey> + </constraint> + </table> + +<!-- END: operation-schema.xml --> +<!-- BEGIN: event-schema.xml --> + + + <!-- metadata --> + + <table name="RHQ_EVENT_DEF"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE(ID)"/> + + <column name="NAME" type="VARCHAR2" size="100" required="true"/> + <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> + <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> + + <index name="RHQ_EVENT_DEF_IDX" unique="true"> + <field ref="RESOURCE_TYPE_ID"/> + <field ref="NAME"/> + </index> + </table> + + <!-- instance data --> + + <table name="RHQ_EVENT_SOURCE"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="EVENT_DEF_ID" type="INTEGER" required="true" references="RHQ_EVENT_DEF(ID)"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE(ID)"/> + + <column name="LOCATION" required="true" size="2000" type="VARCHAR2"/> + + <index name="RHQ_EVENT_SOURCE_IDX" unique="true"> + <field ref="EVENT_DEF_ID"/> + <field ref="RESOURCE_ID"/> + <field ref="LOCATION"/> + </index> + </table> + + <table name="RHQ_EVENT"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="EVENT_SOURCE_ID" type="INTEGER" required="true" references="RHQ_EVENT_SOURCE(ID)"/> + + <column name="TIMESTAMP" required="true" type="LONG"/> + <column name="SEVERITY" required="true" size="20" type="VARCHAR2"/> + <column name="DETAIL" required="true" size="4000" type="VARCHAR2"/> + <index name="RHQ_EVENT_IDX" unique="false"> + <field ref="EVENT_SOURCE_ID"/> + <field ref="TIMESTAMP"/> + </index> + </table> + +<!-- END: event-schema.xml --> +<!-- BEGIN: alert-schema.xml --> + + + <table name="RHQ_ALERT_DEFINITION"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" required="true" size="100" type="VARCHAR2"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="PARENT_ID" type="INTEGER" required="false"/> + <column name="GROUP_ALERT_DEF_ID" type="INTEGER" required="false"/> + <column name="DESCRIPTION" required="false" size="250" type="VARCHAR2"/> + <column name="PRIORITY" type="VARCHAR2" size="15" required="true"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE" required="false"/> + <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE" required="false"/> + <column name="RESOURCE_GROUP_ID" type="INTEGER" references="RHQ_RESOURCE_GROUP" required="false"/> + <column name="ENABLED" required="true" default="TRUE" type="BOOLEAN"/> + + <column name="REQUIRED" required="true" type="SMALLINT"/> + + <column name="RECOVERY_ID" type="INTEGER" required="true"/> + <!-- required, but 0 effectively means null --> + <column name="WILL_RECOVER" required="true" default="false" type="BOOLEAN"/> + <column name="NOTIFY_FILTERED" required="true" default="false" type="BOOLEAN"/> + <column name="CONTROL_FILTERED" required="true" default="FALSE" type="BOOLEAN"/> + + <column name="DELETED" required="true" default="FALSE" type="BOOLEAN"/> + <column name="READ_ONLY" required="true" default="FALSE" type="BOOLEAN"/> + + <column name="DAMPENING_CATEGORY" type="SMALLINT" required="true"/> + <column name="DAMPENING_VALUE" type="INTEGER"/> + <column name="DAMPENING_VALUE_UNITS" type="SMALLINT"/> + <column name="DAMPENING_PERIOD" type="INTEGER"/> + <column name="DAMPENING_PERIOD_UNITS" type="SMALLINT"/> + </table> + + <table name="RHQ_ALERT_DAMPEN_EVENT"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> + <column name="EVENT_TYPE" required="true" type="SMALLINT"/> + <column name="EVENT_TIMESTAMP" required="true" type="LONG"/> + + <index name="RHQ_DAMPENING_EVENT_TYPE_IDX"> + <field ref="EVENT_TYPE"/> + </index> + <index name="RHQ_DAMPENING_EVENT_TS_IDX"> + <field ref="EVENT_TIMESTAMP"/> + </index> + </table> + + <table name="RHQ_ALERT_CONDITION"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="TYPE" required="true" type="VARCHAR2" size="15"/> + <!-- + <column name="REQUIRED" required="true" type="BOOLEAN"/> + --> + <column name="MEASUREMENT_DEFINITION_ID" required="false" type="INTEGER"/> + <column name="NAME" required="false" size="100" type="VARCHAR2"/> + <column name="COMPARATOR" required="false" size="2" type="VARCHAR2"/> + <column name="THRESHOLD" required="false" type="DOUBLE"/> + <!-- event-based conditions use OPTION_STATUS for the string match, so should be a decent length --> + <column name="OPTION_STATUS" required="false" size="256" type="VARCHAR2"/> + <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> + <column name="TRIGGER_ID" required="false" type="INTEGER"/> + </table> + + <table name="RHQ_ALERT" tablespace="DEFAULT" + storage-options="freelists 5" cache="true" logging="false"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> + <column name="CTIME" required="true" type="LONG"/> + <column name="RECOVERY_ID" type="INTEGER" required="true"/> + <!-- required, but 0 effectively means null --> + <column name="WILL_RECOVER" required="true" default="false" type="BOOLEAN"/> + <column name="ACK_TIME" required="false" type="LONG"/> + <column name="ACK_SUBJECT" required="false" size="100" type="VARCHAR2"/> + <index name="RHQ_ALERT_IDX_TIME" unique="false"> + <field ref="CTIME"/> + </index> + <index name="RHQ_ALERT_IDX_ALERTDEF" unique="false"> + <field ref="ALERT_DEFINITION_ID"/> + </index> + </table> + + <table name="RHQ_ALERT_NOTIF_LOG" tablespace="DEFAULT" + storage-options="freelists 5" cache="true" logging="false"> + <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="false"> + <field ref="ALERT_ID"/> + </index> + <column name="SENDER" required="false" size="100" type="VARCHAR2"/> + <column name="RESULT_STATE" required="false" size="20" type="VARCHAR2"/> + <column name="MESSAGE" required="false" size="4000" type="VARCHAR2"/> + </table> + + <table name="RHQ_ALERT_CONDITION_LOG" tablespace="DEFAULT" + storage-options="freelists 5" cache="true" logging="false"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="CTIME" required="true" type="LONG"/> + <column name="ALERT_ID" required="false" type="INTEGER" references="RHQ_ALERT(ID)"/> + <column name="CONDITION_ID" required="true" type="INTEGER" references="RHQ_ALERT_CONDITION(ID)"/> + <column name="VALUE" required="false" size="250" type="VARCHAR2"/> + <index name="RHQ_ALERT_COND_LOG_IDX_TIME"> + <field ref="CTIME" /> + </index> + <index name="RHQ_ALERT_COND_LOG_IDX_ALERT"> + <field ref="ALERT_ID"/> + </index> + </table> + + <table name="RHQ_ALERT_NOTIFICATION" tablespace="DEFAULT" + storage-options="freelists 5" cache="true" logging="false"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> + <column name="SENDER_CONFIG_ID" required="false" type="INTEGER" references="RHQ_CONFIG(ID)"/> + <column name="EXTRA_CONFIG_ID" required="false" type="INTEGER" references="RHQ_CONFIG(ID)"/> + <column name="SENDER_NAME" required="true" size="100" type="VARCHAR2" /> + </table> + +<!-- END: alert-schema.xml --> +<!-- BEGIN: sysconfig-schema.xml --> + + + <table name="RHQ_SYSTEM_CONFIG"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="PROPERTY_KEY" type="VARCHAR2" size="80"/> + <column name="PROPERTY_VALUE" type="VARCHAR2" size="300"/> + <column name="DEFAULT_PROPERTY_VALUE" type="VARCHAR2" size="300"/> + <column name="FREAD_ONLY" type="BOOLEAN" default="FALSE"/> + + <index name="RHQ_SYSTEM_CONFIG_KEY_INDX" unique="true"> + <field ref="PROPERTY_KEY"/> + </index> + </table> + +<!-- END: sysconfig-schema.xml --> +<!-- BEGIN: scheduler-schema.xml --> + + + <table name="RHQ_QRTZ_JOB_DETAILS"> + <column name="JOB_NAME" required="true" type="VARCHAR2" size="80"/> + <column name="JOB_GROUP" required="true" type="VARCHAR2" size="80"/> + <column name="DESCRIPTION" required="false" type="VARCHAR2" size="120"/> + <column name="JOB_CLASS_NAME" required="true" type="VARCHAR2" size="128"/> + <column name="IS_DURABLE" required="true" type="BOOLEAN" default="FALSE"/> + <column name="IS_VOLATILE" required="true" type="BOOLEAN"/> + <column name="IS_STATEFUL" required="true" type="BOOLEAN" default="FALSE"/> + <column name="REQUESTS_RECOVERY" required="true" type="BOOLEAN" default="FALSE"/> + <column name="JOB_DATA" required="false" type="BLOB"/> + + <constraint name="RHQ_PK_QRTZ_JOB_DETAILS"> + <primaryKey> + <field ref="JOB_NAME"/> + <field ref="JOB_GROUP"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_QRTZ_JOB_LISTENERS"> + <column name="JOB_NAME" required="true" type="VARCHAR2" size="80"/> + <column name="JOB_GROUP" required="true" type="VARCHAR2" size="80"/> + <column name="JOB_LISTENER" required="true" type="VARCHAR2" size="80"/> + + <constraint name="RHQ_PK_QRTZ_JOB_LISTENERS"> + <primaryKey> + <field ref="JOB_NAME"/> + <field ref="JOB_GROUP"/> + <field ref="JOB_LISTENER"/> + </primaryKey> + </constraint> + <constraint name="RHQ_FK_QRTZ_JOB_LSTNRS_JN_JG"> + <foreignKey local="JOB_NAME,JOB_GROUP" + references="RHQ_QRTZ_JOB_DETAILS(JOB_NAME,JOB_GROUP)" + ondelete="cascade"/> + </constraint> + </table> + + <table name="RHQ_QRTZ_TRIGGERS"> + <column name="TRIGGER_NAME" type="VARCHAR2" required="true" size="80"/> + <column name="TRIGGER_GROUP" type="VARCHAR2" required="true" size="80"/> + <column name="JOB_NAME" type="VARCHAR2" required="true" size="80"/> + <column name="JOB_GROUP" type="VARCHAR2" required="true" size="80"/> + <column name="IS_VOLATILE" type="BOOLEAN" required="true"/> + <column name="DESCRIPTION" type="VARCHAR2" required="false" size="120"/> + <column name="NEXT_FIRE_TIME" type="LONG" required="false"/> + <column name="PREV_FIRE_TIME" type="LONG" required="false"/> + <column name="PRIORITY" type="INTEGER" required="false"/> + <column name="TRIGGER_STATE" type="VARCHAR" required="true" size="16"/> + <column name="TRIGGER_TYPE" type="VARCHAR" required="true" size="8"/> + <column name="START_TIME" type="LONG" required="true"/> + <column name="END_TIME" type="LONG" required="false"/> + <column name="CALENDAR_NAME" type="VARCHAR2" required="false" size="80"/> + <column name="MISFIRE_INSTR" type="INTEGER" required="false"/> + <column name="JOB_DATA" type="BLOB" required="false"/> + + <constraint name="RHQ_PK_QRTZ_TRIGGERS"> + <primaryKey> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </primaryKey> + </constraint> + <constraint name="RHQ_FK_QRTZ_TRIGGERS_JN_JG"> + <foreignKey local="JOB_NAME,JOB_GROUP" + references="RHQ_QRTZ_JOB_DETAILS(JOB_NAME,JOB_GROUP)" + ondelete="cascade"/> + </constraint> + + <!-- Quartz docs recommend these indexes. --> + <index name="RHQ_QRTZ_TRIGGERS_JN_JG_IDX"> + <field ref="JOB_NAME"/> + <field ref="JOB_GROUP"/> + </index> + <index name="RHQ_QRTZ_TRIGGERS_NFT_IDX"> + <field ref="NEXT_FIRE_TIME"/> + </index> + <index name="RHQ_QRTZ_TRIGGERS_TS_IDX"> + <field ref="TRIGGER_STATE"/> + </index> + <index name="RHQ_QRTZ_TRIGGERS_TS_NFT_IDX"> + <field ref="TRIGGER_STATE"/> + <field ref="NEXT_FIRE_TIME"/> + </index> + + </table> + + <table name="RHQ_QRTZ_SIMPLE_TRIGGERS"> + <column name="TRIGGER_NAME" type="VARCHAR2" required="true" size="80"/> + <column name="TRIGGER_GROUP" type="VARCHAR2" required="true" size="80"/> + <column name="REPEAT_COUNT" type="LONG" required="true"/> + <column name="REPEAT_INTERVAL" type="LONG" required="true"/> + <column name="TIMES_TRIGGERED" type="LONG" required="true"/> + + <constraint name="RHQ_PK_QRTZ_SIMPLE_TRIGGERS"> + <primaryKey> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </primaryKey> + </constraint> + <constraint name="RHQ_FK_QRTZ_SIMPLE_TRGRS_TN_TG"> + <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" + references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" + ondelete="cascade"/> + </constraint> + + <!-- Quartz docs recommend this index. --> + <!-- Commenting out, because Oracle auto-creates an index for the + primary key column(s) and fails if you try to create another + index for the same column(s) (ips, 03/29/07). + --> + <!-- + <index name="RHQ_QRTZ_SIMPLE_TRGRS_TN_TG_IDX"> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </index> + --> + </table> + + <table name="RHQ_QRTZ_CRON_TRIGGERS"> + <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> + <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> + <column name="CRON_EXPRESSION" type="VARCHAR2" size="80" required="true"/> + <column name="TIME_ZONE_ID" type="VARCHAR2" size="80" required="false"/> + + <constraint name="RHQ_PK_QRTZ_CRON_TRIGGERS"> + <primaryKey> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </primaryKey> + </constraint> + <constraint name="RHQ_FK_QRTZ_CRON_TRIG_TN_TG"> + <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" + references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" + ondelete="cascade"/> + </constraint> + + <!-- Quartz docs recommend this index. --> + <!-- Commenting out, because Oracle auto-creates an index for the + primary key column(s) and fails if you try to create another + index for the same column(s) (ips, 03/29/07). + --> + <!-- + <index name="RHQ_QRTZ_CRON_TRGRS_TN_TG_IDX"> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </index> + --> + </table> + + <table name="RHQ_QRTZ_BLOB_TRIGGERS"> + <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> + <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> + <column name="BLOB_DATA" type="BLOB" required="false"/> + + <constraint name="RHQ_PK_QRTZ_BLOB_TRIGGERS"> + <primaryKey> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </primaryKey> + </constraint> + <constraint name="RHQ_FK_QRTZ_BLOB_TRIGG_TN_TG"> + <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" + references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" + ondelete="cascade"/> + </constraint> + + <!-- Quartz docs recommend this index. --> + <!-- Commenting out, because Oracle auto-creates an index for the + primary key column(s) and fails if you try to create another + index for the same column(s) (ips, 03/29/07). + --> + <!-- + <index name="RHQ_QRTZ_BLOB_TRGRS_TN_TG_IDX"> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </index> + --> + </table> + + <table name="RHQ_QRTZ_TRIGGER_LISTENERS"> + <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> + <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> + <column name="TRIGGER_LISTENER" type="VARCHAR2" size="80" required="true"/> + + <constraint name="RHQ_PK_QRTZ_TRIGGER_LISTENERS"> + <primaryKey> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + <field ref="TRIGGER_LISTENER"/> + </primaryKey> + </constraint> + <constraint name="RHQ_FK_QRTZ_TRGR_LSTNRS_TN_TG"> + <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" + references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" + ondelete="cascade"/> + </constraint> + + <!-- Quartz docs recommend this index. --> + <index name="RHQ_QRTZ_TRGR_LSTNRS_TN_TG_IDX"> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </index> + + </table> + + <table name="RHQ_QRTZ_FIRED_TRIGGERS"> + <column name="ENTRY_ID" primarykey="true" type="VARCHAR2" size="95" required="true"/> + <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> + <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> + <column name="INSTANCE_NAME" type="VARCHAR2" size="80" required="true"/> + <column name="FIRED_TIME" type="LONG" required="true"/> + <column name="PRIORITY" type="INTEGER" required="false"/> + <column name="STATE" type="VARCHAR2" size="16" required="true"/> + <column name="IS_VOLATILE" type="BOOLEAN" required="true"/> + <column name="JOB_NAME" type="VARCHAR2" size="80" required="false"/> + <column name="JOB_GROUP" type="VARCHAR2" size="80" required="false"/> + <column name="IS_STATEFUL" type="BOOLEAN" required="false"/> + <column name="REQUESTS_RECOVERY" type="BOOLEAN" required="false"/> + + <!-- Quartz docs recommend these indexes. --> + <index name="RHQ_QRTZ_FIRED_TRGRS_TN_IDX"> + <field ref="TRIGGER_NAME"/> + </index> + <index name="RHQ_QRTZ_FIRED_TRGRS_TG_IDX"> + <field ref="TRIGGER_GROUP"/> + </index> + <index name="RHQ_QRTZ_FIRED_TRGRS_TN_TG_IDX"> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </index> + <index name="RHQ_QRTZ_FIRED_TRGRS_IN_IDX"> + <field ref="INSTANCE_NAME"/> + </index> + <index name="RHQ_QRTZ_FIRED_TRGRS_JN_IDX"> + <field ref="JOB_NAME"/> + </index> + <index name="RHQ_QRTZ_FIRED_TRGRS_JG_IDX"> + <field ref="JOB_GROUP"/> + </index> + + </table> + + <table name="RHQ_QRTZ_CALENDARS"> + <column name="CALENDAR_NAME" primarykey="true" type="VARCHAR2" size="80" required="true"/> + <column name="CALENDAR" type="BLOB" required="true"/> + </table> + + <table name="RHQ_QRTZ_PAUSED_TRIGGER_GRPS"> + <column name="TRIGGER_GROUP" primarykey="true" type="VARCHAR2" size="80" required="true"/> + </table> + + <table name="RHQ_QRTZ_SCHEDULER_STATE"> + <column name="INSTANCE_NAME" primarykey="true" type="VARCHAR2" size="80" required="true"/> + <column name="LAST_CHECKIN_TIME" type="LONG" required="true"/> + <column name="CHECKIN_INTERVAL" type="LONG" required="true"/> + <column name="RECOVERER" type="VARCHAR2" size="80" required="false"/> + </table> + + <table name="RHQ_QRTZ_LOCKS"> + <column name="LOCK_NAME" primarykey="true" type="VARCHAR2" size="40" required="true"/> + <data LOCK_NAME="TRIGGER_ACCESS"/> + <data LOCK_NAME="JOB_ACCESS"/> + <data LOCK_NAME="CALENDAR_ACCESS"/> + <data LOCK_NAME="STATE_ACCESS"/> + <data LOCK_NAME="MISFIRE_ACCESS"/> + </table> + +<!-- END: scheduler-schema.xml --> +<!-- BEGIN: amps-schema.xml --> + + + <table name="RHQ_PLUGIN"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="4000" type="VARCHAR2" required="false"/> + <column name="VERSION" size="200" type="VARCHAR2" required="false"/> + <column name="AMPS_VERSION" size="16" type="VARCHAR2" required="false"/> + <column name="ENABLED" type="BOOLEAN" required="true"/> + <column name="STATUS" size="16" type="VARCHAR2" required="true"/> + <column name="HELP" type="CLOB" required="false"/> + <column name="PATH" size="500" type="VARCHAR2" required="true"/> + <column name="MD5" size="100" type="VARCHAR2" required="true"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="DEPLOYMENT" size="8" type="VARCHAR2" required="true"/> + <column name="PTYPE" size="200" type="VARCHAR2" required="false"/> + <column name="PLUGIN_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> + <column name="JOBS_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> + <column name="CONTENT" type="BLOB" required="false"/> + + <index name="RHQ_PLUGIN_NAME_DEPLOY_IDX" unique="true"> + <field ref="NAME"/> + <field ref="DEPLOYMENT"/> + </index> + </table> + +<!-- END: amps-schema.xml --> +<!-- BEGIN: measurement-schema.xml --> + + <table name="RHQ_MEASUREMENT_DEF"> + + <!-- === required columns === --> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE(ID)"/> + <column name="NAME" type="VARCHAR2" size="100" required="true"/> + + <!-- === optional columns === --> + <!-- an OSGI version range - if null, the metric def applies to all versions of the associated resource type --> + <column name="RESOURCE_VERSION_RANGE" type="VARCHAR2" size="100"/> + <column name="CATEGORY" type="SMALLINT"/> + <column name="UNITS" type="SMALLINT"/> + <column name="NUMERIC_TYPE" type="SMALLINT"/> + <column name="DISPLAY_TYPE" type="SMALLINT"/> + <column name="DATA_TYPE" type="SMALLINT"/> + <column name="RAW_NUMERIC_TYPE" type="SMALLINT"/> + <column name="DEFAULT_ON" type="BOOLEAN" default="false"/> + <column name="DEFAULT_INTERVAL" type="LONG" /> + <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> + <column name="DISPLAY_ORDER" type="INTEGER" default="1000"/> + <column name="DESCRIPTION" type="VARCHAR2" size="500"/> + <column name="DESTINATION_TYPE" type="VARCHAR2" size="100"/> + + <column name="VERSION" type="INTEGER"/> + <!-- for optimistic locking --> + + <!-- === business key (RESOURCE_TYPE_ID + NAME + RAW_NUMERIC_TYPE) === --> + <index name="RHQ_METRIC_DEF_KEY_IDX" unique="true"> + <field ref="RESOURCE_TYPE_ID"/> + <field ref="NAME"/> + <field ref="RAW_NUMERIC_TYPE"/> + </index> + <index name="RHQ_METRIC_DEF_NT_IDX"> + <field ref="NUMERIC_TYPE"/> + </index> + </table> + + + <table name="RHQ_MEASUREMENT_SCHED"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + + <column name="ENABLED" type="BOOLEAN" default="false"/> + <column name="MTIME" type="LONG" /> + <column name="DEFINITION" type="INTEGER" references="RHQ_MEASUREMENT_DEF(ID)"/> + <column name="VERSION" type="INTEGER" /> + <column name="COLL_INTERVAL" type="LONG" /> + <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE(ID)"/> + <index name="RHQ_MEAS_SCHED_UNIQ" unique="true"> + <field ref="RESOURCE_ID"/> + <field ref="DEFINITION"/> + </index> + </table> + + + <table name="RHQ_MEASUREMENT_BLINE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + + <column name="BL_USER_ENTERED" type="BOOLEAN" default="false" required="true"/> + <column name="BL_MIN" type="DOUBLE" required="true"/> + <column name="BL_MAX" type="DOUBLE" required="true"/> + <column name="BL_MEAN" type="DOUBLE" required="true"/> + <column name="BL_COMPUTE_TIME" type="LONG" required="true"/> + <column name="SCHEDULE_ID" type="INTEGER" required="true" references="RHQ_MEASUREMENT_SCHED(ID)"/> + <index name="RHQ_MEAS_BASELINE_CTIME_IDX"> + <field ref="BL_COMPUTE_TIME"/> + </index> + <index name="RHQ_MEAS_BASELINE_SID_IDX"> + <field ref="SCHEDULE_ID"/> + </index> + </table> + + + <table name="RHQ_MEASUREMENT_DATA_NUM_1H" logging="false" cache="true" + tablespace="DEFAULT" storage-options="freelists 20"> + + <column name="TIME_STAMP" required="true" type="LONG"/> + <column name="SCHEDULE_ID" required="true" type="INTEGER"/> + <column name="VALUE" required="false" type="DOUBLE"/> + <column name="MINVALUE" required="false" type="DOUBLE"/> + <column name="MAXVALUE" required="false" type="DOUBLE"/> + + <constraint name="RHQ_MEAS_DATA_1H_ID_TIME_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + + <index name="RHQ_MEAS_DATA_1H_TIME_IDX"> + <field ref="TIME_STAMP"/> + </index> + </table> + + + <table name="RHQ_MEASUREMENT_DATA_NUM_6H" logging="false" cache="true" + tablespace="DEFAULT" storage-options="freelists 20"> + + <column name="TIME_STAMP" required="true" type="LONG"/> + <column name="SCHEDULE_ID" required="true" type="INTEGER"/> + <column name="VALUE" required="false" type="DOUBLE"/> + <column name="MINVALUE" required="false" type="DOUBLE"/> + <column name="MAXVALUE" required="false" type="DOUBLE"/> + + <constraint name="RHQ_MEAS_DATA_6H_ID_TIME_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + + <index name="RHQ_MEAS_DATA_6H_TIME_IDX"> + <field ref="TIME_STAMP"/> + </index> + </table> + + + <table name="RHQ_MEASUREMENT_DATA_NUM_1D" logging="false" cache="true" + tablespace="DEFAULT" storage-options="freelists 20"> + + <column name="TIME_STAMP" required="true" type="LONG"/> + <column name="SCHEDULE_ID" required="true" type="INTEGER"/> + <column name="VALUE" required="false" type="DOUBLE"/> + <column name="MINVALUE" required="false" type="DOUBLE"/> + <column name="MAXVALUE" required="false" type="DOUBLE"/> + + <constraint name="RHQ_MEAS_DATA_1D_ID_TIME_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + + + <table name="RHQ_MEASUREMENT_DATA_TRAIT"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER" /> + <column name="VALUE" type="VARCHAR2" size="4000" /> + <constraint name="RHQ_MEAS_DATA_TRAIT_ID_TIME_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + + + <table name="RHQ_CALLTIME_DATA_KEY"> + <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> + <column name="SCHEDULE_ID" type="INTEGER" required="true"/> + <column name="CALL_DESTINATION" type="VARCHAR2" size="4000" required="true"/> + <index name="RHQ_CALLTIME_DATA_KEY_IDX" unique="true"> + <field ref="SCHEDULE_ID"/> + <field ref="CALL_DESTINATION"/> + </index> + </table> + + + <table name="RHQ_CALLTIME_DATA_VALUE"> + <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> + <column name="KEY_ID" type="INTEGER" references="RHQ_CALLTIME_DATA_KEY" required="true"/> + <column name="BEGIN_TIME" type="LONG" required="true"/> + <column name="END_TIME" type="LONG" required="true"/> + <column name="MINIMUM" type="DOUBLE" required="true"/> + <column name="MAXIMUM" type="DOUBLE" required="true"/> + <column name="TOTAL" type="DOUBLE" required="true"/> + <column name="COUNT" type="LONG" required="true"/> + <index name="RHQ_CT_DA_VA_END_TIM_IDX"> + <field ref="END_TIME"/> + </index> + </table> + + + <table name="RHQ_AVAILABILITY"> + <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE(ID)"/> + <column name="START_TIME" type="LONG" required="true" /> + <column name="END_TIME" type="LONG" required="false" /> + <column name="AVAILABILITY_TYPE" type="SMALLINT" required="false" /> + <index name="RHQ_AVAIL_RESOURCE_START_IDX"> + <field ref="RESOURCE_ID"/> + <field ref="START_TIME"/> + </index> + <!-- only one null row can exist for any resource --> + <index name="RHQ_AVAIL_RESOURCE_END_IDX" condition="END_TIME IS NULL"> + <field ref="RESOURCE_ID"/> + <field ref="END_TIME" /> + </index> + </table> + + <table name="RHQ_RESOURCE_AVAIL"> + <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE(ID)" ondelete="cascade"/> + <column name="AVAILABILITY_TYPE" type="SMALLINT" required="false" /> + <index name="RHQ_RESOURCE_AVAIL_IDX"> + <field ref="RESOURCE_ID" /> + </index> + </table> + + <table name="RHQ_MEASUREMENT_OOB"> + <column name="SCHEDULE_ID" type="INTEGER" references="RHQ_MEASUREMENT_SCHED(ID)" required="true"/> + <column name="TIME_STAMP" type="LONG" required="true"/> + <column name="OOB_FACTOR" type="INTEGER" required="true" /> + <constraint name="RHQ_MEAS_OOB_ID_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_MEASUREMENT_OOB_TMP"> + <column name="SCHEDULE_ID" type="INTEGER" required="true"/> + <column name="TIME_STAMP" type="LONG" required="true"/> + <column name="OOB_FACTOR" type="INTEGER" required="true" /> + <constraint name="RHQ_MEAS_OOB_TMP_ID_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_NUMBERS"> + <column name="i" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true" /> + </table> + + + <table name="RHQ_MEAS_DATA_NUM_R00"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R00_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R00_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R01"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R01_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R01_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R02"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R02_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R02_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R03"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R03_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R03_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R04"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R04_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R04_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R05"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R05_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R05_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R06"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R06_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R06_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R07"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R07_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R07_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R08"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R08_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R08_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R09"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R09_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R09_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R10"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R10_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R10_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R11"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R11_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R11_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R12"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R12_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R12_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R13"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R13_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R13_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R14"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R14_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R14_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + +<!-- END: measurement-schema.xml --> +<!-- BEGIN: content-schema.xml --> + + + <table name="RHQ_ARCHITECTURE"> + <column name="ID" default="sequence-only" initial="100" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="50" type="VARCHAR2" required="true"/> + <index name="RHQ_ARCHITECTURE_NAME_IDX" unique="true"> + <field ref="NAME"/> + </index> + </table> + + <table name="RHQ_REPO_GROUP_TYPE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + </table> + + + <table name="RHQ_REPO_GROUP"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + + <column name="REPO_GROUP_TYPE_ID" type="INTEGER" references="RHQ_REPO_GROUP_TYPE" required="true"/> + + <index name="RHQ_REPO_GROUP_IDX" unique="true"> + <field ref="NAME"/> + <field ref="REPO_GROUP_TYPE_ID"/> + </index> + </table> + + + <table name="RHQ_CONTENT_SOURCE_TYPE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="false"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="PLUGIN_NAME" size="100" type="VARCHAR2" required="false"/> + <!-- we might want this as part of natural key --> + <column name="DEFAULT_LAZY_LOAD" type="BOOLEAN" required="true"/> + <column name="DEFAULT_DOWNLOAD_MODE" size="16" type="VARCHAR2" required="true"/> + <column name="DEFAULT_SYNC_SCHEDULE" size="64" type="VARCHAR2" required="false"/> + <column name="API_CLASS" size="100" type="VARCHAR2" required="true"/> + + <column name="SOURCE_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF" required="false"/> + + <index name="RHQ_CONTENT_SOURCE_TYPE_IDX" unique="true"> + <field ref="NAME"/> + <!-- <field ref="PLUGIN_NAME"/> --> + </index> + </table> + + <table name="RHQ_CONTENT_SOURCE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="LAZY_LOAD" type="BOOLEAN" required="true"/> + <column name="DOWNLOAD_MODE" size="16" type="VARCHAR2" required="true"/> + <column name="SYNC_SCHEDULE" size="64" type="VARCHAR2" required="false"/> + <column name="LOAD_ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="CREATION_TIME" type="LONG" required="true"/> + <column name="LAST_MODIFIED_TIME" type="LONG" required="true"/> + + <column name="CONTENT_SOURCE_TYPE_ID" type="INTEGER" references="RHQ_CONTENT_SOURCE_TYPE" required="true"/> + <column name="CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> + + <index name="RHQ_CONTENT_SOURCE_IDX" unique="true"> + <field ref="NAME"/> + <field ref="CONTENT_SOURCE_TYPE_ID"/> + </index> + </table> + + <table name="RHQ_REPO"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="CREATION_TIME" type="LONG" required="true"/> + <column name="LAST_MODIFIED_TIME" type="LONG" required="true"/> + <column name="IS_CANDIDATE" type="BOOLEAN" required="true"/> + <column name="SYNC_SCHEDULE" size="64" type="VARCHAR2" required="false"/> + + <index name="RHQ_REPO_IDX" unique="true"> + <field ref="NAME"/> + </index> + </table> + + + <table name="RHQ_REPO_RELATION_TYPE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + </table> + + + <table name="RHQ_REPO_RELATION"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="RELATED_REPO_ID" type="INTEGER" references="RHQ_REPO" required="true"/> + <column name="REPO_RELATION_TYPE_ID" type="INTEGER" references="RHQ_REPO_RELATION_TYPE" required="true"/> + </table> + + + + <table name="RHQ_PACKAGE_TYPE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="false"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="CATEGORY" size="50" type="VARCHAR2" required="false"/> + <column name="DISCOVERY_INTERVAL" type="INTEGER" required="false"/> + <column name="IS_CREATION_DATA" type="BOOLEAN" required="true"/> + <column name="SUPPORTS_ARCHITECTURE" type="BOOLEAN" required="true"/> + + <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE" required="true"/> + <column name="DEPLOYMENT_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF" required="false"/> + <column name="PACKAGE_EXTRA_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG_DEF" required="false"/> + + <index name="RHQ_PACKAGE_TYPE_IDX" unique="true"> + <field ref="NAME"/> + <field ref="RESOURCE_TYPE_ID"/> + </index> + + </table> + + <table name="RHQ_PACKAGE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="CLASSIFICATION" size="200" type="VARCHAR2" required="false"/> + + <column name="PACKAGE_TYPE_ID" type="INTEGER" references="RHQ_PACKAGE_TYPE" required="true"/> + + <index name="RHQ_PACKAGE_IDX" unique="true"> + <field ref="NAME"/> + <field ref="PACKAGE_TYPE_ID"/> + </index> + </table> + + <table name="RHQ_PACKAGE_BITS"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="BITS" type="LARGEOBJECT" required="false"/> + </table> + + <table name="RHQ_PACKAGE_VERSION"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="false"/> + <column name="SHORT_DESCRIPTION" size="10000" type="CLOB" required="false"/> + <column name="LONG_DESCRIPTION" size="50000" type="CLOB" required="false"/> + <column name="VERSION" size="500" type="VARCHAR2" required="true"/> + <column name="DISPLAY_VERSION" size="500" type="VARCHAR2" required="false"/> + <column name="FILE_NAME" size="255" type="VARCHAR2" required="false"/> + <column name="FILE_SIZE" type="LONG" required="false"/> + <column name="FILE_MD5" size="32" type="VARCHAR2" required="false"/> + <column name="FILE_SHA256" size="64" type="VARCHAR2" required="false"/> + <column name="FILE_CREATION_TIME" type="LONG" required="false"/> + <column name="LICENSE_NAME" size="255" type="VARCHAR2" required="false"/> + <column name="LICENSE_VERSION" size="20" type="VARCHAR2" required="false"/> + <column name="METADATA" type="BLOB" required="false"/> + + <column name="PACKAGE_ID" type="INTEGER" references="RHQ_PACKAGE" required="true"/> + <column name="ARCHITECTURE_ID" type="INTEGER" references="RHQ_ARCHITECTURE" required="true"/> + <column name="CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> + <column name="PACKAGE_BITS_ID" type="INTEGER" references="RHQ_PACKAGE_BITS" required="false"/> + + <index name="RHQ_PACKAGE_VERSION_IDX" unique="true"> + <field ref="PACKAGE_ID"/> + <field ref="VERSION"/> + <field ref="ARCHITECTURE_ID"/> + </index> + + </table> + + <table name="RHQ_CONTENT_REQ"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="REQUEST_TYPE" type="VARCHAR2" required="true" size="20"/> + <column name="NOTES" type="VARCHAR2" required="false" size="512"/> + </table> + + <table name="RHQ_INSTALLED_PACKAGE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="INSTALLATION_TIME" type="LONG" required="false"/> + + <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE" required="true"/> + <column name="PACKAGE_VERSION_ID" type="INTEGER" references="RHQ_PACKAGE_VERSION" required="true"/> + <column name="SUBJECT_ID" type="INTEGER" references="RHQ_SUBJECT" required="false"/> + </table> + + <table name="RHQ_INSTALLED_PKG_HIST"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="STATUS" type="VARCHAR2" size="24" required="true"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="HISTORY_TIMESTAMP" type="LONG" required="false"/> + + <column name="PACKAGE_VERSION_ID" type="INTEGER" references="RHQ_PACKAGE_VERSION" required="true"/> + <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE" required="true"/> + <column name="DEPLOYMENT_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> + <column name="CONTENT_SERVICE_REQUEST_ID" type="INTEGER" references="RHQ_CONTENT_REQ" required="false"/> + </table> + + <table name="RHQ_CONTENT_SRC_SYNC"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="STATUS" type="VARCHAR2" size="16" required="true"/> + <column name="START_TIME" type="LONG" required="true"/> + <column name="END_TIME" type="LONG" required="false"/> + <column name="RESULTS" type="LONGVARCHAR" required="false"/> + <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> + </table> + + <table name="RHQ_REPO_SYNC"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="STATUS" type="VARCHAR2" size="16" required="true"/> + <column name="START_TIME" type="LONG" required="true"/> + <column name="END_TIME" type="LONG" required="false"/> + <column name="RESULTS" type="LONGVARCHAR" required="false"/> + <column name="PERCENT_COMPLETE" type="LONG" required="false"/> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + </table> + + + <table name="RHQ_PACKAGE_INST_STEP"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="STEP_KEY" type="VARCHAR2" size="500" required="true"/> + <column name="STEP_ORDER" type="INTEGER" required="true"/> + <column name="DESCRIPTION" type="VARCHAR2" size="4000" required="true"/> + <column name="ERROR_MSG" type="LONGVARCHAR" required="false"/> + <column name="RESULT" type="VARCHAR2" size="25" required="true"/> + + <column name="INSTALLED_PKG_HIST_ID" type="INTEGER" references="RHQ_INSTALLED_PKG_HIST"/> + </table> + + <table name="RHQ_REPO_RESOURCE_MAP"> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_REPO_RESOURCE_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="RESOURCE_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_REPO_CONTENT_SRC_MAP"> 1 + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_REPO_CONTENT_SRC_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="CONTENT_SRC_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_REPO_REPO_GROUP_MAP"> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="REPO_GROUP_ID" type="INTEGER" required="true" references="RHQ_REPO_GROUP"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_REPO_REPO_GROUP_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="REPO_GROUP_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_REPO_REPO_RELATION_MAP"> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="REPO_RELATION_ID" type="INTEGER" required="true" references="RHQ_REPO_RELATION"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_REPO_REPO_RELATION_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="REPO_RELATION_ID"/> + </primaryKey> + </constraint> + </table> + + + <table name="RHQ_REPO_PKG_VERSION_MAP"> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_REPO_PKG_VER_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="PACKAGE_VERSION_ID"/> + </primaryKey> + </constraint> + <index name="RHQ_REPO_PKG_VER_MAP_IDX" unique="false"> + <field ref="PACKAGE_VERSION_ID"/> + </index> + </table> + + <table name="RHQ_PKG_VER_CONTENT_SRC_MAP"> + <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> + <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> + <column name="LOCATION" type="VARCHAR2" size="4000" required="true"/> + + <constraint name="RHQ_PKG_VER_CONTENT_SRC_KEY"> + <primaryKey> + <field ref="PACKAGE_VERSION_ID"/> + <field ref="CONTENT_SRC_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_PKG_PRD_MAP"> + <column name="PKG_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> + <column name="PRD_ID" type="INTEGER" required="true" references="RHQ_PRD_VER"/> + + <constraint name="RHQ_PKG_PRD_KEY"> + <primaryKey> + <field ref="PKG_ID"/> + <field ref="PRD_ID"/> + </primaryKey> + </constraint> + + </table> + + <table name="RHQ_DISTRIBUTION_TYPE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + + </table> + + <table name="RHQ_DISTRIBUTION"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="DISTRIBUTION_TYPE_ID" type="INTEGER" required="true" references="RHQ_DISTRIBUTION_TYPE"/> + <column name="LABEL" size="64" type="VARCHAR2" required="true"/> + <column name="BASE_PATH" size="256" type="VARCHAR2" required="true"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + + <index name="RHQ_DISTRIBUTION_IDX" unique="true"> + <field ref="LABEL"/> + <field ref="BASE_PATH"/> + </index> + + </table> + + <table name="RHQ_REPO_DISTRIBUTION"> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="DISTRIBUTION_ID" type="INTEGER" required="true" references="RHQ_DISTRIBUTION"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + + <constraint name="RHQ_REPO_DIST_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="DISTRIBUTION_ID"/> + </primaryKey> + </constraint> + </table> + + + + <table name="RHQ_DISTRIBUTION_FILE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="DISTRIBUTION_ID" type="INTEGER" required="true" references="RHQ_DISTRIBUTION"/> + <column name="RELATIVE_FILENAME" size="256" type="VARCHAR2" required="true"/> + <!--<column name="FILE_SIZE" type="NUMBER" required="true"/>--> + <column name="MD5SUM" size="64" type="VARCHAR2" required="true"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + <!--<column name="CTIME" type="LONG" required="true"/>--> + + <index name="RHQ_DISTRIBUTION_FILE_IDX" unique="true"> + <field ref="DISTRIBUTION_ID"/> + <field ref="RELATIVE_FILENAME"/> + </index> + </table> + + + + + <table name="RHQ_ADVISORY"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="ADVISORY" size="64" type="VARCHAR2" required="true"/> + <column name="ADVISORY_TYPE" size="64" type="VARCHAR2" required="true" /> + <column name="ADVISORY_REL" size="64" type="VARCHAR2" required="false"/> + <column name="ADVISORY_NAME" size="64" type="VARCHAR2" required="false"/> + <column name="DESCRIPTION" size="4000" type="VARCHAR2" required="false"/> + <column name="SYNOPSIS" size="4000" type="VARCHAR2" required="true"/> + <column name="TOPIC" size="4000" type="VARCHAR2" required="false"/> + <column name="SOLUTION" size="4000" type="VARCHAR2" required="false"/> + <column name="SEVERITY" size="64" type="VARCHAR2" required="false"/> + <column name="ISSUE_DATE" type="LONG" required="false"/> + <column name="UPDATE_DATE" type="LONG" required="false"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + + <index name="RHQ_ADVISORY_NAME_UQ" unique="true"> + <field ref="ADVISORY_NAME"/> + </index> + + <index name="RHQ_ADVISORY_UQ" unique="true"> + <field ref="ADVISORY"/> + </index> + + <index name="RHQ_ADVISORY_UDATE_IDX" unique="false"> + <field ref="UPDATE_DATE"/> + </index> + </table> + + <table name="RHQ_ADVISORY_PACKAGE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> + <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + + <index name="RHQ_ADVISORY_PKG_IDX" unique="true"> + <field ref="ADVISORY_ID"/> + <field ref="PACKAGE_VERSION_ID"/> + </index> + </table> + + <table name="RHQ_CVE"> + <column name="ID" default="sequence-only" initial="101" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="64" type="VARCHAR2" required="true"/> + </table> + + <table name="RHQ_ADVISORY_CVE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> + <column name="CVE_ID" type="INTEGER" required="true" references="RHQ_CVE"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + + <index name="RHQ_ADVISORY_CVE_IDX" unique="true"> + <field ref="ADVISORY_ID"/> + <field ref="CVE_ID"/> + </index> + + </table> + + <table name="RHQ_ADVISORY_BUGLIST"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> + <column name="BUG_ID" size="256" type="VARCHAR2" required="true"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + + <index name="RHQ_ADVISORY_BUG_IDX" unique="true"> + <field ref="ADVISORY_ID"/> + <field ref="BUG_ID"/> + </index> + </table> + + + <table name="RHQ_REPO_ADVISORY"> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + + <constraint name="RHQ_REPO_ADV_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="ADVISORY_ID"/> + </primaryKey> + </constraint> + </table> + + <!-- BUNDLE_TYPE is things like "Cobbler profile" or "file-based bundle" or "puppet recipe" --> + <table name="RHQ_BUNDLE_TYPE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> + + <!-- This index is for constraint, not performance --> + <index name="RHQ_BUNDLE_TYPE_UNIQUE" unique="true"> + <field ref="NAME"/> + </index> + </table> + + <!-- BUNDLE is a named piece of content that can be versioned and installed somewhere --> + <table name="RHQ_BUNDLE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="BUNDLE_TYPE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_TYPE"/> + <column name="PACKAGE_TYPE_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_TYPE"/> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + + <!-- This index is for constraint, not performance --> + <index name="RHQ_BUNDLE_UNIQUE" unique="true"> + <field ref="BUNDLE_TYPE_ID"/> + <field ref="NAME"/> + </index> + </table> + + <!-- BUNDLE_VERSION represents an actual piece of content that needs to be installed somewhere --> + <table name="RHQ_BUNDLE_VERSION"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="VERSION" size="500" type="VARCHAR2" required="true"/> + <column name="VERSION_ORDER" type="INTEGER" required="true"/> + <column name="ACTION" type="CLOB" required="true"/> + <column name="CONFIG_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_DEF" /> + <column name="BUNDLE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE"/> + + <!-- This index is for constraint, not performance --> + <index name="RHQ_BUNDLE_VERSION_UNIQUE" unique="true"> + <field ref="BUNDLE_ID"/> + <field ref="NAME"/> + <field ref="VERSION"/> + </index> + </table> + + <!-- Many-to-many table that links many repos to a particular bundle version. destination platforms --> + <!-- would be required to have associations to the specified repos (to access required content --> + <table name="RHQ_BUNDLE_VERSION_REPO"> + <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + + <constraint name="RHQ_BUNDLE_VERSION_REPO_KEY"> + <primaryKey> + <field ref="BUNDLE_VERSION_ID"/> + <field ref="REPO_ID"/> + </primaryKey> + </constraint> + </table> + + <!-- BUNDLE_FILE represents a file that is associated with (possibly bundled inside) a bundle version --> + <table name="RHQ_BUNDLE_FILE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> + <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> + </table> + + <!-- A logical destination for a bundle deployment. Defines the platforms and directory on those targets. --> + <table name="RHQ_BUNDLE_DESTINATION"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="BUNDLE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE"/> + <column name="GROUP_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_GROUP"/> + <column name="DEPLOY_DIR" size="256" type="VARCHAR2" required="true"/> + + <!-- This index is for constraint, not performance --> + <index name="RHQ_BUNDLE_DESTINATION_UNIQUE" unique="true"> + <field ref="BUNDLE_ID"/> + <field ref="GROUP_ID"/> + <field ref="DEPLOY_DIR"/> + </index> + </table> + + <!-- An actual deployment of a bundle version to a destination, with a specific config. Bundle deployments + can differ only on ctime, which is assumed to be different --> + <table name="RHQ_BUNDLE_DEPLOYMENT"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> + <column name="BUNDLE_DESTINATION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DESTINATION"/> + <column name="CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG" /> + <column name="SUBJECT_NAME" type="VARCHAR2" required="false" size="255"/> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="IS_LIVE" type="BOOLEAN" required="true"/> + <column name="REPLACED_BUNDLE_DEPLOYMENT_ID" type="INTEGER" required="false" references="RHQ_BUNDLE_DEPLOYMENT"/> + </table> + + <!-- Represents a bundle version that is deployed on a platform resource --> + <table name="RHQ_BUNDLE_RES_DEPLOY"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="BUNDLE_DEPLOYMENT_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DEPLOYMENT" /> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE" /> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="CTIME" type="LONG" required="true"/> + + <index name="RHQ_BUNDLE_RES_DEPLOY_IDX" unique="true"> + <field ref="BUNDLE_DEPLOYMENT_ID"/> + <field ref="RESOURCE_ID"/> + </index> + </table> + + <table name="RHQ_BUNDLE_RES_DEP_HIST"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="BUNDLE_RES_DEPLOY_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_RES_DEPLOY" /> + <column name="SUBJECT_NAME" required="false" size="255" type="VARCHAR2"/> + <column name="AUDIT_TIME" required="true" type="LONG"/> + <column name="ACTION" required="true" size="128" type="VARCHAR2"/> + <column name="INFO" required="true" size="512" type="VARCHAR2"/> + <column name="CATEGORY" required="false" size="32" type="VARCHAR2"/> + <column name="STATUS" required="true" type="VARCHAR2" size="16"/> + <column name="MESSAGE" required="false" type="LONGVARCHAR"/> + <column name="ATTACHMENT" required="false" type="LONGVARCHAR"/> + </table> + + <table name="RHQ_TAGGING_BUNDLE_MAP"> + <column name="BUNDLE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE"/> + <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> + <constraint name="RHQ_TAGGING_BUNDLE_MAP_KEY"> + <primaryKey> + <field ref="BUNDLE_ID"/> + <field ref="TAG_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_TAGGING_BUNDLE_VERSION_MAP"> + <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> + <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> + <constraint name="RHQ_TAGGING_BUNDLE_VER_MAP_KEY"> + <primaryKey> + <field ref="BUNDLE_VERSION_ID"/> + <field ref="TAG_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_TAGGING_BUNDLE_DEPLOY_MAP"> + <column name="BUNDLE_DEPLOYMENT_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DEPLOYMENT"/> + <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> + <constraint name="RHQ_TAGGING_BUNDLE_DEP_MAP_KEY"> + <primaryKey> + <field ref="BUNDLE_DEPLOYMENT_ID"/> + <field ref="TAG_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_TAGGING_BUNDLE_DEST_MAP"> + <column name="BUNDLE_DESTINATION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DESTINATION"/> + <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> + <constraint name="RHQ_TAGGING_BUNDLE_DES_MAP_KEY"> + <primaryKey> + <field ref="BUNDLE_DESTINATION_ID"/> + <field ref="TAG_ID"/> + </primaryKey> + </constraint> + </table> + + +<!-- END: content-schema.xml --> +<!-- BEGIN: resource-request-schema.xml --> + + + <table name="RHQ_CREATE_RES_HIST"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="PARENT_RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> + <column name="CREATED_RESOURCE_NAME" type="VARCHAR2" size="500" required="false"/> + <column name="NEW_RESOURCE_KEY" type="VARCHAR2" required="false" size="500"/> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> + <column name="CONFIGURATION_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> + <column name="INSTALLED_PACKAGE_ID" type="INTEGER" required="false" references="RHQ_INSTALLED_PACKAGE"/> + </table> + + <table name="RHQ_DELETE_RES_HIST"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> + </table> + +<!-- END: resource-request-schema.xml --> +<!-- BEGIN: jms-schema.xml --> + +<!-- the schema matches that which would be automatically created by the JMS subsystem --> +<!-- see deploy/jms/rhq-jdbc-state-service.xml and rhq-jdbc2-service.xml --> + + + <table name="JMS_MESSAGES"> + <column name="MESSAGEID" required="true" type="INTEGER" /> + <column name="DESTINATION" required="true" type="VARCHAR2" size="255" /> + <column name="TXID" required="false" type="INTEGER" /> + <column name="TXOP" required="false" type="CHAR" size="1" /> + <column name="MESSAGEBLOB" required="false" type="BLOB" /> + + <constraint name="JMS_MESSAGES_PKEY"> + <primaryKey> + <field ref="MESSAGEID"/> + <field ref="DESTINATION"/> + </primaryKey> + </constraint> + + <index name="JMS_MESSAGES_TXOP_TXID"> + <field ref="TXOP"/> + <field ref="TXID"/> + </index> + <index name="JMS_MESSAGES_DESTINATION"> + <field ref="DESTINATION"/> + </index> + </table> + + <table name="JMS_TRANSACTIONS"> + <column name="TXID" required="true" type="INTEGER" primarykey="true" /> + </table> + + <table name="JMS_USERS"> + <column name="USERID" required="true" type="VARCHAR2" size="32" primarykey="true" /> + <column name="PASSWD" required="true" type="VARCHAR2" size="32" /> + <column name="CLIENTID" required="false" type="VARCHAR2" size="128" /> + </table> + + <table name="JMS_ROLES"> + <column name="ROLEID" required="true" type="VARCHAR2" size="32" /> + <column name="USERID" required="true" type="VARCHAR2" size="32" /> + + <constraint name="JMS_ROLES_PKEY"> + <primaryKey> + <field ref="USERID"/> + <field ref="ROLEID"/> + </primaryKey> + </constraint> + </table> + + <table name="JMS_SUBSCRIPTIONS"> + <column name="CLIENTID" required="true" type="VARCHAR2" size="128" /> + <column name="SUBNAME" required="true" type="VARCHAR2" size="128" /> + <column name="TOPIC" required="true" type="VARCHAR2" size="255" /> + <column name="SELECTOR" required="false" type="VARCHAR2" size="255" /> + + <constraint name="JMS_SUBSCRIPTIONS_PKEY"> + <primaryKey> + <field ref="CLIENTID"/> + <field ref="SUBNAME"/> + </primaryKey> + </constraint> + </table> + +<!-- END: jms-schema.xml --> +<!-- BEGIN: obsolete-schema.xml --> + + + <!-- NOTE: The tables will be dropped in the *** REVERSE ORDER *** as listed in this file! --> + <!-- NOTE: So, put the table you want dropped first at the bottom, and so on... --> + + + <!-- !!! REMOVED FROM CONTENT-SCHEMA !!!! --> + + <table name="RHQ_BUNDLE_CONFIG" obsolete="true"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG" /> + <!-- this probably needs a DTYPE discriminator so we know if its a bundle or a specific bundle version --> + <column name="BUNDLE_VERSION_ID" type="INTEGER" required="false" references="RHQ_BUNDLE_VERSION"/> + <column name="BUNDLE_ID" type="INTEGER" required="false" references="RHQ_BUNDLE"/> + </table> + + <table name="RHQ_CHANNEL" obsolete="true"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="CREATION_TIME" type="LONG" required="true"/> + <column name="LAST_MODIFIED_TIME" type="LONG" required="true"/> + + <index name="RHQ_CHANNEL_IDX" unique="true"> + <field ref="NAME"/> + </index> + </table> + + <table name="RHQ_CHANNEL_RESOURCE_MAP" obsolete="true"> + <column name="CHANNEL_ID" type="INTEGER" required="true" references="RHQ_CHANNEL"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_CHANNEL_RESOURCE_MAP_KEY"> + <primaryKey> + <field ref="CHANNEL_ID"/> + <field ref="RESOURCE_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_CHANNEL_CONTENT_SRC_MAP" obsolete="true"> + <column name="CHANNEL_ID" type="INTEGER" required="true" references="RHQ_CHANNEL"/> + <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_CHAN_CONTENT_SRC_MAP_KEY"> + <primaryKey> + <field ref="CHANNEL_ID"/> + <field ref="CONTENT_SRC_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_CHANNEL_PKG_VERSION_MAP" obsolete="true"> + <column name="CHANNEL_ID" type="INTEGER" required="true" references="RHQ_CHANNEL"/> + <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_CHANNEL_PKG_VER_MAP_KEY"> + <primaryKey> + <field ref="CHANNEL_ID"/> + <field ref="PACKAGE_VERSION_ID"/> + </primaryKey> + </constraint> + </table> + + <!-- !!! REMOVED FROM MEASUREMENT-SCHEMA !!!! --> + + <table name="RHQ_MEASUREMENT_OOB" obsolete="true"> + <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> + <column name="SCHEDULE_ID" type="INTEGER" references="RHQ_MEASUREMENT_SCHED(ID)" required="true"/> + <column name="OCCURRED" type="LONG" required="true"/> + <column name="DIFF" type="DOUBLE" required="true"/> + + <index name="RHQ_MEASUREMENT_OOB_IDX" unique="true"> + <field ref="SCHEDULE_ID" /> + <field ref="OCCURRED" /> + </index> + </table> + + + <table name="RHQ_TAG" obsolete="true"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + </table> + + <table name="RHQ_REPO_TAG_MAP" obsolete="true"> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAG"/> + + <constraint name="RHQ_REPO_TAG_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="TAG_ID"/> + </primaryKey> + </constraint> + </table> + + +<!-- END: obsolete-schema.xml --> +</dbsetup> diff --git a/modules/enterprise/server/installer/src/test/resources/org/rhq/enterprise/server/installer/db-schema-combined-3.0.0.xml b/modules/enterprise/server/installer/src/test/resources/org/rhq/enterprise/server/installer/db-schema-combined-3.0.0.xml new file mode 100644 index 0000000..4c07e1a --- /dev/null +++ b/modules/enterprise/server/installer/src/test/resources/org/rhq/enterprise/server/installer/db-schema-combined-3.0.0.xml @@ -0,0 +1,2649 @@ +<?xml version="1.0" encoding="UTF-8"?> +<dbsetup name="schema"> +<!-- BEGIN: config-schema.xml --> + + + <!-- Definition or Metadata tables --> + + <table name="RHQ_CONFIG_DEF"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="NAME" type="VARCHAR2" required="true" size="100"/> + <column name="DESCRIPTION" type="VARCHAR2" required="false" size="250"/> + <column name="VERSION" type="VARCHAR2" required="false" size="50"/> + <column name="CONFIG_FORMAT" type="VARCHAR2" required="false" size="32"/> + </table> + + <table name="RHQ_CONFIG_PROP_GRP_DEF"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="NAME" type="VARCHAR2" required="true" size="100"/> + <column name="DISPLAY_NAME" type="VARCHAR2" required="false" size="100"/> + <column name="DESCRIPTION" type="VARCHAR2" required="false" size="250"/> + <column name="DEFAULT_HIDDEN" type="BOOLEAN" required="false"/> + <column name="ORDER_INDEX" type="INTEGER" required="false"/> + </table> + + <table name="RHQ_CONFIG_PROP_DEF"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="NAME" type="VARCHAR2" required="false" size="255"/> + <column name="DISPLAY_NAME" type="VARCHAR2" required="false" size="100"/> + <column name="DESCRIPTION" type="VARCHAR2" required="false" size="1000"/> + <column name="DEFAULT_VALUE" type="VARCHAR2" required="false" size="2000"/> + <column name="REQUIRED" type="BOOLEAN" required="false"/> + <column name="READONLY" type="BOOLEAN" required="false"/> + <column name="SUMMARY" type="BOOLEAN" required="false"/> + <column name="ACTIVATION_POLICY" type="VARCHAR2" required="false" size="20"/> + <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_GRP_DEF"/> + <column name="ORDER_INDEX" type="INTEGER" required="false"/> + <column name="VERSION" type="VARCHAR2" required="false" size="50"/> + <column name="PARENT_MAP_DEFINITION_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> + <column name="PARENT_LIST_DEFINITION_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> + <column name="SIMPLE_TYPE" type="VARCHAR2" required="false" size="20"/> + <column name="ALLOW_CUSTOM_ENUM_VALUE" type="BOOLEAN" required="false"/> + <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> + <column name="CONFIG_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_DEF"/> + + <!-- only simple properties (not lists and maps) have this --> + <column name="UNITS" type="SMALLINT" required="false"/> + + <!-- only dynamic properties (not simple) have this --> + <column name="DYNAMIC_TYPE" type="VARCHAR2" size="20" required="false"/> + <column name="DYNAMIC_KEY" type="VARCHAR2" size="128" required="false"/> + </table> + + <table name="RHQ_CONF_PROP_DEF_ENUM"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="STRING_VALUE" type="VARCHAR2" required="false" size="500"/> + <column name="ORDER_INDEX" type="INTEGER" required="false"/> + <column name="NAME" type="VARCHAR2" required="false" size="100"/> + <column name="PROPERTY_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> + </table> + + <table name="RHQ_CONFIG_PD_OSRC"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="LINK_TO_TARGET" type="BOOLEAN" required="false"/> + <column name="FILTER" type="VARCHAR2" required="false" size="40"/> + <column name="EXPRESSION" type="VARCHAR2" required="true" size="400"/> + <column name="TARGET_TYPE" type="VARCHAR2" required="true" size="20"/> + <column name="PROPERTY_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> + </table> + + <table name="RHQ_CONFIG_PROP_CONSTR"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="DTYPE" type="VARCHAR2" required="true" size="15"/> + <column name="DETAILS" type="VARCHAR2" required="false" size="250"/> + <column name="CONFIG_PROP_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> + <column name="ORDER_INDEX" type="INTEGER" required="false"/> + </table> + + + <!-- Content or value tables --> + + <table name="RHQ_CONFIG"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="NOTES" type="VARCHAR2" required="false" size="512"/> + <column name="VERSION" type="VARCHAR2" required="false" size="50"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + </table> + + <table name="RHQ_CONFIG_PROPERTY"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="CONFIGURATION_ID" type="INTEGER" required="false" references="RHQ_CONFIG" ondelete="cascade"/> + <column name="STRING_VALUE" type="VARCHAR2" required="false" size="2000"/> + <column name="OVERRIDE" type="BOOLEAN" required="false"/> + <column name="NAME" type="VARCHAR2" required="true" size="255"/> + <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> + <!-- Recursive cascade path to RHQ_CONFIG_PROPERTY causes constraint creation errors on SQL Server, see + http://support.microsoft.com/kb/321843 --> + <column name="PARENT_LIST_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROPERTY" ondelete="cascade" /> + <column name="PARENT_MAP_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROPERTY" ondelete="cascade" /> + <column name="LIST_INDEX" type="INTEGER"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <index name="RHQ_CONFIG_PROP_idx_prop_key" unique="false"> + <field ref="CONFIGURATION_ID"/> + <field ref="NAME"/> + </index> + <index name="RHQ_CONFIG_PROP_idx_map_key" unique="false"> + <field ref="PARENT_MAP_ID"/> + <field ref="NAME"/> + </index> + <index name="RHQ_CONFIG_PROP_idx_list_key" unique="false"> + <field ref="PARENT_LIST_ID"/> + </index> + <!-- List entries all have the same name --> + </table> + + <table name="RHQ_CONFIG_TEMPLATE"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="NAME" type="VARCHAR2" required="false" size="100"/> + <column name="DESCRIPTION" type="VARCHAR2" required="false" size="500"/> + <column name="CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> + <column name="CONFIG_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_DEF"/> + <column name="IS_DEFAULT" type="BOOLEAN" required="false"/> + </table> + + <table name="RHQ_RAW_CONFIG"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="CONFIG_ID" type="INTEGER" required="true" references="RHQ_CONFIG(ID)"/> + <column name="PATH" type="VARCHAR2" required="false" size="512"/> + <column name="CONTENTS" type="CLOB" required="true"/> + <column name="SHA256" type="VARCHAR2" size="64" required="true"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + </table> + +<!-- END: config-schema.xml --> +<!-- BEGIN: cluster-schema.xml --> + + <table name="RHQ_AFFINITY_GROUP"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" required="true" size="255" type="VARCHAR2"/> + </table> + + <table name="RHQ_SERVER"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" required="true" size="255" type="VARCHAR2"/> + <column name="ADDRESS" required="true" size="255" type="VARCHAR2"/> + <column name="PORT" required="true" type="INTEGER"/> + <column name="SECURE_PORT" required="true" type="INTEGER"/> + <column name="CTIME" required="true" type="LONG"/> + <column name="MTIME" required="true" type="LONG"/> + <column name="AFFINITY_GROUP_ID" type="INTEGER" references="RHQ_AFFINITY_GROUP" required="false"/> + <column name="COMPUTE_POWER" required="true" type="INTEGER"/> + <column name="OPERATION_MODE" required="true" size="32" type="VARCHAR2"/> + <column name="STATUS" type="INTEGER" required="false" default="0" /> + + <!-- This index is for constraint, not performance --> + <index name="RHQ_SERVER_NAME_UNIQUE" unique="true"> + <field ref="NAME"/> + </index> + </table> + + <!-- new agent --> + <table name="RHQ_AGENT"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" required="true" size="255" type="VARCHAR2"/> + <column name="ADDRESS" required="true" size="255" type="VARCHAR2"/> + <column name="PORT" required="true" type="INTEGER"/> + <column name="AGENTTOKEN" required="true" size="100" type="VARCHAR2"/> + <column name="REMOTE_ENDPOINT" required="false" size="4000" type="VARCHAR2"/> + <column name="CTIME" required="true" type="LONG"/> + <column name="MTIME" required="true" type="LONG"/> + <column name="LAST_AVAILABILITY_REPORT" required="false" type="LONG"/> + <column name="AFFINITY_GROUP_ID" type="INTEGER" references="RHQ_AFFINITY_GROUP" required="false"/> + <column name="SERVER_ID" type="INTEGER" references="RHQ_SERVER" required="false"/> + <column name="STATUS" type="INTEGER" required="false" default="0" /> + <column name="BACKFILLED" type="BOOLEAN" required="true" /> + + <index name="RHQ_AGENT_NAME_UNIQUE" unique="true"> + <field ref="NAME"/> + </index> + + <index name="RHQ_AGENT_ADDRESS_PORT" unique="true"> + <field ref="ADDRESS"/> + <field ref="PORT"/> + </index> + + <index name="RHQ_AGENT_TOKEN_UNIQUE" unique="true"> + <field ref="AGENTTOKEN"/> + </index> + </table> + + <table name="RHQ_PARTITION_EVENT"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="SUBJECT_NAME" required="true" size="100" type="VARCHAR2"/> + <column name="CTIME" required="true" type="LONG"/> + <column name="EVENT_TYPE" required="true" size="50" type="VARCHAR2"/> + <column name="EVENT_DETAIL" required="false" size="512" type="VARCHAR2"/> + <column name="EXECUTION_STATUS" required="true" size="32" type="VARCHAR2"/> + </table> + + <table name="RHQ_PARTITION_DETAILS"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="PARTITION_EVENT_ID" type="INTEGER" references="RHQ_PARTITION_EVENT" required="true"/> + <column name="AGENT_NAME" type="VARCHAR2" size="255" required="true"/> + <column name="SERVER_NAME" type="VARCHAR2" size="255" required="true"/> + </table> + + <table name="RHQ_FAILOVER_LIST"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="PARTITION_EVENT_ID" type="INTEGER" references="RHQ_PARTITION_EVENT" required="true"/> + <column name="AGENT_ID" type="INTEGER" references="RHQ_AGENT" required="true"/> + <column name="CTIME" required="true" type="LONG"/> + </table> + + <table name="RHQ_FAILOVER_DETAILS"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="FAILOVER_LIST_ID" type="INTEGER" references="RHQ_FAILOVER_LIST" required="true"/> + <column name="SERVER_ID" type="INTEGER" references="RHQ_SERVER" required="true"/> + <column name="ORDINAL" type = "INTEGER" required="true"/> + </table> + +<!-- END: cluster-schema.xml --> +<!-- BEGIN: auth-schema.xml --> + + + <table name="RHQ_PRINCIPAL"> + + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="PRINCIPAL" required="true" type="VARCHAR2" size="100"/> + <column name="PASSWORD" required="true" type="VARCHAR2" size="64"/> + + <!-- ensure that principals are unique --> + <index name="RHQ_PRINCIPAL_PRINCIPAL_KEY" unique="true"> + <field ref="PRINCIPAL"/> + </index> + + </table> + + <table name="RHQ_SUBJECT"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" required="true" size="100" type="VARCHAR2"/> + <column name="CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG"/> + <column name="FIRST_NAME" required="false" size="100" type="VARCHAR2"/> + <column name="LAST_NAME" required="false" size="100" type="VARCHAR2"/> + <column name="EMAIL_ADDRESS" size="100" type="VARCHAR2"/> + <column name="SMS_ADDRESS" size="100" type="VARCHAR2"/> + <column name="PHONE_NUMBER" size="100" type="VARCHAR2"/> + <column name="DEPARTMENT" size="100" type="VARCHAR2"/> + <column name="FACTIVE" required="true" type="BOOLEAN" default="true"/> + <column name="FSYSTEM" required="true" type="BOOLEAN" default="false"/> + + <index name="RHQ_SUBJECT_AUTH_KEY" unique="true"> + <field ref="NAME"/> + </index> + </table> + +<!-- END: auth-schema.xml --> +<!-- BEGIN: inventory-schema.xml --> + + + <!-- NEW RESOURCE TYPES --> + <table name="RHQ_RESOURCE_TYPE"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" type="VARCHAR2" size="100" required="true"/> + <column name="CATEGORY" type="VARCHAR2" size="16" required="true"/> + <column name="CREATION_DATA_TYPE" type="VARCHAR2" size="16" required="true"/> + <column name="CREATE_DELETE_POLICY" type="VARCHAR2" size="16" required="true"/> + <column name="SINGLETON" type="BOOLEAN" required="true"/> + <column name="SUPPORTS_MANUAL_ADD" type="BOOLEAN" required="true"/> + <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> + <column name="PLUGIN" type="VARCHAR2" size="100"/> + <column name="CTIME" type="LONG"/> + <column name="MTIME" type="LONG"/> + <column name="DELETED" type="BOOLEAN" default="FALSE" required="TRUE"/> + <column name="SUBCATEGORY_ID" type="INTEGER"/> + <!-- + TODO add support to DB setup for tables with circular dependencies and then add back this RI + <column name="SUBCATEGORY_ID" type="INTEGER" references="RHQ_RESOURCE_SUBCAT" /> + --> + <column name="PLUGIN_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> + <column name="RES_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> + <column name="BUNDLE_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG"/> + + <index name="RHQ_RES_TYPE_IDX_PLG_NAME" unique="true"> + <field ref="NAME"/> + <field ref="PLUGIN"/> + </index> + </table> + + <!-- NEW RESOURCE SUBCATEGORIES --> + <table name="RHQ_RESOURCE_SUBCAT"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" type="VARCHAR2" size="100"/> + <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> + <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> + <column name="CTIME" type="LONG"/> + <column name="MTIME" type="LONG"/> + <column name="PARENT_SUBCATEGORY_ID" type="INTEGER" references="RHQ_RESOURCE_SUBCAT"/> + <!-- resourceTypeId is not required on child sub categories --> + <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> + </table> + + <!-- Many To Many mapping for resource type to its parents --> + <table name="RHQ_RESOURCE_TYPE_PARENTS"> + <column name="RESOURCE_TYPE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> + <column name="PARENT_RESOURCE_TYPE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> + + <!-- not using full words to fit index name length --> + <constraint name="RHQ_RES_TYPE_PARENTS_KEY"> + <primaryKey> + <field ref="RESOURCE_TYPE_ID"/> + <field ref="PARENT_RESOURCE_TYPE_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_PROCESS_SCAN"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="QUERY" type="VARCHAR2" size="256" required="true"/> + <column name="NAME" type="VARCHAR2" size="100" required="false"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> + + <index name="RHQ_PROCESS_SCAN_QUERY_INDEX" unique="true"> + <field ref="QUERY"/> + <field ref="RESOURCE_TYPE_ID"/> + </index> + </table> + + <table name="RHQ_PRD_VER"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="VERSION" type="VARCHAR2" size="100" required="true"/> + <column name="RES_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> + </table> + + <table name="RHQ_RESOURCE"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> + <column name="UUID" type="CHAR" size="36" required="true"/> + <column name="NAME" type="VARCHAR2" size="500"/> + <!-- ancestry holds the full parental ancestry, used for disambiguation --> + <column name="ANCESTRY" type="VARCHAR2" required="false" size="4000"/> + <column name="RESOURCE_KEY" type="VARCHAR2" required="true" size="500"/> + <column name="AGENT_ID" required="false" type="INTEGER" references="RHQ_AGENT(id)"/> + <column name="INVENTORY_STATUS" type="VARCHAR2" size="20"/> + <column name="CONNECTED" type="BOOLEAN"/> + <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> + <column name="VERSION" type="VARCHAR2" size="100"/> + <column name="CTIME" type="LONG"/> + <column name="MTIME" type="LONG"/> + <column name="ITIME" type="LONG"/> + <column name="RES_CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG"/> + <column name="PLUGIN_CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG"/> + <column name="MODIFIED_BY" required="false" size="100" type="VARCHAR2"/> + <column name="LOCATION" required="false" size="100" type="VARCHAR2"/> + <column name="PARENT_RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE"/> + <column name="PRODUCT_VERSION_ID" type="INTEGER" references="RHQ_PRD_VER"/> + + <index name="RHQ_RESOURCE_idx_key"> + <field ref="RESOURCE_KEY"/> + </index> + + <index name="RHQ_RESOURCE_idx_type"> + <field ref="RESOURCE_TYPE_ID"/> + </index> + + <index name="RHQ_RESOURCE_idx_agent"> + <field ref="AGENT_ID"/> + </index> + + <index name="RHQ_RESOURCE_idx_parent"> + <field ref="PARENT_RESOURCE_ID"/> + </index> + + </table> + + <table name="RHQ_RESOURCE_ERROR"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> + <column name="TIME_OCCURRED" type="LONG" required="true"/> + <column name="ERROR_TYPE" type="VARCHAR2" required="true" size="32"/> + <column name="SUMMARY" type="VARCHAR2" required="true" size="1000"/> + <column name="DETAIL" type="LONGVARCHAR" required="false"/> + + <index name="RHQ_RES_ERROR_IDX_RES_ID"> + <field ref="RESOURCE_ID"/> + </index> + </table> + + <table name="RHQ_GROUP_DEF"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" required="true" size="100" type="VARCHAR2"/> + <column name="DESCRIPTION" size="100" type="VARCHAR2"/> + <column name="CTIME" type="LONG"/> + <column name="MTIME" type="LONG"/> + <column name="CALC_TIME" type="LONG"/> + <column name="CALC_INTERVAL" type="LONG"/> + <column name="RECURSIVE" type="BOOLEAN"/> + <column name="EXPRESSION" type="VARCHAR2" size="1000"/> + + <index name="RHQ_GROUP_DEF_NAME" unique="true"> + <field ref="NAME"/> + </index> + </table> + + <table name="RHQ_RESOURCE_GROUP"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <!-- this name can be longer than the size of the GROUP_BY column, which is used to uniquely identify it --> + <!-- Max bytes for Oracle Varchar2 to accommodate large cluster keys --> + <column name="NAME" required="true" size="4000" type="VARCHAR2"/> + <column name="DESCRIPTION" size="100" type="VARCHAR2"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> + <!-- Compatible groups only --> + <column name="CTIME" type="LONG"/> + <column name="MTIME" type="LONG"/> + <column name="MODIFIED_BY" required="false" size="100" type="VARCHAR2"/> + <column name="RECURSIVE" type="BOOLEAN"/> + + <column name="GROUP_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_GROUP_DEF"/> + <column name="GROUP_BY" size="500" type="VARCHAR2"/> + + <column name="CATEGORY" type="VARCHAR2" size="20" required="true"/> + + <!-- This is only set if this is a subject-owned group (like an autogroup) --> + <column name="SUBJECT_ID" type="INTEGER" references="RHQ_SUBJECT"/> + + <!-- These two only set if this is a backing group for a resource auto-cluster --> + <column name="CLUSTER_KEY" type="VARCHAR2" size="4000" required="false"/> + <column name="CLUSTER_RESOURCE_GROUP_ID" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> + + <!-- This is only set if this is a backing group for a resource auto-group --> + <column name="AUTO_GROUP_PARENT_RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE"/> + + <column name="VISIBLE" type="BOOLEAN"/> + + <index name="RHQ_RES_GROUP_NAME" unique="false"> + <field ref="NAME"/> + </index> + </table> + + <!-- Many To Many mapping for groups to implicit resources --> + <table name="RHQ_RESOURCE_GROUP_RES_IMP_MAP"> + <column name="RESOURCE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE"/> + <column name="RESOURCE_GROUP_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> + + <!-- not using full words to fit index name length --> + <constraint name="RHQ_RES_GROUP_RES_IMP_MAP_KEY"> + <primaryKey> + <field ref="RESOURCE_ID"/> + <field ref="RESOURCE_GROUP_ID"/> + </primaryKey> + </constraint> + </table> + + <!-- Many To Many mapping for groups to explicit resources --> + <table name="RHQ_RESOURCE_GROUP_RES_EXP_MAP"> + <column name="RESOURCE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE"/> + <column name="RESOURCE_GROUP_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> + + <!-- not using full words to fit index name length --> + <constraint name="RHQ_RES_GROUP_RES_EXP_MAP_KEY"> + <primaryKey> + <field ref="RESOURCE_ID"/> + <field ref="RESOURCE_GROUP_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_CONFIG_GROUP_UPDATE"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="GROUP_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_GROUP"/> + <column name="CONFIGURATION_ID" type="INTEGER" required="true" references="RHQ_CONFIG"/> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="SUBJECT_NAME" type="VARCHAR2" required="false" size="100"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> + </table> + + <table name="RHQ_CONFIG_UPDATE"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="CONFIGURATION_ID" type="INTEGER" required="true" references="RHQ_CONFIG" ondelete="cascade"/> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="SUBJECT_NAME" type="VARCHAR2" required="false" size="100"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="CONFIG_RES_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> + <column name="PLUGIN_CONFIG_RES_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> + <column name="AGG_RES_UPDATE_ID" type="INTEGER" required="false" references="RHQ_CONFIG_GROUP_UPDATE"/> + <column name="AGG_PLUGIN_UPDATE_ID" type="INTEGER" required="false" references="RHQ_CONFIG_GROUP_UPDATE"/> + <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> + </table> + + + <table name="RHQ_TAGGING"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="NAMESPACE" type="VARCHAR2" required="false" size="20"/> + <column name="SEMANTIC" type="VARCHAR2" required="false" size="50"/> + <column name="NAME" type="VARCHAR2" required="true" size="100"/> + </table> + + <table name="RHQ_TAGGING_RESOURCE_MAP"> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> + <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> + <constraint name="RHQ_TAGGING_RESOURCE_MAP_KEY"> + <primaryKey> + <field ref="RESOURCE_ID"/> + <field ref="TAG_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_TAGGING_RES_GROUP_MAP"> + <column name="RESOURCE_GROUP_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_GROUP"/> + <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> + <constraint name="RHQ_TAGGING_RES_GROUP_MAP_KEY"> + <primaryKey> + <field ref="RESOURCE_GROUP_ID"/> + <field ref="TAG_ID"/> + </primaryKey> + </constraint> + </table> + +<!-- END: inventory-schema.xml --> +<!-- BEGIN: authz-schema.xml --> + + + <table name="RHQ_ROLE"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" required="true" size="100" type="VARCHAR2"/> + <column name="DESCRIPTION" size="100" type="VARCHAR2"/> + <column name="FSYSTEM" type="BOOLEAN" default="false"/> + + <index name="RHQ_ROLE_NAME_KEY" unique="true"> + <field ref="NAME"/> + </index> + </table> + + <table name="RHQ_ROLE_RESOURCE_GROUP_MAP"> + <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> + <column name="RESOURCE_GROUP_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> + + <constraint name="RHQ_ROLE_RES_GROUP_MAP_KEY"> + <primaryKey> + <field ref="ROLE_ID"/> + <field ref="RESOURCE_GROUP_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_ROLE_LDAP_GROUP"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> + <column name="LDAP_GROUP_NAME" size="128" required="true" type="VARCHAR2"/> + + <index name="RHQ_ROLE_LDAP_GROUP_IDX" unique="true"> + <field ref="ROLE_ID"/> + <field ref="LDAP_GROUP_NAME"/> + </index> + </table> + + <table name="RHQ_PERMISSION"> + <column name="ROLE_ID" type="INTEGER" references="RHQ_ROLE" required="true"/> + <column name="OPERATION" type="INTEGER" required="true"/> + <constraint name="RHQ_PERMISSION_PK"> + <primaryKey> + <field ref="ROLE_ID"/> + <field ref="OPERATION"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_SUBJECT_ROLE_MAP"> + <column name="SUBJECT_ID" required="true" type="INTEGER" references="RHQ_SUBJECT"/> + <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> + + <constraint name="RHQ_SUBJECT_ROLE_MAPPING_KEY"> + <primaryKey> + <field ref="SUBJECT_ID"/> + <field ref="ROLE_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_SUBJECT_ROLE_LDAP_MAP"> + <column name="SUBJECT_ID" required="true" type="INTEGER" references="RHQ_SUBJECT"/> + <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> + <constraint name="RHQ_SUBJECT_ROLE_LDAP_MAP_PK"> + <primaryKey> + <field ref="SUBJECT_ID" /> + <field ref="ROLE_ID"/> + </primaryKey> + </constraint> + </table> +<!-- END: authz-schema.xml --> +<!-- BEGIN: search-schema.xml --> + + + <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="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="GLOBAL" type="BOOLEAN" required="true"/> + </table> + +<!-- END: search-schema.xml --> +<!-- BEGIN: dashboard-schema.xml --> + + + + <table name="RHQ_DASHBOARD"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" type="VARCHAR2" size="200" required="true"/> + <column name="SUBJECT_ID" type="INTEGER" required="true" references="RHQ_SUBJECT"/> + <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> + <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_RESOURCE_GROUP"/> + <column name="CATEGORY" type="VARCHAR2" size="20" required="true"/> + <column name="SHARED" type="BOOLEAN" required="true"/> + <column name="CONFIGURATION_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> + </table> + + + <table name="RHQ_DASHBOARD_PORTLET"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" type="VARCHAR2" size="200" required="true"/> + <column name="PORTLET_KEY" type="VARCHAR2" size="200" required="true"/> + <column name="COL" type="INTEGER" required="true"/> + <column name="COL_INDEX" type="INTEGER" required="true"/> + <column name="HEIGHT" type="INTEGER" required="true"/> + <column name="CONFIGURATION_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> + <column name="DASHBOARD_ID" type="INTEGER" required="false" references="RHQ_DASHBOARD"/> + </table> + +<!-- END: dashboard-schema.xml --> +<!-- BEGIN: operation-schema.xml --> + + + <table name="RHQ_OPERATION_DEF"> + + <!-- === required columns === --> + + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE(ID)"/> + <column name="NAME" type="VARCHAR2" required="true" size="100"/> + + <!-- === optional columns === --> + + <!-- an OSGI version range - if null, the operation def applies to all versions of the associated resource type --> + <column name="RESOURCE_VERSION_RANGE" type="VARCHAR2" size="100"/> + + <!-- A parameter config definition is only required for operations that have parameters. --> + <!-- A results config definition is only required for operations that return data. --> + <column name="PARAMETER_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> + <column name="RESULTS_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> + <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> + <column name="DESCRIPTION" type="VARCHAR2" size="4000"/> + <column name="TIMEOUT" type="INTEGER"/> + + <!-- === business key (RESOURCE_TYPE_ID + NAME) === --> + <index name="RHQ_OPERATION_DEF_KEY_IDX" unique="true"> + <field ref="RESOURCE_TYPE_ID"/> + <field ref="NAME"/> + </index> + + </table> + + <table name="RHQ_OPERATION_HISTORY"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="DTYPE" type="VARCHAR2" required="true" size="8"/> + <column name="JOB_NAME" type="VARCHAR2" required="true" size="100"/> + <column name="JOB_GROUP" type="VARCHAR2" required="true" size="100"/> + <column name="OPERATION_DEF_ID" type="INTEGER" required="true" references="RHQ_OPERATION_DEF"/> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="STIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="PARAMETERS_CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> + + <!-- for resource history --> + <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> + <column name="RESULTS_CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> + <column name="GROUP_HISTORY_ID" type="INTEGER" required="false" references="RHQ_OPERATION_HISTORY"/> + + <!-- for group history --> + <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_RESOURCE_GROUP"/> + + <index name="RHQ_OPERATION_HISTORY_JOB_IDX" unique="true"> + <field ref="JOB_NAME"/> + <field ref="JOB_GROUP"/> + <field ref="CTIME"/> + </index> + + </table> + + <!-- + This table is really just to support some specific use-cases. + Specifically, to be able to get a list of histories for a specific schedule (aka quartz job) + and to be able to query a list of all schedules along with their associated resource/group IDs + possibly sorted by their next fire time. + Note that a NULL next fire time means it won't fire again and the row is probaby about to be deleted; + we can probably not even insert rows with NULL and make it a non-nullable field. But rather than + code special conditions into the session bean, we'll allow a short-lived NULL next fire time row. + --> + <table name="RHQ_OPERATION_SCHEDULE"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + + <column name="JOB_NAME" type="VARCHAR2" required="true" size="100"/> + <column name="JOB_GROUP" type="VARCHAR2" required="true" size="100"/> + <column name="DTYPE" type="VARCHAR2" required="true" size="8"/> + <column name="NEXT_FIRE_TIME" type="LONG" required="false"/> + + <!-- for resource history --> + <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> + + <!-- for group history --> + <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_RESOURCE_GROUP"/> + + <!-- + Note, this is the same as the primary key that Quartz uses for its schedules (RHQ_QRTZ_JOB_DETAILS). + We do not need to add DTYPE to the key, because we ensure the name/group are unique across resource/group + schedules + --> + <!-- === business key (JOB_NAME + JOB_GROUP) === --> + <index name="RHQ_OPERATION_SCHEDULE_KEY_IDX" unique="true"> + <field ref="JOB_NAME"/> + <field ref="JOB_GROUP"/> + </index> + </table> + +<!-- END: operation-schema.xml --> +<!-- BEGIN: event-schema.xml --> + + + <!-- metadata --> + + <table name="RHQ_EVENT_DEF"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE(ID)"/> + + <column name="NAME" type="VARCHAR2" size="100" required="true"/> + <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> + <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> + + <index name="RHQ_EVENT_DEF_IDX" unique="true"> + <field ref="RESOURCE_TYPE_ID"/> + <field ref="NAME"/> + </index> + </table> + + <!-- instance data --> + + <table name="RHQ_EVENT_SOURCE"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="EVENT_DEF_ID" type="INTEGER" required="true" references="RHQ_EVENT_DEF(ID)"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE(ID)"/> + + <column name="LOCATION" required="true" size="2000" type="VARCHAR2"/> + + <index name="RHQ_EVENT_SOURCE_IDX" unique="true"> + <field ref="EVENT_DEF_ID"/> + <field ref="RESOURCE_ID"/> + <field ref="LOCATION"/> + </index> + </table> + + <table name="RHQ_EVENT"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="EVENT_SOURCE_ID" type="INTEGER" required="true" references="RHQ_EVENT_SOURCE(ID)"/> + + <column name="TIMESTAMP" required="true" type="LONG"/> + <column name="SEVERITY" required="true" size="20" type="VARCHAR2"/> + <column name="DETAIL" required="true" size="4000" type="VARCHAR2"/> + <index name="RHQ_EVENT_IDX" unique="false"> + <field ref="EVENT_SOURCE_ID"/> + <field ref="TIMESTAMP"/> + </index> + </table> + +<!-- END: event-schema.xml --> +<!-- BEGIN: alert-schema.xml --> + + + <table name="RHQ_ALERT_DEFINITION"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" required="true" size="100" type="VARCHAR2"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="PARENT_ID" type="INTEGER" required="false"/> + <column name="GROUP_ALERT_DEF_ID" type="INTEGER" required="false"/> + <column name="DESCRIPTION" required="false" size="250" type="VARCHAR2"/> + <column name="PRIORITY" type="VARCHAR2" size="15" required="true"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE" required="false"/> + <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE" required="false"/> + <column name="RESOURCE_GROUP_ID" type="INTEGER" references="RHQ_RESOURCE_GROUP" required="false"/> + <column name="ENABLED" required="true" default="TRUE" type="BOOLEAN"/> + + <column name="REQUIRED" required="true" type="SMALLINT"/> + + <column name="RECOVERY_ID" type="INTEGER" required="true"/> + <!-- required, but 0 effectively means null --> + <column name="WILL_RECOVER" required="true" default="false" type="BOOLEAN"/> + <column name="NOTIFY_FILTERED" required="true" default="false" type="BOOLEAN"/> + <column name="CONTROL_FILTERED" required="true" default="FALSE" type="BOOLEAN"/> + + <column name="DELETED" required="true" default="FALSE" type="BOOLEAN"/> + <column name="READ_ONLY" required="true" default="FALSE" type="BOOLEAN"/> + + <column name="DAMPENING_CATEGORY" type="SMALLINT" required="true"/> + <column name="DAMPENING_VALUE" type="INTEGER"/> + <column name="DAMPENING_VALUE_UNITS" type="SMALLINT"/> + <column name="DAMPENING_PERIOD" type="INTEGER"/> + <column name="DAMPENING_PERIOD_UNITS" type="SMALLINT"/> + </table> + + <table name="RHQ_ALERT_DAMPEN_EVENT"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> + <column name="EVENT_TYPE" required="true" type="SMALLINT"/> + <column name="EVENT_TIMESTAMP" required="true" type="LONG"/> + + <index name="RHQ_DAMPENING_EVENT_TYPE_IDX"> + <field ref="EVENT_TYPE"/> + </index> + <index name="RHQ_DAMPENING_EVENT_TS_IDX"> + <field ref="EVENT_TIMESTAMP"/> + </index> + </table> + + <table name="RHQ_ALERT_CONDITION"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="TYPE" required="true" type="VARCHAR2" size="15"/> + <!-- + <column name="REQUIRED" required="true" type="BOOLEAN"/> + --> + <column name="MEASUREMENT_DEFINITION_ID" required="false" type="INTEGER"/> + <column name="NAME" required="false" size="100" type="VARCHAR2"/> + <column name="COMPARATOR" required="false" size="2" type="VARCHAR2"/> + <column name="THRESHOLD" required="false" type="DOUBLE"/> + <!-- event-based conditions use OPTION_STATUS for the string match, so should be a decent length --> + <column name="OPTION_STATUS" required="false" size="256" type="VARCHAR2"/> + <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> + <column name="TRIGGER_ID" required="false" type="INTEGER"/> + </table> + + <table name="RHQ_ALERT" tablespace="@@@LARGE_TABLESPACE_FOR_DATA@@@" + storage-options="freelists 5" cache="true" logging="false"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> + <column name="CTIME" required="true" type="LONG"/> + <column name="RECOVERY_ID" type="INTEGER" required="true"/> + <!-- required, but 0 effectively means null --> + <column name="WILL_RECOVER" required="true" default="false" type="BOOLEAN"/> + <column name="ACK_TIME" required="false" type="LONG"/> + <column name="ACK_SUBJECT" required="false" size="100" type="VARCHAR2"/> + <index name="RHQ_ALERT_IDX_TIME" unique="false"> + <field ref="CTIME"/> + </index> + <index name="RHQ_ALERT_IDX_ALERTDEF" unique="false"> + <field ref="ALERT_DEFINITION_ID"/> + </index> + </table> + + <table name="RHQ_ALERT_NOTIF_LOG" tablespace="@@@LARGE_TABLESPACE_FOR_DATA@@@" + storage-options="freelists 5" cache="true" logging="false"> + <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="false"> + <field ref="ALERT_ID"/> + </index> + <column name="SENDER" required="false" size="100" type="VARCHAR2"/> + <column name="RESULT_STATE" required="false" size="20" type="VARCHAR2"/> + <column name="MESSAGE" required="false" size="4000" type="VARCHAR2"/> + </table> + + <table name="RHQ_ALERT_CONDITION_LOG" tablespace="@@@LARGE_TABLESPACE_FOR_DATA@@@" + storage-options="freelists 5" cache="true" logging="false"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="CTIME" required="true" type="LONG"/> + <column name="ALERT_ID" required="false" type="INTEGER" references="RHQ_ALERT(ID)"/> + <column name="CONDITION_ID" required="true" type="INTEGER" references="RHQ_ALERT_CONDITION(ID)"/> + <column name="VALUE" required="true" size="250" type="VARCHAR2"/> + <index name="RHQ_ALERT_COND_LOG_IDX_TIME"> + <field ref="CTIME" /> + </index> + <index name="RHQ_ALERT_COND_LOG_IDX_ALERT"> + <field ref="ALERT_ID"/> + </index> + <index name="RHQ_ALERT_COND_LOG_COND_IDX"> + <field ref="CONDITION_ID"/> + </index> + </table> + + <table name="RHQ_ALERT_NOTIFICATION" tablespace="@@@LARGE_TABLESPACE_FOR_DATA@@@" + storage-options="freelists 5" cache="true" logging="false"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> + <column name="SENDER_CONFIG_ID" required="false" type="INTEGER" references="RHQ_CONFIG(ID)"/> + <column name="EXTRA_CONFIG_ID" required="false" type="INTEGER" references="RHQ_CONFIG(ID)"/> + <column name="SENDER_NAME" required="true" size="100" type="VARCHAR2" /> + </table> + +<!-- END: alert-schema.xml --> +<!-- BEGIN: sysconfig-schema.xml --> + + + <table name="RHQ_SYSTEM_CONFIG"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="PROPERTY_KEY" type="VARCHAR2" size="80"/> + <column name="PROPERTY_VALUE" type="VARCHAR2" size="300"/> + <column name="DEFAULT_PROPERTY_VALUE" type="VARCHAR2" size="300"/> + <column name="FREAD_ONLY" type="BOOLEAN" default="FALSE"/> + + <index name="RHQ_SYSTEM_CONFIG_KEY_INDX" unique="true"> + <field ref="PROPERTY_KEY"/> + </index> + </table> + +<!-- END: sysconfig-schema.xml --> +<!-- BEGIN: scheduler-schema.xml --> + + + <table name="RHQ_QRTZ_JOB_DETAILS"> + <column name="JOB_NAME" required="true" type="VARCHAR2" size="80"/> + <column name="JOB_GROUP" required="true" type="VARCHAR2" size="80"/> + <column name="DESCRIPTION" required="false" type="VARCHAR2" size="120"/> + <column name="JOB_CLASS_NAME" required="true" type="VARCHAR2" size="128"/> + <column name="IS_DURABLE" required="true" type="BOOLEAN" default="FALSE"/> + <column name="IS_VOLATILE" required="true" type="BOOLEAN"/> + <column name="IS_STATEFUL" required="true" type="BOOLEAN" default="FALSE"/> + <column name="REQUESTS_RECOVERY" required="true" type="BOOLEAN" default="FALSE"/> + <column name="JOB_DATA" required="false" type="BLOB"/> + + <constraint name="RHQ_PK_QRTZ_JOB_DETAILS"> + <primaryKey> + <field ref="JOB_NAME"/> + <field ref="JOB_GROUP"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_QRTZ_JOB_LISTENERS"> + <column name="JOB_NAME" required="true" type="VARCHAR2" size="80"/> + <column name="JOB_GROUP" required="true" type="VARCHAR2" size="80"/> + <column name="JOB_LISTENER" required="true" type="VARCHAR2" size="80"/> + + <constraint name="RHQ_PK_QRTZ_JOB_LISTENERS"> + <primaryKey> + <field ref="JOB_NAME"/> + <field ref="JOB_GROUP"/> + <field ref="JOB_LISTENER"/> + </primaryKey> + </constraint> + <constraint name="RHQ_FK_QRTZ_JOB_LSTNRS_JN_JG"> + <foreignKey local="JOB_NAME,JOB_GROUP" + references="RHQ_QRTZ_JOB_DETAILS(JOB_NAME,JOB_GROUP)" + ondelete="cascade"/> + </constraint> + </table> + + <table name="RHQ_QRTZ_TRIGGERS"> + <column name="TRIGGER_NAME" type="VARCHAR2" required="true" size="80"/> + <column name="TRIGGER_GROUP" type="VARCHAR2" required="true" size="80"/> + <column name="JOB_NAME" type="VARCHAR2" required="true" size="80"/> + <column name="JOB_GROUP" type="VARCHAR2" required="true" size="80"/> + <column name="IS_VOLATILE" type="BOOLEAN" required="true"/> + <column name="DESCRIPTION" type="VARCHAR2" required="false" size="120"/> + <column name="NEXT_FIRE_TIME" type="LONG" required="false"/> + <column name="PREV_FIRE_TIME" type="LONG" required="false"/> + <column name="PRIORITY" type="INTEGER" required="false"/> + <column name="TRIGGER_STATE" type="VARCHAR" required="true" size="16"/> + <column name="TRIGGER_TYPE" type="VARCHAR" required="true" size="8"/> + <column name="START_TIME" type="LONG" required="true"/> + <column name="END_TIME" type="LONG" required="false"/> + <column name="CALENDAR_NAME" type="VARCHAR2" required="false" size="80"/> + <column name="MISFIRE_INSTR" type="INTEGER" required="false"/> + <column name="JOB_DATA" type="BLOB" required="false"/> + + <constraint name="RHQ_PK_QRTZ_TRIGGERS"> + <primaryKey> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </primaryKey> + </constraint> + <constraint name="RHQ_FK_QRTZ_TRIGGERS_JN_JG"> + <foreignKey local="JOB_NAME,JOB_GROUP" + references="RHQ_QRTZ_JOB_DETAILS(JOB_NAME,JOB_GROUP)" + ondelete="cascade"/> + </constraint> + + <!-- Quartz docs recommend these indexes. --> + <index name="RHQ_QRTZ_TRIGGERS_JN_JG_IDX"> + <field ref="JOB_NAME"/> + <field ref="JOB_GROUP"/> + </index> + <index name="RHQ_QRTZ_TRIGGERS_NFT_IDX"> + <field ref="NEXT_FIRE_TIME"/> + </index> + <index name="RHQ_QRTZ_TRIGGERS_TS_IDX"> + <field ref="TRIGGER_STATE"/> + </index> + <index name="RHQ_QRTZ_TRIGGERS_TS_NFT_IDX"> + <field ref="TRIGGER_STATE"/> + <field ref="NEXT_FIRE_TIME"/> + </index> + + </table> + + <table name="RHQ_QRTZ_SIMPLE_TRIGGERS"> + <column name="TRIGGER_NAME" type="VARCHAR2" required="true" size="80"/> + <column name="TRIGGER_GROUP" type="VARCHAR2" required="true" size="80"/> + <column name="REPEAT_COUNT" type="LONG" required="true"/> + <column name="REPEAT_INTERVAL" type="LONG" required="true"/> + <column name="TIMES_TRIGGERED" type="LONG" required="true"/> + + <constraint name="RHQ_PK_QRTZ_SIMPLE_TRIGGERS"> + <primaryKey> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </primaryKey> + </constraint> + <constraint name="RHQ_FK_QRTZ_SIMPLE_TRGRS_TN_TG"> + <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" + references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" + ondelete="cascade"/> + </constraint> + + <!-- Quartz docs recommend this index. --> + <!-- Commenting out, because Oracle auto-creates an index for the + primary key column(s) and fails if you try to create another + index for the same column(s) (ips, 03/29/07). + --> + <!-- + <index name="RHQ_QRTZ_SIMPLE_TRGRS_TN_TG_IDX"> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </index> + --> + </table> + + <table name="RHQ_QRTZ_CRON_TRIGGERS"> + <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> + <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> + <column name="CRON_EXPRESSION" type="VARCHAR2" size="80" required="true"/> + <column name="TIME_ZONE_ID" type="VARCHAR2" size="80" required="false"/> + + <constraint name="RHQ_PK_QRTZ_CRON_TRIGGERS"> + <primaryKey> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </primaryKey> + </constraint> + <constraint name="RHQ_FK_QRTZ_CRON_TRIG_TN_TG"> + <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" + references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" + ondelete="cascade"/> + </constraint> + + <!-- Quartz docs recommend this index. --> + <!-- Commenting out, because Oracle auto-creates an index for the + primary key column(s) and fails if you try to create another + index for the same column(s) (ips, 03/29/07). + --> + <!-- + <index name="RHQ_QRTZ_CRON_TRGRS_TN_TG_IDX"> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </index> + --> + </table> + + <table name="RHQ_QRTZ_BLOB_TRIGGERS"> + <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> + <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> + <column name="BLOB_DATA" type="BLOB" required="false"/> + + <constraint name="RHQ_PK_QRTZ_BLOB_TRIGGERS"> + <primaryKey> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </primaryKey> + </constraint> + <constraint name="RHQ_FK_QRTZ_BLOB_TRIGG_TN_TG"> + <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" + references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" + ondelete="cascade"/> + </constraint> + + <!-- Quartz docs recommend this index. --> + <!-- Commenting out, because Oracle auto-creates an index for the + primary key column(s) and fails if you try to create another + index for the same column(s) (ips, 03/29/07). + --> + <!-- + <index name="RHQ_QRTZ_BLOB_TRGRS_TN_TG_IDX"> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </index> + --> + </table> + + <table name="RHQ_QRTZ_TRIGGER_LISTENERS"> + <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> + <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> + <column name="TRIGGER_LISTENER" type="VARCHAR2" size="80" required="true"/> + + <constraint name="RHQ_PK_QRTZ_TRIGGER_LISTENERS"> + <primaryKey> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + <field ref="TRIGGER_LISTENER"/> + </primaryKey> + </constraint> + <constraint name="RHQ_FK_QRTZ_TRGR_LSTNRS_TN_TG"> + <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" + references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" + ondelete="cascade"/> + </constraint> + + <!-- Quartz docs recommend this index. --> + <index name="RHQ_QRTZ_TRGR_LSTNRS_TN_TG_IDX"> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </index> + + </table> + + <table name="RHQ_QRTZ_FIRED_TRIGGERS"> + <column name="ENTRY_ID" primarykey="true" type="VARCHAR2" size="95" required="true"/> + <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> + <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> + <column name="INSTANCE_NAME" type="VARCHAR2" size="80" required="true"/> + <column name="FIRED_TIME" type="LONG" required="true"/> + <column name="PRIORITY" type="INTEGER" required="false"/> + <column name="STATE" type="VARCHAR2" size="16" required="true"/> + <column name="IS_VOLATILE" type="BOOLEAN" required="true"/> + <column name="JOB_NAME" type="VARCHAR2" size="80" required="false"/> + <column name="JOB_GROUP" type="VARCHAR2" size="80" required="false"/> + <column name="IS_STATEFUL" type="BOOLEAN" required="false"/> + <column name="REQUESTS_RECOVERY" type="BOOLEAN" required="false"/> + + <!-- Quartz docs recommend these indexes. --> + <index name="RHQ_QRTZ_FIRED_TRGRS_TN_IDX"> + <field ref="TRIGGER_NAME"/> + </index> + <index name="RHQ_QRTZ_FIRED_TRGRS_TG_IDX"> + <field ref="TRIGGER_GROUP"/> + </index> + <index name="RHQ_QRTZ_FIRED_TRGRS_TN_TG_IDX"> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </index> + <index name="RHQ_QRTZ_FIRED_TRGRS_IN_IDX"> + <field ref="INSTANCE_NAME"/> + </index> + <index name="RHQ_QRTZ_FIRED_TRGRS_JN_IDX"> + <field ref="JOB_NAME"/> + </index> + <index name="RHQ_QRTZ_FIRED_TRGRS_JG_IDX"> + <field ref="JOB_GROUP"/> + </index> + + </table> + + <table name="RHQ_QRTZ_CALENDARS"> + <column name="CALENDAR_NAME" primarykey="true" type="VARCHAR2" size="80" required="true"/> + <column name="CALENDAR" type="BLOB" required="true"/> + </table> + + <table name="RHQ_QRTZ_PAUSED_TRIGGER_GRPS"> + <column name="TRIGGER_GROUP" primarykey="true" type="VARCHAR2" size="80" required="true"/> + </table> + + <table name="RHQ_QRTZ_SCHEDULER_STATE"> + <column name="INSTANCE_NAME" primarykey="true" type="VARCHAR2" size="80" required="true"/> + <column name="LAST_CHECKIN_TIME" type="LONG" required="true"/> + <column name="CHECKIN_INTERVAL" type="LONG" required="true"/> + <column name="RECOVERER" type="VARCHAR2" size="80" required="false"/> + </table> + + <table name="RHQ_QRTZ_LOCKS"> + <column name="LOCK_NAME" primarykey="true" type="VARCHAR2" size="40" required="true"/> + <data LOCK_NAME="TRIGGER_ACCESS"/> + <data LOCK_NAME="JOB_ACCESS"/> + <data LOCK_NAME="CALENDAR_ACCESS"/> + <data LOCK_NAME="STATE_ACCESS"/> + <data LOCK_NAME="MISFIRE_ACCESS"/> + </table> + +<!-- END: scheduler-schema.xml --> +<!-- BEGIN: amps-schema.xml --> + + + <table name="RHQ_PLUGIN"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="4000" type="VARCHAR2" required="false"/> + <column name="VERSION" size="200" type="VARCHAR2" required="false"/> + <column name="AMPS_VERSION" size="16" type="VARCHAR2" required="false"/> + <column name="ENABLED" type="BOOLEAN" required="true"/> + <column name="STATUS" size="16" type="VARCHAR2" required="true"/> + <column name="HELP" type="CLOB" required="false"/> + <column name="PATH" size="500" type="VARCHAR2" required="true"/> + <column name="MD5" size="100" type="VARCHAR2" required="true"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="DEPLOYMENT" size="8" type="VARCHAR2" required="true"/> + <column name="PTYPE" size="200" type="VARCHAR2" required="false"/> + <column name="PLUGIN_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> + <column name="JOBS_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> + <column name="CONTENT" type="BLOB" required="false"/> + + <index name="RHQ_PLUGIN_NAME_DEPLOY_IDX" unique="true"> + <field ref="NAME"/> + <field ref="DEPLOYMENT"/> + </index> + </table> + +<!-- END: amps-schema.xml --> +<!-- BEGIN: measurement-schema.xml --> + + <table name="RHQ_MEASUREMENT_DEF"> + + <!-- === required columns === --> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE(ID)"/> + <column name="NAME" type="VARCHAR2" size="100" required="true"/> + + <!-- === optional columns === --> + <!-- an OSGI version range - if null, the metric def applies to all versions of the associated resource type --> + <column name="RESOURCE_VERSION_RANGE" type="VARCHAR2" size="100"/> + <column name="CATEGORY" type="SMALLINT"/> + <column name="UNITS" type="SMALLINT"/> + <column name="NUMERIC_TYPE" type="SMALLINT"/> + <column name="DISPLAY_TYPE" type="SMALLINT"/> + <column name="DATA_TYPE" type="SMALLINT"/> + <column name="RAW_NUMERIC_TYPE" type="SMALLINT"/> + <column name="DEFAULT_ON" type="BOOLEAN" default="false"/> + <column name="DEFAULT_INTERVAL" type="LONG" /> + <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> + <column name="DISPLAY_ORDER" type="INTEGER" default="1000"/> + <column name="DESCRIPTION" type="VARCHAR2" size="500"/> + <column name="DESTINATION_TYPE" type="VARCHAR2" size="100"/> + + <column name="VERSION" type="INTEGER"/> + <!-- for optimistic locking --> + + <!-- === business key (RESOURCE_TYPE_ID + NAME + RAW_NUMERIC_TYPE) === --> + <index name="RHQ_METRIC_DEF_KEY_IDX" unique="true"> + <field ref="RESOURCE_TYPE_ID"/> + <field ref="NAME"/> + <field ref="RAW_NUMERIC_TYPE"/> + </index> + <index name="RHQ_METRIC_DEF_NT_IDX"> + <field ref="NUMERIC_TYPE"/> + </index> + </table> + + + <table name="RHQ_MEASUREMENT_SCHED"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + + <column name="ENABLED" type="BOOLEAN" default="false"/> + <column name="MTIME" type="LONG" /> + <column name="DEFINITION" type="INTEGER" references="RHQ_MEASUREMENT_DEF(ID)"/> + <column name="VERSION" type="INTEGER" /> + <column name="COLL_INTERVAL" type="LONG" /> + <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE(ID)"/> + <index name="RHQ_MEAS_SCHED_UNIQ" unique="true"> + <field ref="RESOURCE_ID"/> + <field ref="DEFINITION"/> + </index> + <index name="RHQ_MEAS_SCHED_RESID_IDX"> + <field ref="RESOURCE_ID"/> + </index> + </table> + + + <table name="RHQ_MEASUREMENT_BLINE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + + <column name="BL_USER_ENTERED" type="BOOLEAN" default="false" required="true"/> + <column name="BL_MIN" type="DOUBLE" required="true"/> + <column name="BL_MAX" type="DOUBLE" required="true"/> + <column name="BL_MEAN" type="DOUBLE" required="true"/> + <column name="BL_COMPUTE_TIME" type="LONG" required="true"/> + <column name="SCHEDULE_ID" type="INTEGER" required="true" references="RHQ_MEASUREMENT_SCHED(ID)"/> + <index name="RHQ_MEAS_BASELINE_CTIME_IDX"> + <field ref="BL_COMPUTE_TIME"/> + </index> + <index name="RHQ_MEAS_BASELINE_SID_IDX"> + <field ref="SCHEDULE_ID"/> + </index> + </table> + + + <table name="RHQ_MEASUREMENT_DATA_NUM_1H" logging="false" cache="true" + tablespace="@@@LARGE_TABLESPACE_FOR_DATA@@@" storage-options="freelists 20"> + + <column name="TIME_STAMP" required="true" type="LONG"/> + <column name="SCHEDULE_ID" required="true" type="INTEGER"/> + <column name="VALUE" required="false" type="DOUBLE"/> + <column name="MINVALUE" required="false" type="DOUBLE"/> + <column name="MAXVALUE" required="false" type="DOUBLE"/> + + <constraint name="RHQ_MEAS_DATA_1H_ID_TIME_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + + <index name="RHQ_MEAS_DATA_1H_TIME_IDX"> + <field ref="TIME_STAMP"/> + </index> + </table> + + + <table name="RHQ_MEASUREMENT_DATA_NUM_6H" logging="false" cache="true" + tablespace="@@@LARGE_TABLESPACE_FOR_DATA@@@" storage-options="freelists 20"> + + <column name="TIME_STAMP" required="true" type="LONG"/> + <column name="SCHEDULE_ID" required="true" type="INTEGER"/> + <column name="VALUE" required="false" type="DOUBLE"/> + <column name="MINVALUE" required="false" type="DOUBLE"/> + <column name="MAXVALUE" required="false" type="DOUBLE"/> + + <constraint name="RHQ_MEAS_DATA_6H_ID_TIME_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + + <index name="RHQ_MEAS_DATA_6H_TIME_IDX"> + <field ref="TIME_STAMP"/> + </index> + </table> + + + <table name="RHQ_MEASUREMENT_DATA_NUM_1D" logging="false" cache="true" + tablespace="@@@LARGE_TABLESPACE_FOR_DATA@@@" storage-options="freelists 20"> + + <column name="TIME_STAMP" required="true" type="LONG"/> + <column name="SCHEDULE_ID" required="true" type="INTEGER"/> + <column name="VALUE" required="false" type="DOUBLE"/> + <column name="MINVALUE" required="false" type="DOUBLE"/> + <column name="MAXVALUE" required="false" type="DOUBLE"/> + + <constraint name="RHQ_MEAS_DATA_1D_ID_TIME_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + + <index name="RHQ_MEAS_DATA_1D_TIME_IDX"> + <field ref="TIME_STAMP" /> + </index> + </table> + + + <table name="RHQ_MEASUREMENT_DATA_TRAIT"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER" /> + <column name="VALUE" type="VARCHAR2" size="4000" /> + <constraint name="RHQ_MEAS_DATA_TRAIT_ID_TIME_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + + + <table name="RHQ_CALLTIME_DATA_KEY"> + <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> + <column name="SCHEDULE_ID" type="INTEGER" required="true"/> + <column name="CALL_DESTINATION" type="VARCHAR2" size="4000" required="true"/> + <index name="RHQ_CALLTIME_DATA_KEY_IDX" unique="true"> + <field ref="SCHEDULE_ID"/> + <field ref="CALL_DESTINATION"/> + </index> + </table> + + + <table name="RHQ_CALLTIME_DATA_VALUE"> + <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> + <column name="KEY_ID" type="INTEGER" references="RHQ_CALLTIME_DATA_KEY" required="true"/> + <column name="BEGIN_TIME" type="LONG" required="true"/> + <column name="END_TIME" type="LONG" required="true"/> + <column name="MINIMUM" type="DOUBLE" required="true"/> + <column name="MAXIMUM" type="DOUBLE" required="true"/> + <column name="TOTAL" type="DOUBLE" required="true"/> + <column name="COUNT" type="LONG" required="true"/> + <index name="RHQ_CT_DA_VA_END_TIM_IDX"> + <field ref="END_TIME"/> + </index> + </table> + + + <table name="RHQ_AVAILABILITY"> + <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE(ID)"/> + <column name="START_TIME" type="LONG" required="true" /> + <column name="END_TIME" type="LONG" required="false" /> + <column name="AVAILABILITY_TYPE" type="SMALLINT" required="false" /> + <index name="RHQ_AVAIL_RESOURCE_START_IDX"> + <field ref="RESOURCE_ID"/> + <field ref="START_TIME"/> + </index> + <!-- only one null row can exist for any resource --> + <index name="RHQ_AVAIL_RESOURCE_END_IDX" condition="END_TIME IS NULL"> + <field ref="RESOURCE_ID"/> + <field ref="END_TIME" /> + </index> + </table> + + <table name="RHQ_RESOURCE_AVAIL"> + <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE(ID)" ondelete="cascade"/> + <column name="AVAILABILITY_TYPE" type="SMALLINT" required="false" /> + <index name="RHQ_RESOURCE_AVAIL_IDX"> + <field ref="RESOURCE_ID" /> + </index> + </table> + + <table name="RHQ_MEASUREMENT_OOB"> + <column name="SCHEDULE_ID" type="INTEGER" references="RHQ_MEASUREMENT_SCHED(ID)" required="true"/> + <column name="TIME_STAMP" type="LONG" required="true"/> + <column name="OOB_FACTOR" type="INTEGER" required="true" /> + <constraint name="RHQ_MEAS_OOB_ID_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_MEASUREMENT_OOB_TMP"> + <column name="SCHEDULE_ID" type="INTEGER" required="true"/> + <column name="TIME_STAMP" type="LONG" required="true"/> + <column name="OOB_FACTOR" type="INTEGER" required="true" /> + <constraint name="RHQ_MEAS_OOB_TMP_ID_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_NUMBERS"> + <column name="i" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true" /> + </table> + + + <table name="RHQ_MEAS_DATA_NUM_R00"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R00_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R00_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R01"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R01_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R01_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R02"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R02_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R02_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R03"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R03_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R03_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R04"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R04_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R04_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R05"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R05_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R05_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R06"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R06_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R06_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R07"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R07_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R07_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R08"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R08_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R08_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R09"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R09_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R09_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R10"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R10_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R10_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R11"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R11_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R11_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R12"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R12_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R12_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R13"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R13_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R13_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R14"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R14_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R14_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + +<!-- END: measurement-schema.xml --> +<!-- BEGIN: content-schema.xml --> + + + <table name="RHQ_ARCHITECTURE"> + <column name="ID" default="sequence-only" initial="100" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="50" type="VARCHAR2" required="true"/> + <index name="RHQ_ARCHITECTURE_NAME_IDX" unique="true"> + <field ref="NAME"/> + </index> + </table> + + <table name="RHQ_REPO_GROUP_TYPE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + </table> + + + <table name="RHQ_REPO_GROUP"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + + <column name="REPO_GROUP_TYPE_ID" type="INTEGER" references="RHQ_REPO_GROUP_TYPE" required="true"/> + + <index name="RHQ_REPO_GROUP_IDX" unique="true"> + <field ref="NAME"/> + <field ref="REPO_GROUP_TYPE_ID"/> + </index> + </table> + + + <table name="RHQ_CONTENT_SOURCE_TYPE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="false"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="PLUGIN_NAME" size="100" type="VARCHAR2" required="false"/> + <!-- we might want this as part of natural key --> + <column name="DEFAULT_LAZY_LOAD" type="BOOLEAN" required="true"/> + <column name="DEFAULT_DOWNLOAD_MODE" size="16" type="VARCHAR2" required="true"/> + <column name="DEFAULT_SYNC_SCHEDULE" size="64" type="VARCHAR2" required="false"/> + <column name="API_CLASS" size="100" type="VARCHAR2" required="true"/> + + <column name="SOURCE_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF" required="false"/> + + <index name="RHQ_CONTENT_SOURCE_TYPE_IDX" unique="true"> + <field ref="NAME"/> + <!-- <field ref="PLUGIN_NAME"/> --> + </index> + </table> + + <table name="RHQ_CONTENT_SOURCE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="LAZY_LOAD" type="BOOLEAN" required="true"/> + <column name="DOWNLOAD_MODE" size="16" type="VARCHAR2" required="true"/> + <column name="SYNC_SCHEDULE" size="64" type="VARCHAR2" required="false"/> + <column name="LOAD_ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="CREATION_TIME" type="LONG" required="true"/> + <column name="LAST_MODIFIED_TIME" type="LONG" required="true"/> + + <column name="CONTENT_SOURCE_TYPE_ID" type="INTEGER" references="RHQ_CONTENT_SOURCE_TYPE" required="true"/> + <column name="CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> + + <index name="RHQ_CONTENT_SOURCE_IDX" unique="true"> + <field ref="NAME"/> + <field ref="CONTENT_SOURCE_TYPE_ID"/> + </index> + </table> + + <table name="RHQ_REPO"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="CREATION_TIME" type="LONG" required="true"/> + <column name="LAST_MODIFIED_TIME" type="LONG" required="true"/> + <column name="IS_CANDIDATE" type="BOOLEAN" required="true"/> + <column name="SYNC_SCHEDULE" size="64" type="VARCHAR2" required="false"/> + <column name="OWNER_ID" type="INTEGER" required="false" references="RHQ_SUBJECT" /> + <column name="IS_PRIVATE" type="BOOLEAN" required="true" /> + + <index name="RHQ_REPO_IDX" unique="true"> + <field ref="NAME"/> + </index> + </table> + + + <table name="RHQ_REPO_RELATION_TYPE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + </table> + + + <table name="RHQ_REPO_RELATION"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="RELATED_REPO_ID" type="INTEGER" references="RHQ_REPO" required="true"/> + <column name="REPO_RELATION_TYPE_ID" type="INTEGER" references="RHQ_REPO_RELATION_TYPE" required="true"/> + </table> + + + + <table name="RHQ_PACKAGE_TYPE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="false"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="CATEGORY" size="50" type="VARCHAR2" required="false"/> + <column name="DISCOVERY_INTERVAL" type="INTEGER" required="false"/> + <column name="IS_CREATION_DATA" type="BOOLEAN" required="true"/> + <column name="SUPPORTS_ARCHITECTURE" type="BOOLEAN" required="true"/> + + <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE" required="false"/> + <column name="DEPLOYMENT_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF" required="false"/> + <column name="PACKAGE_EXTRA_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG_DEF" required="false"/> + + <index name="RHQ_PACKAGE_TYPE_IDX" unique="true"> + <field ref="NAME"/> + <field ref="RESOURCE_TYPE_ID"/> + </index> + + </table> + + <table name="RHQ_PACKAGE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="CLASSIFICATION" size="200" type="VARCHAR2" required="false"/> + + <column name="PACKAGE_TYPE_ID" type="INTEGER" references="RHQ_PACKAGE_TYPE" required="true"/> + + <index name="RHQ_PACKAGE_IDX" unique="true"> + <field ref="NAME"/> + <field ref="PACKAGE_TYPE_ID"/> + </index> + </table> + + <table name="RHQ_PACKAGE_BITS"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="BITS" type="LARGEOBJECT" required="false"/> + </table> + + <table name="RHQ_PACKAGE_VERSION"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="false"/> + <column name="SHORT_DESCRIPTION" size="10000" type="CLOB" required="false"/> + <column name="LONG_DESCRIPTION" size="50000" type="CLOB" required="false"/> + <column name="VERSION" size="500" type="VARCHAR2" required="true"/> + <column name="DISPLAY_VERSION" size="500" type="VARCHAR2" required="false"/> + <column name="FILE_NAME" size="255" type="VARCHAR2" required="false"/> + <column name="FILE_SIZE" type="LONG" required="false"/> + <column name="FILE_MD5" size="32" type="VARCHAR2" required="false"/> + <column name="FILE_SHA256" size="64" type="VARCHAR2" required="false"/> + <column name="FILE_CREATION_TIME" type="LONG" required="false"/> + <column name="LICENSE_NAME" size="255" type="VARCHAR2" required="false"/> + <column name="LICENSE_VERSION" size="20" type="VARCHAR2" required="false"/> + <column name="METADATA" type="BLOB" required="false"/> + + <column name="PACKAGE_ID" type="INTEGER" references="RHQ_PACKAGE" required="true"/> + <column name="ARCHITECTURE_ID" type="INTEGER" references="RHQ_ARCHITECTURE" required="true"/> + <column name="CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> + <column name="PACKAGE_BITS_ID" type="INTEGER" references="RHQ_PACKAGE_BITS" required="false"/> + + <index name="RHQ_PACKAGE_VERSION_IDX" unique="true"> + <field ref="PACKAGE_ID"/> + <field ref="VERSION"/> + <field ref="ARCHITECTURE_ID"/> + </index> + + </table> + + <table name="RHQ_CONTENT_REQ"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="REQUEST_TYPE" type="VARCHAR2" required="true" size="20"/> + <column name="NOTES" type="VARCHAR2" required="false" size="512"/> + </table> + + <table name="RHQ_INSTALLED_PACKAGE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="INSTALLATION_TIME" type="LONG" required="false"/> + + <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE" required="true"/> + <column name="PACKAGE_VERSION_ID" type="INTEGER" references="RHQ_PACKAGE_VERSION" required="true"/> + <column name="SUBJECT_ID" type="INTEGER" references="RHQ_SUBJECT" required="false"/> + </table> + + <table name="RHQ_INSTALLED_PKG_HIST"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="STATUS" type="VARCHAR2" size="24" required="true"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="HISTORY_TIMESTAMP" type="LONG" required="false"/> + + <column name="PACKAGE_VERSION_ID" type="INTEGER" references="RHQ_PACKAGE_VERSION" required="true"/> + <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE" required="true"/> + <column name="DEPLOYMENT_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> + <column name="CONTENT_SERVICE_REQUEST_ID" type="INTEGER" references="RHQ_CONTENT_REQ" required="false"/> + </table> + + <table name="RHQ_CONTENT_SRC_SYNC"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="STATUS" type="VARCHAR2" size="16" required="true"/> + <column name="START_TIME" type="LONG" required="true"/> + <column name="END_TIME" type="LONG" required="false"/> + <column name="RESULTS" type="LONGVARCHAR" required="false"/> + <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> + </table> + + <table name="RHQ_REPO_SYNC"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="STATUS" type="VARCHAR2" size="16" required="true"/> + <column name="START_TIME" type="LONG" required="true"/> + <column name="END_TIME" type="LONG" required="false"/> + <column name="RESULTS" type="LONGVARCHAR" required="false"/> + <column name="PERCENT_COMPLETE" type="LONG" required="false"/> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + </table> + + + <table name="RHQ_PACKAGE_INST_STEP"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="STEP_KEY" type="VARCHAR2" size="500" required="true"/> + <column name="STEP_ORDER" type="INTEGER" required="true"/> + <column name="DESCRIPTION" type="VARCHAR2" size="4000" required="true"/> + <column name="ERROR_MSG" type="LONGVARCHAR" required="false"/> + <column name="RESULT" type="VARCHAR2" size="25" required="true"/> + + <column name="INSTALLED_PKG_HIST_ID" type="INTEGER" references="RHQ_INSTALLED_PKG_HIST"/> + </table> + + <table name="RHQ_REPO_RESOURCE_MAP"> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_REPO_RESOURCE_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="RESOURCE_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_REPO_CONTENT_SRC_MAP"> 1 + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_REPO_CONTENT_SRC_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="CONTENT_SRC_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_REPO_REPO_GROUP_MAP"> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="REPO_GROUP_ID" type="INTEGER" required="true" references="RHQ_REPO_GROUP"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_REPO_REPO_GROUP_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="REPO_GROUP_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_REPO_REPO_RELATION_MAP"> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="REPO_RELATION_ID" type="INTEGER" required="true" references="RHQ_REPO_RELATION"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_REPO_REPO_RELATION_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="REPO_RELATION_ID"/> + </primaryKey> + </constraint> + </table> + + + <table name="RHQ_REPO_PKG_VERSION_MAP"> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_REPO_PKG_VER_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="PACKAGE_VERSION_ID"/> + </primaryKey> + </constraint> + <index name="RHQ_REPO_PKG_VER_MAP_IDX" unique="false"> + <field ref="PACKAGE_VERSION_ID"/> + </index> + </table> + + <table name="RHQ_PKG_VER_CONTENT_SRC_MAP"> + <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> + <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> + <column name="LOCATION" type="VARCHAR2" size="4000" required="true"/> + + <constraint name="RHQ_PKG_VER_CONTENT_SRC_KEY"> + <primaryKey> + <field ref="PACKAGE_VERSION_ID"/> + <field ref="CONTENT_SRC_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_PKG_PRD_MAP"> + <column name="PKG_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> + <column name="PRD_ID" type="INTEGER" required="true" references="RHQ_PRD_VER"/> + + <constraint name="RHQ_PKG_PRD_KEY"> + <primaryKey> + <field ref="PKG_ID"/> + <field ref="PRD_ID"/> + </primaryKey> + </constraint> + + </table> + + <table name="RHQ_DISTRIBUTION_TYPE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + + </table> + + <table name="RHQ_DISTRIBUTION"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="DISTRIBUTION_TYPE_ID" type="INTEGER" required="true" references="RHQ_DISTRIBUTION_TYPE"/> + <column name="LABEL" size="64" type="VARCHAR2" required="true"/> + <column name="BASE_PATH" size="256" type="VARCHAR2" required="true"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + + <index name="RHQ_DISTRIBUTION_IDX" unique="true"> + <field ref="LABEL"/> + <field ref="BASE_PATH"/> + </index> + + </table> + + <table name="RHQ_REPO_DISTRIBUTION"> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="DISTRIBUTION_ID" type="INTEGER" required="true" references="RHQ_DISTRIBUTION"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + + <constraint name="RHQ_REPO_DIST_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="DISTRIBUTION_ID"/> + </primaryKey> + </constraint> + </table> + + + + <table name="RHQ_DISTRIBUTION_FILE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="DISTRIBUTION_ID" type="INTEGER" required="true" references="RHQ_DISTRIBUTION"/> + <column name="RELATIVE_FILENAME" size="256" type="VARCHAR2" required="true"/> + <!--<column name="FILE_SIZE" type="NUMBER" required="true"/>--> + <column name="MD5SUM" size="64" type="VARCHAR2" required="true"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + <!--<column name="CTIME" type="LONG" required="true"/>--> + + <index name="RHQ_DISTRIBUTION_FILE_IDX" unique="true"> + <field ref="DISTRIBUTION_ID"/> + <field ref="RELATIVE_FILENAME"/> + </index> + </table> + + + + + <table name="RHQ_ADVISORY"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="ADVISORY" size="64" type="VARCHAR2" required="true"/> + <column name="ADVISORY_TYPE" size="64" type="VARCHAR2" required="true" /> + <column name="ADVISORY_REL" size="64" type="VARCHAR2" required="false"/> + <column name="ADVISORY_NAME" size="64" type="VARCHAR2" required="false"/> + <column name="DESCRIPTION" size="4000" type="VARCHAR2" required="false"/> + <column name="SYNOPSIS" size="4000" type="VARCHAR2" required="true"/> + <column name="TOPIC" size="4000" type="VARCHAR2" required="false"/> + <column name="SOLUTION" size="4000" type="VARCHAR2" required="false"/> + <column name="SEVERITY" size="64" type="VARCHAR2" required="false"/> + <column name="ISSUE_DATE" type="LONG" required="false"/> + <column name="UPDATE_DATE" type="LONG" required="false"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + + <index name="RHQ_ADVISORY_NAME_UQ" unique="true"> + <field ref="ADVISORY_NAME"/> + </index> + + <index name="RHQ_ADVISORY_UQ" unique="true"> + <field ref="ADVISORY"/> + </index> + + <index name="RHQ_ADVISORY_UDATE_IDX" unique="false"> + <field ref="UPDATE_DATE"/> + </index> + </table> + + <table name="RHQ_ADVISORY_PACKAGE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> + <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + + <index name="RHQ_ADVISORY_PKG_IDX" unique="true"> + <field ref="ADVISORY_ID"/> + <field ref="PACKAGE_VERSION_ID"/> + </index> + </table> + + <table name="RHQ_CVE"> + <column name="ID" default="sequence-only" initial="101" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="64" type="VARCHAR2" required="true"/> + </table> + + <table name="RHQ_ADVISORY_CVE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> + <column name="CVE_ID" type="INTEGER" required="true" references="RHQ_CVE"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + + <index name="RHQ_ADVISORY_CVE_IDX" unique="true"> + <field ref="ADVISORY_ID"/> + <field ref="CVE_ID"/> + </index> + + </table> + + <table name="RHQ_ADVISORY_BUGLIST"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> + <column name="BUG_ID" size="256" type="VARCHAR2" required="true"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + + <index name="RHQ_ADVISORY_BUG_IDX" unique="true"> + <field ref="ADVISORY_ID"/> + <field ref="BUG_ID"/> + </index> + </table> + + + <table name="RHQ_REPO_ADVISORY"> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + + <constraint name="RHQ_REPO_ADV_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="ADVISORY_ID"/> + </primaryKey> + </constraint> + </table> + + <!-- BUNDLE_TYPE is things like "Cobbler profile" or "file-based bundle" or "puppet recipe" --> + <table name="RHQ_BUNDLE_TYPE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> + + <!-- This index is for constraint, not performance --> + <index name="RHQ_BUNDLE_TYPE_UNIQUE" unique="true"> + <field ref="NAME"/> + </index> + </table> + + <!-- BUNDLE is a named piece of content that can be versioned and installed somewhere --> + <table name="RHQ_BUNDLE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="BUNDLE_TYPE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_TYPE"/> + <column name="PACKAGE_TYPE_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_TYPE"/> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + + <!-- This index is for constraint, not performance --> + <index name="RHQ_BUNDLE_UNIQUE" unique="true"> + <field ref="BUNDLE_TYPE_ID"/> + <field ref="NAME"/> + </index> + </table> + + <!-- BUNDLE_VERSION represents an actual piece of content that needs to be installed somewhere --> + <table name="RHQ_BUNDLE_VERSION"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="VERSION" size="500" type="VARCHAR2" required="true"/> + <column name="VERSION_ORDER" type="INTEGER" required="true"/> + <column name="ACTION" type="CLOB" required="true"/> + <column name="CONFIG_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_DEF" /> + <column name="BUNDLE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE"/> + + <!-- This index is for constraint, not performance --> + <index name="RHQ_BUNDLE_VERSION_UNIQUE" unique="true"> + <field ref="BUNDLE_ID"/> + <field ref="NAME"/> + <field ref="VERSION"/> + </index> + </table> + + <!-- Many-to-many table that links many repos to a particular bundle version. destination platforms --> + <!-- would be required to have associations to the specified repos (to access required content --> + <table name="RHQ_BUNDLE_VERSION_REPO"> + <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + + <constraint name="RHQ_BUNDLE_VERSION_REPO_KEY"> + <primaryKey> + <field ref="BUNDLE_VERSION_ID"/> + <field ref="REPO_ID"/> + </primaryKey> + </constraint> + </table> + + <!-- BUNDLE_FILE represents a file that is associated with (possibly bundled inside) a bundle version --> + <table name="RHQ_BUNDLE_FILE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> + <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> + </table> + + <!-- A logical destination for a bundle deployment. Defines the platforms and directory on those targets. --> + <table name="RHQ_BUNDLE_DESTINATION"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="BUNDLE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE"/> + <column name="GROUP_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_GROUP"/> + <column name="DEPLOY_DIR" size="256" type="VARCHAR2" required="true"/> + <column name="DEST_BASE_DIR_NAME" size="200" type="VARCHAR2" required="true"/> + + <!-- This index is for constraint, not performance --> + <index name="RHQ_BUNDLE_DESTINATION_UNIQUE" unique="true"> + <field ref="BUNDLE_ID"/> + <field ref="GROUP_ID"/> + <field ref="DEPLOY_DIR"/> + </index> + </table> + + <!-- An actual deployment of a bundle version to a destination, with a specific config. Bundle deployments + can differ only on ctime, which is assumed to be different --> + <table name="RHQ_BUNDLE_DEPLOYMENT"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> + <column name="BUNDLE_DESTINATION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DESTINATION"/> + <column name="CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG" /> + <column name="SUBJECT_NAME" type="VARCHAR2" required="false" size="255"/> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="IS_LIVE" type="BOOLEAN" required="true"/> + <column name="REPLACED_BUNDLE_DEPLOYMENT_ID" type="INTEGER" required="false" references="RHQ_BUNDLE_DEPLOYMENT"/> + </table> + + <!-- Represents a bundle version that is deployed on a platform resource --> + <table name="RHQ_BUNDLE_RES_DEPLOY"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="BUNDLE_DEPLOYMENT_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DEPLOYMENT" /> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE" /> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="CTIME" type="LONG" required="true"/> + + <index name="RHQ_BUNDLE_RES_DEPLOY_IDX" unique="true"> + <field ref="BUNDLE_DEPLOYMENT_ID"/> + <field ref="RESOURCE_ID"/> + </index> + </table> + + <table name="RHQ_BUNDLE_RES_DEP_HIST"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="BUNDLE_RES_DEPLOY_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_RES_DEPLOY" /> + <column name="SUBJECT_NAME" required="false" size="255" type="VARCHAR2"/> + <column name="AUDIT_TIME" required="true" type="LONG"/> + <column name="ACTION" required="true" size="128" type="VARCHAR2"/> + <column name="INFO" required="true" size="512" type="VARCHAR2"/> + <column name="CATEGORY" required="false" size="32" type="VARCHAR2"/> + <column name="STATUS" required="true" type="VARCHAR2" size="16"/> + <column name="MESSAGE" required="false" type="LONGVARCHAR"/> + <column name="ATTACHMENT" required="false" type="LONGVARCHAR"/> + </table> + + <table name="RHQ_TAGGING_BUNDLE_MAP"> + <column name="BUNDLE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE"/> + <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> + <constraint name="RHQ_TAGGING_BUNDLE_MAP_KEY"> + <primaryKey> + <field ref="BUNDLE_ID"/> + <field ref="TAG_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_TAGGING_BUNDLE_VERSION_MAP"> + <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> + <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> + <constraint name="RHQ_TAGGING_BUNDLE_VER_MAP_KEY"> + <primaryKey> + <field ref="BUNDLE_VERSION_ID"/> + <field ref="TAG_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_TAGGING_BUNDLE_DEPLOY_MAP"> + <column name="BUNDLE_DEPLOYMENT_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DEPLOYMENT"/> + <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> + <constraint name="RHQ_TAGGING_BUNDLE_DEP_MAP_KEY"> + <primaryKey> + <field ref="BUNDLE_DEPLOYMENT_ID"/> + <field ref="TAG_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_TAGGING_BUNDLE_DEST_MAP"> + <column name="BUNDLE_DESTINATION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DESTINATION"/> + <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> + <constraint name="RHQ_TAGGING_BUNDLE_DES_MAP_KEY"> + <primaryKey> + <field ref="BUNDLE_DESTINATION_ID"/> + <field ref="TAG_ID"/> + </primaryKey> + </constraint> + </table> + + <!-- Drift Management Tables --> + <table name="RHQ_DRIFT_DEF_TEMPLATE"> + <column name="ID" default="sequence-only" initial="1001" primarykey="true" required="true" type="INTEGER"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> + <column name="CONFIG_ID" type="INTEGER" required="true" references="RHQ_CONFIG"/> + <column name="NAME" type="VARCHAR2" size="128" required="true"/> + <column name="DESCRIPTION" type="VARCHAR2" size="512" required="false"/> + <!-- true if defined by user, false if provided by plugin --> + <column name="IS_USER_DEFINED" type="BOOLEAN" required="true"/> + <!-- + Change sets are managed by the drift server plugins; therefore, we cannot maintain + a FK constraint on the change set id. And the type cannot be integer because + other back ends like MongoDB use other types that are basically variants of a + UUID + + jsanda + --> + <column name="DRIFT_CHANGE_SET_ID" type="VARCHAR2" size="64" required="false"/> + <column name="CTIME" type="LONG" required="true"/> + + <index name="RHQ_DRIFT_DEF_TEMPLATE_UNIQUE" unique="true"> + <field ref="RESOURCE_TYPE_ID"/> + <field ref="NAME"/> + </index> + </table> + + <!-- Content of a file being managed for drift. Used for diff and/or remediation --> + <table name="RHQ_DRIFT_FILE"> + <column name="HASH_ID" type="VARCHAR2" size="64" primarykey="true" required="true"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="DATA" type="LARGEOBJECT" required="false"/> + <column name="DATA_SIZE" type="LONG" required="false"/> + <column name="STATUS" type="VARCHAR2" size="20" required="true"/> + </table> + + <!-- A single drift definition defining file tracking + Note: A resource or group (todo: group, other?) can have zero or more drift configurations. + Note: The name, interval and is_enabled values are also stored withing the referenced config. + This allows us to use the config editor to manipulate all fields. + Note: Name is read-only + Note: Interval unit is millis + --> + <table name="RHQ_DRIFT_DEFINITION"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="CONFIG_ID" type="INTEGER" required="true" references="RHQ_CONFIG"/> + <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> + <column name="DRIFT_DEF_TEMPLATE_ID" type="INTEGER" required="false" references="RHQ_DRIFT_DEF_TEMPLATE"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="NAME" type="VARCHAR2" size="512" required="true"/> + <column name="DESCRIPTION" type="VARCHAR2" size="512" required="false"/> + <column name="INTERVAL" type="LONG" required="true"/> + <column name="IS_ENABLED" type="BOOLEAN" required="true"/> + <column name="DRIFT_HANDLING_MODE" type="VARCHAR2" size="20" required="true"/> + <column name="IS_PINNED" type="BOOLEAN" required="true"/> + <column name="IS_ATTACHED" type="BOOLEAN" required="true"/> + <column name="COMPLIANCE_STATUS" type="INTEGER" required="true"/> + </table> + + <!-- A set of drift records (note, this is for the JPA server plugin impl only) --> + <table name="RHQ_DRIFT_SET"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + </table> + + <!-- A drift change-set report for a resource (note, this is for the JPA server plugin impl only) --> + <table name="RHQ_DRIFT_CHANGE_SET"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="DRIFT_SET_ID" type="INTEGER" required="false" references="RHQ_DRIFT_SET"/> + <column name="CTIME" type="LONG" required="true"/> + <!-- Version 0 is initial change-set --> + <column name="VERSION" type="INTEGER" required="true"/> + <column name="CATEGORY" type="VARCHAR2" size="20" required="true"/> + <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> + <column name="DRIFT_DEFINITION_ID" type="INTEGER" required="false" references="RHQ_DRIFT_DEFINITION"/> + <!-- the drift handling mode at changeset creation time --> + <column name="DRIFT_HANDLING_MODE" type="VARCHAR2" size="20" required="true"/> + </table> + + <!-- A single occurence of drift for a resource (note, this is for the JPA server plugin impl only) --> + <table name="RHQ_DRIFT"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="CATEGORY" type="VARCHAR2" size="20" required="true"/> + <column name="DRIFT_SET_ID" type="INTEGER" required="false" references="RHQ_DRIFT_SET"/> + <column name="DRIFT_CHANGE_SET_ID" type="INTEGER" required="true" references="RHQ_DRIFT_CHANGE_SET"/> + <!-- the file path not including the base directory --> + <column name="PATH" type="VARCHAR2" size="1024" required="true"/> + <!-- the same as PATH less [/]filename.ext. Redundant storage for the purpose of strict directory search. + this field can be considered transient for serialization purposes --> + <column name="PATH_DIRECTORY" type="VARCHAR2" size="1024" required="true"/> + <column name="OLD_DRIFT_FILE" type="VARCHAR2" size="64" required="false" references="RHQ_DRIFT_FILE"/> + <column name="NEW_DRIFT_FILE" type="VARCHAR2" size="64" required="false" references="RHQ_DRIFT_FILE"/> + </table> + + +<!-- END: content-schema.xml --> +<!-- BEGIN: resource-request-schema.xml --> + + + <table name="RHQ_CREATE_RES_HIST"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="PARENT_RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> + <column name="CREATED_RESOURCE_NAME" type="VARCHAR2" size="500" required="false"/> + <column name="NEW_RESOURCE_KEY" type="VARCHAR2" required="false" size="500"/> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> + <column name="CONFIGURATION_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> + <column name="INSTALLED_PACKAGE_ID" type="INTEGER" required="false" references="RHQ_INSTALLED_PACKAGE"/> + </table> + + <table name="RHQ_DELETE_RES_HIST"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> + </table> + +<!-- END: resource-request-schema.xml --> +<!-- BEGIN: jms-schema.xml --> + +<!-- the schema matches that which would be automatically created by the JMS subsystem --> +<!-- see deploy/jms/rhq-jdbc-state-service.xml and rhq-jdbc2-service.xml --> + + + <table name="JMS_MESSAGES"> + <column name="MESSAGEID" required="true" type="INTEGER" /> + <column name="DESTINATION" required="true" type="VARCHAR2" size="255" /> + <column name="TXID" required="false" type="INTEGER" /> + <column name="TXOP" required="false" type="CHAR" size="1" /> + <column name="MESSAGEBLOB" required="false" type="BLOB" /> + + <constraint name="JMS_MESSAGES_PKEY"> + <primaryKey> + <field ref="MESSAGEID"/> + <field ref="DESTINATION"/> + </primaryKey> + </constraint> + + <index name="JMS_MESSAGES_TXOP_TXID"> + <field ref="TXOP"/> + <field ref="TXID"/> + </index> + <index name="JMS_MESSAGES_DESTINATION"> + <field ref="DESTINATION"/> + </index> + </table> + + <table name="JMS_TRANSACTIONS"> + <column name="TXID" required="true" type="INTEGER" primarykey="true" /> + </table> + + <table name="JMS_USERS"> + <column name="USERID" required="true" type="VARCHAR2" size="32" primarykey="true" /> + <column name="PASSWD" required="true" type="VARCHAR2" size="32" /> + <column name="CLIENTID" required="false" type="VARCHAR2" size="128" /> + </table> + + <table name="JMS_ROLES"> + <column name="ROLEID" required="true" type="VARCHAR2" size="32" /> + <column name="USERID" required="true" type="VARCHAR2" size="32" /> + + <constraint name="JMS_ROLES_PKEY"> + <primaryKey> + <field ref="USERID"/> + <field ref="ROLEID"/> + </primaryKey> + </constraint> + </table> + + <table name="JMS_SUBSCRIPTIONS"> + <column name="CLIENTID" required="true" type="VARCHAR2" size="128" /> + <column name="SUBNAME" required="true" type="VARCHAR2" size="128" /> + <column name="TOPIC" required="true" type="VARCHAR2" size="255" /> + <column name="SELECTOR" required="false" type="VARCHAR2" size="255" /> + + <constraint name="JMS_SUBSCRIPTIONS_PKEY"> + <primaryKey> + <field ref="CLIENTID"/> + <field ref="SUBNAME"/> + </primaryKey> + </constraint> + </table> + +<!-- END: jms-schema.xml --> +<!-- BEGIN: obsolete-schema.xml --> + + + <!-- NOTE: The tables will be dropped in the *** REVERSE ORDER *** as listed in this file! --> + <!-- NOTE: So, put the table you want dropped first at the bottom, and so on... --> + + + <!-- !!! REMOVED FROM CONTENT-SCHEMA !!!! --> + + <table name="RHQ_DRIFT_TEMPLATE_MAP"> + <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> + <column name="CONFIG_TEMPLATE_ID" type="INTEGER" required="true" references="RHQ_CONFIG_TEMPLATE"/> + </table> + + <table name="RHQ_BUNDLE_CONFIG" obsolete="true"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG" /> + <!-- this probably needs a DTYPE discriminator so we know if its a bundle or a specific bundle version --> + <column name="BUNDLE_VERSION_ID" type="INTEGER" required="false" references="RHQ_BUNDLE_VERSION"/> + <column name="BUNDLE_ID" type="INTEGER" required="false" references="RHQ_BUNDLE"/> + </table> + + <table name="RHQ_CHANNEL" obsolete="true"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="CREATION_TIME" type="LONG" required="true"/> + <column name="LAST_MODIFIED_TIME" type="LONG" required="true"/> + + <index name="RHQ_CHANNEL_IDX" unique="true"> + <field ref="NAME"/> + </index> + </table> + + <table name="RHQ_CHANNEL_RESOURCE_MAP" obsolete="true"> + <column name="CHANNEL_ID" type="INTEGER" required="true" references="RHQ_CHANNEL"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_CHANNEL_RESOURCE_MAP_KEY"> + <primaryKey> + <field ref="CHANNEL_ID"/> + <field ref="RESOURCE_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_CHANNEL_CONTENT_SRC_MAP" obsolete="true"> + <column name="CHANNEL_ID" type="INTEGER" required="true" references="RHQ_CHANNEL"/> + <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_CHAN_CONTENT_SRC_MAP_KEY"> + <primaryKey> + <field ref="CHANNEL_ID"/> + <field ref="CONTENT_SRC_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_CHANNEL_PKG_VERSION_MAP" obsolete="true"> + <column name="CHANNEL_ID" type="INTEGER" required="true" references="RHQ_CHANNEL"/> + <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_CHANNEL_PKG_VER_MAP_KEY"> + <primaryKey> + <field ref="CHANNEL_ID"/> + <field ref="PACKAGE_VERSION_ID"/> + </primaryKey> + </constraint> + </table> + + <!-- !!! REMOVED FROM MEASUREMENT-SCHEMA !!!! --> + + <table name="RHQ_MEASUREMENT_OOB" obsolete="true"> + <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> + <column name="SCHEDULE_ID" type="INTEGER" references="RHQ_MEASUREMENT_SCHED(ID)" required="true"/> + <column name="OCCURRED" type="LONG" required="true"/> + <column name="DIFF" type="DOUBLE" required="true"/> + + <index name="RHQ_MEASUREMENT_OOB_IDX" unique="true"> + <field ref="SCHEDULE_ID" /> + <field ref="OCCURRED" /> + </index> + </table> + + + <table name="RHQ_TAG" obsolete="true"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + </table> + + <table name="RHQ_REPO_TAG_MAP" obsolete="true"> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAG"/> + + <constraint name="RHQ_REPO_TAG_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="TAG_ID"/> + </primaryKey> + </constraint> + </table> + + +<!-- END: obsolete-schema.xml --> +</dbsetup> diff --git a/modules/enterprise/server/installer/src/test/resources/org/rhq/enterprise/server/installer/db-schema-combined-rhq-4.2.0.xml b/modules/enterprise/server/installer/src/test/resources/org/rhq/enterprise/server/installer/db-schema-combined-rhq-4.2.0.xml new file mode 100644 index 0000000..425a806 --- /dev/null +++ b/modules/enterprise/server/installer/src/test/resources/org/rhq/enterprise/server/installer/db-schema-combined-rhq-4.2.0.xml @@ -0,0 +1,2642 @@ +<?xml version="1.0" encoding="UTF-8"?> +<dbsetup name="schema"> +<!-- BEGIN: config-schema.xml --> + + + <!-- Definition or Metadata tables --> + + <table name="RHQ_CONFIG_DEF"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="NAME" type="VARCHAR2" required="true" size="100"/> + <column name="DESCRIPTION" type="VARCHAR2" required="false" size="250"/> + <column name="VERSION" type="VARCHAR2" required="false" size="50"/> + <column name="CONFIG_FORMAT" type="VARCHAR2" required="false" size="32"/> + </table> + + <table name="RHQ_CONFIG_PROP_GRP_DEF"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="NAME" type="VARCHAR2" required="true" size="100"/> + <column name="DISPLAY_NAME" type="VARCHAR2" required="false" size="100"/> + <column name="DESCRIPTION" type="VARCHAR2" required="false" size="250"/> + <column name="DEFAULT_HIDDEN" type="BOOLEAN" required="false"/> + <column name="ORDER_INDEX" type="INTEGER" required="false"/> + </table> + + <table name="RHQ_CONFIG_PROP_DEF"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="NAME" type="VARCHAR2" required="false" size="255"/> + <column name="DISPLAY_NAME" type="VARCHAR2" required="false" size="100"/> + <column name="DESCRIPTION" type="VARCHAR2" required="false" size="1000"/> + <column name="DEFAULT_VALUE" type="VARCHAR2" required="false" size="2000"/> + <column name="REQUIRED" type="BOOLEAN" required="false"/> + <column name="READONLY" type="BOOLEAN" required="false"/> + <column name="SUMMARY" type="BOOLEAN" required="false"/> + <column name="ACTIVATION_POLICY" type="VARCHAR2" required="false" size="20"/> + <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_GRP_DEF"/> + <column name="ORDER_INDEX" type="INTEGER" required="false"/> + <column name="VERSION" type="VARCHAR2" required="false" size="50"/> + <column name="PARENT_MAP_DEFINITION_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> + <column name="PARENT_LIST_DEFINITION_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> + <column name="SIMPLE_TYPE" type="VARCHAR2" required="false" size="20"/> + <column name="ALLOW_CUSTOM_ENUM_VALUE" type="BOOLEAN" required="false"/> + <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> + <column name="CONFIG_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_DEF"/> + + <!-- only simple properties (not lists and maps) have this --> + <column name="UNITS" type="SMALLINT" required="false"/> + + <!-- only dynamic properties (not simple) have this --> + <column name="DYNAMIC_TYPE" type="VARCHAR2" size="20" required="false"/> + <column name="DYNAMIC_KEY" type="VARCHAR2" size="128" required="false"/> + </table> + + <table name="RHQ_CONF_PROP_DEF_ENUM"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="STRING_VALUE" type="VARCHAR2" required="false" size="500"/> + <column name="ORDER_INDEX" type="INTEGER" required="false"/> + <column name="NAME" type="VARCHAR2" required="false" size="100"/> + <column name="PROPERTY_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> + </table> + + <table name="RHQ_CONFIG_PD_OSRC"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="LINK_TO_TARGET" type="BOOLEAN" required="false"/> + <column name="FILTER" type="VARCHAR2" required="false" size="40"/> + <column name="EXPRESSION" type="VARCHAR2" required="true" size="400"/> + <column name="TARGET_TYPE" type="VARCHAR2" required="true" size="20"/> + <column name="PROPERTY_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> + </table> + + <table name="RHQ_CONFIG_PROP_CONSTR"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="DTYPE" type="VARCHAR2" required="true" size="15"/> + <column name="DETAILS" type="VARCHAR2" required="false" size="250"/> + <column name="CONFIG_PROP_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> + <column name="ORDER_INDEX" type="INTEGER" required="false"/> + </table> + + + <!-- Content or value tables --> + + <table name="RHQ_CONFIG"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="NOTES" type="VARCHAR2" required="false" size="512"/> + <column name="VERSION" type="VARCHAR2" required="false" size="50"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + </table> + + <table name="RHQ_CONFIG_PROPERTY"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="CONFIGURATION_ID" type="INTEGER" required="false" references="RHQ_CONFIG" ondelete="cascade"/> + <column name="STRING_VALUE" type="VARCHAR2" required="false" size="2000"/> + <column name="OVERRIDE" type="BOOLEAN" required="false"/> + <column name="NAME" type="VARCHAR2" required="true" size="255"/> + <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> + <!-- Recursive cascade path to RHQ_CONFIG_PROPERTY causes constraint creation errors on SQL Server, see + http://support.microsoft.com/kb/321843 --> + <column name="PARENT_LIST_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROPERTY" ondelete="cascade" /> + <column name="PARENT_MAP_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROPERTY" ondelete="cascade" /> + <column name="LIST_INDEX" type="INTEGER"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <index name="RHQ_CONFIG_PROP_idx_prop_key" unique="false"> + <field ref="CONFIGURATION_ID"/> + <field ref="NAME"/> + </index> + <index name="RHQ_CONFIG_PROP_idx_map_key" unique="false"> + <field ref="PARENT_MAP_ID"/> + <field ref="NAME"/> + </index> + <index name="RHQ_CONFIG_PROP_idx_list_key" unique="false"> + <field ref="PARENT_LIST_ID"/> + </index> + <!-- List entries all have the same name --> + </table> + + <table name="RHQ_CONFIG_TEMPLATE"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="NAME" type="VARCHAR2" required="false" size="100"/> + <column name="DESCRIPTION" type="VARCHAR2" required="false" size="500"/> + <column name="CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> + <column name="CONFIG_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_DEF"/> + <column name="IS_DEFAULT" type="BOOLEAN" required="false"/> + </table> + + <table name="RHQ_RAW_CONFIG"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="CONFIG_ID" type="INTEGER" required="true" references="RHQ_CONFIG(ID)"/> + <column name="PATH" type="VARCHAR2" required="false" size="512"/> + <column name="CONTENTS" type="CLOB" required="true"/> + <column name="SHA256" type="VARCHAR2" size="64" required="true"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + </table> + +<!-- END: config-schema.xml --> +<!-- BEGIN: cluster-schema.xml --> + + <table name="RHQ_AFFINITY_GROUP"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" required="true" size="255" type="VARCHAR2"/> + </table> + + <table name="RHQ_SERVER"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" required="true" size="255" type="VARCHAR2"/> + <column name="ADDRESS" required="true" size="255" type="VARCHAR2"/> + <column name="PORT" required="true" type="INTEGER"/> + <column name="SECURE_PORT" required="true" type="INTEGER"/> + <column name="CTIME" required="true" type="LONG"/> + <column name="MTIME" required="true" type="LONG"/> + <column name="AFFINITY_GROUP_ID" type="INTEGER" references="RHQ_AFFINITY_GROUP" required="false"/> + <column name="COMPUTE_POWER" required="true" type="INTEGER"/> + <column name="OPERATION_MODE" required="true" size="32" type="VARCHAR2"/> + <column name="STATUS" type="INTEGER" required="false" default="0" /> + + <!-- This index is for constraint, not performance --> + <index name="RHQ_SERVER_NAME_UNIQUE" unique="true"> + <field ref="NAME"/> + </index> + </table> + + <!-- new agent --> + <table name="RHQ_AGENT"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" required="true" size="255" type="VARCHAR2"/> + <column name="ADDRESS" required="true" size="255" type="VARCHAR2"/> + <column name="PORT" required="true" type="INTEGER"/> + <column name="AGENTTOKEN" required="true" size="100" type="VARCHAR2"/> + <column name="REMOTE_ENDPOINT" required="false" size="4000" type="VARCHAR2"/> + <column name="CTIME" required="true" type="LONG"/> + <column name="MTIME" required="true" type="LONG"/> + <column name="LAST_AVAILABILITY_REPORT" required="false" type="LONG"/> + <column name="AFFINITY_GROUP_ID" type="INTEGER" references="RHQ_AFFINITY_GROUP" required="false"/> + <column name="SERVER_ID" type="INTEGER" references="RHQ_SERVER" required="false"/> + <column name="STATUS" type="INTEGER" required="false" default="0" /> + <column name="BACKFILLED" type="BOOLEAN" required="true" /> + + <index name="RHQ_AGENT_NAME_UNIQUE" unique="true"> + <field ref="NAME"/> + </index> + + <index name="RHQ_AGENT_ADDRESS_PORT" unique="true"> + <field ref="ADDRESS"/> + <field ref="PORT"/> + </index> + + <index name="RHQ_AGENT_TOKEN_UNIQUE" unique="true"> + <field ref="AGENTTOKEN"/> + </index> + </table> + + <table name="RHQ_PARTITION_EVENT"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="SUBJECT_NAME" required="true" size="100" type="VARCHAR2"/> + <column name="CTIME" required="true" type="LONG"/> + <column name="EVENT_TYPE" required="true" size="50" type="VARCHAR2"/> + <column name="EVENT_DETAIL" required="false" size="512" type="VARCHAR2"/> + <column name="EXECUTION_STATUS" required="true" size="32" type="VARCHAR2"/> + </table> + + <table name="RHQ_PARTITION_DETAILS"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="PARTITION_EVENT_ID" type="INTEGER" references="RHQ_PARTITION_EVENT" required="true"/> + <column name="AGENT_NAME" type="VARCHAR2" size="255" required="true"/> + <column name="SERVER_NAME" type="VARCHAR2" size="255" required="true"/> + </table> + + <table name="RHQ_FAILOVER_LIST"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="PARTITION_EVENT_ID" type="INTEGER" references="RHQ_PARTITION_EVENT" required="true"/> + <column name="AGENT_ID" type="INTEGER" references="RHQ_AGENT" required="true"/> + <column name="CTIME" required="true" type="LONG"/> + </table> + + <table name="RHQ_FAILOVER_DETAILS"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="FAILOVER_LIST_ID" type="INTEGER" references="RHQ_FAILOVER_LIST" required="true"/> + <column name="SERVER_ID" type="INTEGER" references="RHQ_SERVER" required="true"/> + <column name="ORDINAL" type = "INTEGER" required="true"/> + </table> + +<!-- END: cluster-schema.xml --> +<!-- BEGIN: auth-schema.xml --> + + + <table name="RHQ_PRINCIPAL"> + + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="PRINCIPAL" required="true" type="VARCHAR2" size="100"/> + <column name="PASSWORD" required="true" type="VARCHAR2" size="64"/> + + <!-- ensure that principals are unique --> + <index name="RHQ_PRINCIPAL_PRINCIPAL_KEY" unique="true"> + <field ref="PRINCIPAL"/> + </index> + + </table> + + <table name="RHQ_SUBJECT"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" required="true" size="100" type="VARCHAR2"/> + <column name="CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG"/> + <column name="FIRST_NAME" required="false" size="100" type="VARCHAR2"/> + <column name="LAST_NAME" required="false" size="100" type="VARCHAR2"/> + <column name="EMAIL_ADDRESS" size="100" type="VARCHAR2"/> + <column name="SMS_ADDRESS" size="100" type="VARCHAR2"/> + <column name="PHONE_NUMBER" size="100" type="VARCHAR2"/> + <column name="DEPARTMENT" size="100" type="VARCHAR2"/> + <column name="FACTIVE" required="true" type="BOOLEAN" default="true"/> + <column name="FSYSTEM" required="true" type="BOOLEAN" default="false"/> + + <index name="RHQ_SUBJECT_AUTH_KEY" unique="true"> + <field ref="NAME"/> + </index> + </table> + +<!-- END: auth-schema.xml --> +<!-- BEGIN: inventory-schema.xml --> + + + <!-- NEW RESOURCE TYPES --> + <table name="RHQ_RESOURCE_TYPE"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" type="VARCHAR2" size="100" required="true"/> + <column name="CATEGORY" type="VARCHAR2" size="16" required="true"/> + <column name="CREATION_DATA_TYPE" type="VARCHAR2" size="16" required="true"/> + <column name="CREATE_DELETE_POLICY" type="VARCHAR2" size="16" required="true"/> + <column name="SINGLETON" type="BOOLEAN" required="true"/> + <column name="SUPPORTS_MANUAL_ADD" type="BOOLEAN" required="true"/> + <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> + <column name="PLUGIN" type="VARCHAR2" size="100"/> + <column name="CTIME" type="LONG"/> + <column name="MTIME" type="LONG"/> + <column name="DELETED" type="BOOLEAN" default="FALSE" required="TRUE"/> + <column name="SUBCATEGORY_ID" type="INTEGER"/> + <!-- + TODO add support to DB setup for tables with circular dependencies and then add back this RI + <column name="SUBCATEGORY_ID" type="INTEGER" references="RHQ_RESOURCE_SUBCAT" /> + --> + <column name="PLUGIN_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> + <column name="RES_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> + <column name="BUNDLE_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG"/> + + <index name="RHQ_RES_TYPE_IDX_PLG_NAME" unique="true"> + <field ref="NAME"/> + <field ref="PLUGIN"/> + </index> + </table> + + <!-- NEW RESOURCE SUBCATEGORIES --> + <table name="RHQ_RESOURCE_SUBCAT"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" type="VARCHAR2" size="100"/> + <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> + <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> + <column name="CTIME" type="LONG"/> + <column name="MTIME" type="LONG"/> + <column name="PARENT_SUBCATEGORY_ID" type="INTEGER" references="RHQ_RESOURCE_SUBCAT"/> + <!-- resourceTypeId is not required on child sub categories --> + <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> + </table> + + <!-- Many To Many mapping for resource type to its parents --> + <table name="RHQ_RESOURCE_TYPE_PARENTS"> + <column name="RESOURCE_TYPE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> + <column name="PARENT_RESOURCE_TYPE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> + + <!-- not using full words to fit index name length --> + <constraint name="RHQ_RES_TYPE_PARENTS_KEY"> + <primaryKey> + <field ref="RESOURCE_TYPE_ID"/> + <field ref="PARENT_RESOURCE_TYPE_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_PROCESS_SCAN"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="QUERY" type="VARCHAR2" size="256" required="true"/> + <column name="NAME" type="VARCHAR2" size="100" required="false"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> + + <index name="RHQ_PROCESS_SCAN_QUERY_INDEX" unique="true"> + <field ref="QUERY"/> + <field ref="RESOURCE_TYPE_ID"/> + </index> + </table> + + <table name="RHQ_PRD_VER"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="VERSION" type="VARCHAR2" size="50" required="true"/> + <column name="RES_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> + </table> + + <table name="RHQ_RESOURCE"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> + <column name="UUID" type="CHAR" size="36" required="true"/> + <column name="NAME" type="VARCHAR2" size="500"/> + <!-- ancestry holds the full parental ancestry, used for disambiguation --> + <column name="ANCESTRY" type="VARCHAR2" required="false" size="4000"/> + <column name="RESOURCE_KEY" type="VARCHAR2" required="true" size="500"/> + <column name="AGENT_ID" required="false" type="INTEGER" references="RHQ_AGENT(id)"/> + <column name="INVENTORY_STATUS" type="VARCHAR2" size="20"/> + <column name="CONNECTED" type="BOOLEAN"/> + <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> + <column name="VERSION" type="VARCHAR2" size="100"/> + <column name="CTIME" type="LONG"/> + <column name="MTIME" type="LONG"/> + <column name="ITIME" type="LONG"/> + <column name="RES_CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG"/> + <column name="PLUGIN_CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG"/> + <column name="MODIFIED_BY" required="false" size="100" type="VARCHAR2"/> + <column name="LOCATION" required="false" size="100" type="VARCHAR2"/> + <column name="PARENT_RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE"/> + <column name="PRODUCT_VERSION_ID" type="INTEGER" references="RHQ_PRD_VER"/> + + <index name="RHQ_RESOURCE_idx_key"> + <field ref="RESOURCE_KEY"/> + </index> + + <index name="RHQ_RESOURCE_idx_type"> + <field ref="RESOURCE_TYPE_ID"/> + </index> + + <index name="RHQ_RESOURCE_idx_agent"> + <field ref="AGENT_ID"/> + </index> + + <index name="RHQ_RESOURCE_idx_parent"> + <field ref="PARENT_RESOURCE_ID"/> + </index> + + </table> + + <table name="RHQ_RESOURCE_ERROR"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> + <column name="TIME_OCCURRED" type="LONG" required="true"/> + <column name="ERROR_TYPE" type="VARCHAR2" required="true" size="32"/> + <column name="SUMMARY" type="VARCHAR2" required="true" size="1000"/> + <column name="DETAIL" type="LONGVARCHAR" required="false"/> + + <index name="RHQ_RES_ERROR_IDX_RES_ID"> + <field ref="RESOURCE_ID"/> + </index> + </table> + + <table name="RHQ_GROUP_DEF"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" required="true" size="100" type="VARCHAR2"/> + <column name="DESCRIPTION" size="100" type="VARCHAR2"/> + <column name="CTIME" type="LONG"/> + <column name="MTIME" type="LONG"/> + <column name="CALC_TIME" type="LONG"/> + <column name="CALC_INTERVAL" type="LONG"/> + <column name="RECURSIVE" type="BOOLEAN"/> + <column name="EXPRESSION" type="VARCHAR2" size="1000"/> + + <index name="RHQ_GROUP_DEF_NAME" unique="true"> + <field ref="NAME"/> + </index> + </table> + + <table name="RHQ_RESOURCE_GROUP"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <!-- this name can be longer than the size of the GROUP_BY column, which is used to uniquely identify it --> + <!-- Max bytes for Oracle Varchar2 to accommodate large cluster keys --> + <column name="NAME" required="true" size="4000" type="VARCHAR2"/> + <column name="DESCRIPTION" size="100" type="VARCHAR2"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> + <!-- Compatible groups only --> + <column name="CTIME" type="LONG"/> + <column name="MTIME" type="LONG"/> + <column name="MODIFIED_BY" required="false" size="100" type="VARCHAR2"/> + <column name="RECURSIVE" type="BOOLEAN"/> + + <column name="GROUP_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_GROUP_DEF"/> + <column name="GROUP_BY" size="500" type="VARCHAR2"/> + + <column name="CATEGORY" type="VARCHAR2" size="20" required="true"/> + + <!-- This is only set if this is a subject-owned group (like an autogroup) --> + <column name="SUBJECT_ID" type="INTEGER" references="RHQ_SUBJECT"/> + + <!-- These two only set if this is a backing group for a resource auto-cluster --> + <column name="CLUSTER_KEY" type="VARCHAR2" size="4000" required="false"/> + <column name="CLUSTER_RESOURCE_GROUP_ID" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> + + <!-- This is only set if this is a backing group for a resource auto-group --> + <column name="AUTO_GROUP_PARENT_RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE"/> + + <column name="VISIBLE" type="BOOLEAN"/> + + <index name="RHQ_RES_GROUP_NAME" unique="false"> + <field ref="NAME"/> + </index> + </table> + + <!-- Many To Many mapping for groups to implicit resources --> + <table name="RHQ_RESOURCE_GROUP_RES_IMP_MAP"> + <column name="RESOURCE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE"/> + <column name="RESOURCE_GROUP_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> + + <!-- not using full words to fit index name length --> + <constraint name="RHQ_RES_GROUP_RES_IMP_MAP_KEY"> + <primaryKey> + <field ref="RESOURCE_ID"/> + <field ref="RESOURCE_GROUP_ID"/> + </primaryKey> + </constraint> + </table> + + <!-- Many To Many mapping for groups to explicit resources --> + <table name="RHQ_RESOURCE_GROUP_RES_EXP_MAP"> + <column name="RESOURCE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE"/> + <column name="RESOURCE_GROUP_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> + + <!-- not using full words to fit index name length --> + <constraint name="RHQ_RES_GROUP_RES_EXP_MAP_KEY"> + <primaryKey> + <field ref="RESOURCE_ID"/> + <field ref="RESOURCE_GROUP_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_CONFIG_GROUP_UPDATE"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="GROUP_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_GROUP"/> + <column name="CONFIGURATION_ID" type="INTEGER" required="true" references="RHQ_CONFIG"/> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="SUBJECT_NAME" type="VARCHAR2" required="false" size="100"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> + </table> + + <table name="RHQ_CONFIG_UPDATE"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="CONFIGURATION_ID" type="INTEGER" required="true" references="RHQ_CONFIG" ondelete="cascade"/> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="SUBJECT_NAME" type="VARCHAR2" required="false" size="100"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="CONFIG_RES_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> + <column name="PLUGIN_CONFIG_RES_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> + <column name="AGG_RES_UPDATE_ID" type="INTEGER" required="false" references="RHQ_CONFIG_GROUP_UPDATE"/> + <column name="AGG_PLUGIN_UPDATE_ID" type="INTEGER" required="false" references="RHQ_CONFIG_GROUP_UPDATE"/> + <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> + </table> + + + <table name="RHQ_TAGGING"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="NAMESPACE" type="VARCHAR2" required="false" size="20"/> + <column name="SEMANTIC" type="VARCHAR2" required="false" size="50"/> + <column name="NAME" type="VARCHAR2" required="true" size="100"/> + </table> + + <table name="RHQ_TAGGING_RESOURCE_MAP"> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> + <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> + <constraint name="RHQ_TAGGING_RESOURCE_MAP_KEY"> + <primaryKey> + <field ref="RESOURCE_ID"/> + <field ref="TAG_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_TAGGING_RES_GROUP_MAP"> + <column name="RESOURCE_GROUP_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_GROUP"/> + <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> + <constraint name="RHQ_TAGGING_RES_GROUP_MAP_KEY"> + <primaryKey> + <field ref="RESOURCE_GROUP_ID"/> + <field ref="TAG_ID"/> + </primaryKey> + </constraint> + </table> + +<!-- END: inventory-schema.xml --> +<!-- BEGIN: authz-schema.xml --> + + + <table name="RHQ_ROLE"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" required="true" size="100" type="VARCHAR2"/> + <column name="DESCRIPTION" size="100" type="VARCHAR2"/> + <column name="FSYSTEM" type="BOOLEAN" default="false"/> + + <index name="RHQ_ROLE_NAME_KEY" unique="true"> + <field ref="NAME"/> + </index> + </table> + + <table name="RHQ_ROLE_RESOURCE_GROUP_MAP"> + <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> + <column name="RESOURCE_GROUP_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> + + <constraint name="RHQ_ROLE_RES_GROUP_MAP_KEY"> + <primaryKey> + <field ref="ROLE_ID"/> + <field ref="RESOURCE_GROUP_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_ROLE_LDAP_GROUP"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> + <column name="LDAP_GROUP_NAME" size="128" required="true" type="VARCHAR2"/> + + <index name="RHQ_ROLE_LDAP_GROUP_IDX" unique="true"> + <field ref="ROLE_ID"/> + <field ref="LDAP_GROUP_NAME"/> + </index> + </table> + + <table name="RHQ_PERMISSION"> + <column name="ROLE_ID" type="INTEGER" references="RHQ_ROLE" required="true"/> + <column name="OPERATION" type="INTEGER" required="true"/> + <constraint name="RHQ_PERMISSION_PK"> + <primaryKey> + <field ref="ROLE_ID"/> + <field ref="OPERATION"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_SUBJECT_ROLE_MAP"> + <column name="SUBJECT_ID" required="true" type="INTEGER" references="RHQ_SUBJECT"/> + <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> + + <constraint name="RHQ_SUBJECT_ROLE_MAPPING_KEY"> + <primaryKey> + <field ref="SUBJECT_ID"/> + <field ref="ROLE_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_SUBJECT_ROLE_LDAP_MAP"> + <column name="SUBJECT_ID" required="true" type="INTEGER" references="RHQ_SUBJECT"/> + <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> + <constraint name="RHQ_SUBJECT_ROLE_LDAP_MAP_PK"> + <primaryKey> + <field ref="SUBJECT_ID" /> + <field ref="ROLE_ID"/> + </primaryKey> + </constraint> + </table> +<!-- END: authz-schema.xml --> +<!-- BEGIN: search-schema.xml --> + + + <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="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="GLOBAL" type="BOOLEAN" required="true"/> + </table> + +<!-- END: search-schema.xml --> +<!-- BEGIN: dashboard-schema.xml --> + + + + <table name="RHQ_DASHBOARD"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" type="VARCHAR2" size="200" required="true"/> + <column name="SUBJECT_ID" type="INTEGER" required="true" references="RHQ_SUBJECT"/> + <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> + <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_RESOURCE_GROUP"/> + <column name="CATEGORY" type="VARCHAR2" size="20" required="true"/> + <column name="SHARED" type="BOOLEAN" required="true"/> + <column name="CONFIGURATION_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> + </table> + + + <table name="RHQ_DASHBOARD_PORTLET"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" type="VARCHAR2" size="200" required="true"/> + <column name="PORTLET_KEY" type="VARCHAR2" size="200" required="true"/> + <column name="COL" type="INTEGER" required="true"/> + <column name="COL_INDEX" type="INTEGER" required="true"/> + <column name="HEIGHT" type="INTEGER" required="true"/> + <column name="CONFIGURATION_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> + <column name="DASHBOARD_ID" type="INTEGER" required="false" references="RHQ_DASHBOARD"/> + </table> + +<!-- END: dashboard-schema.xml --> +<!-- BEGIN: operation-schema.xml --> + + + <table name="RHQ_OPERATION_DEF"> + + <!-- === required columns === --> + + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE(ID)"/> + <column name="NAME" type="VARCHAR2" required="true" size="100"/> + + <!-- === optional columns === --> + + <!-- an OSGI version range - if null, the operation def applies to all versions of the associated resource type --> + <column name="RESOURCE_VERSION_RANGE" type="VARCHAR2" size="100"/> + + <!-- A parameter config definition is only required for operations that have parameters. --> + <!-- A results config definition is only required for operations that return data. --> + <column name="PARAMETER_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> + <column name="RESULTS_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> + <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> + <column name="DESCRIPTION" type="VARCHAR2" size="4000"/> + <column name="TIMEOUT" type="INTEGER"/> + + <!-- === business key (RESOURCE_TYPE_ID + NAME) === --> + <index name="RHQ_OPERATION_DEF_KEY_IDX" unique="true"> + <field ref="RESOURCE_TYPE_ID"/> + <field ref="NAME"/> + </index> + + </table> + + <table name="RHQ_OPERATION_HISTORY"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="DTYPE" type="VARCHAR2" required="true" size="8"/> + <column name="JOB_NAME" type="VARCHAR2" required="true" size="100"/> + <column name="JOB_GROUP" type="VARCHAR2" required="true" size="100"/> + <column name="OPERATION_DEF_ID" type="INTEGER" required="true" references="RHQ_OPERATION_DEF"/> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="STIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="PARAMETERS_CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> + + <!-- for resource history --> + <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> + <column name="RESULTS_CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> + <column name="GROUP_HISTORY_ID" type="INTEGER" required="false" references="RHQ_OPERATION_HISTORY"/> + + <!-- for group history --> + <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_RESOURCE_GROUP"/> + + <index name="RHQ_OPERATION_HISTORY_JOB_IDX" unique="true"> + <field ref="JOB_NAME"/> + <field ref="JOB_GROUP"/> + <field ref="CTIME"/> + </index> + + </table> + + <!-- + This table is really just to support some specific use-cases. + Specifically, to be able to get a list of histories for a specific schedule (aka quartz job) + and to be able to query a list of all schedules along with their associated resource/group IDs + possibly sorted by their next fire time. + Note that a NULL next fire time means it won't fire again and the row is probaby about to be deleted; + we can probably not even insert rows with NULL and make it a non-nullable field. But rather than + code special conditions into the session bean, we'll allow a short-lived NULL next fire time row. + --> + <table name="RHQ_OPERATION_SCHEDULE"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + + <column name="JOB_NAME" type="VARCHAR2" required="true" size="100"/> + <column name="JOB_GROUP" type="VARCHAR2" required="true" size="100"/> + <column name="DTYPE" type="VARCHAR2" required="true" size="8"/> + <column name="NEXT_FIRE_TIME" type="LONG" required="false"/> + + <!-- for resource history --> + <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> + + <!-- for group history --> + <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_RESOURCE_GROUP"/> + + <!-- + Note, this is the same as the primary key that Quartz uses for its schedules (RHQ_QRTZ_JOB_DETAILS). + We do not need to add DTYPE to the key, because we ensure the name/group are unique across resource/group + schedules + --> + <!-- === business key (JOB_NAME + JOB_GROUP) === --> + <index name="RHQ_OPERATION_SCHEDULE_KEY_IDX" unique="true"> + <field ref="JOB_NAME"/> + <field ref="JOB_GROUP"/> + </index> + </table> + +<!-- END: operation-schema.xml --> +<!-- BEGIN: event-schema.xml --> + + + <!-- metadata --> + + <table name="RHQ_EVENT_DEF"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE(ID)"/> + + <column name="NAME" type="VARCHAR2" size="100" required="true"/> + <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> + <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> + + <index name="RHQ_EVENT_DEF_IDX" unique="true"> + <field ref="RESOURCE_TYPE_ID"/> + <field ref="NAME"/> + </index> + </table> + + <!-- instance data --> + + <table name="RHQ_EVENT_SOURCE"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="EVENT_DEF_ID" type="INTEGER" required="true" references="RHQ_EVENT_DEF(ID)"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE(ID)"/> + + <column name="LOCATION" required="true" size="2000" type="VARCHAR2"/> + + <index name="RHQ_EVENT_SOURCE_IDX" unique="true"> + <field ref="EVENT_DEF_ID"/> + <field ref="RESOURCE_ID"/> + <field ref="LOCATION"/> + </index> + </table> + + <table name="RHQ_EVENT"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="EVENT_SOURCE_ID" type="INTEGER" required="true" references="RHQ_EVENT_SOURCE(ID)"/> + + <column name="TIMESTAMP" required="true" type="LONG"/> + <column name="SEVERITY" required="true" size="20" type="VARCHAR2"/> + <column name="DETAIL" required="true" size="4000" type="VARCHAR2"/> + <index name="RHQ_EVENT_IDX" unique="false"> + <field ref="EVENT_SOURCE_ID"/> + <field ref="TIMESTAMP"/> + </index> + </table> + +<!-- END: event-schema.xml --> +<!-- BEGIN: alert-schema.xml --> + + + <table name="RHQ_ALERT_DEFINITION"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" required="true" size="100" type="VARCHAR2"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="PARENT_ID" type="INTEGER" required="false"/> + <column name="GROUP_ALERT_DEF_ID" type="INTEGER" required="false"/> + <column name="DESCRIPTION" required="false" size="250" type="VARCHAR2"/> + <column name="PRIORITY" type="VARCHAR2" size="15" required="true"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE" required="false"/> + <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE" required="false"/> + <column name="RESOURCE_GROUP_ID" type="INTEGER" references="RHQ_RESOURCE_GROUP" required="false"/> + <column name="ENABLED" required="true" default="TRUE" type="BOOLEAN"/> + + <column name="REQUIRED" required="true" type="SMALLINT"/> + + <column name="RECOVERY_ID" type="INTEGER" required="true"/> + <!-- required, but 0 effectively means null --> + <column name="WILL_RECOVER" required="true" default="false" type="BOOLEAN"/> + <column name="NOTIFY_FILTERED" required="true" default="false" type="BOOLEAN"/> + <column name="CONTROL_FILTERED" required="true" default="FALSE" type="BOOLEAN"/> + + <column name="DELETED" required="true" default="FALSE" type="BOOLEAN"/> + <column name="READ_ONLY" required="true" default="FALSE" type="BOOLEAN"/> + + <column name="DAMPENING_CATEGORY" type="SMALLINT" required="true"/> + <column name="DAMPENING_VALUE" type="INTEGER"/> + <column name="DAMPENING_VALUE_UNITS" type="SMALLINT"/> + <column name="DAMPENING_PERIOD" type="INTEGER"/> + <column name="DAMPENING_PERIOD_UNITS" type="SMALLINT"/> + </table> + + <table name="RHQ_ALERT_DAMPEN_EVENT"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> + <column name="EVENT_TYPE" required="true" type="SMALLINT"/> + <column name="EVENT_TIMESTAMP" required="true" type="LONG"/> + + <index name="RHQ_DAMPENING_EVENT_TYPE_IDX"> + <field ref="EVENT_TYPE"/> + </index> + <index name="RHQ_DAMPENING_EVENT_TS_IDX"> + <field ref="EVENT_TIMESTAMP"/> + </index> + </table> + + <table name="RHQ_ALERT_CONDITION"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="TYPE" required="true" type="VARCHAR2" size="15"/> + <!-- + <column name="REQUIRED" required="true" type="BOOLEAN"/> + --> + <column name="MEASUREMENT_DEFINITION_ID" required="false" type="INTEGER"/> + <column name="NAME" required="false" size="100" type="VARCHAR2"/> + <column name="COMPARATOR" required="false" size="2" type="VARCHAR2"/> + <column name="THRESHOLD" required="false" type="DOUBLE"/> + <!-- event-based conditions use OPTION_STATUS for the string match, so should be a decent length --> + <column name="OPTION_STATUS" required="false" size="256" type="VARCHAR2"/> + <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> + <column name="TRIGGER_ID" required="false" type="INTEGER"/> + </table> + + <table name="RHQ_ALERT" tablespace="DEFAULT" + storage-options="freelists 5" cache="true" logging="false"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> + <column name="CTIME" required="true" type="LONG"/> + <column name="RECOVERY_ID" type="INTEGER" required="true"/> + <!-- required, but 0 effectively means null --> + <column name="WILL_RECOVER" required="true" default="false" type="BOOLEAN"/> + <column name="ACK_TIME" required="false" type="LONG"/> + <column name="ACK_SUBJECT" required="false" size="100" type="VARCHAR2"/> + <index name="RHQ_ALERT_IDX_TIME" unique="false"> + <field ref="CTIME"/> + </index> + <index name="RHQ_ALERT_IDX_ALERTDEF" unique="false"> + <field ref="ALERT_DEFINITION_ID"/> + </index> + </table> + + <table name="RHQ_ALERT_NOTIF_LOG" tablespace="DEFAULT" + storage-options="freelists 5" cache="true" logging="false"> + <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="false"> + <field ref="ALERT_ID"/> + </index> + <column name="SENDER" required="false" size="100" type="VARCHAR2"/> + <column name="RESULT_STATE" required="false" size="20" type="VARCHAR2"/> + <column name="MESSAGE" required="false" size="4000" type="VARCHAR2"/> + </table> + + <table name="RHQ_ALERT_CONDITION_LOG" tablespace="DEFAULT" + storage-options="freelists 5" cache="true" logging="false"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="CTIME" required="true" type="LONG"/> + <column name="ALERT_ID" required="false" type="INTEGER" references="RHQ_ALERT(ID)"/> + <column name="CONDITION_ID" required="true" type="INTEGER" references="RHQ_ALERT_CONDITION(ID)"/> + <column name="VALUE" required="true" size="250" type="VARCHAR2"/> + <index name="RHQ_ALERT_COND_LOG_IDX_TIME"> + <field ref="CTIME" /> + </index> + <index name="RHQ_ALERT_COND_LOG_IDX_ALERT"> + <field ref="ALERT_ID"/> + </index> + <index name="RHQ_ALERT_COND_LOG_COND_IDX"> + <field ref="CONDITION_ID"/> + </index> + </table> + + <table name="RHQ_ALERT_NOTIFICATION" tablespace="DEFAULT" + storage-options="freelists 5" cache="true" logging="false"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> + <column name="SENDER_CONFIG_ID" required="false" type="INTEGER" references="RHQ_CONFIG(ID)"/> + <column name="EXTRA_CONFIG_ID" required="false" type="INTEGER" references="RHQ_CONFIG(ID)"/> + <column name="SENDER_NAME" required="true" size="100" type="VARCHAR2" /> + </table> + +<!-- END: alert-schema.xml --> +<!-- BEGIN: sysconfig-schema.xml --> + + + <table name="RHQ_SYSTEM_CONFIG"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="PROPERTY_KEY" type="VARCHAR2" size="80"/> + <column name="PROPERTY_VALUE" type="VARCHAR2" size="300"/> + <column name="DEFAULT_PROPERTY_VALUE" type="VARCHAR2" size="300"/> + <column name="FREAD_ONLY" type="BOOLEAN" default="FALSE"/> + + <index name="RHQ_SYSTEM_CONFIG_KEY_INDX" unique="true"> + <field ref="PROPERTY_KEY"/> + </index> + </table> + +<!-- END: sysconfig-schema.xml --> +<!-- BEGIN: scheduler-schema.xml --> + + + <table name="RHQ_QRTZ_JOB_DETAILS"> + <column name="JOB_NAME" required="true" type="VARCHAR2" size="80"/> + <column name="JOB_GROUP" required="true" type="VARCHAR2" size="80"/> + <column name="DESCRIPTION" required="false" type="VARCHAR2" size="120"/> + <column name="JOB_CLASS_NAME" required="true" type="VARCHAR2" size="128"/> + <column name="IS_DURABLE" required="true" type="BOOLEAN" default="FALSE"/> + <column name="IS_VOLATILE" required="true" type="BOOLEAN"/> + <column name="IS_STATEFUL" required="true" type="BOOLEAN" default="FALSE"/> + <column name="REQUESTS_RECOVERY" required="true" type="BOOLEAN" default="FALSE"/> + <column name="JOB_DATA" required="false" type="BLOB"/> + + <constraint name="RHQ_PK_QRTZ_JOB_DETAILS"> + <primaryKey> + <field ref="JOB_NAME"/> + <field ref="JOB_GROUP"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_QRTZ_JOB_LISTENERS"> + <column name="JOB_NAME" required="true" type="VARCHAR2" size="80"/> + <column name="JOB_GROUP" required="true" type="VARCHAR2" size="80"/> + <column name="JOB_LISTENER" required="true" type="VARCHAR2" size="80"/> + + <constraint name="RHQ_PK_QRTZ_JOB_LISTENERS"> + <primaryKey> + <field ref="JOB_NAME"/> + <field ref="JOB_GROUP"/> + <field ref="JOB_LISTENER"/> + </primaryKey> + </constraint> + <constraint name="RHQ_FK_QRTZ_JOB_LSTNRS_JN_JG"> + <foreignKey local="JOB_NAME,JOB_GROUP" + references="RHQ_QRTZ_JOB_DETAILS(JOB_NAME,JOB_GROUP)" + ondelete="cascade"/> + </constraint> + </table> + + <table name="RHQ_QRTZ_TRIGGERS"> + <column name="TRIGGER_NAME" type="VARCHAR2" required="true" size="80"/> + <column name="TRIGGER_GROUP" type="VARCHAR2" required="true" size="80"/> + <column name="JOB_NAME" type="VARCHAR2" required="true" size="80"/> + <column name="JOB_GROUP" type="VARCHAR2" required="true" size="80"/> + <column name="IS_VOLATILE" type="BOOLEAN" required="true"/> + <column name="DESCRIPTION" type="VARCHAR2" required="false" size="120"/> + <column name="NEXT_FIRE_TIME" type="LONG" required="false"/> + <column name="PREV_FIRE_TIME" type="LONG" required="false"/> + <column name="PRIORITY" type="INTEGER" required="false"/> + <column name="TRIGGER_STATE" type="VARCHAR" required="true" size="16"/> + <column name="TRIGGER_TYPE" type="VARCHAR" required="true" size="8"/> + <column name="START_TIME" type="LONG" required="true"/> + <column name="END_TIME" type="LONG" required="false"/> + <column name="CALENDAR_NAME" type="VARCHAR2" required="false" size="80"/> + <column name="MISFIRE_INSTR" type="INTEGER" required="false"/> + <column name="JOB_DATA" type="BLOB" required="false"/> + + <constraint name="RHQ_PK_QRTZ_TRIGGERS"> + <primaryKey> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </primaryKey> + </constraint> + <constraint name="RHQ_FK_QRTZ_TRIGGERS_JN_JG"> + <foreignKey local="JOB_NAME,JOB_GROUP" + references="RHQ_QRTZ_JOB_DETAILS(JOB_NAME,JOB_GROUP)" + ondelete="cascade"/> + </constraint> + + <!-- Quartz docs recommend these indexes. --> + <index name="RHQ_QRTZ_TRIGGERS_JN_JG_IDX"> + <field ref="JOB_NAME"/> + <field ref="JOB_GROUP"/> + </index> + <index name="RHQ_QRTZ_TRIGGERS_NFT_IDX"> + <field ref="NEXT_FIRE_TIME"/> + </index> + <index name="RHQ_QRTZ_TRIGGERS_TS_IDX"> + <field ref="TRIGGER_STATE"/> + </index> + <index name="RHQ_QRTZ_TRIGGERS_TS_NFT_IDX"> + <field ref="TRIGGER_STATE"/> + <field ref="NEXT_FIRE_TIME"/> + </index> + + </table> + + <table name="RHQ_QRTZ_SIMPLE_TRIGGERS"> + <column name="TRIGGER_NAME" type="VARCHAR2" required="true" size="80"/> + <column name="TRIGGER_GROUP" type="VARCHAR2" required="true" size="80"/> + <column name="REPEAT_COUNT" type="LONG" required="true"/> + <column name="REPEAT_INTERVAL" type="LONG" required="true"/> + <column name="TIMES_TRIGGERED" type="LONG" required="true"/> + + <constraint name="RHQ_PK_QRTZ_SIMPLE_TRIGGERS"> + <primaryKey> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </primaryKey> + </constraint> + <constraint name="RHQ_FK_QRTZ_SIMPLE_TRGRS_TN_TG"> + <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" + references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" + ondelete="cascade"/> + </constraint> + + <!-- Quartz docs recommend this index. --> + <!-- Commenting out, because Oracle auto-creates an index for the + primary key column(s) and fails if you try to create another + index for the same column(s) (ips, 03/29/07). + --> + <!-- + <index name="RHQ_QRTZ_SIMPLE_TRGRS_TN_TG_IDX"> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </index> + --> + </table> + + <table name="RHQ_QRTZ_CRON_TRIGGERS"> + <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> + <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> + <column name="CRON_EXPRESSION" type="VARCHAR2" size="80" required="true"/> + <column name="TIME_ZONE_ID" type="VARCHAR2" size="80" required="false"/> + + <constraint name="RHQ_PK_QRTZ_CRON_TRIGGERS"> + <primaryKey> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </primaryKey> + </constraint> + <constraint name="RHQ_FK_QRTZ_CRON_TRIG_TN_TG"> + <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" + references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" + ondelete="cascade"/> + </constraint> + + <!-- Quartz docs recommend this index. --> + <!-- Commenting out, because Oracle auto-creates an index for the + primary key column(s) and fails if you try to create another + index for the same column(s) (ips, 03/29/07). + --> + <!-- + <index name="RHQ_QRTZ_CRON_TRGRS_TN_TG_IDX"> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </index> + --> + </table> + + <table name="RHQ_QRTZ_BLOB_TRIGGERS"> + <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> + <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> + <column name="BLOB_DATA" type="BLOB" required="false"/> + + <constraint name="RHQ_PK_QRTZ_BLOB_TRIGGERS"> + <primaryKey> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </primaryKey> + </constraint> + <constraint name="RHQ_FK_QRTZ_BLOB_TRIGG_TN_TG"> + <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" + references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" + ondelete="cascade"/> + </constraint> + + <!-- Quartz docs recommend this index. --> + <!-- Commenting out, because Oracle auto-creates an index for the + primary key column(s) and fails if you try to create another + index for the same column(s) (ips, 03/29/07). + --> + <!-- + <index name="RHQ_QRTZ_BLOB_TRGRS_TN_TG_IDX"> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </index> + --> + </table> + + <table name="RHQ_QRTZ_TRIGGER_LISTENERS"> + <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> + <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> + <column name="TRIGGER_LISTENER" type="VARCHAR2" size="80" required="true"/> + + <constraint name="RHQ_PK_QRTZ_TRIGGER_LISTENERS"> + <primaryKey> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + <field ref="TRIGGER_LISTENER"/> + </primaryKey> + </constraint> + <constraint name="RHQ_FK_QRTZ_TRGR_LSTNRS_TN_TG"> + <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" + references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" + ondelete="cascade"/> + </constraint> + + <!-- Quartz docs recommend this index. --> + <index name="RHQ_QRTZ_TRGR_LSTNRS_TN_TG_IDX"> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </index> + + </table> + + <table name="RHQ_QRTZ_FIRED_TRIGGERS"> + <column name="ENTRY_ID" primarykey="true" type="VARCHAR2" size="95" required="true"/> + <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> + <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> + <column name="INSTANCE_NAME" type="VARCHAR2" size="80" required="true"/> + <column name="FIRED_TIME" type="LONG" required="true"/> + <column name="PRIORITY" type="INTEGER" required="false"/> + <column name="STATE" type="VARCHAR2" size="16" required="true"/> + <column name="IS_VOLATILE" type="BOOLEAN" required="true"/> + <column name="JOB_NAME" type="VARCHAR2" size="80" required="false"/> + <column name="JOB_GROUP" type="VARCHAR2" size="80" required="false"/> + <column name="IS_STATEFUL" type="BOOLEAN" required="false"/> + <column name="REQUESTS_RECOVERY" type="BOOLEAN" required="false"/> + + <!-- Quartz docs recommend these indexes. --> + <index name="RHQ_QRTZ_FIRED_TRGRS_TN_IDX"> + <field ref="TRIGGER_NAME"/> + </index> + <index name="RHQ_QRTZ_FIRED_TRGRS_TG_IDX"> + <field ref="TRIGGER_GROUP"/> + </index> + <index name="RHQ_QRTZ_FIRED_TRGRS_TN_TG_IDX"> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </index> + <index name="RHQ_QRTZ_FIRED_TRGRS_IN_IDX"> + <field ref="INSTANCE_NAME"/> + </index> + <index name="RHQ_QRTZ_FIRED_TRGRS_JN_IDX"> + <field ref="JOB_NAME"/> + </index> + <index name="RHQ_QRTZ_FIRED_TRGRS_JG_IDX"> + <field ref="JOB_GROUP"/> + </index> + + </table> + + <table name="RHQ_QRTZ_CALENDARS"> + <column name="CALENDAR_NAME" primarykey="true" type="VARCHAR2" size="80" required="true"/> + <column name="CALENDAR" type="BLOB" required="true"/> + </table> + + <table name="RHQ_QRTZ_PAUSED_TRIGGER_GRPS"> + <column name="TRIGGER_GROUP" primarykey="true" type="VARCHAR2" size="80" required="true"/> + </table> + + <table name="RHQ_QRTZ_SCHEDULER_STATE"> + <column name="INSTANCE_NAME" primarykey="true" type="VARCHAR2" size="80" required="true"/> + <column name="LAST_CHECKIN_TIME" type="LONG" required="true"/> + <column name="CHECKIN_INTERVAL" type="LONG" required="true"/> + <column name="RECOVERER" type="VARCHAR2" size="80" required="false"/> + </table> + + <table name="RHQ_QRTZ_LOCKS"> + <column name="LOCK_NAME" primarykey="true" type="VARCHAR2" size="40" required="true"/> + <data LOCK_NAME="TRIGGER_ACCESS"/> + <data LOCK_NAME="JOB_ACCESS"/> + <data LOCK_NAME="CALENDAR_ACCESS"/> + <data LOCK_NAME="STATE_ACCESS"/> + <data LOCK_NAME="MISFIRE_ACCESS"/> + </table> + +<!-- END: scheduler-schema.xml --> +<!-- BEGIN: amps-schema.xml --> + + + <table name="RHQ_PLUGIN"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="4000" type="VARCHAR2" required="false"/> + <column name="VERSION" size="200" type="VARCHAR2" required="false"/> + <column name="AMPS_VERSION" size="16" type="VARCHAR2" required="false"/> + <column name="ENABLED" type="BOOLEAN" required="true"/> + <column name="STATUS" size="16" type="VARCHAR2" required="true"/> + <column name="HELP" type="CLOB" required="false"/> + <column name="PATH" size="500" type="VARCHAR2" required="true"/> + <column name="MD5" size="100" type="VARCHAR2" required="true"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="DEPLOYMENT" size="8" type="VARCHAR2" required="true"/> + <column name="PTYPE" size="200" type="VARCHAR2" required="false"/> + <column name="PLUGIN_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> + <column name="JOBS_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> + <column name="CONTENT" type="BLOB" required="false"/> + + <index name="RHQ_PLUGIN_NAME_DEPLOY_IDX" unique="true"> + <field ref="NAME"/> + <field ref="DEPLOYMENT"/> + </index> + </table> + +<!-- END: amps-schema.xml --> +<!-- BEGIN: measurement-schema.xml --> + + <table name="RHQ_MEASUREMENT_DEF"> + + <!-- === required columns === --> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE(ID)"/> + <column name="NAME" type="VARCHAR2" size="100" required="true"/> + + <!-- === optional columns === --> + <!-- an OSGI version range - if null, the metric def applies to all versions of the associated resource type --> + <column name="RESOURCE_VERSION_RANGE" type="VARCHAR2" size="100"/> + <column name="CATEGORY" type="SMALLINT"/> + <column name="UNITS" type="SMALLINT"/> + <column name="NUMERIC_TYPE" type="SMALLINT"/> + <column name="DISPLAY_TYPE" type="SMALLINT"/> + <column name="DATA_TYPE" type="SMALLINT"/> + <column name="RAW_NUMERIC_TYPE" type="SMALLINT"/> + <column name="DEFAULT_ON" type="BOOLEAN" default="false"/> + <column name="DEFAULT_INTERVAL" type="LONG" /> + <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> + <column name="DISPLAY_ORDER" type="INTEGER" default="1000"/> + <column name="DESCRIPTION" type="VARCHAR2" size="500"/> + <column name="DESTINATION_TYPE" type="VARCHAR2" size="100"/> + + <column name="VERSION" type="INTEGER"/> + <!-- for optimistic locking --> + + <!-- === business key (RESOURCE_TYPE_ID + NAME + RAW_NUMERIC_TYPE) === --> + <index name="RHQ_METRIC_DEF_KEY_IDX" unique="true"> + <field ref="RESOURCE_TYPE_ID"/> + <field ref="NAME"/> + <field ref="RAW_NUMERIC_TYPE"/> + </index> + <index name="RHQ_METRIC_DEF_NT_IDX"> + <field ref="NUMERIC_TYPE"/> + </index> + </table> + + + <table name="RHQ_MEASUREMENT_SCHED"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + + <column name="ENABLED" type="BOOLEAN" default="false"/> + <column name="MTIME" type="LONG" /> + <column name="DEFINITION" type="INTEGER" references="RHQ_MEASUREMENT_DEF(ID)"/> + <column name="VERSION" type="INTEGER" /> + <column name="COLL_INTERVAL" type="LONG" /> + <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE(ID)"/> + <index name="RHQ_MEAS_SCHED_UNIQ" unique="true"> + <field ref="RESOURCE_ID"/> + <field ref="DEFINITION"/> + </index> + <index name="RHQ_MEAS_SCHED_RESID_IDX"> + <field ref="RESOURCE_ID"/> + </index> + </table> + + + <table name="RHQ_MEASUREMENT_BLINE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + + <column name="BL_USER_ENTERED" type="BOOLEAN" default="false" required="true"/> + <column name="BL_MIN" type="DOUBLE" required="true"/> + <column name="BL_MAX" type="DOUBLE" required="true"/> + <column name="BL_MEAN" type="DOUBLE" required="true"/> + <column name="BL_COMPUTE_TIME" type="LONG" required="true"/> + <column name="SCHEDULE_ID" type="INTEGER" required="true" references="RHQ_MEASUREMENT_SCHED(ID)"/> + <index name="RHQ_MEAS_BASELINE_CTIME_IDX"> + <field ref="BL_COMPUTE_TIME"/> + </index> + <index name="RHQ_MEAS_BASELINE_SID_IDX"> + <field ref="SCHEDULE_ID"/> + </index> + </table> + + + <table name="RHQ_MEASUREMENT_DATA_NUM_1H" logging="false" cache="true" + tablespace="DEFAULT" storage-options="freelists 20"> + + <column name="TIME_STAMP" required="true" type="LONG"/> + <column name="SCHEDULE_ID" required="true" type="INTEGER"/> + <column name="VALUE" required="false" type="DOUBLE"/> + <column name="MINVALUE" required="false" type="DOUBLE"/> + <column name="MAXVALUE" required="false" type="DOUBLE"/> + + <constraint name="RHQ_MEAS_DATA_1H_ID_TIME_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + + <index name="RHQ_MEAS_DATA_1H_TIME_IDX"> + <field ref="TIME_STAMP"/> + </index> + </table> + + + <table name="RHQ_MEASUREMENT_DATA_NUM_6H" logging="false" cache="true" + tablespace="DEFAULT" storage-options="freelists 20"> + + <column name="TIME_STAMP" required="true" type="LONG"/> + <column name="SCHEDULE_ID" required="true" type="INTEGER"/> + <column name="VALUE" required="false" type="DOUBLE"/> + <column name="MINVALUE" required="false" type="DOUBLE"/> + <column name="MAXVALUE" required="false" type="DOUBLE"/> + + <constraint name="RHQ_MEAS_DATA_6H_ID_TIME_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + + <index name="RHQ_MEAS_DATA_6H_TIME_IDX"> + <field ref="TIME_STAMP"/> + </index> + </table> + + + <table name="RHQ_MEASUREMENT_DATA_NUM_1D" logging="false" cache="true" + tablespace="DEFAULT" storage-options="freelists 20"> + + <column name="TIME_STAMP" required="true" type="LONG"/> + <column name="SCHEDULE_ID" required="true" type="INTEGER"/> + <column name="VALUE" required="false" type="DOUBLE"/> + <column name="MINVALUE" required="false" type="DOUBLE"/> + <column name="MAXVALUE" required="false" type="DOUBLE"/> + + <constraint name="RHQ_MEAS_DATA_1D_ID_TIME_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + + <index name="RHQ_MEAS_DATA_1D_TIME_IDX"> + <field ref="TIME_STAMP" /> + </index> + </table> + + + <table name="RHQ_MEASUREMENT_DATA_TRAIT"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER" /> + <column name="VALUE" type="VARCHAR2" size="4000" /> + <constraint name="RHQ_MEAS_DATA_TRAIT_ID_TIME_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + + + <table name="RHQ_CALLTIME_DATA_KEY"> + <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> + <column name="SCHEDULE_ID" type="INTEGER" required="true"/> + <column name="CALL_DESTINATION" type="VARCHAR2" size="4000" required="true"/> + <index name="RHQ_CALLTIME_DATA_KEY_IDX" unique="true"> + <field ref="SCHEDULE_ID"/> + <field ref="CALL_DESTINATION"/> + </index> + </table> + + + <table name="RHQ_CALLTIME_DATA_VALUE"> + <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> + <column name="KEY_ID" type="INTEGER" references="RHQ_CALLTIME_DATA_KEY" required="true"/> + <column name="BEGIN_TIME" type="LONG" required="true"/> + <column name="END_TIME" type="LONG" required="true"/> + <column name="MINIMUM" type="DOUBLE" required="true"/> + <column name="MAXIMUM" type="DOUBLE" required="true"/> + <column name="TOTAL" type="DOUBLE" required="true"/> + <column name="COUNT" type="LONG" required="true"/> + <index name="RHQ_CT_DA_VA_END_TIM_IDX"> + <field ref="END_TIME"/> + </index> + </table> + + + <table name="RHQ_AVAILABILITY"> + <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE(ID)"/> + <column name="START_TIME" type="LONG" required="true" /> + <column name="END_TIME" type="LONG" required="false" /> + <column name="AVAILABILITY_TYPE" type="SMALLINT" required="false" /> + <index name="RHQ_AVAIL_RESOURCE_START_IDX"> + <field ref="RESOURCE_ID"/> + <field ref="START_TIME"/> + </index> + <!-- only one null row can exist for any resource --> + <index name="RHQ_AVAIL_RESOURCE_END_IDX" condition="END_TIME IS NULL"> + <field ref="RESOURCE_ID"/> + <field ref="END_TIME" /> + </index> + </table> + + <table name="RHQ_RESOURCE_AVAIL"> + <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE(ID)" ondelete="cascade"/> + <column name="AVAILABILITY_TYPE" type="SMALLINT" required="false" /> + <index name="RHQ_RESOURCE_AVAIL_IDX"> + <field ref="RESOURCE_ID" /> + </index> + </table> + + <table name="RHQ_MEASUREMENT_OOB"> + <column name="SCHEDULE_ID" type="INTEGER" references="RHQ_MEASUREMENT_SCHED(ID)" required="true"/> + <column name="TIME_STAMP" type="LONG" required="true"/> + <column name="OOB_FACTOR" type="INTEGER" required="true" /> + <constraint name="RHQ_MEAS_OOB_ID_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_MEASUREMENT_OOB_TMP"> + <column name="SCHEDULE_ID" type="INTEGER" required="true"/> + <column name="TIME_STAMP" type="LONG" required="true"/> + <column name="OOB_FACTOR" type="INTEGER" required="true" /> + <constraint name="RHQ_MEAS_OOB_TMP_ID_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_NUMBERS"> + <column name="i" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true" /> + </table> + + + <table name="RHQ_MEAS_DATA_NUM_R00"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R00_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R00_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R01"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R01_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R01_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R02"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R02_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R02_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R03"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R03_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R03_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R04"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R04_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R04_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R05"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R05_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R05_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R06"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R06_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R06_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R07"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R07_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R07_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R08"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R08_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R08_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R09"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R09_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R09_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R10"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R10_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R10_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R11"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R11_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R11_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R12"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R12_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R12_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R13"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R13_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R13_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R14"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R14_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R14_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + +<!-- END: measurement-schema.xml --> +<!-- BEGIN: content-schema.xml --> + + + <table name="RHQ_ARCHITECTURE"> + <column name="ID" default="sequence-only" initial="100" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="50" type="VARCHAR2" required="true"/> + <index name="RHQ_ARCHITECTURE_NAME_IDX" unique="true"> + <field ref="NAME"/> + </index> + </table> + + <table name="RHQ_REPO_GROUP_TYPE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + </table> + + + <table name="RHQ_REPO_GROUP"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + + <column name="REPO_GROUP_TYPE_ID" type="INTEGER" references="RHQ_REPO_GROUP_TYPE" required="true"/> + + <index name="RHQ_REPO_GROUP_IDX" unique="true"> + <field ref="NAME"/> + <field ref="REPO_GROUP_TYPE_ID"/> + </index> + </table> + + + <table name="RHQ_CONTENT_SOURCE_TYPE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="false"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="PLUGIN_NAME" size="100" type="VARCHAR2" required="false"/> + <!-- we might want this as part of natural key --> + <column name="DEFAULT_LAZY_LOAD" type="BOOLEAN" required="true"/> + <column name="DEFAULT_DOWNLOAD_MODE" size="16" type="VARCHAR2" required="true"/> + <column name="DEFAULT_SYNC_SCHEDULE" size="64" type="VARCHAR2" required="false"/> + <column name="API_CLASS" size="100" type="VARCHAR2" required="true"/> + + <column name="SOURCE_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF" required="false"/> + + <index name="RHQ_CONTENT_SOURCE_TYPE_IDX" unique="true"> + <field ref="NAME"/> + <!-- <field ref="PLUGIN_NAME"/> --> + </index> + </table> + + <table name="RHQ_CONTENT_SOURCE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="LAZY_LOAD" type="BOOLEAN" required="true"/> + <column name="DOWNLOAD_MODE" size="16" type="VARCHAR2" required="true"/> + <column name="SYNC_SCHEDULE" size="64" type="VARCHAR2" required="false"/> + <column name="LOAD_ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="CREATION_TIME" type="LONG" required="true"/> + <column name="LAST_MODIFIED_TIME" type="LONG" required="true"/> + + <column name="CONTENT_SOURCE_TYPE_ID" type="INTEGER" references="RHQ_CONTENT_SOURCE_TYPE" required="true"/> + <column name="CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> + + <index name="RHQ_CONTENT_SOURCE_IDX" unique="true"> + <field ref="NAME"/> + <field ref="CONTENT_SOURCE_TYPE_ID"/> + </index> + </table> + + <table name="RHQ_REPO"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="CREATION_TIME" type="LONG" required="true"/> + <column name="LAST_MODIFIED_TIME" type="LONG" required="true"/> + <column name="IS_CANDIDATE" type="BOOLEAN" required="true"/> + <column name="SYNC_SCHEDULE" size="64" type="VARCHAR2" required="false"/> + <column name="OWNER_ID" type="INTEGER" required="false" references="RHQ_SUBJECT" /> + <column name="IS_PRIVATE" type="BOOLEAN" required="true" /> + + <index name="RHQ_REPO_IDX" unique="true"> + <field ref="NAME"/> + </index> + </table> + + + <table name="RHQ_REPO_RELATION_TYPE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + </table> + + + <table name="RHQ_REPO_RELATION"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="RELATED_REPO_ID" type="INTEGER" references="RHQ_REPO" required="true"/> + <column name="REPO_RELATION_TYPE_ID" type="INTEGER" references="RHQ_REPO_RELATION_TYPE" required="true"/> + </table> + + + + <table name="RHQ_PACKAGE_TYPE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="false"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="CATEGORY" size="50" type="VARCHAR2" required="false"/> + <column name="DISCOVERY_INTERVAL" type="INTEGER" required="false"/> + <column name="IS_CREATION_DATA" type="BOOLEAN" required="true"/> + <column name="SUPPORTS_ARCHITECTURE" type="BOOLEAN" required="true"/> + + <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE" required="false"/> + <column name="DEPLOYMENT_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF" required="false"/> + <column name="PACKAGE_EXTRA_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG_DEF" required="false"/> + + <index name="RHQ_PACKAGE_TYPE_IDX" unique="true"> + <field ref="NAME"/> + <field ref="RESOURCE_TYPE_ID"/> + </index> + + </table> + + <table name="RHQ_PACKAGE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="CLASSIFICATION" size="200" type="VARCHAR2" required="false"/> + + <column name="PACKAGE_TYPE_ID" type="INTEGER" references="RHQ_PACKAGE_TYPE" required="true"/> + + <index name="RHQ_PACKAGE_IDX" unique="true"> + <field ref="NAME"/> + <field ref="PACKAGE_TYPE_ID"/> + </index> + </table> + + <table name="RHQ_PACKAGE_BITS"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="BITS" type="LARGEOBJECT" required="false"/> + </table> + + <table name="RHQ_PACKAGE_VERSION"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="false"/> + <column name="SHORT_DESCRIPTION" size="10000" type="CLOB" required="false"/> + <column name="LONG_DESCRIPTION" size="50000" type="CLOB" required="false"/> + <column name="VERSION" size="500" type="VARCHAR2" required="true"/> + <column name="DISPLAY_VERSION" size="500" type="VARCHAR2" required="false"/> + <column name="FILE_NAME" size="255" type="VARCHAR2" required="false"/> + <column name="FILE_SIZE" type="LONG" required="false"/> + <column name="FILE_MD5" size="32" type="VARCHAR2" required="false"/> + <column name="FILE_SHA256" size="64" type="VARCHAR2" required="false"/> + <column name="FILE_CREATION_TIME" type="LONG" required="false"/> + <column name="LICENSE_NAME" size="255" type="VARCHAR2" required="false"/> + <column name="LICENSE_VERSION" size="20" type="VARCHAR2" required="false"/> + <column name="METADATA" type="BLOB" required="false"/> + + <column name="PACKAGE_ID" type="INTEGER" references="RHQ_PACKAGE" required="true"/> + <column name="ARCHITECTURE_ID" type="INTEGER" references="RHQ_ARCHITECTURE" required="true"/> + <column name="CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> + <column name="PACKAGE_BITS_ID" type="INTEGER" references="RHQ_PACKAGE_BITS" required="false"/> + + <index name="RHQ_PACKAGE_VERSION_IDX" unique="true"> + <field ref="PACKAGE_ID"/> + <field ref="VERSION"/> + <field ref="ARCHITECTURE_ID"/> + </index> + + </table> + + <table name="RHQ_CONTENT_REQ"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="REQUEST_TYPE" type="VARCHAR2" required="true" size="20"/> + <column name="NOTES" type="VARCHAR2" required="false" size="512"/> + </table> + + <table name="RHQ_INSTALLED_PACKAGE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="INSTALLATION_TIME" type="LONG" required="false"/> + + <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE" required="true"/> + <column name="PACKAGE_VERSION_ID" type="INTEGER" references="RHQ_PACKAGE_VERSION" required="true"/> + <column name="SUBJECT_ID" type="INTEGER" references="RHQ_SUBJECT" required="false"/> + </table> + + <table name="RHQ_INSTALLED_PKG_HIST"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="STATUS" type="VARCHAR2" size="24" required="true"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="HISTORY_TIMESTAMP" type="LONG" required="false"/> + + <column name="PACKAGE_VERSION_ID" type="INTEGER" references="RHQ_PACKAGE_VERSION" required="true"/> + <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE" required="true"/> + <column name="DEPLOYMENT_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> + <column name="CONTENT_SERVICE_REQUEST_ID" type="INTEGER" references="RHQ_CONTENT_REQ" required="false"/> + </table> + + <table name="RHQ_CONTENT_SRC_SYNC"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="STATUS" type="VARCHAR2" size="16" required="true"/> + <column name="START_TIME" type="LONG" required="true"/> + <column name="END_TIME" type="LONG" required="false"/> + <column name="RESULTS" type="LONGVARCHAR" required="false"/> + <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> + </table> + + <table name="RHQ_REPO_SYNC"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="STATUS" type="VARCHAR2" size="16" required="true"/> + <column name="START_TIME" type="LONG" required="true"/> + <column name="END_TIME" type="LONG" required="false"/> + <column name="RESULTS" type="LONGVARCHAR" required="false"/> + <column name="PERCENT_COMPLETE" type="LONG" required="false"/> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + </table> + + + <table name="RHQ_PACKAGE_INST_STEP"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="STEP_KEY" type="VARCHAR2" size="500" required="true"/> + <column name="STEP_ORDER" type="INTEGER" required="true"/> + <column name="DESCRIPTION" type="VARCHAR2" size="4000" required="true"/> + <column name="ERROR_MSG" type="LONGVARCHAR" required="false"/> + <column name="RESULT" type="VARCHAR2" size="25" required="true"/> + + <column name="INSTALLED_PKG_HIST_ID" type="INTEGER" references="RHQ_INSTALLED_PKG_HIST"/> + </table> + + <table name="RHQ_REPO_RESOURCE_MAP"> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_REPO_RESOURCE_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="RESOURCE_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_REPO_CONTENT_SRC_MAP"> 1 + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_REPO_CONTENT_SRC_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="CONTENT_SRC_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_REPO_REPO_GROUP_MAP"> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="REPO_GROUP_ID" type="INTEGER" required="true" references="RHQ_REPO_GROUP"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_REPO_REPO_GROUP_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="REPO_GROUP_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_REPO_REPO_RELATION_MAP"> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="REPO_RELATION_ID" type="INTEGER" required="true" references="RHQ_REPO_RELATION"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_REPO_REPO_RELATION_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="REPO_RELATION_ID"/> + </primaryKey> + </constraint> + </table> + + + <table name="RHQ_REPO_PKG_VERSION_MAP"> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_REPO_PKG_VER_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="PACKAGE_VERSION_ID"/> + </primaryKey> + </constraint> + <index name="RHQ_REPO_PKG_VER_MAP_IDX" unique="false"> + <field ref="PACKAGE_VERSION_ID"/> + </index> + </table> + + <table name="RHQ_PKG_VER_CONTENT_SRC_MAP"> + <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> + <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> + <column name="LOCATION" type="VARCHAR2" size="4000" required="true"/> + + <constraint name="RHQ_PKG_VER_CONTENT_SRC_KEY"> + <primaryKey> + <field ref="PACKAGE_VERSION_ID"/> + <field ref="CONTENT_SRC_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_PKG_PRD_MAP"> + <column name="PKG_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> + <column name="PRD_ID" type="INTEGER" required="true" references="RHQ_PRD_VER"/> + + <constraint name="RHQ_PKG_PRD_KEY"> + <primaryKey> + <field ref="PKG_ID"/> + <field ref="PRD_ID"/> + </primaryKey> + </constraint> + + </table> + + <table name="RHQ_DISTRIBUTION_TYPE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + + </table> + + <table name="RHQ_DISTRIBUTION"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="DISTRIBUTION_TYPE_ID" type="INTEGER" required="true" references="RHQ_DISTRIBUTION_TYPE"/> + <column name="LABEL" size="64" type="VARCHAR2" required="true"/> + <column name="BASE_PATH" size="256" type="VARCHAR2" required="true"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + + <index name="RHQ_DISTRIBUTION_IDX" unique="true"> + <field ref="LABEL"/> + <field ref="BASE_PATH"/> + </index> + + </table> + + <table name="RHQ_REPO_DISTRIBUTION"> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="DISTRIBUTION_ID" type="INTEGER" required="true" references="RHQ_DISTRIBUTION"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + + <constraint name="RHQ_REPO_DIST_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="DISTRIBUTION_ID"/> + </primaryKey> + </constraint> + </table> + + + + <table name="RHQ_DISTRIBUTION_FILE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="DISTRIBUTION_ID" type="INTEGER" required="true" references="RHQ_DISTRIBUTION"/> + <column name="RELATIVE_FILENAME" size="256" type="VARCHAR2" required="true"/> + <!--<column name="FILE_SIZE" type="NUMBER" required="true"/>--> + <column name="MD5SUM" size="64" type="VARCHAR2" required="true"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + <!--<column name="CTIME" type="LONG" required="true"/>--> + + <index name="RHQ_DISTRIBUTION_FILE_IDX" unique="true"> + <field ref="DISTRIBUTION_ID"/> + <field ref="RELATIVE_FILENAME"/> + </index> + </table> + + + + + <table name="RHQ_ADVISORY"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="ADVISORY" size="64" type="VARCHAR2" required="true"/> + <column name="ADVISORY_TYPE" size="64" type="VARCHAR2" required="true" /> + <column name="ADVISORY_REL" size="64" type="VARCHAR2" required="false"/> + <column name="ADVISORY_NAME" size="64" type="VARCHAR2" required="false"/> + <column name="DESCRIPTION" size="4000" type="VARCHAR2" required="false"/> + <column name="SYNOPSIS" size="4000" type="VARCHAR2" required="true"/> + <column name="TOPIC" size="4000" type="VARCHAR2" required="false"/> + <column name="SOLUTION" size="4000" type="VARCHAR2" required="false"/> + <column name="SEVERITY" size="64" type="VARCHAR2" required="false"/> + <column name="ISSUE_DATE" type="LONG" required="false"/> + <column name="UPDATE_DATE" type="LONG" required="false"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + + <index name="RHQ_ADVISORY_NAME_UQ" unique="true"> + <field ref="ADVISORY_NAME"/> + </index> + + <index name="RHQ_ADVISORY_UQ" unique="true"> + <field ref="ADVISORY"/> + </index> + + <index name="RHQ_ADVISORY_UDATE_IDX" unique="false"> + <field ref="UPDATE_DATE"/> + </index> + </table> + + <table name="RHQ_ADVISORY_PACKAGE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> + <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + + <index name="RHQ_ADVISORY_PKG_IDX" unique="true"> + <field ref="ADVISORY_ID"/> + <field ref="PACKAGE_VERSION_ID"/> + </index> + </table> + + <table name="RHQ_CVE"> + <column name="ID" default="sequence-only" initial="101" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="64" type="VARCHAR2" required="true"/> + </table> + + <table name="RHQ_ADVISORY_CVE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> + <column name="CVE_ID" type="INTEGER" required="true" references="RHQ_CVE"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + + <index name="RHQ_ADVISORY_CVE_IDX" unique="true"> + <field ref="ADVISORY_ID"/> + <field ref="CVE_ID"/> + </index> + + </table> + + <table name="RHQ_ADVISORY_BUGLIST"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> + <column name="BUG_ID" size="256" type="VARCHAR2" required="true"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + + <index name="RHQ_ADVISORY_BUG_IDX" unique="true"> + <field ref="ADVISORY_ID"/> + <field ref="BUG_ID"/> + </index> + </table> + + + <table name="RHQ_REPO_ADVISORY"> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + + <constraint name="RHQ_REPO_ADV_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="ADVISORY_ID"/> + </primaryKey> + </constraint> + </table> + + <!-- BUNDLE_TYPE is things like "Cobbler profile" or "file-based bundle" or "puppet recipe" --> + <table name="RHQ_BUNDLE_TYPE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> + + <!-- This index is for constraint, not performance --> + <index name="RHQ_BUNDLE_TYPE_UNIQUE" unique="true"> + <field ref="NAME"/> + </index> + </table> + + <!-- BUNDLE is a named piece of content that can be versioned and installed somewhere --> + <table name="RHQ_BUNDLE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="BUNDLE_TYPE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_TYPE"/> + <column name="PACKAGE_TYPE_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_TYPE"/> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + + <!-- This index is for constraint, not performance --> + <index name="RHQ_BUNDLE_UNIQUE" unique="true"> + <field ref="BUNDLE_TYPE_ID"/> + <field ref="NAME"/> + </index> + </table> + + <!-- BUNDLE_VERSION represents an actual piece of content that needs to be installed somewhere --> + <table name="RHQ_BUNDLE_VERSION"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="VERSION" size="500" type="VARCHAR2" required="true"/> + <column name="VERSION_ORDER" type="INTEGER" required="true"/> + <column name="ACTION" type="CLOB" required="true"/> + <column name="CONFIG_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_DEF" /> + <column name="BUNDLE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE"/> + + <!-- This index is for constraint, not performance --> + <index name="RHQ_BUNDLE_VERSION_UNIQUE" unique="true"> + <field ref="BUNDLE_ID"/> + <field ref="NAME"/> + <field ref="VERSION"/> + </index> + </table> + + <!-- Many-to-many table that links many repos to a particular bundle version. destination platforms --> + <!-- would be required to have associations to the specified repos (to access required content --> + <table name="RHQ_BUNDLE_VERSION_REPO"> + <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + + <constraint name="RHQ_BUNDLE_VERSION_REPO_KEY"> + <primaryKey> + <field ref="BUNDLE_VERSION_ID"/> + <field ref="REPO_ID"/> + </primaryKey> + </constraint> + </table> + + <!-- BUNDLE_FILE represents a file that is associated with (possibly bundled inside) a bundle version --> + <table name="RHQ_BUNDLE_FILE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> + <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> + </table> + + <!-- A logical destination for a bundle deployment. Defines the platforms and directory on those targets. --> + <table name="RHQ_BUNDLE_DESTINATION"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="BUNDLE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE"/> + <column name="GROUP_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_GROUP"/> + <column name="DEPLOY_DIR" size="256" type="VARCHAR2" required="true"/> + <column name="DEST_BASE_DIR_NAME" size="200" type="VARCHAR2" required="true"/> + + <!-- This index is for constraint, not performance --> + <index name="RHQ_BUNDLE_DESTINATION_UNIQUE" unique="true"> + <field ref="BUNDLE_ID"/> + <field ref="GROUP_ID"/> + <field ref="DEPLOY_DIR"/> + </index> + </table> + + <!-- An actual deployment of a bundle version to a destination, with a specific config. Bundle deployments + can differ only on ctime, which is assumed to be different --> + <table name="RHQ_BUNDLE_DEPLOYMENT"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> + <column name="BUNDLE_DESTINATION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DESTINATION"/> + <column name="CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG" /> + <column name="SUBJECT_NAME" type="VARCHAR2" required="false" size="255"/> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="IS_LIVE" type="BOOLEAN" required="true"/> + <column name="REPLACED_BUNDLE_DEPLOYMENT_ID" type="INTEGER" required="false" references="RHQ_BUNDLE_DEPLOYMENT"/> + </table> + + <!-- Represents a bundle version that is deployed on a platform resource --> + <table name="RHQ_BUNDLE_RES_DEPLOY"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="BUNDLE_DEPLOYMENT_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DEPLOYMENT" /> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE" /> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="CTIME" type="LONG" required="true"/> + + <index name="RHQ_BUNDLE_RES_DEPLOY_IDX" unique="true"> + <field ref="BUNDLE_DEPLOYMENT_ID"/> + <field ref="RESOURCE_ID"/> + </index> + </table> + + <table name="RHQ_BUNDLE_RES_DEP_HIST"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="BUNDLE_RES_DEPLOY_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_RES_DEPLOY" /> + <column name="SUBJECT_NAME" required="false" size="255" type="VARCHAR2"/> + <column name="AUDIT_TIME" required="true" type="LONG"/> + <column name="ACTION" required="true" size="128" type="VARCHAR2"/> + <column name="INFO" required="true" size="512" type="VARCHAR2"/> + <column name="CATEGORY" required="false" size="32" type="VARCHAR2"/> + <column name="STATUS" required="true" type="VARCHAR2" size="16"/> + <column name="MESSAGE" required="false" type="LONGVARCHAR"/> + <column name="ATTACHMENT" required="false" type="LONGVARCHAR"/> + </table> + + <table name="RHQ_TAGGING_BUNDLE_MAP"> + <column name="BUNDLE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE"/> + <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> + <constraint name="RHQ_TAGGING_BUNDLE_MAP_KEY"> + <primaryKey> + <field ref="BUNDLE_ID"/> + <field ref="TAG_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_TAGGING_BUNDLE_VERSION_MAP"> + <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> + <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> + <constraint name="RHQ_TAGGING_BUNDLE_VER_MAP_KEY"> + <primaryKey> + <field ref="BUNDLE_VERSION_ID"/> + <field ref="TAG_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_TAGGING_BUNDLE_DEPLOY_MAP"> + <column name="BUNDLE_DEPLOYMENT_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DEPLOYMENT"/> + <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> + <constraint name="RHQ_TAGGING_BUNDLE_DEP_MAP_KEY"> + <primaryKey> + <field ref="BUNDLE_DEPLOYMENT_ID"/> + <field ref="TAG_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_TAGGING_BUNDLE_DEST_MAP"> + <column name="BUNDLE_DESTINATION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DESTINATION"/> + <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> + <constraint name="RHQ_TAGGING_BUNDLE_DES_MAP_KEY"> + <primaryKey> + <field ref="BUNDLE_DESTINATION_ID"/> + <field ref="TAG_ID"/> + </primaryKey> + </constraint> + </table> + + <!-- Drift Management Tables --> + <table name="RHQ_DRIFT_DEF_TEMPLATE"> + <column name="ID" default="sequence-only" initial="1001" primarykey="true" required="true" type="INTEGER"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> + <column name="CONFIG_ID" type="INTEGER" required="true" references="RHQ_CONFIG"/> + <column name="NAME" type="VARCHAR2" size="128" required="true"/> + <column name="DESCRIPTION" type="VARCHAR2" size="512" required="false"/> + <!-- true if defined by user, false if provided by plugin --> + <column name="IS_USER_DEFINED" type="BOOLEAN" required="true"/> + <!-- + Change sets are managed by the drift server plugins; therefore, we cannot maintain + a FK constraint on the change set id. And the type cannot be integer because + other back ends like MongoDB use other types that are basically variants of a + UUID + + jsanda + --> + <column name="DRIFT_CHANGE_SET_ID" type="VARCHAR2" size="64" required="false"/> + <column name="CTIME" type="LONG" required="true"/> + + <index name="RHQ_DRIFT_DEF_TEMPLATE_UNIQUE" unique="true"> + <field ref="RESOURCE_TYPE_ID"/> + <field ref="NAME"/> + </index> + </table> + + <!-- Content of a file being managed for drift. Used for diff and/or remediation --> + <table name="RHQ_DRIFT_FILE"> + <column name="HASH_ID" type="VARCHAR2" size="64" primarykey="true" required="true"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="DATA" type="LARGEOBJECT" required="false"/> + <column name="DATA_SIZE" type="LONG" required="false"/> + <column name="STATUS" type="VARCHAR2" size="20" required="true"/> + </table> + + <!-- A single drift definition defining file tracking + Note: A resource or group (todo: group, other?) can have zero or more drift configurations. + Note: The name, interval and is_enabled values are also stored withing the referenced config. + This allows us to use the config editor to manipulate all fields. + Note: Name is read-only + Note: Interval unit is millis + --> + <table name="RHQ_DRIFT_DEFINITION"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="CONFIG_ID" type="INTEGER" required="true" references="RHQ_CONFIG"/> + <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> + <column name="DRIFT_DEF_TEMPLATE_ID" type="INTEGER" required="false" references="RHQ_DRIFT_DEF_TEMPLATE"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="NAME" type="VARCHAR2" size="128" required="true"/> + <column name="DESCRIPTION" type="VARCHAR2" size="512" required="false"/> + <column name="INTERVAL" type="LONG" required="true"/> + <column name="IS_ENABLED" type="BOOLEAN" required="true"/> + <column name="DRIFT_HANDLING_MODE" type="VARCHAR2" size="20" required="true"/> + <column name="IS_PINNED" type="BOOLEAN" required="true"/> + <column name="IS_ATTACHED" type="BOOLEAN" required="true"/> + </table> + + <table name="RHQ_DRIFT_SET"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + </table> + + <!-- A drift change-set report for a resource --> + <table name="RHQ_DRIFT_CHANGE_SET"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="DRIFT_SET_ID" type="INTEGER" required="false" references="RHQ_DRIFT_SET"/> + <column name="CTIME" type="LONG" required="true"/> + <!-- Version 0 is initial change-set --> + <column name="VERSION" type="INTEGER" required="true"/> + <column name="CATEGORY" type="VARCHAR2" size="20" required="true"/> + <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> + <column name="DRIFT_DEFINITION_ID" type="INTEGER" required="false" references="RHQ_DRIFT_DEFINITION"/> + <!-- the drift handling mode at changeset creation time --> + <column name="DRIFT_HANDLING_MODE" type="VARCHAR2" size="20" required="true"/> + </table> + + <!-- A single occurence of drift for a resource --> + <table name="RHQ_DRIFT"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="CATEGORY" type="VARCHAR2" size="20" required="true"/> + <column name="DRIFT_SET_ID" type="INTEGER" required="false" references="RHQ_DRIFT_SET"/> + <column name="DRIFT_CHANGE_SET_ID" type="INTEGER" required="true" references="RHQ_DRIFT_CHANGE_SET"/> + <!-- the file path not including the base directory --> + <column name="PATH" type="VARCHAR2" size="1024" required="true"/> + <!-- the same as PATH less [/]filename.ext. Redundant storage for the purpose of strict directory search. + this field can be considered transient for serialization purposes --> + <column name="PATH_DIRECTORY" type="VARCHAR2" size="1024" required="true"/> + <column name="OLD_DRIFT_FILE" type="VARCHAR2" size="64" required="false" references="RHQ_DRIFT_FILE"/> + <column name="NEW_DRIFT_FILE" type="VARCHAR2" size="64" required="false" references="RHQ_DRIFT_FILE"/> + </table> + + +<!-- END: content-schema.xml --> +<!-- BEGIN: resource-request-schema.xml --> + + + <table name="RHQ_CREATE_RES_HIST"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="PARENT_RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> + <column name="CREATED_RESOURCE_NAME" type="VARCHAR2" size="500" required="false"/> + <column name="NEW_RESOURCE_KEY" type="VARCHAR2" required="false" size="500"/> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> + <column name="CONFIGURATION_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> + <column name="INSTALLED_PACKAGE_ID" type="INTEGER" required="false" references="RHQ_INSTALLED_PACKAGE"/> + </table> + + <table name="RHQ_DELETE_RES_HIST"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> + </table> + +<!-- END: resource-request-schema.xml --> +<!-- BEGIN: jms-schema.xml --> + +<!-- the schema matches that which would be automatically created by the JMS subsystem --> +<!-- see deploy/jms/rhq-jdbc-state-service.xml and rhq-jdbc2-service.xml --> + + + <table name="JMS_MESSAGES"> + <column name="MESSAGEID" required="true" type="INTEGER" /> + <column name="DESTINATION" required="true" type="VARCHAR2" size="255" /> + <column name="TXID" required="false" type="INTEGER" /> + <column name="TXOP" required="false" type="CHAR" size="1" /> + <column name="MESSAGEBLOB" required="false" type="BLOB" /> + + <constraint name="JMS_MESSAGES_PKEY"> + <primaryKey> + <field ref="MESSAGEID"/> + <field ref="DESTINATION"/> + </primaryKey> + </constraint> + + <index name="JMS_MESSAGES_TXOP_TXID"> + <field ref="TXOP"/> + <field ref="TXID"/> + </index> + <index name="JMS_MESSAGES_DESTINATION"> + <field ref="DESTINATION"/> + </index> + </table> + + <table name="JMS_TRANSACTIONS"> + <column name="TXID" required="true" type="INTEGER" primarykey="true" /> + </table> + + <table name="JMS_USERS"> + <column name="USERID" required="true" type="VARCHAR2" size="32" primarykey="true" /> + <column name="PASSWD" required="true" type="VARCHAR2" size="32" /> + <column name="CLIENTID" required="false" type="VARCHAR2" size="128" /> + </table> + + <table name="JMS_ROLES"> + <column name="ROLEID" required="true" type="VARCHAR2" size="32" /> + <column name="USERID" required="true" type="VARCHAR2" size="32" /> + + <constraint name="JMS_ROLES_PKEY"> + <primaryKey> + <field ref="USERID"/> + <field ref="ROLEID"/> + </primaryKey> + </constraint> + </table> + + <table name="JMS_SUBSCRIPTIONS"> + <column name="CLIENTID" required="true" type="VARCHAR2" size="128" /> + <column name="SUBNAME" required="true" type="VARCHAR2" size="128" /> + <column name="TOPIC" required="true" type="VARCHAR2" size="255" /> + <column name="SELECTOR" required="false" type="VARCHAR2" size="255" /> + + <constraint name="JMS_SUBSCRIPTIONS_PKEY"> + <primaryKey> + <field ref="CLIENTID"/> + <field ref="SUBNAME"/> + </primaryKey> + </constraint> + </table> + +<!-- END: jms-schema.xml --> +<!-- BEGIN: obsolete-schema.xml --> + + + <!-- NOTE: The tables will be dropped in the *** REVERSE ORDER *** as listed in this file! --> + <!-- NOTE: So, put the table you want dropped first at the bottom, and so on... --> + + + <!-- !!! REMOVED FROM CONTENT-SCHEMA !!!! --> + + <table name="RHQ_BUNDLE_CONFIG" obsolete="true"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG" /> + <!-- this probably needs a DTYPE discriminator so we know if its a bundle or a specific bundle version --> + <column name="BUNDLE_VERSION_ID" type="INTEGER" required="false" references="RHQ_BUNDLE_VERSION"/> + <column name="BUNDLE_ID" type="INTEGER" required="false" references="RHQ_BUNDLE"/> + </table> + + <table name="RHQ_CHANNEL" obsolete="true"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="CREATION_TIME" type="LONG" required="true"/> + <column name="LAST_MODIFIED_TIME" type="LONG" required="true"/> + + <index name="RHQ_CHANNEL_IDX" unique="true"> + <field ref="NAME"/> + </index> + </table> + + <table name="RHQ_CHANNEL_RESOURCE_MAP" obsolete="true"> + <column name="CHANNEL_ID" type="INTEGER" required="true" references="RHQ_CHANNEL"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_CHANNEL_RESOURCE_MAP_KEY"> + <primaryKey> + <field ref="CHANNEL_ID"/> + <field ref="RESOURCE_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_CHANNEL_CONTENT_SRC_MAP" obsolete="true"> + <column name="CHANNEL_ID" type="INTEGER" required="true" references="RHQ_CHANNEL"/> + <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_CHAN_CONTENT_SRC_MAP_KEY"> + <primaryKey> + <field ref="CHANNEL_ID"/> + <field ref="CONTENT_SRC_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_CHANNEL_PKG_VERSION_MAP" obsolete="true"> + <column name="CHANNEL_ID" type="INTEGER" required="true" references="RHQ_CHANNEL"/> + <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_CHANNEL_PKG_VER_MAP_KEY"> + <primaryKey> + <field ref="CHANNEL_ID"/> + <field ref="PACKAGE_VERSION_ID"/> + </primaryKey> + </constraint> + </table> + + <!-- !!! REMOVED FROM MEASUREMENT-SCHEMA !!!! --> + + <table name="RHQ_MEASUREMENT_OOB" obsolete="true"> + <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> + <column name="SCHEDULE_ID" type="INTEGER" references="RHQ_MEASUREMENT_SCHED(ID)" required="true"/> + <column name="OCCURRED" type="LONG" required="true"/> + <column name="DIFF" type="DOUBLE" required="true"/> + + <index name="RHQ_MEASUREMENT_OOB_IDX" unique="true"> + <field ref="SCHEDULE_ID" /> + <field ref="OCCURRED" /> + </index> + </table> + + + <table name="RHQ_TAG" obsolete="true"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + </table> + + <table name="RHQ_REPO_TAG_MAP" obsolete="true"> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAG"/> + + <constraint name="RHQ_REPO_TAG_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="TAG_ID"/> + </primaryKey> + </constraint> + </table> + + +<!-- END: obsolete-schema.xml --> +</dbsetup> diff --git a/modules/enterprise/server/installer/src/test/resources/org/rhq/enterprise/server/installer/db-schema-combined-rhq-4.3.0.xml b/modules/enterprise/server/installer/src/test/resources/org/rhq/enterprise/server/installer/db-schema-combined-rhq-4.3.0.xml new file mode 100644 index 0000000..3fd833f --- /dev/null +++ b/modules/enterprise/server/installer/src/test/resources/org/rhq/enterprise/server/installer/db-schema-combined-rhq-4.3.0.xml @@ -0,0 +1,2649 @@ +<?xml version="1.0" encoding="UTF-8"?> +<dbsetup name="schema"> +<!-- BEGIN: config-schema.xml --> + + + <!-- Definition or Metadata tables --> + + <table name="RHQ_CONFIG_DEF"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="NAME" type="VARCHAR2" required="true" size="100"/> + <column name="DESCRIPTION" type="VARCHAR2" required="false" size="250"/> + <column name="VERSION" type="VARCHAR2" required="false" size="50"/> + <column name="CONFIG_FORMAT" type="VARCHAR2" required="false" size="32"/> + </table> + + <table name="RHQ_CONFIG_PROP_GRP_DEF"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="NAME" type="VARCHAR2" required="true" size="100"/> + <column name="DISPLAY_NAME" type="VARCHAR2" required="false" size="100"/> + <column name="DESCRIPTION" type="VARCHAR2" required="false" size="250"/> + <column name="DEFAULT_HIDDEN" type="BOOLEAN" required="false"/> + <column name="ORDER_INDEX" type="INTEGER" required="false"/> + </table> + + <table name="RHQ_CONFIG_PROP_DEF"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="NAME" type="VARCHAR2" required="false" size="255"/> + <column name="DISPLAY_NAME" type="VARCHAR2" required="false" size="100"/> + <column name="DESCRIPTION" type="VARCHAR2" required="false" size="1000"/> + <column name="DEFAULT_VALUE" type="VARCHAR2" required="false" size="2000"/> + <column name="REQUIRED" type="BOOLEAN" required="false"/> + <column name="READONLY" type="BOOLEAN" required="false"/> + <column name="SUMMARY" type="BOOLEAN" required="false"/> + <column name="ACTIVATION_POLICY" type="VARCHAR2" required="false" size="20"/> + <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_GRP_DEF"/> + <column name="ORDER_INDEX" type="INTEGER" required="false"/> + <column name="VERSION" type="VARCHAR2" required="false" size="50"/> + <column name="PARENT_MAP_DEFINITION_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> + <column name="PARENT_LIST_DEFINITION_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> + <column name="SIMPLE_TYPE" type="VARCHAR2" required="false" size="20"/> + <column name="ALLOW_CUSTOM_ENUM_VALUE" type="BOOLEAN" required="false"/> + <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> + <column name="CONFIG_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_DEF"/> + + <!-- only simple properties (not lists and maps) have this --> + <column name="UNITS" type="SMALLINT" required="false"/> + + <!-- only dynamic properties (not simple) have this --> + <column name="DYNAMIC_TYPE" type="VARCHAR2" size="20" required="false"/> + <column name="DYNAMIC_KEY" type="VARCHAR2" size="128" required="false"/> + </table> + + <table name="RHQ_CONF_PROP_DEF_ENUM"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="STRING_VALUE" type="VARCHAR2" required="false" size="500"/> + <column name="ORDER_INDEX" type="INTEGER" required="false"/> + <column name="NAME" type="VARCHAR2" required="false" size="100"/> + <column name="PROPERTY_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> + </table> + + <table name="RHQ_CONFIG_PD_OSRC"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="LINK_TO_TARGET" type="BOOLEAN" required="false"/> + <column name="FILTER" type="VARCHAR2" required="false" size="40"/> + <column name="EXPRESSION" type="VARCHAR2" required="true" size="400"/> + <column name="TARGET_TYPE" type="VARCHAR2" required="true" size="20"/> + <column name="PROPERTY_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> + </table> + + <table name="RHQ_CONFIG_PROP_CONSTR"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="DTYPE" type="VARCHAR2" required="true" size="15"/> + <column name="DETAILS" type="VARCHAR2" required="false" size="250"/> + <column name="CONFIG_PROP_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> + <column name="ORDER_INDEX" type="INTEGER" required="false"/> + </table> + + + <!-- Content or value tables --> + + <table name="RHQ_CONFIG"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="NOTES" type="VARCHAR2" required="false" size="512"/> + <column name="VERSION" type="VARCHAR2" required="false" size="50"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + </table> + + <table name="RHQ_CONFIG_PROPERTY"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="CONFIGURATION_ID" type="INTEGER" required="false" references="RHQ_CONFIG" ondelete="cascade"/> + <column name="STRING_VALUE" type="VARCHAR2" required="false" size="2000"/> + <column name="OVERRIDE" type="BOOLEAN" required="false"/> + <column name="NAME" type="VARCHAR2" required="true" size="255"/> + <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> + <!-- Recursive cascade path to RHQ_CONFIG_PROPERTY causes constraint creation errors on SQL Server, see + http://support.microsoft.com/kb/321843 --> + <column name="PARENT_LIST_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROPERTY" ondelete="cascade" /> + <column name="PARENT_MAP_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROPERTY" ondelete="cascade" /> + <column name="LIST_INDEX" type="INTEGER"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <index name="RHQ_CONFIG_PROP_idx_prop_key" unique="false"> + <field ref="CONFIGURATION_ID"/> + <field ref="NAME"/> + </index> + <index name="RHQ_CONFIG_PROP_idx_map_key" unique="false"> + <field ref="PARENT_MAP_ID"/> + <field ref="NAME"/> + </index> + <index name="RHQ_CONFIG_PROP_idx_list_key" unique="false"> + <field ref="PARENT_LIST_ID"/> + </index> + <!-- List entries all have the same name --> + </table> + + <table name="RHQ_CONFIG_TEMPLATE"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="NAME" type="VARCHAR2" required="false" size="100"/> + <column name="DESCRIPTION" type="VARCHAR2" required="false" size="500"/> + <column name="CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> + <column name="CONFIG_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_DEF"/> + <column name="IS_DEFAULT" type="BOOLEAN" required="false"/> + </table> + + <table name="RHQ_RAW_CONFIG"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="CONFIG_ID" type="INTEGER" required="true" references="RHQ_CONFIG(ID)"/> + <column name="PATH" type="VARCHAR2" required="false" size="512"/> + <column name="CONTENTS" type="CLOB" required="true"/> + <column name="SHA256" type="VARCHAR2" size="64" required="true"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + </table> + +<!-- END: config-schema.xml --> +<!-- BEGIN: cluster-schema.xml --> + + <table name="RHQ_AFFINITY_GROUP"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" required="true" size="255" type="VARCHAR2"/> + </table> + + <table name="RHQ_SERVER"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" required="true" size="255" type="VARCHAR2"/> + <column name="ADDRESS" required="true" size="255" type="VARCHAR2"/> + <column name="PORT" required="true" type="INTEGER"/> + <column name="SECURE_PORT" required="true" type="INTEGER"/> + <column name="CTIME" required="true" type="LONG"/> + <column name="MTIME" required="true" type="LONG"/> + <column name="AFFINITY_GROUP_ID" type="INTEGER" references="RHQ_AFFINITY_GROUP" required="false"/> + <column name="COMPUTE_POWER" required="true" type="INTEGER"/> + <column name="OPERATION_MODE" required="true" size="32" type="VARCHAR2"/> + <column name="STATUS" type="INTEGER" required="false" default="0" /> + + <!-- This index is for constraint, not performance --> + <index name="RHQ_SERVER_NAME_UNIQUE" unique="true"> + <field ref="NAME"/> + </index> + </table> + + <!-- new agent --> + <table name="RHQ_AGENT"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" required="true" size="255" type="VARCHAR2"/> + <column name="ADDRESS" required="true" size="255" type="VARCHAR2"/> + <column name="PORT" required="true" type="INTEGER"/> + <column name="AGENTTOKEN" required="true" size="100" type="VARCHAR2"/> + <column name="REMOTE_ENDPOINT" required="false" size="4000" type="VARCHAR2"/> + <column name="CTIME" required="true" type="LONG"/> + <column name="MTIME" required="true" type="LONG"/> + <column name="LAST_AVAILABILITY_REPORT" required="false" type="LONG"/> + <column name="AFFINITY_GROUP_ID" type="INTEGER" references="RHQ_AFFINITY_GROUP" required="false"/> + <column name="SERVER_ID" type="INTEGER" references="RHQ_SERVER" required="false"/> + <column name="STATUS" type="INTEGER" required="false" default="0" /> + <column name="BACKFILLED" type="BOOLEAN" required="true" /> + + <index name="RHQ_AGENT_NAME_UNIQUE" unique="true"> + <field ref="NAME"/> + </index> + + <index name="RHQ_AGENT_ADDRESS_PORT" unique="true"> + <field ref="ADDRESS"/> + <field ref="PORT"/> + </index> + + <index name="RHQ_AGENT_TOKEN_UNIQUE" unique="true"> + <field ref="AGENTTOKEN"/> + </index> + </table> + + <table name="RHQ_PARTITION_EVENT"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="SUBJECT_NAME" required="true" size="100" type="VARCHAR2"/> + <column name="CTIME" required="true" type="LONG"/> + <column name="EVENT_TYPE" required="true" size="50" type="VARCHAR2"/> + <column name="EVENT_DETAIL" required="false" size="512" type="VARCHAR2"/> + <column name="EXECUTION_STATUS" required="true" size="32" type="VARCHAR2"/> + </table> + + <table name="RHQ_PARTITION_DETAILS"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="PARTITION_EVENT_ID" type="INTEGER" references="RHQ_PARTITION_EVENT" required="true"/> + <column name="AGENT_NAME" type="VARCHAR2" size="255" required="true"/> + <column name="SERVER_NAME" type="VARCHAR2" size="255" required="true"/> + </table> + + <table name="RHQ_FAILOVER_LIST"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="PARTITION_EVENT_ID" type="INTEGER" references="RHQ_PARTITION_EVENT" required="true"/> + <column name="AGENT_ID" type="INTEGER" references="RHQ_AGENT" required="true"/> + <column name="CTIME" required="true" type="LONG"/> + </table> + + <table name="RHQ_FAILOVER_DETAILS"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="FAILOVER_LIST_ID" type="INTEGER" references="RHQ_FAILOVER_LIST" required="true"/> + <column name="SERVER_ID" type="INTEGER" references="RHQ_SERVER" required="true"/> + <column name="ORDINAL" type = "INTEGER" required="true"/> + </table> + +<!-- END: cluster-schema.xml --> +<!-- BEGIN: auth-schema.xml --> + + + <table name="RHQ_PRINCIPAL"> + + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="PRINCIPAL" required="true" type="VARCHAR2" size="100"/> + <column name="PASSWORD" required="true" type="VARCHAR2" size="64"/> + + <!-- ensure that principals are unique --> + <index name="RHQ_PRINCIPAL_PRINCIPAL_KEY" unique="true"> + <field ref="PRINCIPAL"/> + </index> + + </table> + + <table name="RHQ_SUBJECT"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" required="true" size="100" type="VARCHAR2"/> + <column name="CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG"/> + <column name="FIRST_NAME" required="false" size="100" type="VARCHAR2"/> + <column name="LAST_NAME" required="false" size="100" type="VARCHAR2"/> + <column name="EMAIL_ADDRESS" size="100" type="VARCHAR2"/> + <column name="SMS_ADDRESS" size="100" type="VARCHAR2"/> + <column name="PHONE_NUMBER" size="100" type="VARCHAR2"/> + <column name="DEPARTMENT" size="100" type="VARCHAR2"/> + <column name="FACTIVE" required="true" type="BOOLEAN" default="true"/> + <column name="FSYSTEM" required="true" type="BOOLEAN" default="false"/> + + <index name="RHQ_SUBJECT_AUTH_KEY" unique="true"> + <field ref="NAME"/> + </index> + </table> + +<!-- END: auth-schema.xml --> +<!-- BEGIN: inventory-schema.xml --> + + + <!-- NEW RESOURCE TYPES --> + <table name="RHQ_RESOURCE_TYPE"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" type="VARCHAR2" size="100" required="true"/> + <column name="CATEGORY" type="VARCHAR2" size="16" required="true"/> + <column name="CREATION_DATA_TYPE" type="VARCHAR2" size="16" required="true"/> + <column name="CREATE_DELETE_POLICY" type="VARCHAR2" size="16" required="true"/> + <column name="SINGLETON" type="BOOLEAN" required="true"/> + <column name="SUPPORTS_MANUAL_ADD" type="BOOLEAN" required="true"/> + <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> + <column name="PLUGIN" type="VARCHAR2" size="100"/> + <column name="CTIME" type="LONG"/> + <column name="MTIME" type="LONG"/> + <column name="DELETED" type="BOOLEAN" default="FALSE" required="TRUE"/> + <column name="SUBCATEGORY_ID" type="INTEGER"/> + <!-- + TODO add support to DB setup for tables with circular dependencies and then add back this RI + <column name="SUBCATEGORY_ID" type="INTEGER" references="RHQ_RESOURCE_SUBCAT" /> + --> + <column name="PLUGIN_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> + <column name="RES_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> + <column name="BUNDLE_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG"/> + + <index name="RHQ_RES_TYPE_IDX_PLG_NAME" unique="true"> + <field ref="NAME"/> + <field ref="PLUGIN"/> + </index> + </table> + + <!-- NEW RESOURCE SUBCATEGORIES --> + <table name="RHQ_RESOURCE_SUBCAT"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" type="VARCHAR2" size="100"/> + <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> + <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> + <column name="CTIME" type="LONG"/> + <column name="MTIME" type="LONG"/> + <column name="PARENT_SUBCATEGORY_ID" type="INTEGER" references="RHQ_RESOURCE_SUBCAT"/> + <!-- resourceTypeId is not required on child sub categories --> + <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> + </table> + + <!-- Many To Many mapping for resource type to its parents --> + <table name="RHQ_RESOURCE_TYPE_PARENTS"> + <column name="RESOURCE_TYPE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> + <column name="PARENT_RESOURCE_TYPE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> + + <!-- not using full words to fit index name length --> + <constraint name="RHQ_RES_TYPE_PARENTS_KEY"> + <primaryKey> + <field ref="RESOURCE_TYPE_ID"/> + <field ref="PARENT_RESOURCE_TYPE_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_PROCESS_SCAN"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="QUERY" type="VARCHAR2" size="256" required="true"/> + <column name="NAME" type="VARCHAR2" size="100" required="false"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> + + <index name="RHQ_PROCESS_SCAN_QUERY_INDEX" unique="true"> + <field ref="QUERY"/> + <field ref="RESOURCE_TYPE_ID"/> + </index> + </table> + + <table name="RHQ_PRD_VER"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="VERSION" type="VARCHAR2" size="100" required="true"/> + <column name="RES_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> + </table> + + <table name="RHQ_RESOURCE"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> + <column name="UUID" type="CHAR" size="36" required="true"/> + <column name="NAME" type="VARCHAR2" size="500"/> + <!-- ancestry holds the full parental ancestry, used for disambiguation --> + <column name="ANCESTRY" type="VARCHAR2" required="false" size="4000"/> + <column name="RESOURCE_KEY" type="VARCHAR2" required="true" size="500"/> + <column name="AGENT_ID" required="false" type="INTEGER" references="RHQ_AGENT(id)"/> + <column name="INVENTORY_STATUS" type="VARCHAR2" size="20"/> + <column name="CONNECTED" type="BOOLEAN"/> + <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> + <column name="VERSION" type="VARCHAR2" size="100"/> + <column name="CTIME" type="LONG"/> + <column name="MTIME" type="LONG"/> + <column name="ITIME" type="LONG"/> + <column name="RES_CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG"/> + <column name="PLUGIN_CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG"/> + <column name="MODIFIED_BY" required="false" size="100" type="VARCHAR2"/> + <column name="LOCATION" required="false" size="100" type="VARCHAR2"/> + <column name="PARENT_RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE"/> + <column name="PRODUCT_VERSION_ID" type="INTEGER" references="RHQ_PRD_VER"/> + + <index name="RHQ_RESOURCE_idx_key"> + <field ref="RESOURCE_KEY"/> + </index> + + <index name="RHQ_RESOURCE_idx_type"> + <field ref="RESOURCE_TYPE_ID"/> + </index> + + <index name="RHQ_RESOURCE_idx_agent"> + <field ref="AGENT_ID"/> + </index> + + <index name="RHQ_RESOURCE_idx_parent"> + <field ref="PARENT_RESOURCE_ID"/> + </index> + + </table> + + <table name="RHQ_RESOURCE_ERROR"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> + <column name="TIME_OCCURRED" type="LONG" required="true"/> + <column name="ERROR_TYPE" type="VARCHAR2" required="true" size="32"/> + <column name="SUMMARY" type="VARCHAR2" required="true" size="1000"/> + <column name="DETAIL" type="LONGVARCHAR" required="false"/> + + <index name="RHQ_RES_ERROR_IDX_RES_ID"> + <field ref="RESOURCE_ID"/> + </index> + </table> + + <table name="RHQ_GROUP_DEF"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" required="true" size="100" type="VARCHAR2"/> + <column name="DESCRIPTION" size="100" type="VARCHAR2"/> + <column name="CTIME" type="LONG"/> + <column name="MTIME" type="LONG"/> + <column name="CALC_TIME" type="LONG"/> + <column name="CALC_INTERVAL" type="LONG"/> + <column name="RECURSIVE" type="BOOLEAN"/> + <column name="EXPRESSION" type="VARCHAR2" size="1000"/> + + <index name="RHQ_GROUP_DEF_NAME" unique="true"> + <field ref="NAME"/> + </index> + </table> + + <table name="RHQ_RESOURCE_GROUP"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <!-- this name can be longer than the size of the GROUP_BY column, which is used to uniquely identify it --> + <!-- Max bytes for Oracle Varchar2 to accommodate large cluster keys --> + <column name="NAME" required="true" size="4000" type="VARCHAR2"/> + <column name="DESCRIPTION" size="100" type="VARCHAR2"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> + <!-- Compatible groups only --> + <column name="CTIME" type="LONG"/> + <column name="MTIME" type="LONG"/> + <column name="MODIFIED_BY" required="false" size="100" type="VARCHAR2"/> + <column name="RECURSIVE" type="BOOLEAN"/> + + <column name="GROUP_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_GROUP_DEF"/> + <column name="GROUP_BY" size="500" type="VARCHAR2"/> + + <column name="CATEGORY" type="VARCHAR2" size="20" required="true"/> + + <!-- This is only set if this is a subject-owned group (like an autogroup) --> + <column name="SUBJECT_ID" type="INTEGER" references="RHQ_SUBJECT"/> + + <!-- These two only set if this is a backing group for a resource auto-cluster --> + <column name="CLUSTER_KEY" type="VARCHAR2" size="4000" required="false"/> + <column name="CLUSTER_RESOURCE_GROUP_ID" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> + + <!-- This is only set if this is a backing group for a resource auto-group --> + <column name="AUTO_GROUP_PARENT_RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE"/> + + <column name="VISIBLE" type="BOOLEAN"/> + + <index name="RHQ_RES_GROUP_NAME" unique="false"> + <field ref="NAME"/> + </index> + </table> + + <!-- Many To Many mapping for groups to implicit resources --> + <table name="RHQ_RESOURCE_GROUP_RES_IMP_MAP"> + <column name="RESOURCE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE"/> + <column name="RESOURCE_GROUP_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> + + <!-- not using full words to fit index name length --> + <constraint name="RHQ_RES_GROUP_RES_IMP_MAP_KEY"> + <primaryKey> + <field ref="RESOURCE_ID"/> + <field ref="RESOURCE_GROUP_ID"/> + </primaryKey> + </constraint> + </table> + + <!-- Many To Many mapping for groups to explicit resources --> + <table name="RHQ_RESOURCE_GROUP_RES_EXP_MAP"> + <column name="RESOURCE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE"/> + <column name="RESOURCE_GROUP_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> + + <!-- not using full words to fit index name length --> + <constraint name="RHQ_RES_GROUP_RES_EXP_MAP_KEY"> + <primaryKey> + <field ref="RESOURCE_ID"/> + <field ref="RESOURCE_GROUP_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_CONFIG_GROUP_UPDATE"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="GROUP_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_GROUP"/> + <column name="CONFIGURATION_ID" type="INTEGER" required="true" references="RHQ_CONFIG"/> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="SUBJECT_NAME" type="VARCHAR2" required="false" size="100"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> + </table> + + <table name="RHQ_CONFIG_UPDATE"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="CONFIGURATION_ID" type="INTEGER" required="true" references="RHQ_CONFIG" ondelete="cascade"/> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="SUBJECT_NAME" type="VARCHAR2" required="false" size="100"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="CONFIG_RES_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> + <column name="PLUGIN_CONFIG_RES_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> + <column name="AGG_RES_UPDATE_ID" type="INTEGER" required="false" references="RHQ_CONFIG_GROUP_UPDATE"/> + <column name="AGG_PLUGIN_UPDATE_ID" type="INTEGER" required="false" references="RHQ_CONFIG_GROUP_UPDATE"/> + <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> + </table> + + + <table name="RHQ_TAGGING"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="NAMESPACE" type="VARCHAR2" required="false" size="20"/> + <column name="SEMANTIC" type="VARCHAR2" required="false" size="50"/> + <column name="NAME" type="VARCHAR2" required="true" size="100"/> + </table> + + <table name="RHQ_TAGGING_RESOURCE_MAP"> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> + <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> + <constraint name="RHQ_TAGGING_RESOURCE_MAP_KEY"> + <primaryKey> + <field ref="RESOURCE_ID"/> + <field ref="TAG_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_TAGGING_RES_GROUP_MAP"> + <column name="RESOURCE_GROUP_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_GROUP"/> + <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> + <constraint name="RHQ_TAGGING_RES_GROUP_MAP_KEY"> + <primaryKey> + <field ref="RESOURCE_GROUP_ID"/> + <field ref="TAG_ID"/> + </primaryKey> + </constraint> + </table> + +<!-- END: inventory-schema.xml --> +<!-- BEGIN: authz-schema.xml --> + + + <table name="RHQ_ROLE"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" required="true" size="100" type="VARCHAR2"/> + <column name="DESCRIPTION" size="100" type="VARCHAR2"/> + <column name="FSYSTEM" type="BOOLEAN" default="false"/> + + <index name="RHQ_ROLE_NAME_KEY" unique="true"> + <field ref="NAME"/> + </index> + </table> + + <table name="RHQ_ROLE_RESOURCE_GROUP_MAP"> + <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> + <column name="RESOURCE_GROUP_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> + + <constraint name="RHQ_ROLE_RES_GROUP_MAP_KEY"> + <primaryKey> + <field ref="ROLE_ID"/> + <field ref="RESOURCE_GROUP_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_ROLE_LDAP_GROUP"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> + <column name="LDAP_GROUP_NAME" size="128" required="true" type="VARCHAR2"/> + + <index name="RHQ_ROLE_LDAP_GROUP_IDX" unique="true"> + <field ref="ROLE_ID"/> + <field ref="LDAP_GROUP_NAME"/> + </index> + </table> + + <table name="RHQ_PERMISSION"> + <column name="ROLE_ID" type="INTEGER" references="RHQ_ROLE" required="true"/> + <column name="OPERATION" type="INTEGER" required="true"/> + <constraint name="RHQ_PERMISSION_PK"> + <primaryKey> + <field ref="ROLE_ID"/> + <field ref="OPERATION"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_SUBJECT_ROLE_MAP"> + <column name="SUBJECT_ID" required="true" type="INTEGER" references="RHQ_SUBJECT"/> + <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> + + <constraint name="RHQ_SUBJECT_ROLE_MAPPING_KEY"> + <primaryKey> + <field ref="SUBJECT_ID"/> + <field ref="ROLE_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_SUBJECT_ROLE_LDAP_MAP"> + <column name="SUBJECT_ID" required="true" type="INTEGER" references="RHQ_SUBJECT"/> + <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> + <constraint name="RHQ_SUBJECT_ROLE_LDAP_MAP_PK"> + <primaryKey> + <field ref="SUBJECT_ID" /> + <field ref="ROLE_ID"/> + </primaryKey> + </constraint> + </table> +<!-- END: authz-schema.xml --> +<!-- BEGIN: search-schema.xml --> + + + <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="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="GLOBAL" type="BOOLEAN" required="true"/> + </table> + +<!-- END: search-schema.xml --> +<!-- BEGIN: dashboard-schema.xml --> + + + + <table name="RHQ_DASHBOARD"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" type="VARCHAR2" size="200" required="true"/> + <column name="SUBJECT_ID" type="INTEGER" required="true" references="RHQ_SUBJECT"/> + <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> + <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_RESOURCE_GROUP"/> + <column name="CATEGORY" type="VARCHAR2" size="20" required="true"/> + <column name="SHARED" type="BOOLEAN" required="true"/> + <column name="CONFIGURATION_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> + </table> + + + <table name="RHQ_DASHBOARD_PORTLET"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" type="VARCHAR2" size="200" required="true"/> + <column name="PORTLET_KEY" type="VARCHAR2" size="200" required="true"/> + <column name="COL" type="INTEGER" required="true"/> + <column name="COL_INDEX" type="INTEGER" required="true"/> + <column name="HEIGHT" type="INTEGER" required="true"/> + <column name="CONFIGURATION_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> + <column name="DASHBOARD_ID" type="INTEGER" required="false" references="RHQ_DASHBOARD"/> + </table> + +<!-- END: dashboard-schema.xml --> +<!-- BEGIN: operation-schema.xml --> + + + <table name="RHQ_OPERATION_DEF"> + + <!-- === required columns === --> + + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE(ID)"/> + <column name="NAME" type="VARCHAR2" required="true" size="100"/> + + <!-- === optional columns === --> + + <!-- an OSGI version range - if null, the operation def applies to all versions of the associated resource type --> + <column name="RESOURCE_VERSION_RANGE" type="VARCHAR2" size="100"/> + + <!-- A parameter config definition is only required for operations that have parameters. --> + <!-- A results config definition is only required for operations that return data. --> + <column name="PARAMETER_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> + <column name="RESULTS_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> + <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> + <column name="DESCRIPTION" type="VARCHAR2" size="4000"/> + <column name="TIMEOUT" type="INTEGER"/> + + <!-- === business key (RESOURCE_TYPE_ID + NAME) === --> + <index name="RHQ_OPERATION_DEF_KEY_IDX" unique="true"> + <field ref="RESOURCE_TYPE_ID"/> + <field ref="NAME"/> + </index> + + </table> + + <table name="RHQ_OPERATION_HISTORY"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="DTYPE" type="VARCHAR2" required="true" size="8"/> + <column name="JOB_NAME" type="VARCHAR2" required="true" size="100"/> + <column name="JOB_GROUP" type="VARCHAR2" required="true" size="100"/> + <column name="OPERATION_DEF_ID" type="INTEGER" required="true" references="RHQ_OPERATION_DEF"/> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="STIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="PARAMETERS_CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> + + <!-- for resource history --> + <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> + <column name="RESULTS_CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> + <column name="GROUP_HISTORY_ID" type="INTEGER" required="false" references="RHQ_OPERATION_HISTORY"/> + + <!-- for group history --> + <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_RESOURCE_GROUP"/> + + <index name="RHQ_OPERATION_HISTORY_JOB_IDX" unique="true"> + <field ref="JOB_NAME"/> + <field ref="JOB_GROUP"/> + <field ref="CTIME"/> + </index> + + </table> + + <!-- + This table is really just to support some specific use-cases. + Specifically, to be able to get a list of histories for a specific schedule (aka quartz job) + and to be able to query a list of all schedules along with their associated resource/group IDs + possibly sorted by their next fire time. + Note that a NULL next fire time means it won't fire again and the row is probaby about to be deleted; + we can probably not even insert rows with NULL and make it a non-nullable field. But rather than + code special conditions into the session bean, we'll allow a short-lived NULL next fire time row. + --> + <table name="RHQ_OPERATION_SCHEDULE"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + + <column name="JOB_NAME" type="VARCHAR2" required="true" size="100"/> + <column name="JOB_GROUP" type="VARCHAR2" required="true" size="100"/> + <column name="DTYPE" type="VARCHAR2" required="true" size="8"/> + <column name="NEXT_FIRE_TIME" type="LONG" required="false"/> + + <!-- for resource history --> + <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> + + <!-- for group history --> + <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_RESOURCE_GROUP"/> + + <!-- + Note, this is the same as the primary key that Quartz uses for its schedules (RHQ_QRTZ_JOB_DETAILS). + We do not need to add DTYPE to the key, because we ensure the name/group are unique across resource/group + schedules + --> + <!-- === business key (JOB_NAME + JOB_GROUP) === --> + <index name="RHQ_OPERATION_SCHEDULE_KEY_IDX" unique="true"> + <field ref="JOB_NAME"/> + <field ref="JOB_GROUP"/> + </index> + </table> + +<!-- END: operation-schema.xml --> +<!-- BEGIN: event-schema.xml --> + + + <!-- metadata --> + + <table name="RHQ_EVENT_DEF"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE(ID)"/> + + <column name="NAME" type="VARCHAR2" size="100" required="true"/> + <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> + <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> + + <index name="RHQ_EVENT_DEF_IDX" unique="true"> + <field ref="RESOURCE_TYPE_ID"/> + <field ref="NAME"/> + </index> + </table> + + <!-- instance data --> + + <table name="RHQ_EVENT_SOURCE"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="EVENT_DEF_ID" type="INTEGER" required="true" references="RHQ_EVENT_DEF(ID)"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE(ID)"/> + + <column name="LOCATION" required="true" size="2000" type="VARCHAR2"/> + + <index name="RHQ_EVENT_SOURCE_IDX" unique="true"> + <field ref="EVENT_DEF_ID"/> + <field ref="RESOURCE_ID"/> + <field ref="LOCATION"/> + </index> + </table> + + <table name="RHQ_EVENT"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="EVENT_SOURCE_ID" type="INTEGER" required="true" references="RHQ_EVENT_SOURCE(ID)"/> + + <column name="TIMESTAMP" required="true" type="LONG"/> + <column name="SEVERITY" required="true" size="20" type="VARCHAR2"/> + <column name="DETAIL" required="true" size="4000" type="VARCHAR2"/> + <index name="RHQ_EVENT_IDX" unique="false"> + <field ref="EVENT_SOURCE_ID"/> + <field ref="TIMESTAMP"/> + </index> + </table> + +<!-- END: event-schema.xml --> +<!-- BEGIN: alert-schema.xml --> + + + <table name="RHQ_ALERT_DEFINITION"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" required="true" size="100" type="VARCHAR2"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="PARENT_ID" type="INTEGER" required="false"/> + <column name="GROUP_ALERT_DEF_ID" type="INTEGER" required="false"/> + <column name="DESCRIPTION" required="false" size="250" type="VARCHAR2"/> + <column name="PRIORITY" type="VARCHAR2" size="15" required="true"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE" required="false"/> + <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE" required="false"/> + <column name="RESOURCE_GROUP_ID" type="INTEGER" references="RHQ_RESOURCE_GROUP" required="false"/> + <column name="ENABLED" required="true" default="TRUE" type="BOOLEAN"/> + + <column name="REQUIRED" required="true" type="SMALLINT"/> + + <column name="RECOVERY_ID" type="INTEGER" required="true"/> + <!-- required, but 0 effectively means null --> + <column name="WILL_RECOVER" required="true" default="false" type="BOOLEAN"/> + <column name="NOTIFY_FILTERED" required="true" default="false" type="BOOLEAN"/> + <column name="CONTROL_FILTERED" required="true" default="FALSE" type="BOOLEAN"/> + + <column name="DELETED" required="true" default="FALSE" type="BOOLEAN"/> + <column name="READ_ONLY" required="true" default="FALSE" type="BOOLEAN"/> + + <column name="DAMPENING_CATEGORY" type="SMALLINT" required="true"/> + <column name="DAMPENING_VALUE" type="INTEGER"/> + <column name="DAMPENING_VALUE_UNITS" type="SMALLINT"/> + <column name="DAMPENING_PERIOD" type="INTEGER"/> + <column name="DAMPENING_PERIOD_UNITS" type="SMALLINT"/> + </table> + + <table name="RHQ_ALERT_DAMPEN_EVENT"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> + <column name="EVENT_TYPE" required="true" type="SMALLINT"/> + <column name="EVENT_TIMESTAMP" required="true" type="LONG"/> + + <index name="RHQ_DAMPENING_EVENT_TYPE_IDX"> + <field ref="EVENT_TYPE"/> + </index> + <index name="RHQ_DAMPENING_EVENT_TS_IDX"> + <field ref="EVENT_TIMESTAMP"/> + </index> + </table> + + <table name="RHQ_ALERT_CONDITION"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="TYPE" required="true" type="VARCHAR2" size="15"/> + <!-- + <column name="REQUIRED" required="true" type="BOOLEAN"/> + --> + <column name="MEASUREMENT_DEFINITION_ID" required="false" type="INTEGER"/> + <column name="NAME" required="false" size="100" type="VARCHAR2"/> + <column name="COMPARATOR" required="false" size="2" type="VARCHAR2"/> + <column name="THRESHOLD" required="false" type="DOUBLE"/> + <!-- event-based conditions use OPTION_STATUS for the string match, so should be a decent length --> + <column name="OPTION_STATUS" required="false" size="256" type="VARCHAR2"/> + <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> + <column name="TRIGGER_ID" required="false" type="INTEGER"/> + </table> + + <table name="RHQ_ALERT" tablespace="DEFAULT" + storage-options="freelists 5" cache="true" logging="false"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> + <column name="CTIME" required="true" type="LONG"/> + <column name="RECOVERY_ID" type="INTEGER" required="true"/> + <!-- required, but 0 effectively means null --> + <column name="WILL_RECOVER" required="true" default="false" type="BOOLEAN"/> + <column name="ACK_TIME" required="false" type="LONG"/> + <column name="ACK_SUBJECT" required="false" size="100" type="VARCHAR2"/> + <index name="RHQ_ALERT_IDX_TIME" unique="false"> + <field ref="CTIME"/> + </index> + <index name="RHQ_ALERT_IDX_ALERTDEF" unique="false"> + <field ref="ALERT_DEFINITION_ID"/> + </index> + </table> + + <table name="RHQ_ALERT_NOTIF_LOG" tablespace="DEFAULT" + storage-options="freelists 5" cache="true" logging="false"> + <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="false"> + <field ref="ALERT_ID"/> + </index> + <column name="SENDER" required="false" size="100" type="VARCHAR2"/> + <column name="RESULT_STATE" required="false" size="20" type="VARCHAR2"/> + <column name="MESSAGE" required="false" size="4000" type="VARCHAR2"/> + </table> + + <table name="RHQ_ALERT_CONDITION_LOG" tablespace="DEFAULT" + storage-options="freelists 5" cache="true" logging="false"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="CTIME" required="true" type="LONG"/> + <column name="ALERT_ID" required="false" type="INTEGER" references="RHQ_ALERT(ID)"/> + <column name="CONDITION_ID" required="true" type="INTEGER" references="RHQ_ALERT_CONDITION(ID)"/> + <column name="VALUE" required="true" size="250" type="VARCHAR2"/> + <index name="RHQ_ALERT_COND_LOG_IDX_TIME"> + <field ref="CTIME" /> + </index> + <index name="RHQ_ALERT_COND_LOG_IDX_ALERT"> + <field ref="ALERT_ID"/> + </index> + <index name="RHQ_ALERT_COND_LOG_COND_IDX"> + <field ref="CONDITION_ID"/> + </index> + </table> + + <table name="RHQ_ALERT_NOTIFICATION" tablespace="DEFAULT" + storage-options="freelists 5" cache="true" logging="false"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> + <column name="SENDER_CONFIG_ID" required="false" type="INTEGER" references="RHQ_CONFIG(ID)"/> + <column name="EXTRA_CONFIG_ID" required="false" type="INTEGER" references="RHQ_CONFIG(ID)"/> + <column name="SENDER_NAME" required="true" size="100" type="VARCHAR2" /> + </table> + +<!-- END: alert-schema.xml --> +<!-- BEGIN: sysconfig-schema.xml --> + + + <table name="RHQ_SYSTEM_CONFIG"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="PROPERTY_KEY" type="VARCHAR2" size="80"/> + <column name="PROPERTY_VALUE" type="VARCHAR2" size="300"/> + <column name="DEFAULT_PROPERTY_VALUE" type="VARCHAR2" size="300"/> + <column name="FREAD_ONLY" type="BOOLEAN" default="FALSE"/> + + <index name="RHQ_SYSTEM_CONFIG_KEY_INDX" unique="true"> + <field ref="PROPERTY_KEY"/> + </index> + </table> + +<!-- END: sysconfig-schema.xml --> +<!-- BEGIN: scheduler-schema.xml --> + + + <table name="RHQ_QRTZ_JOB_DETAILS"> + <column name="JOB_NAME" required="true" type="VARCHAR2" size="80"/> + <column name="JOB_GROUP" required="true" type="VARCHAR2" size="80"/> + <column name="DESCRIPTION" required="false" type="VARCHAR2" size="120"/> + <column name="JOB_CLASS_NAME" required="true" type="VARCHAR2" size="128"/> + <column name="IS_DURABLE" required="true" type="BOOLEAN" default="FALSE"/> + <column name="IS_VOLATILE" required="true" type="BOOLEAN"/> + <column name="IS_STATEFUL" required="true" type="BOOLEAN" default="FALSE"/> + <column name="REQUESTS_RECOVERY" required="true" type="BOOLEAN" default="FALSE"/> + <column name="JOB_DATA" required="false" type="BLOB"/> + + <constraint name="RHQ_PK_QRTZ_JOB_DETAILS"> + <primaryKey> + <field ref="JOB_NAME"/> + <field ref="JOB_GROUP"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_QRTZ_JOB_LISTENERS"> + <column name="JOB_NAME" required="true" type="VARCHAR2" size="80"/> + <column name="JOB_GROUP" required="true" type="VARCHAR2" size="80"/> + <column name="JOB_LISTENER" required="true" type="VARCHAR2" size="80"/> + + <constraint name="RHQ_PK_QRTZ_JOB_LISTENERS"> + <primaryKey> + <field ref="JOB_NAME"/> + <field ref="JOB_GROUP"/> + <field ref="JOB_LISTENER"/> + </primaryKey> + </constraint> + <constraint name="RHQ_FK_QRTZ_JOB_LSTNRS_JN_JG"> + <foreignKey local="JOB_NAME,JOB_GROUP" + references="RHQ_QRTZ_JOB_DETAILS(JOB_NAME,JOB_GROUP)" + ondelete="cascade"/> + </constraint> + </table> + + <table name="RHQ_QRTZ_TRIGGERS"> + <column name="TRIGGER_NAME" type="VARCHAR2" required="true" size="80"/> + <column name="TRIGGER_GROUP" type="VARCHAR2" required="true" size="80"/> + <column name="JOB_NAME" type="VARCHAR2" required="true" size="80"/> + <column name="JOB_GROUP" type="VARCHAR2" required="true" size="80"/> + <column name="IS_VOLATILE" type="BOOLEAN" required="true"/> + <column name="DESCRIPTION" type="VARCHAR2" required="false" size="120"/> + <column name="NEXT_FIRE_TIME" type="LONG" required="false"/> + <column name="PREV_FIRE_TIME" type="LONG" required="false"/> + <column name="PRIORITY" type="INTEGER" required="false"/> + <column name="TRIGGER_STATE" type="VARCHAR" required="true" size="16"/> + <column name="TRIGGER_TYPE" type="VARCHAR" required="true" size="8"/> + <column name="START_TIME" type="LONG" required="true"/> + <column name="END_TIME" type="LONG" required="false"/> + <column name="CALENDAR_NAME" type="VARCHAR2" required="false" size="80"/> + <column name="MISFIRE_INSTR" type="INTEGER" required="false"/> + <column name="JOB_DATA" type="BLOB" required="false"/> + + <constraint name="RHQ_PK_QRTZ_TRIGGERS"> + <primaryKey> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </primaryKey> + </constraint> + <constraint name="RHQ_FK_QRTZ_TRIGGERS_JN_JG"> + <foreignKey local="JOB_NAME,JOB_GROUP" + references="RHQ_QRTZ_JOB_DETAILS(JOB_NAME,JOB_GROUP)" + ondelete="cascade"/> + </constraint> + + <!-- Quartz docs recommend these indexes. --> + <index name="RHQ_QRTZ_TRIGGERS_JN_JG_IDX"> + <field ref="JOB_NAME"/> + <field ref="JOB_GROUP"/> + </index> + <index name="RHQ_QRTZ_TRIGGERS_NFT_IDX"> + <field ref="NEXT_FIRE_TIME"/> + </index> + <index name="RHQ_QRTZ_TRIGGERS_TS_IDX"> + <field ref="TRIGGER_STATE"/> + </index> + <index name="RHQ_QRTZ_TRIGGERS_TS_NFT_IDX"> + <field ref="TRIGGER_STATE"/> + <field ref="NEXT_FIRE_TIME"/> + </index> + + </table> + + <table name="RHQ_QRTZ_SIMPLE_TRIGGERS"> + <column name="TRIGGER_NAME" type="VARCHAR2" required="true" size="80"/> + <column name="TRIGGER_GROUP" type="VARCHAR2" required="true" size="80"/> + <column name="REPEAT_COUNT" type="LONG" required="true"/> + <column name="REPEAT_INTERVAL" type="LONG" required="true"/> + <column name="TIMES_TRIGGERED" type="LONG" required="true"/> + + <constraint name="RHQ_PK_QRTZ_SIMPLE_TRIGGERS"> + <primaryKey> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </primaryKey> + </constraint> + <constraint name="RHQ_FK_QRTZ_SIMPLE_TRGRS_TN_TG"> + <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" + references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" + ondelete="cascade"/> + </constraint> + + <!-- Quartz docs recommend this index. --> + <!-- Commenting out, because Oracle auto-creates an index for the + primary key column(s) and fails if you try to create another + index for the same column(s) (ips, 03/29/07). + --> + <!-- + <index name="RHQ_QRTZ_SIMPLE_TRGRS_TN_TG_IDX"> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </index> + --> + </table> + + <table name="RHQ_QRTZ_CRON_TRIGGERS"> + <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> + <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> + <column name="CRON_EXPRESSION" type="VARCHAR2" size="80" required="true"/> + <column name="TIME_ZONE_ID" type="VARCHAR2" size="80" required="false"/> + + <constraint name="RHQ_PK_QRTZ_CRON_TRIGGERS"> + <primaryKey> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </primaryKey> + </constraint> + <constraint name="RHQ_FK_QRTZ_CRON_TRIG_TN_TG"> + <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" + references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" + ondelete="cascade"/> + </constraint> + + <!-- Quartz docs recommend this index. --> + <!-- Commenting out, because Oracle auto-creates an index for the + primary key column(s) and fails if you try to create another + index for the same column(s) (ips, 03/29/07). + --> + <!-- + <index name="RHQ_QRTZ_CRON_TRGRS_TN_TG_IDX"> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </index> + --> + </table> + + <table name="RHQ_QRTZ_BLOB_TRIGGERS"> + <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> + <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> + <column name="BLOB_DATA" type="BLOB" required="false"/> + + <constraint name="RHQ_PK_QRTZ_BLOB_TRIGGERS"> + <primaryKey> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </primaryKey> + </constraint> + <constraint name="RHQ_FK_QRTZ_BLOB_TRIGG_TN_TG"> + <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" + references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" + ondelete="cascade"/> + </constraint> + + <!-- Quartz docs recommend this index. --> + <!-- Commenting out, because Oracle auto-creates an index for the + primary key column(s) and fails if you try to create another + index for the same column(s) (ips, 03/29/07). + --> + <!-- + <index name="RHQ_QRTZ_BLOB_TRGRS_TN_TG_IDX"> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </index> + --> + </table> + + <table name="RHQ_QRTZ_TRIGGER_LISTENERS"> + <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> + <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> + <column name="TRIGGER_LISTENER" type="VARCHAR2" size="80" required="true"/> + + <constraint name="RHQ_PK_QRTZ_TRIGGER_LISTENERS"> + <primaryKey> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + <field ref="TRIGGER_LISTENER"/> + </primaryKey> + </constraint> + <constraint name="RHQ_FK_QRTZ_TRGR_LSTNRS_TN_TG"> + <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" + references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" + ondelete="cascade"/> + </constraint> + + <!-- Quartz docs recommend this index. --> + <index name="RHQ_QRTZ_TRGR_LSTNRS_TN_TG_IDX"> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </index> + + </table> + + <table name="RHQ_QRTZ_FIRED_TRIGGERS"> + <column name="ENTRY_ID" primarykey="true" type="VARCHAR2" size="95" required="true"/> + <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> + <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> + <column name="INSTANCE_NAME" type="VARCHAR2" size="80" required="true"/> + <column name="FIRED_TIME" type="LONG" required="true"/> + <column name="PRIORITY" type="INTEGER" required="false"/> + <column name="STATE" type="VARCHAR2" size="16" required="true"/> + <column name="IS_VOLATILE" type="BOOLEAN" required="true"/> + <column name="JOB_NAME" type="VARCHAR2" size="80" required="false"/> + <column name="JOB_GROUP" type="VARCHAR2" size="80" required="false"/> + <column name="IS_STATEFUL" type="BOOLEAN" required="false"/> + <column name="REQUESTS_RECOVERY" type="BOOLEAN" required="false"/> + + <!-- Quartz docs recommend these indexes. --> + <index name="RHQ_QRTZ_FIRED_TRGRS_TN_IDX"> + <field ref="TRIGGER_NAME"/> + </index> + <index name="RHQ_QRTZ_FIRED_TRGRS_TG_IDX"> + <field ref="TRIGGER_GROUP"/> + </index> + <index name="RHQ_QRTZ_FIRED_TRGRS_TN_TG_IDX"> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </index> + <index name="RHQ_QRTZ_FIRED_TRGRS_IN_IDX"> + <field ref="INSTANCE_NAME"/> + </index> + <index name="RHQ_QRTZ_FIRED_TRGRS_JN_IDX"> + <field ref="JOB_NAME"/> + </index> + <index name="RHQ_QRTZ_FIRED_TRGRS_JG_IDX"> + <field ref="JOB_GROUP"/> + </index> + + </table> + + <table name="RHQ_QRTZ_CALENDARS"> + <column name="CALENDAR_NAME" primarykey="true" type="VARCHAR2" size="80" required="true"/> + <column name="CALENDAR" type="BLOB" required="true"/> + </table> + + <table name="RHQ_QRTZ_PAUSED_TRIGGER_GRPS"> + <column name="TRIGGER_GROUP" primarykey="true" type="VARCHAR2" size="80" required="true"/> + </table> + + <table name="RHQ_QRTZ_SCHEDULER_STATE"> + <column name="INSTANCE_NAME" primarykey="true" type="VARCHAR2" size="80" required="true"/> + <column name="LAST_CHECKIN_TIME" type="LONG" required="true"/> + <column name="CHECKIN_INTERVAL" type="LONG" required="true"/> + <column name="RECOVERER" type="VARCHAR2" size="80" required="false"/> + </table> + + <table name="RHQ_QRTZ_LOCKS"> + <column name="LOCK_NAME" primarykey="true" type="VARCHAR2" size="40" required="true"/> + <data LOCK_NAME="TRIGGER_ACCESS"/> + <data LOCK_NAME="JOB_ACCESS"/> + <data LOCK_NAME="CALENDAR_ACCESS"/> + <data LOCK_NAME="STATE_ACCESS"/> + <data LOCK_NAME="MISFIRE_ACCESS"/> + </table> + +<!-- END: scheduler-schema.xml --> +<!-- BEGIN: amps-schema.xml --> + + + <table name="RHQ_PLUGIN"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="4000" type="VARCHAR2" required="false"/> + <column name="VERSION" size="200" type="VARCHAR2" required="false"/> + <column name="AMPS_VERSION" size="16" type="VARCHAR2" required="false"/> + <column name="ENABLED" type="BOOLEAN" required="true"/> + <column name="STATUS" size="16" type="VARCHAR2" required="true"/> + <column name="HELP" type="CLOB" required="false"/> + <column name="PATH" size="500" type="VARCHAR2" required="true"/> + <column name="MD5" size="100" type="VARCHAR2" required="true"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="DEPLOYMENT" size="8" type="VARCHAR2" required="true"/> + <column name="PTYPE" size="200" type="VARCHAR2" required="false"/> + <column name="PLUGIN_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> + <column name="JOBS_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> + <column name="CONTENT" type="BLOB" required="false"/> + + <index name="RHQ_PLUGIN_NAME_DEPLOY_IDX" unique="true"> + <field ref="NAME"/> + <field ref="DEPLOYMENT"/> + </index> + </table> + +<!-- END: amps-schema.xml --> +<!-- BEGIN: measurement-schema.xml --> + + <table name="RHQ_MEASUREMENT_DEF"> + + <!-- === required columns === --> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE(ID)"/> + <column name="NAME" type="VARCHAR2" size="100" required="true"/> + + <!-- === optional columns === --> + <!-- an OSGI version range - if null, the metric def applies to all versions of the associated resource type --> + <column name="RESOURCE_VERSION_RANGE" type="VARCHAR2" size="100"/> + <column name="CATEGORY" type="SMALLINT"/> + <column name="UNITS" type="SMALLINT"/> + <column name="NUMERIC_TYPE" type="SMALLINT"/> + <column name="DISPLAY_TYPE" type="SMALLINT"/> + <column name="DATA_TYPE" type="SMALLINT"/> + <column name="RAW_NUMERIC_TYPE" type="SMALLINT"/> + <column name="DEFAULT_ON" type="BOOLEAN" default="false"/> + <column name="DEFAULT_INTERVAL" type="LONG" /> + <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> + <column name="DISPLAY_ORDER" type="INTEGER" default="1000"/> + <column name="DESCRIPTION" type="VARCHAR2" size="500"/> + <column name="DESTINATION_TYPE" type="VARCHAR2" size="100"/> + + <column name="VERSION" type="INTEGER"/> + <!-- for optimistic locking --> + + <!-- === business key (RESOURCE_TYPE_ID + NAME + RAW_NUMERIC_TYPE) === --> + <index name="RHQ_METRIC_DEF_KEY_IDX" unique="true"> + <field ref="RESOURCE_TYPE_ID"/> + <field ref="NAME"/> + <field ref="RAW_NUMERIC_TYPE"/> + </index> + <index name="RHQ_METRIC_DEF_NT_IDX"> + <field ref="NUMERIC_TYPE"/> + </index> + </table> + + + <table name="RHQ_MEASUREMENT_SCHED"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + + <column name="ENABLED" type="BOOLEAN" default="false"/> + <column name="MTIME" type="LONG" /> + <column name="DEFINITION" type="INTEGER" references="RHQ_MEASUREMENT_DEF(ID)"/> + <column name="VERSION" type="INTEGER" /> + <column name="COLL_INTERVAL" type="LONG" /> + <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE(ID)"/> + <index name="RHQ_MEAS_SCHED_UNIQ" unique="true"> + <field ref="RESOURCE_ID"/> + <field ref="DEFINITION"/> + </index> + <index name="RHQ_MEAS_SCHED_RESID_IDX"> + <field ref="RESOURCE_ID"/> + </index> + </table> + + + <table name="RHQ_MEASUREMENT_BLINE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + + <column name="BL_USER_ENTERED" type="BOOLEAN" default="false" required="true"/> + <column name="BL_MIN" type="DOUBLE" required="true"/> + <column name="BL_MAX" type="DOUBLE" required="true"/> + <column name="BL_MEAN" type="DOUBLE" required="true"/> + <column name="BL_COMPUTE_TIME" type="LONG" required="true"/> + <column name="SCHEDULE_ID" type="INTEGER" required="true" references="RHQ_MEASUREMENT_SCHED(ID)"/> + <index name="RHQ_MEAS_BASELINE_CTIME_IDX"> + <field ref="BL_COMPUTE_TIME"/> + </index> + <index name="RHQ_MEAS_BASELINE_SID_IDX"> + <field ref="SCHEDULE_ID"/> + </index> + </table> + + + <table name="RHQ_MEASUREMENT_DATA_NUM_1H" logging="false" cache="true" + tablespace="DEFAULT" storage-options="freelists 20"> + + <column name="TIME_STAMP" required="true" type="LONG"/> + <column name="SCHEDULE_ID" required="true" type="INTEGER"/> + <column name="VALUE" required="false" type="DOUBLE"/> + <column name="MINVALUE" required="false" type="DOUBLE"/> + <column name="MAXVALUE" required="false" type="DOUBLE"/> + + <constraint name="RHQ_MEAS_DATA_1H_ID_TIME_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + + <index name="RHQ_MEAS_DATA_1H_TIME_IDX"> + <field ref="TIME_STAMP"/> + </index> + </table> + + + <table name="RHQ_MEASUREMENT_DATA_NUM_6H" logging="false" cache="true" + tablespace="DEFAULT" storage-options="freelists 20"> + + <column name="TIME_STAMP" required="true" type="LONG"/> + <column name="SCHEDULE_ID" required="true" type="INTEGER"/> + <column name="VALUE" required="false" type="DOUBLE"/> + <column name="MINVALUE" required="false" type="DOUBLE"/> + <column name="MAXVALUE" required="false" type="DOUBLE"/> + + <constraint name="RHQ_MEAS_DATA_6H_ID_TIME_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + + <index name="RHQ_MEAS_DATA_6H_TIME_IDX"> + <field ref="TIME_STAMP"/> + </index> + </table> + + + <table name="RHQ_MEASUREMENT_DATA_NUM_1D" logging="false" cache="true" + tablespace="DEFAULT" storage-options="freelists 20"> + + <column name="TIME_STAMP" required="true" type="LONG"/> + <column name="SCHEDULE_ID" required="true" type="INTEGER"/> + <column name="VALUE" required="false" type="DOUBLE"/> + <column name="MINVALUE" required="false" type="DOUBLE"/> + <column name="MAXVALUE" required="false" type="DOUBLE"/> + + <constraint name="RHQ_MEAS_DATA_1D_ID_TIME_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + + <index name="RHQ_MEAS_DATA_1D_TIME_IDX"> + <field ref="TIME_STAMP" /> + </index> + </table> + + + <table name="RHQ_MEASUREMENT_DATA_TRAIT"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER" /> + <column name="VALUE" type="VARCHAR2" size="4000" /> + <constraint name="RHQ_MEAS_DATA_TRAIT_ID_TIME_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + + + <table name="RHQ_CALLTIME_DATA_KEY"> + <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> + <column name="SCHEDULE_ID" type="INTEGER" required="true"/> + <column name="CALL_DESTINATION" type="VARCHAR2" size="4000" required="true"/> + <index name="RHQ_CALLTIME_DATA_KEY_IDX" unique="true"> + <field ref="SCHEDULE_ID"/> + <field ref="CALL_DESTINATION"/> + </index> + </table> + + + <table name="RHQ_CALLTIME_DATA_VALUE"> + <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> + <column name="KEY_ID" type="INTEGER" references="RHQ_CALLTIME_DATA_KEY" required="true"/> + <column name="BEGIN_TIME" type="LONG" required="true"/> + <column name="END_TIME" type="LONG" required="true"/> + <column name="MINIMUM" type="DOUBLE" required="true"/> + <column name="MAXIMUM" type="DOUBLE" required="true"/> + <column name="TOTAL" type="DOUBLE" required="true"/> + <column name="COUNT" type="LONG" required="true"/> + <index name="RHQ_CT_DA_VA_END_TIM_IDX"> + <field ref="END_TIME"/> + </index> + </table> + + + <table name="RHQ_AVAILABILITY"> + <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE(ID)"/> + <column name="START_TIME" type="LONG" required="true" /> + <column name="END_TIME" type="LONG" required="false" /> + <column name="AVAILABILITY_TYPE" type="SMALLINT" required="false" /> + <index name="RHQ_AVAIL_RESOURCE_START_IDX"> + <field ref="RESOURCE_ID"/> + <field ref="START_TIME"/> + </index> + <!-- only one null row can exist for any resource --> + <index name="RHQ_AVAIL_RESOURCE_END_IDX" condition="END_TIME IS NULL"> + <field ref="RESOURCE_ID"/> + <field ref="END_TIME" /> + </index> + </table> + + <table name="RHQ_RESOURCE_AVAIL"> + <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE(ID)" ondelete="cascade"/> + <column name="AVAILABILITY_TYPE" type="SMALLINT" required="false" /> + <index name="RHQ_RESOURCE_AVAIL_IDX"> + <field ref="RESOURCE_ID" /> + </index> + </table> + + <table name="RHQ_MEASUREMENT_OOB"> + <column name="SCHEDULE_ID" type="INTEGER" references="RHQ_MEASUREMENT_SCHED(ID)" required="true"/> + <column name="TIME_STAMP" type="LONG" required="true"/> + <column name="OOB_FACTOR" type="INTEGER" required="true" /> + <constraint name="RHQ_MEAS_OOB_ID_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_MEASUREMENT_OOB_TMP"> + <column name="SCHEDULE_ID" type="INTEGER" required="true"/> + <column name="TIME_STAMP" type="LONG" required="true"/> + <column name="OOB_FACTOR" type="INTEGER" required="true" /> + <constraint name="RHQ_MEAS_OOB_TMP_ID_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_NUMBERS"> + <column name="i" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true" /> + </table> + + + <table name="RHQ_MEAS_DATA_NUM_R00"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R00_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R00_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R01"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R01_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R01_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R02"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R02_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R02_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R03"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R03_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R03_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R04"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R04_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R04_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R05"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R05_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R05_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R06"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R06_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R06_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R07"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R07_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R07_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R08"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R08_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R08_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R09"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R09_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R09_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R10"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R10_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R10_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R11"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R11_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R11_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R12"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R12_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R12_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R13"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R13_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R13_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R14"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R14_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R14_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + +<!-- END: measurement-schema.xml --> +<!-- BEGIN: content-schema.xml --> + + + <table name="RHQ_ARCHITECTURE"> + <column name="ID" default="sequence-only" initial="100" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="50" type="VARCHAR2" required="true"/> + <index name="RHQ_ARCHITECTURE_NAME_IDX" unique="true"> + <field ref="NAME"/> + </index> + </table> + + <table name="RHQ_REPO_GROUP_TYPE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + </table> + + + <table name="RHQ_REPO_GROUP"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + + <column name="REPO_GROUP_TYPE_ID" type="INTEGER" references="RHQ_REPO_GROUP_TYPE" required="true"/> + + <index name="RHQ_REPO_GROUP_IDX" unique="true"> + <field ref="NAME"/> + <field ref="REPO_GROUP_TYPE_ID"/> + </index> + </table> + + + <table name="RHQ_CONTENT_SOURCE_TYPE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="false"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="PLUGIN_NAME" size="100" type="VARCHAR2" required="false"/> + <!-- we might want this as part of natural key --> + <column name="DEFAULT_LAZY_LOAD" type="BOOLEAN" required="true"/> + <column name="DEFAULT_DOWNLOAD_MODE" size="16" type="VARCHAR2" required="true"/> + <column name="DEFAULT_SYNC_SCHEDULE" size="64" type="VARCHAR2" required="false"/> + <column name="API_CLASS" size="100" type="VARCHAR2" required="true"/> + + <column name="SOURCE_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF" required="false"/> + + <index name="RHQ_CONTENT_SOURCE_TYPE_IDX" unique="true"> + <field ref="NAME"/> + <!-- <field ref="PLUGIN_NAME"/> --> + </index> + </table> + + <table name="RHQ_CONTENT_SOURCE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="LAZY_LOAD" type="BOOLEAN" required="true"/> + <column name="DOWNLOAD_MODE" size="16" type="VARCHAR2" required="true"/> + <column name="SYNC_SCHEDULE" size="64" type="VARCHAR2" required="false"/> + <column name="LOAD_ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="CREATION_TIME" type="LONG" required="true"/> + <column name="LAST_MODIFIED_TIME" type="LONG" required="true"/> + + <column name="CONTENT_SOURCE_TYPE_ID" type="INTEGER" references="RHQ_CONTENT_SOURCE_TYPE" required="true"/> + <column name="CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> + + <index name="RHQ_CONTENT_SOURCE_IDX" unique="true"> + <field ref="NAME"/> + <field ref="CONTENT_SOURCE_TYPE_ID"/> + </index> + </table> + + <table name="RHQ_REPO"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="CREATION_TIME" type="LONG" required="true"/> + <column name="LAST_MODIFIED_TIME" type="LONG" required="true"/> + <column name="IS_CANDIDATE" type="BOOLEAN" required="true"/> + <column name="SYNC_SCHEDULE" size="64" type="VARCHAR2" required="false"/> + <column name="OWNER_ID" type="INTEGER" required="false" references="RHQ_SUBJECT" /> + <column name="IS_PRIVATE" type="BOOLEAN" required="true" /> + + <index name="RHQ_REPO_IDX" unique="true"> + <field ref="NAME"/> + </index> + </table> + + + <table name="RHQ_REPO_RELATION_TYPE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + </table> + + + <table name="RHQ_REPO_RELATION"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="RELATED_REPO_ID" type="INTEGER" references="RHQ_REPO" required="true"/> + <column name="REPO_RELATION_TYPE_ID" type="INTEGER" references="RHQ_REPO_RELATION_TYPE" required="true"/> + </table> + + + + <table name="RHQ_PACKAGE_TYPE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="false"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="CATEGORY" size="50" type="VARCHAR2" required="false"/> + <column name="DISCOVERY_INTERVAL" type="INTEGER" required="false"/> + <column name="IS_CREATION_DATA" type="BOOLEAN" required="true"/> + <column name="SUPPORTS_ARCHITECTURE" type="BOOLEAN" required="true"/> + + <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE" required="false"/> + <column name="DEPLOYMENT_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF" required="false"/> + <column name="PACKAGE_EXTRA_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG_DEF" required="false"/> + + <index name="RHQ_PACKAGE_TYPE_IDX" unique="true"> + <field ref="NAME"/> + <field ref="RESOURCE_TYPE_ID"/> + </index> + + </table> + + <table name="RHQ_PACKAGE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="CLASSIFICATION" size="200" type="VARCHAR2" required="false"/> + + <column name="PACKAGE_TYPE_ID" type="INTEGER" references="RHQ_PACKAGE_TYPE" required="true"/> + + <index name="RHQ_PACKAGE_IDX" unique="true"> + <field ref="NAME"/> + <field ref="PACKAGE_TYPE_ID"/> + </index> + </table> + + <table name="RHQ_PACKAGE_BITS"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="BITS" type="LARGEOBJECT" required="false"/> + </table> + + <table name="RHQ_PACKAGE_VERSION"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="false"/> + <column name="SHORT_DESCRIPTION" size="10000" type="CLOB" required="false"/> + <column name="LONG_DESCRIPTION" size="50000" type="CLOB" required="false"/> + <column name="VERSION" size="500" type="VARCHAR2" required="true"/> + <column name="DISPLAY_VERSION" size="500" type="VARCHAR2" required="false"/> + <column name="FILE_NAME" size="255" type="VARCHAR2" required="false"/> + <column name="FILE_SIZE" type="LONG" required="false"/> + <column name="FILE_MD5" size="32" type="VARCHAR2" required="false"/> + <column name="FILE_SHA256" size="64" type="VARCHAR2" required="false"/> + <column name="FILE_CREATION_TIME" type="LONG" required="false"/> + <column name="LICENSE_NAME" size="255" type="VARCHAR2" required="false"/> + <column name="LICENSE_VERSION" size="20" type="VARCHAR2" required="false"/> + <column name="METADATA" type="BLOB" required="false"/> + + <column name="PACKAGE_ID" type="INTEGER" references="RHQ_PACKAGE" required="true"/> + <column name="ARCHITECTURE_ID" type="INTEGER" references="RHQ_ARCHITECTURE" required="true"/> + <column name="CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> + <column name="PACKAGE_BITS_ID" type="INTEGER" references="RHQ_PACKAGE_BITS" required="false"/> + + <index name="RHQ_PACKAGE_VERSION_IDX" unique="true"> + <field ref="PACKAGE_ID"/> + <field ref="VERSION"/> + <field ref="ARCHITECTURE_ID"/> + </index> + + </table> + + <table name="RHQ_CONTENT_REQ"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="REQUEST_TYPE" type="VARCHAR2" required="true" size="20"/> + <column name="NOTES" type="VARCHAR2" required="false" size="512"/> + </table> + + <table name="RHQ_INSTALLED_PACKAGE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="INSTALLATION_TIME" type="LONG" required="false"/> + + <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE" required="true"/> + <column name="PACKAGE_VERSION_ID" type="INTEGER" references="RHQ_PACKAGE_VERSION" required="true"/> + <column name="SUBJECT_ID" type="INTEGER" references="RHQ_SUBJECT" required="false"/> + </table> + + <table name="RHQ_INSTALLED_PKG_HIST"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="STATUS" type="VARCHAR2" size="24" required="true"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="HISTORY_TIMESTAMP" type="LONG" required="false"/> + + <column name="PACKAGE_VERSION_ID" type="INTEGER" references="RHQ_PACKAGE_VERSION" required="true"/> + <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE" required="true"/> + <column name="DEPLOYMENT_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> + <column name="CONTENT_SERVICE_REQUEST_ID" type="INTEGER" references="RHQ_CONTENT_REQ" required="false"/> + </table> + + <table name="RHQ_CONTENT_SRC_SYNC"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="STATUS" type="VARCHAR2" size="16" required="true"/> + <column name="START_TIME" type="LONG" required="true"/> + <column name="END_TIME" type="LONG" required="false"/> + <column name="RESULTS" type="LONGVARCHAR" required="false"/> + <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> + </table> + + <table name="RHQ_REPO_SYNC"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="STATUS" type="VARCHAR2" size="16" required="true"/> + <column name="START_TIME" type="LONG" required="true"/> + <column name="END_TIME" type="LONG" required="false"/> + <column name="RESULTS" type="LONGVARCHAR" required="false"/> + <column name="PERCENT_COMPLETE" type="LONG" required="false"/> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + </table> + + + <table name="RHQ_PACKAGE_INST_STEP"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="STEP_KEY" type="VARCHAR2" size="500" required="true"/> + <column name="STEP_ORDER" type="INTEGER" required="true"/> + <column name="DESCRIPTION" type="VARCHAR2" size="4000" required="true"/> + <column name="ERROR_MSG" type="LONGVARCHAR" required="false"/> + <column name="RESULT" type="VARCHAR2" size="25" required="true"/> + + <column name="INSTALLED_PKG_HIST_ID" type="INTEGER" references="RHQ_INSTALLED_PKG_HIST"/> + </table> + + <table name="RHQ_REPO_RESOURCE_MAP"> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_REPO_RESOURCE_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="RESOURCE_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_REPO_CONTENT_SRC_MAP"> 1 + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_REPO_CONTENT_SRC_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="CONTENT_SRC_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_REPO_REPO_GROUP_MAP"> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="REPO_GROUP_ID" type="INTEGER" required="true" references="RHQ_REPO_GROUP"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_REPO_REPO_GROUP_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="REPO_GROUP_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_REPO_REPO_RELATION_MAP"> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="REPO_RELATION_ID" type="INTEGER" required="true" references="RHQ_REPO_RELATION"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_REPO_REPO_RELATION_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="REPO_RELATION_ID"/> + </primaryKey> + </constraint> + </table> + + + <table name="RHQ_REPO_PKG_VERSION_MAP"> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_REPO_PKG_VER_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="PACKAGE_VERSION_ID"/> + </primaryKey> + </constraint> + <index name="RHQ_REPO_PKG_VER_MAP_IDX" unique="false"> + <field ref="PACKAGE_VERSION_ID"/> + </index> + </table> + + <table name="RHQ_PKG_VER_CONTENT_SRC_MAP"> + <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> + <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> + <column name="LOCATION" type="VARCHAR2" size="4000" required="true"/> + + <constraint name="RHQ_PKG_VER_CONTENT_SRC_KEY"> + <primaryKey> + <field ref="PACKAGE_VERSION_ID"/> + <field ref="CONTENT_SRC_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_PKG_PRD_MAP"> + <column name="PKG_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> + <column name="PRD_ID" type="INTEGER" required="true" references="RHQ_PRD_VER"/> + + <constraint name="RHQ_PKG_PRD_KEY"> + <primaryKey> + <field ref="PKG_ID"/> + <field ref="PRD_ID"/> + </primaryKey> + </constraint> + + </table> + + <table name="RHQ_DISTRIBUTION_TYPE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + + </table> + + <table name="RHQ_DISTRIBUTION"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="DISTRIBUTION_TYPE_ID" type="INTEGER" required="true" references="RHQ_DISTRIBUTION_TYPE"/> + <column name="LABEL" size="64" type="VARCHAR2" required="true"/> + <column name="BASE_PATH" size="256" type="VARCHAR2" required="true"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + + <index name="RHQ_DISTRIBUTION_IDX" unique="true"> + <field ref="LABEL"/> + <field ref="BASE_PATH"/> + </index> + + </table> + + <table name="RHQ_REPO_DISTRIBUTION"> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="DISTRIBUTION_ID" type="INTEGER" required="true" references="RHQ_DISTRIBUTION"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + + <constraint name="RHQ_REPO_DIST_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="DISTRIBUTION_ID"/> + </primaryKey> + </constraint> + </table> + + + + <table name="RHQ_DISTRIBUTION_FILE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="DISTRIBUTION_ID" type="INTEGER" required="true" references="RHQ_DISTRIBUTION"/> + <column name="RELATIVE_FILENAME" size="256" type="VARCHAR2" required="true"/> + <!--<column name="FILE_SIZE" type="NUMBER" required="true"/>--> + <column name="MD5SUM" size="64" type="VARCHAR2" required="true"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + <!--<column name="CTIME" type="LONG" required="true"/>--> + + <index name="RHQ_DISTRIBUTION_FILE_IDX" unique="true"> + <field ref="DISTRIBUTION_ID"/> + <field ref="RELATIVE_FILENAME"/> + </index> + </table> + + + + + <table name="RHQ_ADVISORY"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="ADVISORY" size="64" type="VARCHAR2" required="true"/> + <column name="ADVISORY_TYPE" size="64" type="VARCHAR2" required="true" /> + <column name="ADVISORY_REL" size="64" type="VARCHAR2" required="false"/> + <column name="ADVISORY_NAME" size="64" type="VARCHAR2" required="false"/> + <column name="DESCRIPTION" size="4000" type="VARCHAR2" required="false"/> + <column name="SYNOPSIS" size="4000" type="VARCHAR2" required="true"/> + <column name="TOPIC" size="4000" type="VARCHAR2" required="false"/> + <column name="SOLUTION" size="4000" type="VARCHAR2" required="false"/> + <column name="SEVERITY" size="64" type="VARCHAR2" required="false"/> + <column name="ISSUE_DATE" type="LONG" required="false"/> + <column name="UPDATE_DATE" type="LONG" required="false"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + + <index name="RHQ_ADVISORY_NAME_UQ" unique="true"> + <field ref="ADVISORY_NAME"/> + </index> + + <index name="RHQ_ADVISORY_UQ" unique="true"> + <field ref="ADVISORY"/> + </index> + + <index name="RHQ_ADVISORY_UDATE_IDX" unique="false"> + <field ref="UPDATE_DATE"/> + </index> + </table> + + <table name="RHQ_ADVISORY_PACKAGE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> + <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + + <index name="RHQ_ADVISORY_PKG_IDX" unique="true"> + <field ref="ADVISORY_ID"/> + <field ref="PACKAGE_VERSION_ID"/> + </index> + </table> + + <table name="RHQ_CVE"> + <column name="ID" default="sequence-only" initial="101" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="64" type="VARCHAR2" required="true"/> + </table> + + <table name="RHQ_ADVISORY_CVE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> + <column name="CVE_ID" type="INTEGER" required="true" references="RHQ_CVE"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + + <index name="RHQ_ADVISORY_CVE_IDX" unique="true"> + <field ref="ADVISORY_ID"/> + <field ref="CVE_ID"/> + </index> + + </table> + + <table name="RHQ_ADVISORY_BUGLIST"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> + <column name="BUG_ID" size="256" type="VARCHAR2" required="true"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + + <index name="RHQ_ADVISORY_BUG_IDX" unique="true"> + <field ref="ADVISORY_ID"/> + <field ref="BUG_ID"/> + </index> + </table> + + + <table name="RHQ_REPO_ADVISORY"> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + + <constraint name="RHQ_REPO_ADV_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="ADVISORY_ID"/> + </primaryKey> + </constraint> + </table> + + <!-- BUNDLE_TYPE is things like "Cobbler profile" or "file-based bundle" or "puppet recipe" --> + <table name="RHQ_BUNDLE_TYPE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> + + <!-- This index is for constraint, not performance --> + <index name="RHQ_BUNDLE_TYPE_UNIQUE" unique="true"> + <field ref="NAME"/> + </index> + </table> + + <!-- BUNDLE is a named piece of content that can be versioned and installed somewhere --> + <table name="RHQ_BUNDLE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="BUNDLE_TYPE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_TYPE"/> + <column name="PACKAGE_TYPE_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_TYPE"/> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + + <!-- This index is for constraint, not performance --> + <index name="RHQ_BUNDLE_UNIQUE" unique="true"> + <field ref="BUNDLE_TYPE_ID"/> + <field ref="NAME"/> + </index> + </table> + + <!-- BUNDLE_VERSION represents an actual piece of content that needs to be installed somewhere --> + <table name="RHQ_BUNDLE_VERSION"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="VERSION" size="500" type="VARCHAR2" required="true"/> + <column name="VERSION_ORDER" type="INTEGER" required="true"/> + <column name="ACTION" type="CLOB" required="true"/> + <column name="CONFIG_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_DEF" /> + <column name="BUNDLE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE"/> + + <!-- This index is for constraint, not performance --> + <index name="RHQ_BUNDLE_VERSION_UNIQUE" unique="true"> + <field ref="BUNDLE_ID"/> + <field ref="NAME"/> + <field ref="VERSION"/> + </index> + </table> + + <!-- Many-to-many table that links many repos to a particular bundle version. destination platforms --> + <!-- would be required to have associations to the specified repos (to access required content --> + <table name="RHQ_BUNDLE_VERSION_REPO"> + <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + + <constraint name="RHQ_BUNDLE_VERSION_REPO_KEY"> + <primaryKey> + <field ref="BUNDLE_VERSION_ID"/> + <field ref="REPO_ID"/> + </primaryKey> + </constraint> + </table> + + <!-- BUNDLE_FILE represents a file that is associated with (possibly bundled inside) a bundle version --> + <table name="RHQ_BUNDLE_FILE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> + <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> + </table> + + <!-- A logical destination for a bundle deployment. Defines the platforms and directory on those targets. --> + <table name="RHQ_BUNDLE_DESTINATION"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="BUNDLE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE"/> + <column name="GROUP_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_GROUP"/> + <column name="DEPLOY_DIR" size="256" type="VARCHAR2" required="true"/> + <column name="DEST_BASE_DIR_NAME" size="200" type="VARCHAR2" required="true"/> + + <!-- This index is for constraint, not performance --> + <index name="RHQ_BUNDLE_DESTINATION_UNIQUE" unique="true"> + <field ref="BUNDLE_ID"/> + <field ref="GROUP_ID"/> + <field ref="DEPLOY_DIR"/> + </index> + </table> + + <!-- An actual deployment of a bundle version to a destination, with a specific config. Bundle deployments + can differ only on ctime, which is assumed to be different --> + <table name="RHQ_BUNDLE_DEPLOYMENT"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> + <column name="BUNDLE_DESTINATION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DESTINATION"/> + <column name="CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG" /> + <column name="SUBJECT_NAME" type="VARCHAR2" required="false" size="255"/> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="IS_LIVE" type="BOOLEAN" required="true"/> + <column name="REPLACED_BUNDLE_DEPLOYMENT_ID" type="INTEGER" required="false" references="RHQ_BUNDLE_DEPLOYMENT"/> + </table> + + <!-- Represents a bundle version that is deployed on a platform resource --> + <table name="RHQ_BUNDLE_RES_DEPLOY"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="BUNDLE_DEPLOYMENT_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DEPLOYMENT" /> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE" /> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="CTIME" type="LONG" required="true"/> + + <index name="RHQ_BUNDLE_RES_DEPLOY_IDX" unique="true"> + <field ref="BUNDLE_DEPLOYMENT_ID"/> + <field ref="RESOURCE_ID"/> + </index> + </table> + + <table name="RHQ_BUNDLE_RES_DEP_HIST"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="BUNDLE_RES_DEPLOY_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_RES_DEPLOY" /> + <column name="SUBJECT_NAME" required="false" size="255" type="VARCHAR2"/> + <column name="AUDIT_TIME" required="true" type="LONG"/> + <column name="ACTION" required="true" size="128" type="VARCHAR2"/> + <column name="INFO" required="true" size="512" type="VARCHAR2"/> + <column name="CATEGORY" required="false" size="32" type="VARCHAR2"/> + <column name="STATUS" required="true" type="VARCHAR2" size="16"/> + <column name="MESSAGE" required="false" type="LONGVARCHAR"/> + <column name="ATTACHMENT" required="false" type="LONGVARCHAR"/> + </table> + + <table name="RHQ_TAGGING_BUNDLE_MAP"> + <column name="BUNDLE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE"/> + <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> + <constraint name="RHQ_TAGGING_BUNDLE_MAP_KEY"> + <primaryKey> + <field ref="BUNDLE_ID"/> + <field ref="TAG_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_TAGGING_BUNDLE_VERSION_MAP"> + <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> + <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> + <constraint name="RHQ_TAGGING_BUNDLE_VER_MAP_KEY"> + <primaryKey> + <field ref="BUNDLE_VERSION_ID"/> + <field ref="TAG_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_TAGGING_BUNDLE_DEPLOY_MAP"> + <column name="BUNDLE_DEPLOYMENT_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DEPLOYMENT"/> + <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> + <constraint name="RHQ_TAGGING_BUNDLE_DEP_MAP_KEY"> + <primaryKey> + <field ref="BUNDLE_DEPLOYMENT_ID"/> + <field ref="TAG_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_TAGGING_BUNDLE_DEST_MAP"> + <column name="BUNDLE_DESTINATION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DESTINATION"/> + <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> + <constraint name="RHQ_TAGGING_BUNDLE_DES_MAP_KEY"> + <primaryKey> + <field ref="BUNDLE_DESTINATION_ID"/> + <field ref="TAG_ID"/> + </primaryKey> + </constraint> + </table> + + <!-- Drift Management Tables --> + <table name="RHQ_DRIFT_DEF_TEMPLATE"> + <column name="ID" default="sequence-only" initial="1001" primarykey="true" required="true" type="INTEGER"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> + <column name="CONFIG_ID" type="INTEGER" required="true" references="RHQ_CONFIG"/> + <column name="NAME" type="VARCHAR2" size="128" required="true"/> + <column name="DESCRIPTION" type="VARCHAR2" size="512" required="false"/> + <!-- true if defined by user, false if provided by plugin --> + <column name="IS_USER_DEFINED" type="BOOLEAN" required="true"/> + <!-- + Change sets are managed by the drift server plugins; therefore, we cannot maintain + a FK constraint on the change set id. And the type cannot be integer because + other back ends like MongoDB use other types that are basically variants of a + UUID + + jsanda + --> + <column name="DRIFT_CHANGE_SET_ID" type="VARCHAR2" size="64" required="false"/> + <column name="CTIME" type="LONG" required="true"/> + + <index name="RHQ_DRIFT_DEF_TEMPLATE_UNIQUE" unique="true"> + <field ref="RESOURCE_TYPE_ID"/> + <field ref="NAME"/> + </index> + </table> + + <!-- Content of a file being managed for drift. Used for diff and/or remediation --> + <table name="RHQ_DRIFT_FILE"> + <column name="HASH_ID" type="VARCHAR2" size="64" primarykey="true" required="true"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="DATA" type="LARGEOBJECT" required="false"/> + <column name="DATA_SIZE" type="LONG" required="false"/> + <column name="STATUS" type="VARCHAR2" size="20" required="true"/> + </table> + + <!-- A single drift definition defining file tracking + Note: A resource or group (todo: group, other?) can have zero or more drift configurations. + Note: The name, interval and is_enabled values are also stored withing the referenced config. + This allows us to use the config editor to manipulate all fields. + Note: Name is read-only + Note: Interval unit is millis + --> + <table name="RHQ_DRIFT_DEFINITION"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="CONFIG_ID" type="INTEGER" required="true" references="RHQ_CONFIG"/> + <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> + <column name="DRIFT_DEF_TEMPLATE_ID" type="INTEGER" required="false" references="RHQ_DRIFT_DEF_TEMPLATE"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="NAME" type="VARCHAR2" size="512" required="true"/> + <column name="DESCRIPTION" type="VARCHAR2" size="512" required="false"/> + <column name="INTERVAL" type="LONG" required="true"/> + <column name="IS_ENABLED" type="BOOLEAN" required="true"/> + <column name="DRIFT_HANDLING_MODE" type="VARCHAR2" size="20" required="true"/> + <column name="IS_PINNED" type="BOOLEAN" required="true"/> + <column name="IS_ATTACHED" type="BOOLEAN" required="true"/> + <column name="COMPLIANCE_STATUS" type="INTEGER" required="true"/> + </table> + + <!-- A set of drift records (note, this is for the JPA server plugin impl only) --> + <table name="RHQ_DRIFT_SET"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + </table> + + <!-- A drift change-set report for a resource (note, this is for the JPA server plugin impl only) --> + <table name="RHQ_DRIFT_CHANGE_SET"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="DRIFT_SET_ID" type="INTEGER" required="false" references="RHQ_DRIFT_SET"/> + <column name="CTIME" type="LONG" required="true"/> + <!-- Version 0 is initial change-set --> + <column name="VERSION" type="INTEGER" required="true"/> + <column name="CATEGORY" type="VARCHAR2" size="20" required="true"/> + <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> + <column name="DRIFT_DEFINITION_ID" type="INTEGER" required="false" references="RHQ_DRIFT_DEFINITION"/> + <!-- the drift handling mode at changeset creation time --> + <column name="DRIFT_HANDLING_MODE" type="VARCHAR2" size="20" required="true"/> + </table> + + <!-- A single occurence of drift for a resource (note, this is for the JPA server plugin impl only) --> + <table name="RHQ_DRIFT"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="CATEGORY" type="VARCHAR2" size="20" required="true"/> + <column name="DRIFT_SET_ID" type="INTEGER" required="false" references="RHQ_DRIFT_SET"/> + <column name="DRIFT_CHANGE_SET_ID" type="INTEGER" required="true" references="RHQ_DRIFT_CHANGE_SET"/> + <!-- the file path not including the base directory --> + <column name="PATH" type="VARCHAR2" size="1024" required="true"/> + <!-- the same as PATH less [/]filename.ext. Redundant storage for the purpose of strict directory search. + this field can be considered transient for serialization purposes --> + <column name="PATH_DIRECTORY" type="VARCHAR2" size="1024" required="true"/> + <column name="OLD_DRIFT_FILE" type="VARCHAR2" size="64" required="false" references="RHQ_DRIFT_FILE"/> + <column name="NEW_DRIFT_FILE" type="VARCHAR2" size="64" required="false" references="RHQ_DRIFT_FILE"/> + </table> + + +<!-- END: content-schema.xml --> +<!-- BEGIN: resource-request-schema.xml --> + + + <table name="RHQ_CREATE_RES_HIST"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="PARENT_RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> + <column name="CREATED_RESOURCE_NAME" type="VARCHAR2" size="500" required="false"/> + <column name="NEW_RESOURCE_KEY" type="VARCHAR2" required="false" size="500"/> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> + <column name="CONFIGURATION_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> + <column name="INSTALLED_PACKAGE_ID" type="INTEGER" required="false" references="RHQ_INSTALLED_PACKAGE"/> + </table> + + <table name="RHQ_DELETE_RES_HIST"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> + </table> + +<!-- END: resource-request-schema.xml --> +<!-- BEGIN: jms-schema.xml --> + +<!-- the schema matches that which would be automatically created by the JMS subsystem --> +<!-- see deploy/jms/rhq-jdbc-state-service.xml and rhq-jdbc2-service.xml --> + + + <table name="JMS_MESSAGES"> + <column name="MESSAGEID" required="true" type="INTEGER" /> + <column name="DESTINATION" required="true" type="VARCHAR2" size="255" /> + <column name="TXID" required="false" type="INTEGER" /> + <column name="TXOP" required="false" type="CHAR" size="1" /> + <column name="MESSAGEBLOB" required="false" type="BLOB" /> + + <constraint name="JMS_MESSAGES_PKEY"> + <primaryKey> + <field ref="MESSAGEID"/> + <field ref="DESTINATION"/> + </primaryKey> + </constraint> + + <index name="JMS_MESSAGES_TXOP_TXID"> + <field ref="TXOP"/> + <field ref="TXID"/> + </index> + <index name="JMS_MESSAGES_DESTINATION"> + <field ref="DESTINATION"/> + </index> + </table> + + <table name="JMS_TRANSACTIONS"> + <column name="TXID" required="true" type="INTEGER" primarykey="true" /> + </table> + + <table name="JMS_USERS"> + <column name="USERID" required="true" type="VARCHAR2" size="32" primarykey="true" /> + <column name="PASSWD" required="true" type="VARCHAR2" size="32" /> + <column name="CLIENTID" required="false" type="VARCHAR2" size="128" /> + </table> + + <table name="JMS_ROLES"> + <column name="ROLEID" required="true" type="VARCHAR2" size="32" /> + <column name="USERID" required="true" type="VARCHAR2" size="32" /> + + <constraint name="JMS_ROLES_PKEY"> + <primaryKey> + <field ref="USERID"/> + <field ref="ROLEID"/> + </primaryKey> + </constraint> + </table> + + <table name="JMS_SUBSCRIPTIONS"> + <column name="CLIENTID" required="true" type="VARCHAR2" size="128" /> + <column name="SUBNAME" required="true" type="VARCHAR2" size="128" /> + <column name="TOPIC" required="true" type="VARCHAR2" size="255" /> + <column name="SELECTOR" required="false" type="VARCHAR2" size="255" /> + + <constraint name="JMS_SUBSCRIPTIONS_PKEY"> + <primaryKey> + <field ref="CLIENTID"/> + <field ref="SUBNAME"/> + </primaryKey> + </constraint> + </table> + +<!-- END: jms-schema.xml --> +<!-- BEGIN: obsolete-schema.xml --> + + + <!-- NOTE: The tables will be dropped in the *** REVERSE ORDER *** as listed in this file! --> + <!-- NOTE: So, put the table you want dropped first at the bottom, and so on... --> + + + <!-- !!! REMOVED FROM CONTENT-SCHEMA !!!! --> + + <table name="RHQ_DRIFT_TEMPLATE_MAP"> + <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> + <column name="CONFIG_TEMPLATE_ID" type="INTEGER" required="true" references="RHQ_CONFIG_TEMPLATE"/> + </table> + + <table name="RHQ_BUNDLE_CONFIG" obsolete="true"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG" /> + <!-- this probably needs a DTYPE discriminator so we know if its a bundle or a specific bundle version --> + <column name="BUNDLE_VERSION_ID" type="INTEGER" required="false" references="RHQ_BUNDLE_VERSION"/> + <column name="BUNDLE_ID" type="INTEGER" required="false" references="RHQ_BUNDLE"/> + </table> + + <table name="RHQ_CHANNEL" obsolete="true"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="CREATION_TIME" type="LONG" required="true"/> + <column name="LAST_MODIFIED_TIME" type="LONG" required="true"/> + + <index name="RHQ_CHANNEL_IDX" unique="true"> + <field ref="NAME"/> + </index> + </table> + + <table name="RHQ_CHANNEL_RESOURCE_MAP" obsolete="true"> + <column name="CHANNEL_ID" type="INTEGER" required="true" references="RHQ_CHANNEL"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_CHANNEL_RESOURCE_MAP_KEY"> + <primaryKey> + <field ref="CHANNEL_ID"/> + <field ref="RESOURCE_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_CHANNEL_CONTENT_SRC_MAP" obsolete="true"> + <column name="CHANNEL_ID" type="INTEGER" required="true" references="RHQ_CHANNEL"/> + <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_CHAN_CONTENT_SRC_MAP_KEY"> + <primaryKey> + <field ref="CHANNEL_ID"/> + <field ref="CONTENT_SRC_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_CHANNEL_PKG_VERSION_MAP" obsolete="true"> + <column name="CHANNEL_ID" type="INTEGER" required="true" references="RHQ_CHANNEL"/> + <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_CHANNEL_PKG_VER_MAP_KEY"> + <primaryKey> + <field ref="CHANNEL_ID"/> + <field ref="PACKAGE_VERSION_ID"/> + </primaryKey> + </constraint> + </table> + + <!-- !!! REMOVED FROM MEASUREMENT-SCHEMA !!!! --> + + <table name="RHQ_MEASUREMENT_OOB" obsolete="true"> + <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> + <column name="SCHEDULE_ID" type="INTEGER" references="RHQ_MEASUREMENT_SCHED(ID)" required="true"/> + <column name="OCCURRED" type="LONG" required="true"/> + <column name="DIFF" type="DOUBLE" required="true"/> + + <index name="RHQ_MEASUREMENT_OOB_IDX" unique="true"> + <field ref="SCHEDULE_ID" /> + <field ref="OCCURRED" /> + </index> + </table> + + + <table name="RHQ_TAG" obsolete="true"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + </table> + + <table name="RHQ_REPO_TAG_MAP" obsolete="true"> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAG"/> + + <constraint name="RHQ_REPO_TAG_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="TAG_ID"/> + </primaryKey> + </constraint> + </table> + + +<!-- END: obsolete-schema.xml --> +</dbsetup> diff --git a/modules/enterprise/server/installer/src/test/resources/org/rhq/enterprise/server/installer/db-schema-combined-rhq-4.4.0.xml b/modules/enterprise/server/installer/src/test/resources/org/rhq/enterprise/server/installer/db-schema-combined-rhq-4.4.0.xml new file mode 100644 index 0000000..2eb4b19 --- /dev/null +++ b/modules/enterprise/server/installer/src/test/resources/org/rhq/enterprise/server/installer/db-schema-combined-rhq-4.4.0.xml @@ -0,0 +1,2649 @@ +<?xml version="1.0" encoding="UTF-8"?> +<dbsetup name="schema"> +<!-- BEGIN: config-schema.xml --> + + + <!-- Definition or Metadata tables --> + + <table name="RHQ_CONFIG_DEF"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="NAME" type="VARCHAR2" required="true" size="100"/> + <column name="DESCRIPTION" type="VARCHAR2" required="false" size="250"/> + <column name="VERSION" type="VARCHAR2" required="false" size="50"/> + <column name="CONFIG_FORMAT" type="VARCHAR2" required="false" size="32"/> + </table> + + <table name="RHQ_CONFIG_PROP_GRP_DEF"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="NAME" type="VARCHAR2" required="true" size="100"/> + <column name="DISPLAY_NAME" type="VARCHAR2" required="false" size="100"/> + <column name="DESCRIPTION" type="VARCHAR2" required="false" size="250"/> + <column name="DEFAULT_HIDDEN" type="BOOLEAN" required="false"/> + <column name="ORDER_INDEX" type="INTEGER" required="false"/> + </table> + + <table name="RHQ_CONFIG_PROP_DEF"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="NAME" type="VARCHAR2" required="false" size="255"/> + <column name="DISPLAY_NAME" type="VARCHAR2" required="false" size="100"/> + <column name="DESCRIPTION" type="VARCHAR2" required="false" size="1000"/> + <column name="DEFAULT_VALUE" type="VARCHAR2" required="false" size="2000"/> + <column name="REQUIRED" type="BOOLEAN" required="false"/> + <column name="READONLY" type="BOOLEAN" required="false"/> + <column name="SUMMARY" type="BOOLEAN" required="false"/> + <column name="ACTIVATION_POLICY" type="VARCHAR2" required="false" size="20"/> + <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_GRP_DEF"/> + <column name="ORDER_INDEX" type="INTEGER" required="false"/> + <column name="VERSION" type="VARCHAR2" required="false" size="50"/> + <column name="PARENT_MAP_DEFINITION_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> + <column name="PARENT_LIST_DEFINITION_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> + <column name="SIMPLE_TYPE" type="VARCHAR2" required="false" size="20"/> + <column name="ALLOW_CUSTOM_ENUM_VALUE" type="BOOLEAN" required="false"/> + <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> + <column name="CONFIG_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_DEF"/> + + <!-- only simple properties (not lists and maps) have this --> + <column name="UNITS" type="SMALLINT" required="false"/> + + <!-- only dynamic properties (not simple) have this --> + <column name="DYNAMIC_TYPE" type="VARCHAR2" size="20" required="false"/> + <column name="DYNAMIC_KEY" type="VARCHAR2" size="128" required="false"/> + </table> + + <table name="RHQ_CONF_PROP_DEF_ENUM"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="STRING_VALUE" type="VARCHAR2" required="false" size="500"/> + <column name="ORDER_INDEX" type="INTEGER" required="false"/> + <column name="NAME" type="VARCHAR2" required="false" size="100"/> + <column name="PROPERTY_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> + </table> + + <table name="RHQ_CONFIG_PD_OSRC"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="LINK_TO_TARGET" type="BOOLEAN" required="false"/> + <column name="FILTER" type="VARCHAR2" required="false" size="40"/> + <column name="EXPRESSION" type="VARCHAR2" required="true" size="400"/> + <column name="TARGET_TYPE" type="VARCHAR2" required="true" size="20"/> + <column name="PROPERTY_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> + </table> + + <table name="RHQ_CONFIG_PROP_CONSTR"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="DTYPE" type="VARCHAR2" required="true" size="15"/> + <column name="DETAILS" type="VARCHAR2" required="false" size="250"/> + <column name="CONFIG_PROP_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> + <column name="ORDER_INDEX" type="INTEGER" required="false"/> + </table> + + + <!-- Content or value tables --> + + <table name="RHQ_CONFIG"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="NOTES" type="VARCHAR2" required="false" size="512"/> + <column name="VERSION" type="VARCHAR2" required="false" size="50"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + </table> + + <table name="RHQ_CONFIG_PROPERTY"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="CONFIGURATION_ID" type="INTEGER" required="false" references="RHQ_CONFIG" ondelete="cascade"/> + <column name="STRING_VALUE" type="VARCHAR2" required="false" size="2000"/> + <column name="OVERRIDE" type="BOOLEAN" required="false"/> + <column name="NAME" type="VARCHAR2" required="true" size="255"/> + <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> + <!-- Recursive cascade path to RHQ_CONFIG_PROPERTY causes constraint creation errors on SQL Server, see + http://support.microsoft.com/kb/321843 --> + <column name="PARENT_LIST_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROPERTY" ondelete="cascade" /> + <column name="PARENT_MAP_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROPERTY" ondelete="cascade" /> + <column name="LIST_INDEX" type="INTEGER"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <index name="RHQ_CONFIG_PROP_idx_prop_key" unique="false"> + <field ref="CONFIGURATION_ID"/> + <field ref="NAME"/> + </index> + <index name="RHQ_CONFIG_PROP_idx_map_key" unique="false"> + <field ref="PARENT_MAP_ID"/> + <field ref="NAME"/> + </index> + <index name="RHQ_CONFIG_PROP_idx_list_key" unique="false"> + <field ref="PARENT_LIST_ID"/> + </index> + <!-- List entries all have the same name --> + </table> + + <table name="RHQ_CONFIG_TEMPLATE"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="NAME" type="VARCHAR2" required="false" size="100"/> + <column name="DESCRIPTION" type="VARCHAR2" required="false" size="500"/> + <column name="CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> + <column name="CONFIG_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_DEF"/> + <column name="IS_DEFAULT" type="BOOLEAN" required="false"/> + </table> + + <table name="RHQ_RAW_CONFIG"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="CONFIG_ID" type="INTEGER" required="true" references="RHQ_CONFIG(ID)"/> + <column name="PATH" type="VARCHAR2" required="false" size="512"/> + <column name="CONTENTS" type="CLOB" required="true"/> + <column name="SHA256" type="VARCHAR2" size="64" required="true"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + </table> + +<!-- END: config-schema.xml --> +<!-- BEGIN: cluster-schema.xml --> + + <table name="RHQ_AFFINITY_GROUP"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" required="true" size="255" type="VARCHAR2"/> + </table> + + <table name="RHQ_SERVER"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" required="true" size="255" type="VARCHAR2"/> + <column name="ADDRESS" required="true" size="255" type="VARCHAR2"/> + <column name="PORT" required="true" type="INTEGER"/> + <column name="SECURE_PORT" required="true" type="INTEGER"/> + <column name="CTIME" required="true" type="LONG"/> + <column name="MTIME" required="true" type="LONG"/> + <column name="AFFINITY_GROUP_ID" type="INTEGER" references="RHQ_AFFINITY_GROUP" required="false"/> + <column name="COMPUTE_POWER" required="true" type="INTEGER"/> + <column name="OPERATION_MODE" required="true" size="32" type="VARCHAR2"/> + <column name="STATUS" type="INTEGER" required="false" default="0" /> + + <!-- This index is for constraint, not performance --> + <index name="RHQ_SERVER_NAME_UNIQUE" unique="true"> + <field ref="NAME"/> + </index> + </table> + + <!-- new agent --> + <table name="RHQ_AGENT"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" required="true" size="255" type="VARCHAR2"/> + <column name="ADDRESS" required="true" size="255" type="VARCHAR2"/> + <column name="PORT" required="true" type="INTEGER"/> + <column name="AGENTTOKEN" required="true" size="100" type="VARCHAR2"/> + <column name="REMOTE_ENDPOINT" required="false" size="4000" type="VARCHAR2"/> + <column name="CTIME" required="true" type="LONG"/> + <column name="MTIME" required="true" type="LONG"/> + <column name="LAST_AVAILABILITY_REPORT" required="false" type="LONG"/> + <column name="LAST_AVAILABILITY_PING" required="false" type="LONG"/> + <column name="AFFINITY_GROUP_ID" type="INTEGER" references="RHQ_AFFINITY_GROUP" required="false"/> + <column name="SERVER_ID" type="INTEGER" references="RHQ_SERVER" required="false"/> + <column name="STATUS" type="INTEGER" required="false" default="0" /> + <column name="BACKFILLED" type="BOOLEAN" required="true" /> + + <index name="RHQ_AGENT_NAME_UNIQUE" unique="true"> + <field ref="NAME"/> + </index> + + <index name="RHQ_AGENT_ADDRESS_PORT" unique="true"> + <field ref="ADDRESS"/> + <field ref="PORT"/> + </index> + + <index name="RHQ_AGENT_TOKEN_UNIQUE" unique="true"> + <field ref="AGENTTOKEN"/> + </index> + </table> + + <table name="RHQ_PARTITION_EVENT"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="SUBJECT_NAME" required="true" size="100" type="VARCHAR2"/> + <column name="CTIME" required="true" type="LONG"/> + <column name="EVENT_TYPE" required="true" size="50" type="VARCHAR2"/> + <column name="EVENT_DETAIL" required="false" size="512" type="VARCHAR2"/> + <column name="EXECUTION_STATUS" required="true" size="32" type="VARCHAR2"/> + </table> + + <table name="RHQ_PARTITION_DETAILS"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="PARTITION_EVENT_ID" type="INTEGER" references="RHQ_PARTITION_EVENT" required="true"/> + <column name="AGENT_NAME" type="VARCHAR2" size="255" required="true"/> + <column name="SERVER_NAME" type="VARCHAR2" size="255" required="true"/> + </table> + + <table name="RHQ_FAILOVER_LIST"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="PARTITION_EVENT_ID" type="INTEGER" references="RHQ_PARTITION_EVENT" required="true"/> + <column name="AGENT_ID" type="INTEGER" references="RHQ_AGENT" required="true"/> + <column name="CTIME" required="true" type="LONG"/> + </table> + + <table name="RHQ_FAILOVER_DETAILS"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="FAILOVER_LIST_ID" type="INTEGER" references="RHQ_FAILOVER_LIST" required="true"/> + <column name="SERVER_ID" type="INTEGER" references="RHQ_SERVER" required="true"/> + <column name="ORDINAL" type = "INTEGER" required="true"/> + </table> + +<!-- END: cluster-schema.xml --> +<!-- BEGIN: auth-schema.xml --> + + + <table name="RHQ_PRINCIPAL"> + + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="PRINCIPAL" required="true" type="VARCHAR2" size="100"/> + <column name="PASSWORD" required="true" type="VARCHAR2" size="64"/> + + <!-- ensure that principals are unique --> + <index name="RHQ_PRINCIPAL_PRINCIPAL_KEY" unique="true"> + <field ref="PRINCIPAL"/> + </index> + + </table> + + <table name="RHQ_SUBJECT"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" required="true" size="100" type="VARCHAR2"/> + <column name="CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG"/> + <column name="FIRST_NAME" required="false" size="100" type="VARCHAR2"/> + <column name="LAST_NAME" required="false" size="100" type="VARCHAR2"/> + <column name="EMAIL_ADDRESS" size="100" type="VARCHAR2"/> + <column name="SMS_ADDRESS" size="100" type="VARCHAR2"/> + <column name="PHONE_NUMBER" size="100" type="VARCHAR2"/> + <column name="DEPARTMENT" size="100" type="VARCHAR2"/> + <column name="FACTIVE" required="true" type="BOOLEAN" default="true"/> + <column name="FSYSTEM" required="true" type="BOOLEAN" default="false"/> + + <index name="RHQ_SUBJECT_AUTH_KEY" unique="true"> + <field ref="NAME"/> + </index> + </table> + +<!-- END: auth-schema.xml --> +<!-- BEGIN: inventory-schema.xml --> + + + <!-- NEW RESOURCE TYPES --> + <table name="RHQ_RESOURCE_TYPE"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" type="VARCHAR2" size="100" required="true"/> + <column name="CATEGORY" type="VARCHAR2" size="16" required="true"/> + <column name="CREATION_DATA_TYPE" type="VARCHAR2" size="16" required="true"/> + <column name="CREATE_DELETE_POLICY" type="VARCHAR2" size="16" required="true"/> + <column name="SINGLETON" type="BOOLEAN" required="true"/> + <column name="SUPPORTS_MANUAL_ADD" type="BOOLEAN" required="true"/> + <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> + <column name="PLUGIN" type="VARCHAR2" size="100"/> + <column name="CTIME" type="LONG"/> + <column name="MTIME" type="LONG"/> + <column name="DELETED" type="BOOLEAN" default="FALSE" required="TRUE"/> + <column name="SUBCATEGORY_ID" type="INTEGER"/> + <!-- + TODO add support to DB setup for tables with circular dependencies and then add back this RI + <column name="SUBCATEGORY_ID" type="INTEGER" references="RHQ_RESOURCE_SUBCAT" /> + --> + <column name="PLUGIN_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> + <column name="RES_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> + <column name="BUNDLE_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG"/> + + <index name="RHQ_RES_TYPE_IDX_PLG_NAME" unique="true"> + <field ref="NAME"/> + <field ref="PLUGIN"/> + </index> + </table> + + <!-- NEW RESOURCE SUBCATEGORIES --> + <table name="RHQ_RESOURCE_SUBCAT"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" type="VARCHAR2" size="100"/> + <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> + <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> + <column name="CTIME" type="LONG"/> + <column name="MTIME" type="LONG"/> + <column name="PARENT_SUBCATEGORY_ID" type="INTEGER" references="RHQ_RESOURCE_SUBCAT"/> + <!-- resourceTypeId is not required on child sub categories --> + <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> + </table> + + <!-- Many To Many mapping for resource type to its parents --> + <table name="RHQ_RESOURCE_TYPE_PARENTS"> + <column name="RESOURCE_TYPE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> + <column name="PARENT_RESOURCE_TYPE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> + + <!-- not using full words to fit index name length --> + <constraint name="RHQ_RES_TYPE_PARENTS_KEY"> + <primaryKey> + <field ref="RESOURCE_TYPE_ID"/> + <field ref="PARENT_RESOURCE_TYPE_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_PROCESS_SCAN"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="QUERY" type="VARCHAR2" size="256" required="true"/> + <column name="NAME" type="VARCHAR2" size="100" required="false"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> + + <index name="RHQ_PROCESS_SCAN_QUERY_INDEX" unique="true"> + <field ref="QUERY"/> + <field ref="RESOURCE_TYPE_ID"/> + </index> + </table> + + <table name="RHQ_PRD_VER"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="VERSION" type="VARCHAR2" size="100" required="true"/> + <column name="RES_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> + </table> + + <table name="RHQ_RESOURCE"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> + <column name="UUID" type="CHAR" size="36" required="true"/> + <column name="NAME" type="VARCHAR2" size="500"/> + <!-- ancestry holds the full parental ancestry, used for disambiguation --> + <column name="ANCESTRY" type="VARCHAR2" required="false" size="4000"/> + <column name="RESOURCE_KEY" type="VARCHAR2" required="true" size="500"/> + <column name="AGENT_ID" required="false" type="INTEGER" references="RHQ_AGENT(id)"/> + <column name="INVENTORY_STATUS" type="VARCHAR2" size="20"/> + <column name="CONNECTED" type="BOOLEAN"/> + <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> + <column name="VERSION" type="VARCHAR2" size="100"/> + <column name="CTIME" type="LONG"/> + <column name="MTIME" type="LONG"/> + <column name="ITIME" type="LONG"/> + <column name="RES_CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG"/> + <column name="PLUGIN_CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG"/> + <column name="MODIFIED_BY" required="false" size="100" type="VARCHAR2"/> + <column name="LOCATION" required="false" size="100" type="VARCHAR2"/> + <column name="PARENT_RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE"/> + <column name="PRODUCT_VERSION_ID" type="INTEGER" references="RHQ_PRD_VER"/> + + <index name="RHQ_RESOURCE_idx_key"> + <field ref="RESOURCE_KEY"/> + </index> + + <index name="RHQ_RESOURCE_idx_type"> + <field ref="RESOURCE_TYPE_ID"/> + </index> + + <index name="RHQ_RESOURCE_idx_agent"> + <field ref="AGENT_ID"/> + </index> + + <index name="RHQ_RESOURCE_idx_parent"> + <field ref="PARENT_RESOURCE_ID"/> + </index> + + </table> + + <table name="RHQ_RESOURCE_ERROR"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> + <column name="TIME_OCCURRED" type="LONG" required="true"/> + <column name="ERROR_TYPE" type="VARCHAR2" required="true" size="32"/> + <column name="SUMMARY" type="VARCHAR2" required="true" size="1000"/> + <column name="DETAIL" type="LONGVARCHAR" required="false"/> + + <index name="RHQ_RES_ERROR_IDX_RES_ID"> + <field ref="RESOURCE_ID"/> + </index> + </table> + + <table name="RHQ_GROUP_DEF"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" required="true" size="100" type="VARCHAR2"/> + <column name="DESCRIPTION" size="100" type="VARCHAR2"/> + <column name="CTIME" type="LONG"/> + <column name="MTIME" type="LONG"/> + <column name="CALC_TIME" type="LONG"/> + <column name="CALC_INTERVAL" type="LONG"/> + <column name="RECURSIVE" type="BOOLEAN"/> + <column name="EXPRESSION" type="VARCHAR2" size="1000"/> + + <index name="RHQ_GROUP_DEF_NAME" unique="true"> + <field ref="NAME"/> + </index> + </table> + + <table name="RHQ_RESOURCE_GROUP"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <!-- this name can be longer than the size of the GROUP_BY column, which is used to uniquely identify it --> + <!-- Max bytes for Oracle Varchar2 to accommodate large cluster keys --> + <column name="NAME" required="true" size="4000" type="VARCHAR2"/> + <column name="DESCRIPTION" size="100" type="VARCHAR2"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE"/> + <!-- Compatible groups only --> + <column name="CTIME" type="LONG"/> + <column name="MTIME" type="LONG"/> + <column name="MODIFIED_BY" required="false" size="100" type="VARCHAR2"/> + <column name="RECURSIVE" type="BOOLEAN"/> + + <column name="GROUP_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_GROUP_DEF"/> + <column name="GROUP_BY" size="500" type="VARCHAR2"/> + + <column name="CATEGORY" type="VARCHAR2" size="20" required="true"/> + + <!-- This is only set if this is a subject-owned group (like an autogroup) --> + <column name="SUBJECT_ID" type="INTEGER" references="RHQ_SUBJECT"/> + + <!-- These two only set if this is a backing group for a resource auto-cluster --> + <column name="CLUSTER_KEY" type="VARCHAR2" size="4000" required="false"/> + <column name="CLUSTER_RESOURCE_GROUP_ID" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> + + <!-- This is only set if this is a backing group for a resource auto-group --> + <column name="AUTO_GROUP_PARENT_RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE"/> + + <column name="VISIBLE" type="BOOLEAN"/> + + <index name="RHQ_RES_GROUP_NAME" unique="false"> + <field ref="NAME"/> + </index> + </table> + + <!-- Many To Many mapping for groups to implicit resources --> + <table name="RHQ_RESOURCE_GROUP_RES_IMP_MAP"> + <column name="RESOURCE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE"/> + <column name="RESOURCE_GROUP_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> + + <!-- not using full words to fit index name length --> + <constraint name="RHQ_RES_GROUP_RES_IMP_MAP_KEY"> + <primaryKey> + <field ref="RESOURCE_ID"/> + <field ref="RESOURCE_GROUP_ID"/> + </primaryKey> + </constraint> + </table> + + <!-- Many To Many mapping for groups to explicit resources --> + <table name="RHQ_RESOURCE_GROUP_RES_EXP_MAP"> + <column name="RESOURCE_ID" required="true" type="INTEGER" references="RHQ_RESOURCE"/> + <column name="RESOURCE_GROUP_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> + + <!-- not using full words to fit index name length --> + <constraint name="RHQ_RES_GROUP_RES_EXP_MAP_KEY"> + <primaryKey> + <field ref="RESOURCE_ID"/> + <field ref="RESOURCE_GROUP_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_CONFIG_GROUP_UPDATE"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="GROUP_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_GROUP"/> + <column name="CONFIGURATION_ID" type="INTEGER" required="true" references="RHQ_CONFIG"/> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="SUBJECT_NAME" type="VARCHAR2" required="false" size="100"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> + </table> + + <table name="RHQ_CONFIG_UPDATE"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="CONFIGURATION_ID" type="INTEGER" required="true" references="RHQ_CONFIG" ondelete="cascade"/> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="SUBJECT_NAME" type="VARCHAR2" required="false" size="100"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="CONFIG_RES_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> + <column name="PLUGIN_CONFIG_RES_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> + <column name="AGG_RES_UPDATE_ID" type="INTEGER" required="false" references="RHQ_CONFIG_GROUP_UPDATE"/> + <column name="AGG_PLUGIN_UPDATE_ID" type="INTEGER" required="false" references="RHQ_CONFIG_GROUP_UPDATE"/> + <column name="DTYPE" type="VARCHAR2" required="true" size="10"/> + </table> + + + <table name="RHQ_TAGGING"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="NAMESPACE" type="VARCHAR2" required="false" size="20"/> + <column name="SEMANTIC" type="VARCHAR2" required="false" size="50"/> + <column name="NAME" type="VARCHAR2" required="true" size="100"/> + </table> + + <table name="RHQ_TAGGING_RESOURCE_MAP"> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> + <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> + <constraint name="RHQ_TAGGING_RESOURCE_MAP_KEY"> + <primaryKey> + <field ref="RESOURCE_ID"/> + <field ref="TAG_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_TAGGING_RES_GROUP_MAP"> + <column name="RESOURCE_GROUP_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_GROUP"/> + <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> + <constraint name="RHQ_TAGGING_RES_GROUP_MAP_KEY"> + <primaryKey> + <field ref="RESOURCE_GROUP_ID"/> + <field ref="TAG_ID"/> + </primaryKey> + </constraint> + </table> + +<!-- END: inventory-schema.xml --> +<!-- BEGIN: authz-schema.xml --> + + + <table name="RHQ_ROLE"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" required="true" size="100" type="VARCHAR2"/> + <column name="DESCRIPTION" size="100" type="VARCHAR2"/> + <column name="FSYSTEM" type="BOOLEAN" default="false"/> + + <index name="RHQ_ROLE_NAME_KEY" unique="true"> + <field ref="NAME"/> + </index> + </table> + + <table name="RHQ_ROLE_RESOURCE_GROUP_MAP"> + <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> + <column name="RESOURCE_GROUP_ID" required="true" type="INTEGER" references="RHQ_RESOURCE_GROUP"/> + + <constraint name="RHQ_ROLE_RES_GROUP_MAP_KEY"> + <primaryKey> + <field ref="ROLE_ID"/> + <field ref="RESOURCE_GROUP_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_ROLE_LDAP_GROUP"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> + <column name="LDAP_GROUP_NAME" size="128" required="true" type="VARCHAR2"/> + + <index name="RHQ_ROLE_LDAP_GROUP_IDX" unique="true"> + <field ref="ROLE_ID"/> + <field ref="LDAP_GROUP_NAME"/> + </index> + </table> + + <table name="RHQ_PERMISSION"> + <column name="ROLE_ID" type="INTEGER" references="RHQ_ROLE" required="true"/> + <column name="OPERATION" type="INTEGER" required="true"/> + <constraint name="RHQ_PERMISSION_PK"> + <primaryKey> + <field ref="ROLE_ID"/> + <field ref="OPERATION"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_SUBJECT_ROLE_MAP"> + <column name="SUBJECT_ID" required="true" type="INTEGER" references="RHQ_SUBJECT"/> + <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> + + <constraint name="RHQ_SUBJECT_ROLE_MAPPING_KEY"> + <primaryKey> + <field ref="SUBJECT_ID"/> + <field ref="ROLE_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_SUBJECT_ROLE_LDAP_MAP"> + <column name="SUBJECT_ID" required="true" type="INTEGER" references="RHQ_SUBJECT"/> + <column name="ROLE_ID" required="true" type="INTEGER" references="RHQ_ROLE"/> + <constraint name="RHQ_SUBJECT_ROLE_LDAP_MAP_PK"> + <primaryKey> + <field ref="SUBJECT_ID" /> + <field ref="ROLE_ID"/> + </primaryKey> + </constraint> + </table> +<!-- END: authz-schema.xml --> +<!-- BEGIN: search-schema.xml --> + + + <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="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="GLOBAL" type="BOOLEAN" required="true"/> + </table> + +<!-- END: search-schema.xml --> +<!-- BEGIN: dashboard-schema.xml --> + + + + <table name="RHQ_DASHBOARD"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" type="VARCHAR2" size="200" required="true"/> + <column name="SUBJECT_ID" type="INTEGER" required="true" references="RHQ_SUBJECT"/> + <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> + <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_RESOURCE_GROUP"/> + <column name="CATEGORY" type="VARCHAR2" size="20" required="true"/> + <column name="SHARED" type="BOOLEAN" required="true"/> + <column name="CONFIGURATION_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> + </table> + + + <table name="RHQ_DASHBOARD_PORTLET"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" type="VARCHAR2" size="200" required="true"/> + <column name="PORTLET_KEY" type="VARCHAR2" size="200" required="true"/> + <column name="COL" type="INTEGER" required="true"/> + <column name="COL_INDEX" type="INTEGER" required="true"/> + <column name="HEIGHT" type="INTEGER" required="true"/> + <column name="CONFIGURATION_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> + <column name="DASHBOARD_ID" type="INTEGER" required="false" references="RHQ_DASHBOARD"/> + </table> + +<!-- END: dashboard-schema.xml --> +<!-- BEGIN: operation-schema.xml --> + + + <table name="RHQ_OPERATION_DEF"> + + <!-- === required columns === --> + + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE(ID)"/> + <column name="NAME" type="VARCHAR2" required="true" size="100"/> + + <!-- === optional columns === --> + + <!-- an OSGI version range - if null, the operation def applies to all versions of the associated resource type --> + <column name="RESOURCE_VERSION_RANGE" type="VARCHAR2" size="100"/> + + <!-- A parameter config definition is only required for operations that have parameters. --> + <!-- A results config definition is only required for operations that return data. --> + <column name="PARAMETER_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> + <column name="RESULTS_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF(ID)"/> + <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> + <column name="DESCRIPTION" type="VARCHAR2" size="4000"/> + <column name="TIMEOUT" type="INTEGER"/> + + <!-- === business key (RESOURCE_TYPE_ID + NAME) === --> + <index name="RHQ_OPERATION_DEF_KEY_IDX" unique="true"> + <field ref="RESOURCE_TYPE_ID"/> + <field ref="NAME"/> + </index> + + </table> + + <table name="RHQ_OPERATION_HISTORY"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="DTYPE" type="VARCHAR2" required="true" size="8"/> + <column name="JOB_NAME" type="VARCHAR2" required="true" size="100"/> + <column name="JOB_GROUP" type="VARCHAR2" required="true" size="100"/> + <column name="OPERATION_DEF_ID" type="INTEGER" required="true" references="RHQ_OPERATION_DEF"/> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="STIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="PARAMETERS_CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> + + <!-- for resource history --> + <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> + <column name="RESULTS_CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> + <column name="GROUP_HISTORY_ID" type="INTEGER" required="false" references="RHQ_OPERATION_HISTORY"/> + + <!-- for group history --> + <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_RESOURCE_GROUP"/> + + <index name="RHQ_OPERATION_HISTORY_JOB_IDX" unique="true"> + <field ref="JOB_NAME"/> + <field ref="JOB_GROUP"/> + <field ref="CTIME"/> + </index> + + </table> + + <!-- + This table is really just to support some specific use-cases. + Specifically, to be able to get a list of histories for a specific schedule (aka quartz job) + and to be able to query a list of all schedules along with their associated resource/group IDs + possibly sorted by their next fire time. + Note that a NULL next fire time means it won't fire again and the row is probaby about to be deleted; + we can probably not even insert rows with NULL and make it a non-nullable field. But rather than + code special conditions into the session bean, we'll allow a short-lived NULL next fire time row. + --> + <table name="RHQ_OPERATION_SCHEDULE"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + + <column name="JOB_NAME" type="VARCHAR2" required="true" size="100"/> + <column name="JOB_GROUP" type="VARCHAR2" required="true" size="100"/> + <column name="DTYPE" type="VARCHAR2" required="true" size="8"/> + <column name="NEXT_FIRE_TIME" type="LONG" required="false"/> + + <!-- for resource history --> + <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> + + <!-- for group history --> + <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_RESOURCE_GROUP"/> + + <!-- + Note, this is the same as the primary key that Quartz uses for its schedules (RHQ_QRTZ_JOB_DETAILS). + We do not need to add DTYPE to the key, because we ensure the name/group are unique across resource/group + schedules + --> + <!-- === business key (JOB_NAME + JOB_GROUP) === --> + <index name="RHQ_OPERATION_SCHEDULE_KEY_IDX" unique="true"> + <field ref="JOB_NAME"/> + <field ref="JOB_GROUP"/> + </index> + </table> + +<!-- END: operation-schema.xml --> +<!-- BEGIN: event-schema.xml --> + + + <!-- metadata --> + + <table name="RHQ_EVENT_DEF"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE(ID)"/> + + <column name="NAME" type="VARCHAR2" size="100" required="true"/> + <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> + <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> + + <index name="RHQ_EVENT_DEF_IDX" unique="true"> + <field ref="RESOURCE_TYPE_ID"/> + <field ref="NAME"/> + </index> + </table> + + <!-- instance data --> + + <table name="RHQ_EVENT_SOURCE"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="EVENT_DEF_ID" type="INTEGER" required="true" references="RHQ_EVENT_DEF(ID)"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE(ID)"/> + + <column name="LOCATION" required="true" size="2000" type="VARCHAR2"/> + + <index name="RHQ_EVENT_SOURCE_IDX" unique="true"> + <field ref="EVENT_DEF_ID"/> + <field ref="RESOURCE_ID"/> + <field ref="LOCATION"/> + </index> + </table> + + <table name="RHQ_EVENT"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="EVENT_SOURCE_ID" type="INTEGER" required="true" references="RHQ_EVENT_SOURCE(ID)"/> + + <column name="TIMESTAMP" required="true" type="LONG"/> + <column name="SEVERITY" required="true" size="20" type="VARCHAR2"/> + <column name="DETAIL" required="true" size="4000" type="VARCHAR2"/> + <index name="RHQ_EVENT_IDX" unique="false"> + <field ref="EVENT_SOURCE_ID"/> + <field ref="TIMESTAMP"/> + </index> + </table> + +<!-- END: event-schema.xml --> +<!-- BEGIN: alert-schema.xml --> + + + <table name="RHQ_ALERT_DEFINITION"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" required="true" size="100" type="VARCHAR2"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="PARENT_ID" type="INTEGER" required="false"/> + <column name="GROUP_ALERT_DEF_ID" type="INTEGER" required="false"/> + <column name="DESCRIPTION" required="false" size="250" type="VARCHAR2"/> + <column name="PRIORITY" type="VARCHAR2" size="15" required="true"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE" required="false"/> + <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE" required="false"/> + <column name="RESOURCE_GROUP_ID" type="INTEGER" references="RHQ_RESOURCE_GROUP" required="false"/> + <column name="ENABLED" required="true" default="TRUE" type="BOOLEAN"/> + + <column name="REQUIRED" required="true" type="SMALLINT"/> + + <column name="RECOVERY_ID" type="INTEGER" required="true"/> + <!-- required, but 0 effectively means null --> + <column name="WILL_RECOVER" required="true" default="false" type="BOOLEAN"/> + <column name="NOTIFY_FILTERED" required="true" default="false" type="BOOLEAN"/> + <column name="CONTROL_FILTERED" required="true" default="FALSE" type="BOOLEAN"/> + + <column name="DELETED" required="true" default="FALSE" type="BOOLEAN"/> + <column name="READ_ONLY" required="true" default="FALSE" type="BOOLEAN"/> + + <column name="DAMPENING_CATEGORY" type="SMALLINT" required="true"/> + <column name="DAMPENING_VALUE" type="INTEGER"/> + <column name="DAMPENING_VALUE_UNITS" type="SMALLINT"/> + <column name="DAMPENING_PERIOD" type="INTEGER"/> + <column name="DAMPENING_PERIOD_UNITS" type="SMALLINT"/> + </table> + + <table name="RHQ_ALERT_DAMPEN_EVENT"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> + <column name="EVENT_TYPE" required="true" type="SMALLINT"/> + <column name="EVENT_TIMESTAMP" required="true" type="LONG"/> + + <index name="RHQ_DAMPENING_EVENT_TYPE_IDX"> + <field ref="EVENT_TYPE"/> + </index> + <index name="RHQ_DAMPENING_EVENT_TS_IDX"> + <field ref="EVENT_TIMESTAMP"/> + </index> + </table> + + <table name="RHQ_ALERT_CONDITION"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="TYPE" required="true" type="VARCHAR2" size="15"/> + <!-- + <column name="REQUIRED" required="true" type="BOOLEAN"/> + --> + <column name="MEASUREMENT_DEFINITION_ID" required="false" type="INTEGER"/> + <column name="NAME" required="false" size="100" type="VARCHAR2"/> + <column name="COMPARATOR" required="false" size="2" type="VARCHAR2"/> + <column name="THRESHOLD" required="false" type="DOUBLE"/> + <!-- event-based conditions use OPTION_STATUS for the string match, so should be a decent length --> + <column name="OPTION_STATUS" required="false" size="256" type="VARCHAR2"/> + <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> + <column name="TRIGGER_ID" required="false" type="INTEGER"/> + </table> + + <table name="RHQ_ALERT" tablespace="DEFAULT" + storage-options="freelists 5" cache="true"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> + <column name="CTIME" required="true" type="LONG"/> + <column name="RECOVERY_ID" type="INTEGER" required="true"/> + <!-- required, but 0 effectively means null --> + <column name="WILL_RECOVER" required="true" default="false" type="BOOLEAN"/> + <column name="ACK_TIME" required="false" type="LONG"/> + <column name="ACK_SUBJECT" required="false" size="100" type="VARCHAR2"/> + <index name="RHQ_ALERT_IDX_TIME" unique="false"> + <field ref="CTIME"/> + </index> + <index name="RHQ_ALERT_IDX_ALERTDEF" unique="false"> + <field ref="ALERT_DEFINITION_ID"/> + </index> + </table> + + <table name="RHQ_ALERT_NOTIF_LOG" tablespace="DEFAULT" + storage-options="freelists 5" cache="true"> + <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="false"> + <field ref="ALERT_ID"/> + </index> + <column name="SENDER" required="false" size="100" type="VARCHAR2"/> + <column name="RESULT_STATE" required="false" size="20" type="VARCHAR2"/> + <column name="MESSAGE" required="false" size="4000" type="VARCHAR2"/> + </table> + + <table name="RHQ_ALERT_CONDITION_LOG" tablespace="DEFAULT" + storage-options="freelists 5" cache="true"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="CTIME" required="true" type="LONG"/> + <column name="ALERT_ID" required="false" type="INTEGER" references="RHQ_ALERT(ID)"/> + <column name="CONDITION_ID" required="true" type="INTEGER" references="RHQ_ALERT_CONDITION(ID)"/> + <column name="VALUE" required="true" size="250" type="VARCHAR2"/> + <index name="RHQ_ALERT_COND_LOG_IDX_TIME"> + <field ref="CTIME" /> + </index> + <index name="RHQ_ALERT_COND_LOG_IDX_ALERT"> + <field ref="ALERT_ID"/> + </index> + <index name="RHQ_ALERT_COND_LOG_COND_IDX"> + <field ref="CONDITION_ID"/> + </index> + </table> + + <table name="RHQ_ALERT_NOTIFICATION"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/> + <column name="SENDER_CONFIG_ID" required="false" type="INTEGER" references="RHQ_CONFIG(ID)"/> + <column name="EXTRA_CONFIG_ID" required="false" type="INTEGER" references="RHQ_CONFIG(ID)"/> + <column name="SENDER_NAME" required="true" size="100" type="VARCHAR2" /> + </table> + +<!-- END: alert-schema.xml --> +<!-- BEGIN: sysconfig-schema.xml --> + + + <table name="RHQ_SYSTEM_CONFIG"> + <column name="ID" default="sequence-only" initial="10001" + primarykey="true" required="true" type="INTEGER"/> + <column name="PROPERTY_KEY" type="VARCHAR2" size="80"/> + <column name="PROPERTY_VALUE" type="VARCHAR2" size="300"/> + <column name="DEFAULT_PROPERTY_VALUE" type="VARCHAR2" size="300"/> + <column name="FREAD_ONLY" type="BOOLEAN" default="FALSE"/> + + <index name="RHQ_SYSTEM_CONFIG_KEY_INDX" unique="true"> + <field ref="PROPERTY_KEY"/> + </index> + </table> + +<!-- END: sysconfig-schema.xml --> +<!-- BEGIN: scheduler-schema.xml --> + + + <table name="RHQ_QRTZ_JOB_DETAILS"> + <column name="JOB_NAME" required="true" type="VARCHAR2" size="80"/> + <column name="JOB_GROUP" required="true" type="VARCHAR2" size="80"/> + <column name="DESCRIPTION" required="false" type="VARCHAR2" size="120"/> + <column name="JOB_CLASS_NAME" required="true" type="VARCHAR2" size="128"/> + <column name="IS_DURABLE" required="true" type="BOOLEAN" default="FALSE"/> + <column name="IS_VOLATILE" required="true" type="BOOLEAN"/> + <column name="IS_STATEFUL" required="true" type="BOOLEAN" default="FALSE"/> + <column name="REQUESTS_RECOVERY" required="true" type="BOOLEAN" default="FALSE"/> + <column name="JOB_DATA" required="false" type="BLOB"/> + + <constraint name="RHQ_PK_QRTZ_JOB_DETAILS"> + <primaryKey> + <field ref="JOB_NAME"/> + <field ref="JOB_GROUP"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_QRTZ_JOB_LISTENERS"> + <column name="JOB_NAME" required="true" type="VARCHAR2" size="80"/> + <column name="JOB_GROUP" required="true" type="VARCHAR2" size="80"/> + <column name="JOB_LISTENER" required="true" type="VARCHAR2" size="80"/> + + <constraint name="RHQ_PK_QRTZ_JOB_LISTENERS"> + <primaryKey> + <field ref="JOB_NAME"/> + <field ref="JOB_GROUP"/> + <field ref="JOB_LISTENER"/> + </primaryKey> + </constraint> + <constraint name="RHQ_FK_QRTZ_JOB_LSTNRS_JN_JG"> + <foreignKey local="JOB_NAME,JOB_GROUP" + references="RHQ_QRTZ_JOB_DETAILS(JOB_NAME,JOB_GROUP)" + ondelete="cascade"/> + </constraint> + </table> + + <table name="RHQ_QRTZ_TRIGGERS"> + <column name="TRIGGER_NAME" type="VARCHAR2" required="true" size="80"/> + <column name="TRIGGER_GROUP" type="VARCHAR2" required="true" size="80"/> + <column name="JOB_NAME" type="VARCHAR2" required="true" size="80"/> + <column name="JOB_GROUP" type="VARCHAR2" required="true" size="80"/> + <column name="IS_VOLATILE" type="BOOLEAN" required="true"/> + <column name="DESCRIPTION" type="VARCHAR2" required="false" size="120"/> + <column name="NEXT_FIRE_TIME" type="LONG" required="false"/> + <column name="PREV_FIRE_TIME" type="LONG" required="false"/> + <column name="PRIORITY" type="INTEGER" required="false"/> + <column name="TRIGGER_STATE" type="VARCHAR" required="true" size="16"/> + <column name="TRIGGER_TYPE" type="VARCHAR" required="true" size="8"/> + <column name="START_TIME" type="LONG" required="true"/> + <column name="END_TIME" type="LONG" required="false"/> + <column name="CALENDAR_NAME" type="VARCHAR2" required="false" size="80"/> + <column name="MISFIRE_INSTR" type="INTEGER" required="false"/> + <column name="JOB_DATA" type="BLOB" required="false"/> + + <constraint name="RHQ_PK_QRTZ_TRIGGERS"> + <primaryKey> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </primaryKey> + </constraint> + <constraint name="RHQ_FK_QRTZ_TRIGGERS_JN_JG"> + <foreignKey local="JOB_NAME,JOB_GROUP" + references="RHQ_QRTZ_JOB_DETAILS(JOB_NAME,JOB_GROUP)" + ondelete="cascade"/> + </constraint> + + <!-- Quartz docs recommend these indexes. --> + <index name="RHQ_QRTZ_TRIGGERS_JN_JG_IDX"> + <field ref="JOB_NAME"/> + <field ref="JOB_GROUP"/> + </index> + <index name="RHQ_QRTZ_TRIGGERS_NFT_IDX"> + <field ref="NEXT_FIRE_TIME"/> + </index> + <index name="RHQ_QRTZ_TRIGGERS_TS_IDX"> + <field ref="TRIGGER_STATE"/> + </index> + <index name="RHQ_QRTZ_TRIGGERS_TS_NFT_IDX"> + <field ref="TRIGGER_STATE"/> + <field ref="NEXT_FIRE_TIME"/> + </index> + + </table> + + <table name="RHQ_QRTZ_SIMPLE_TRIGGERS"> + <column name="TRIGGER_NAME" type="VARCHAR2" required="true" size="80"/> + <column name="TRIGGER_GROUP" type="VARCHAR2" required="true" size="80"/> + <column name="REPEAT_COUNT" type="LONG" required="true"/> + <column name="REPEAT_INTERVAL" type="LONG" required="true"/> + <column name="TIMES_TRIGGERED" type="LONG" required="true"/> + + <constraint name="RHQ_PK_QRTZ_SIMPLE_TRIGGERS"> + <primaryKey> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </primaryKey> + </constraint> + <constraint name="RHQ_FK_QRTZ_SIMPLE_TRGRS_TN_TG"> + <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" + references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" + ondelete="cascade"/> + </constraint> + + <!-- Quartz docs recommend this index. --> + <!-- Commenting out, because Oracle auto-creates an index for the + primary key column(s) and fails if you try to create another + index for the same column(s) (ips, 03/29/07). + --> + <!-- + <index name="RHQ_QRTZ_SIMPLE_TRGRS_TN_TG_IDX"> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </index> + --> + </table> + + <table name="RHQ_QRTZ_CRON_TRIGGERS"> + <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> + <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> + <column name="CRON_EXPRESSION" type="VARCHAR2" size="80" required="true"/> + <column name="TIME_ZONE_ID" type="VARCHAR2" size="80" required="false"/> + + <constraint name="RHQ_PK_QRTZ_CRON_TRIGGERS"> + <primaryKey> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </primaryKey> + </constraint> + <constraint name="RHQ_FK_QRTZ_CRON_TRIG_TN_TG"> + <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" + references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" + ondelete="cascade"/> + </constraint> + + <!-- Quartz docs recommend this index. --> + <!-- Commenting out, because Oracle auto-creates an index for the + primary key column(s) and fails if you try to create another + index for the same column(s) (ips, 03/29/07). + --> + <!-- + <index name="RHQ_QRTZ_CRON_TRGRS_TN_TG_IDX"> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </index> + --> + </table> + + <table name="RHQ_QRTZ_BLOB_TRIGGERS"> + <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> + <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> + <column name="BLOB_DATA" type="BLOB" required="false"/> + + <constraint name="RHQ_PK_QRTZ_BLOB_TRIGGERS"> + <primaryKey> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </primaryKey> + </constraint> + <constraint name="RHQ_FK_QRTZ_BLOB_TRIGG_TN_TG"> + <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" + references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" + ondelete="cascade"/> + </constraint> + + <!-- Quartz docs recommend this index. --> + <!-- Commenting out, because Oracle auto-creates an index for the + primary key column(s) and fails if you try to create another + index for the same column(s) (ips, 03/29/07). + --> + <!-- + <index name="RHQ_QRTZ_BLOB_TRGRS_TN_TG_IDX"> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </index> + --> + </table> + + <table name="RHQ_QRTZ_TRIGGER_LISTENERS"> + <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> + <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> + <column name="TRIGGER_LISTENER" type="VARCHAR2" size="80" required="true"/> + + <constraint name="RHQ_PK_QRTZ_TRIGGER_LISTENERS"> + <primaryKey> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + <field ref="TRIGGER_LISTENER"/> + </primaryKey> + </constraint> + <constraint name="RHQ_FK_QRTZ_TRGR_LSTNRS_TN_TG"> + <foreignKey local="TRIGGER_NAME,TRIGGER_GROUP" + references="RHQ_QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)" + ondelete="cascade"/> + </constraint> + + <!-- Quartz docs recommend this index. --> + <index name="RHQ_QRTZ_TRGR_LSTNRS_TN_TG_IDX"> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </index> + + </table> + + <table name="RHQ_QRTZ_FIRED_TRIGGERS"> + <column name="ENTRY_ID" primarykey="true" type="VARCHAR2" size="95" required="true"/> + <column name="TRIGGER_NAME" type="VARCHAR2" size="80" required="true"/> + <column name="TRIGGER_GROUP" type="VARCHAR2" size="80" required="true"/> + <column name="INSTANCE_NAME" type="VARCHAR2" size="80" required="true"/> + <column name="FIRED_TIME" type="LONG" required="true"/> + <column name="PRIORITY" type="INTEGER" required="false"/> + <column name="STATE" type="VARCHAR2" size="16" required="true"/> + <column name="IS_VOLATILE" type="BOOLEAN" required="true"/> + <column name="JOB_NAME" type="VARCHAR2" size="80" required="false"/> + <column name="JOB_GROUP" type="VARCHAR2" size="80" required="false"/> + <column name="IS_STATEFUL" type="BOOLEAN" required="false"/> + <column name="REQUESTS_RECOVERY" type="BOOLEAN" required="false"/> + + <!-- Quartz docs recommend these indexes. --> + <index name="RHQ_QRTZ_FIRED_TRGRS_TN_IDX"> + <field ref="TRIGGER_NAME"/> + </index> + <index name="RHQ_QRTZ_FIRED_TRGRS_TG_IDX"> + <field ref="TRIGGER_GROUP"/> + </index> + <index name="RHQ_QRTZ_FIRED_TRGRS_TN_TG_IDX"> + <field ref="TRIGGER_NAME"/> + <field ref="TRIGGER_GROUP"/> + </index> + <index name="RHQ_QRTZ_FIRED_TRGRS_IN_IDX"> + <field ref="INSTANCE_NAME"/> + </index> + <index name="RHQ_QRTZ_FIRED_TRGRS_JN_IDX"> + <field ref="JOB_NAME"/> + </index> + <index name="RHQ_QRTZ_FIRED_TRGRS_JG_IDX"> + <field ref="JOB_GROUP"/> + </index> + + </table> + + <table name="RHQ_QRTZ_CALENDARS"> + <column name="CALENDAR_NAME" primarykey="true" type="VARCHAR2" size="80" required="true"/> + <column name="CALENDAR" type="BLOB" required="true"/> + </table> + + <table name="RHQ_QRTZ_PAUSED_TRIGGER_GRPS"> + <column name="TRIGGER_GROUP" primarykey="true" type="VARCHAR2" size="80" required="true"/> + </table> + + <table name="RHQ_QRTZ_SCHEDULER_STATE"> + <column name="INSTANCE_NAME" primarykey="true" type="VARCHAR2" size="80" required="true"/> + <column name="LAST_CHECKIN_TIME" type="LONG" required="true"/> + <column name="CHECKIN_INTERVAL" type="LONG" required="true"/> + <column name="RECOVERER" type="VARCHAR2" size="80" required="false"/> + </table> + + <table name="RHQ_QRTZ_LOCKS"> + <column name="LOCK_NAME" primarykey="true" type="VARCHAR2" size="40" required="true"/> + <data LOCK_NAME="TRIGGER_ACCESS"/> + <data LOCK_NAME="JOB_ACCESS"/> + <data LOCK_NAME="CALENDAR_ACCESS"/> + <data LOCK_NAME="STATE_ACCESS"/> + <data LOCK_NAME="MISFIRE_ACCESS"/> + </table> + +<!-- END: scheduler-schema.xml --> +<!-- BEGIN: amps-schema.xml --> + + + <table name="RHQ_PLUGIN"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="4000" type="VARCHAR2" required="false"/> + <column name="VERSION" size="200" type="VARCHAR2" required="false"/> + <column name="AMPS_VERSION" size="16" type="VARCHAR2" required="false"/> + <column name="ENABLED" type="BOOLEAN" required="true"/> + <column name="STATUS" size="16" type="VARCHAR2" required="true"/> + <column name="HELP" type="CLOB" required="false"/> + <column name="PATH" size="500" type="VARCHAR2" required="true"/> + <column name="MD5" size="100" type="VARCHAR2" required="true"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="DEPLOYMENT" size="8" type="VARCHAR2" required="true"/> + <column name="PTYPE" size="200" type="VARCHAR2" required="false"/> + <column name="PLUGIN_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> + <column name="JOBS_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> + <column name="CONTENT" type="BLOB" required="false"/> + + <index name="RHQ_PLUGIN_NAME_DEPLOY_IDX" unique="true"> + <field ref="NAME"/> + <field ref="DEPLOYMENT"/> + </index> + </table> + +<!-- END: amps-schema.xml --> +<!-- BEGIN: measurement-schema.xml --> + + <table name="RHQ_MEASUREMENT_DEF"> + + <!-- === required columns === --> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE(ID)"/> + <column name="NAME" type="VARCHAR2" size="100" required="true"/> + + <!-- === optional columns === --> + <!-- an OSGI version range - if null, the metric def applies to all versions of the associated resource type --> + <column name="RESOURCE_VERSION_RANGE" type="VARCHAR2" size="100"/> + <column name="CATEGORY" type="SMALLINT"/> + <column name="UNITS" type="SMALLINT"/> + <column name="NUMERIC_TYPE" type="SMALLINT"/> + <column name="DISPLAY_TYPE" type="SMALLINT"/> + <column name="DATA_TYPE" type="SMALLINT"/> + <column name="RAW_NUMERIC_TYPE" type="SMALLINT"/> + <column name="DEFAULT_ON" type="BOOLEAN" default="false"/> + <column name="DEFAULT_INTERVAL" type="LONG" /> + <column name="DISPLAY_NAME" type="VARCHAR2" size="100"/> + <column name="DISPLAY_ORDER" type="INTEGER" default="1000"/> + <column name="DESCRIPTION" type="VARCHAR2" size="500"/> + <column name="DESTINATION_TYPE" type="VARCHAR2" size="100"/> + + <column name="VERSION" type="INTEGER"/> + <!-- for optimistic locking --> + + <!-- === business key (RESOURCE_TYPE_ID + NAME + RAW_NUMERIC_TYPE) === --> + <index name="RHQ_METRIC_DEF_KEY_IDX" unique="true"> + <field ref="RESOURCE_TYPE_ID"/> + <field ref="NAME"/> + <field ref="RAW_NUMERIC_TYPE"/> + </index> + <index name="RHQ_METRIC_DEF_NT_IDX"> + <field ref="NUMERIC_TYPE"/> + </index> + </table> + + + <table name="RHQ_MEASUREMENT_SCHED"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + + <column name="ENABLED" type="BOOLEAN" default="false"/> + <column name="MTIME" type="LONG" /> + <column name="DEFINITION" type="INTEGER" references="RHQ_MEASUREMENT_DEF(ID)"/> + <column name="VERSION" type="INTEGER" /> + <column name="COLL_INTERVAL" type="LONG" /> + <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE(ID)"/> + <index name="RHQ_MEAS_SCHED_UNIQ" unique="true"> + <field ref="RESOURCE_ID"/> + <field ref="DEFINITION"/> + </index> + <index name="RHQ_MEAS_SCHED_RESID_IDX"> + <field ref="RESOURCE_ID"/> + </index> + </table> + + + <table name="RHQ_MEASUREMENT_BLINE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + + <column name="BL_USER_ENTERED" type="BOOLEAN" default="false" required="true"/> + <column name="BL_MIN" type="DOUBLE" required="true"/> + <column name="BL_MAX" type="DOUBLE" required="true"/> + <column name="BL_MEAN" type="DOUBLE" required="true"/> + <column name="BL_COMPUTE_TIME" type="LONG" required="true"/> + <column name="SCHEDULE_ID" type="INTEGER" required="true" references="RHQ_MEASUREMENT_SCHED(ID)"/> + <index name="RHQ_MEAS_BASELINE_CTIME_IDX"> + <field ref="BL_COMPUTE_TIME"/> + </index> + <index name="RHQ_MEAS_BASELINE_SID_IDX"> + <field ref="SCHEDULE_ID"/> + </index> + </table> + + + <table name="RHQ_MEASUREMENT_DATA_NUM_1H" cache="true" + tablespace="DEFAULT" storage-options="freelists 20"> + + <column name="TIME_STAMP" required="true" type="LONG"/> + <column name="SCHEDULE_ID" required="true" type="INTEGER"/> + <column name="VALUE" required="false" type="DOUBLE"/> + <column name="MINVALUE" required="false" type="DOUBLE"/> + <column name="MAXVALUE" required="false" type="DOUBLE"/> + + <constraint name="RHQ_MEAS_DATA_1H_ID_TIME_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + + <index name="RHQ_MEAS_DATA_1H_TIME_IDX"> + <field ref="TIME_STAMP"/> + </index> + </table> + + + <table name="RHQ_MEASUREMENT_DATA_NUM_6H" cache="true" + tablespace="DEFAULT" storage-options="freelists 20"> + + <column name="TIME_STAMP" required="true" type="LONG"/> + <column name="SCHEDULE_ID" required="true" type="INTEGER"/> + <column name="VALUE" required="false" type="DOUBLE"/> + <column name="MINVALUE" required="false" type="DOUBLE"/> + <column name="MAXVALUE" required="false" type="DOUBLE"/> + + <constraint name="RHQ_MEAS_DATA_6H_ID_TIME_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + + <index name="RHQ_MEAS_DATA_6H_TIME_IDX"> + <field ref="TIME_STAMP"/> + </index> + </table> + + + <table name="RHQ_MEASUREMENT_DATA_NUM_1D" cache="true" + tablespace="DEFAULT" storage-options="freelists 20"> + + <column name="TIME_STAMP" required="true" type="LONG"/> + <column name="SCHEDULE_ID" required="true" type="INTEGER"/> + <column name="VALUE" required="false" type="DOUBLE"/> + <column name="MINVALUE" required="false" type="DOUBLE"/> + <column name="MAXVALUE" required="false" type="DOUBLE"/> + + <constraint name="RHQ_MEAS_DATA_1D_ID_TIME_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + + <index name="RHQ_MEAS_DATA_1D_TIME_IDX"> + <field ref="TIME_STAMP" /> + </index> + </table> + + + <table name="RHQ_MEASUREMENT_DATA_TRAIT"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER" /> + <column name="VALUE" type="VARCHAR2" size="4000" /> + <constraint name="RHQ_MEAS_DATA_TRAIT_ID_TIME_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + + + <table name="RHQ_CALLTIME_DATA_KEY"> + <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> + <column name="SCHEDULE_ID" type="INTEGER" required="true"/> + <column name="CALL_DESTINATION" type="VARCHAR2" size="4000" required="true"/> + <index name="RHQ_CALLTIME_DATA_KEY_IDX" unique="true"> + <field ref="SCHEDULE_ID"/> + <field ref="CALL_DESTINATION"/> + </index> + </table> + + + <table name="RHQ_CALLTIME_DATA_VALUE" logging="false"> + <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> + <column name="KEY_ID" type="INTEGER" references="RHQ_CALLTIME_DATA_KEY" required="true"/> + <column name="BEGIN_TIME" type="LONG" required="true"/> + <column name="END_TIME" type="LONG" required="true"/> + <column name="MINIMUM" type="DOUBLE" required="true"/> + <column name="MAXIMUM" type="DOUBLE" required="true"/> + <column name="TOTAL" type="DOUBLE" required="true"/> + <column name="COUNT" type="LONG" required="true"/> + <index name="RHQ_CT_DA_VA_END_TIM_IDX"> + <field ref="END_TIME"/> + </index> + </table> + + + <table name="RHQ_AVAILABILITY"> + <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE(ID)"/> + <column name="START_TIME" type="LONG" required="true" /> + <column name="END_TIME" type="LONG" required="false" /> + <column name="AVAILABILITY_TYPE" type="SMALLINT" required="true" /> + <index name="RHQ_AVAIL_RESOURCE_START_IDX"> + <field ref="RESOURCE_ID"/> + <field ref="START_TIME"/> + </index> + <!-- only one null row can exist for any resource --> + <index name="RHQ_AVAIL_RESOURCE_END_IDX" condition="END_TIME IS NULL"> + <field ref="RESOURCE_ID"/> + <field ref="END_TIME" /> + </index> + </table> + + <table name="RHQ_RESOURCE_AVAIL"> + <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE(ID)" ondelete="cascade"/> + <column name="AVAILABILITY_TYPE" type="SMALLINT" required="true" /> + <index name="RHQ_RESOURCE_AVAIL_IDX"> + <field ref="RESOURCE_ID" /> + </index> + </table> + + <table name="RHQ_MEASUREMENT_OOB"> + <column name="SCHEDULE_ID" type="INTEGER" references="RHQ_MEASUREMENT_SCHED(ID)" required="true"/> + <column name="TIME_STAMP" type="LONG" required="true"/> + <column name="OOB_FACTOR" type="INTEGER" required="true" /> + <constraint name="RHQ_MEAS_OOB_ID_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_MEASUREMENT_OOB_TMP"> + <column name="SCHEDULE_ID" type="INTEGER" required="true"/> + <column name="TIME_STAMP" type="LONG" required="true"/> + <column name="OOB_FACTOR" type="INTEGER" required="true" /> + <constraint name="RHQ_MEAS_OOB_TMP_ID_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_NUMBERS"> + <column name="i" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true" /> + </table> + + + <table name="RHQ_MEAS_DATA_NUM_R00" logging="false"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R00_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R00_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R01" logging="false"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R01_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R01_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R02" logging="false"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R02_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R02_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R03" logging="false"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R03_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R03_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R04" logging="false"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R04_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R04_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R05" logging="false"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R05_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R05_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R06" logging="false"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R06_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R06_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R07" logging="false"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R07_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R07_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R08" logging="false"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R08_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R08_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R09" logging="false"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R09_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R09_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R10" logging="false"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R10_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R10_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R11" logging="false"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R11_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R11_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R12" logging="false"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R12_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R12_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R13" logging="false"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R13_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R13_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + <table name="RHQ_MEAS_DATA_NUM_R14" logging="false"> + <column name="TIME_STAMP" type="LONG"/> + <column name="SCHEDULE_ID" type="INTEGER"/> + <column name="VALUE" type="DOUBLE"/> + <index name="RHQ_MEAS_DATA_R14_TS_IDX"> + <field ref="TIME_STAMP"/> + </index> + <constraint name="RHQ_MEAS_DATA_NUM_R14_ID_T_PK"> + <primaryKey> + <field ref="SCHEDULE_ID"/> + <field ref="TIME_STAMP"/> + </primaryKey> + </constraint> + </table> + +<!-- END: measurement-schema.xml --> +<!-- BEGIN: content-schema.xml --> + + + <table name="RHQ_ARCHITECTURE"> + <column name="ID" default="sequence-only" initial="100" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="50" type="VARCHAR2" required="true"/> + <index name="RHQ_ARCHITECTURE_NAME_IDX" unique="true"> + <field ref="NAME"/> + </index> + </table> + + <table name="RHQ_REPO_GROUP_TYPE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + </table> + + + <table name="RHQ_REPO_GROUP"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + + <column name="REPO_GROUP_TYPE_ID" type="INTEGER" references="RHQ_REPO_GROUP_TYPE" required="true"/> + + <index name="RHQ_REPO_GROUP_IDX" unique="true"> + <field ref="NAME"/> + <field ref="REPO_GROUP_TYPE_ID"/> + </index> + </table> + + + <table name="RHQ_CONTENT_SOURCE_TYPE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="false"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="PLUGIN_NAME" size="100" type="VARCHAR2" required="false"/> + <!-- we might want this as part of natural key --> + <column name="DEFAULT_LAZY_LOAD" type="BOOLEAN" required="true"/> + <column name="DEFAULT_DOWNLOAD_MODE" size="16" type="VARCHAR2" required="true"/> + <column name="DEFAULT_SYNC_SCHEDULE" size="64" type="VARCHAR2" required="false"/> + <column name="API_CLASS" size="100" type="VARCHAR2" required="true"/> + + <column name="SOURCE_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF" required="false"/> + + <index name="RHQ_CONTENT_SOURCE_TYPE_IDX" unique="true"> + <field ref="NAME"/> + <!-- <field ref="PLUGIN_NAME"/> --> + </index> + </table> + + <table name="RHQ_CONTENT_SOURCE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="LAZY_LOAD" type="BOOLEAN" required="true"/> + <column name="DOWNLOAD_MODE" size="16" type="VARCHAR2" required="true"/> + <column name="SYNC_SCHEDULE" size="64" type="VARCHAR2" required="false"/> + <column name="LOAD_ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="CREATION_TIME" type="LONG" required="true"/> + <column name="LAST_MODIFIED_TIME" type="LONG" required="true"/> + + <column name="CONTENT_SOURCE_TYPE_ID" type="INTEGER" references="RHQ_CONTENT_SOURCE_TYPE" required="true"/> + <column name="CONFIGURATION_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> + + <index name="RHQ_CONTENT_SOURCE_IDX" unique="true"> + <field ref="NAME"/> + <field ref="CONTENT_SOURCE_TYPE_ID"/> + </index> + </table> + + <table name="RHQ_REPO"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="CREATION_TIME" type="LONG" required="true"/> + <column name="LAST_MODIFIED_TIME" type="LONG" required="true"/> + <column name="IS_CANDIDATE" type="BOOLEAN" required="true"/> + <column name="SYNC_SCHEDULE" size="64" type="VARCHAR2" required="false"/> + <column name="OWNER_ID" type="INTEGER" required="false" references="RHQ_SUBJECT" /> + <column name="IS_PRIVATE" type="BOOLEAN" required="true" /> + + <index name="RHQ_REPO_IDX" unique="true"> + <field ref="NAME"/> + </index> + </table> + + + <table name="RHQ_REPO_RELATION_TYPE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + </table> + + + <table name="RHQ_REPO_RELATION"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="RELATED_REPO_ID" type="INTEGER" references="RHQ_REPO" required="true"/> + <column name="REPO_RELATION_TYPE_ID" type="INTEGER" references="RHQ_REPO_RELATION_TYPE" required="true"/> + </table> + + + + <table name="RHQ_PACKAGE_TYPE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="false"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="CATEGORY" size="50" type="VARCHAR2" required="false"/> + <column name="DISCOVERY_INTERVAL" type="INTEGER" required="false"/> + <column name="IS_CREATION_DATA" type="BOOLEAN" required="true"/> + <column name="SUPPORTS_ARCHITECTURE" type="BOOLEAN" required="true"/> + + <column name="RESOURCE_TYPE_ID" type="INTEGER" references="RHQ_RESOURCE_TYPE" required="false"/> + <column name="DEPLOYMENT_CONFIG_DEF_ID" type="INTEGER" references="RHQ_CONFIG_DEF" required="false"/> + <column name="PACKAGE_EXTRA_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG_DEF" required="false"/> + + <index name="RHQ_PACKAGE_TYPE_IDX" unique="true"> + <field ref="NAME"/> + <field ref="RESOURCE_TYPE_ID"/> + </index> + + </table> + + <table name="RHQ_PACKAGE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="CLASSIFICATION" size="200" type="VARCHAR2" required="false"/> + + <column name="PACKAGE_TYPE_ID" type="INTEGER" references="RHQ_PACKAGE_TYPE" required="true"/> + + <index name="RHQ_PACKAGE_IDX" unique="true"> + <field ref="NAME"/> + <field ref="PACKAGE_TYPE_ID"/> + </index> + </table> + + <table name="RHQ_PACKAGE_BITS"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="BITS" type="LARGEOBJECT" required="false"/> + </table> + + <table name="RHQ_PACKAGE_VERSION"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="DISPLAY_NAME" size="200" type="VARCHAR2" required="false"/> + <column name="SHORT_DESCRIPTION" size="10000" type="CLOB" required="false"/> + <column name="LONG_DESCRIPTION" size="50000" type="CLOB" required="false"/> + <column name="VERSION" size="500" type="VARCHAR2" required="true"/> + <column name="DISPLAY_VERSION" size="500" type="VARCHAR2" required="false"/> + <column name="FILE_NAME" size="255" type="VARCHAR2" required="false"/> + <column name="FILE_SIZE" type="LONG" required="false"/> + <column name="FILE_MD5" size="32" type="VARCHAR2" required="false"/> + <column name="FILE_SHA256" size="64" type="VARCHAR2" required="false"/> + <column name="FILE_CREATION_TIME" type="LONG" required="false"/> + <column name="LICENSE_NAME" size="255" type="VARCHAR2" required="false"/> + <column name="LICENSE_VERSION" size="20" type="VARCHAR2" required="false"/> + <column name="METADATA" type="BLOB" required="false"/> + + <column name="PACKAGE_ID" type="INTEGER" references="RHQ_PACKAGE" required="true"/> + <column name="ARCHITECTURE_ID" type="INTEGER" references="RHQ_ARCHITECTURE" required="true"/> + <column name="CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> + <column name="PACKAGE_BITS_ID" type="INTEGER" references="RHQ_PACKAGE_BITS" required="false"/> + + <index name="RHQ_PACKAGE_VERSION_IDX" unique="true"> + <field ref="PACKAGE_ID"/> + <field ref="VERSION"/> + <field ref="ARCHITECTURE_ID"/> + </index> + + </table> + + <table name="RHQ_CONTENT_REQ"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="REQUEST_TYPE" type="VARCHAR2" required="true" size="20"/> + <column name="NOTES" type="VARCHAR2" required="false" size="512"/> + </table> + + <table name="RHQ_INSTALLED_PACKAGE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="INSTALLATION_TIME" type="LONG" required="false"/> + + <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE" required="true"/> + <column name="PACKAGE_VERSION_ID" type="INTEGER" references="RHQ_PACKAGE_VERSION" required="true"/> + <column name="SUBJECT_ID" type="INTEGER" references="RHQ_SUBJECT" required="false"/> + </table> + + <table name="RHQ_INSTALLED_PKG_HIST"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="STATUS" type="VARCHAR2" size="24" required="true"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="HISTORY_TIMESTAMP" type="LONG" required="false"/> + + <column name="PACKAGE_VERSION_ID" type="INTEGER" references="RHQ_PACKAGE_VERSION" required="true"/> + <column name="RESOURCE_ID" type="INTEGER" references="RHQ_RESOURCE" required="true"/> + <column name="DEPLOYMENT_CONFIG_ID" type="INTEGER" references="RHQ_CONFIG" required="false"/> + <column name="CONTENT_SERVICE_REQUEST_ID" type="INTEGER" references="RHQ_CONTENT_REQ" required="false"/> + </table> + + <table name="RHQ_CONTENT_SRC_SYNC"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="STATUS" type="VARCHAR2" size="16" required="true"/> + <column name="START_TIME" type="LONG" required="true"/> + <column name="END_TIME" type="LONG" required="false"/> + <column name="RESULTS" type="LONGVARCHAR" required="false"/> + <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> + </table> + + <table name="RHQ_REPO_SYNC"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="STATUS" type="VARCHAR2" size="16" required="true"/> + <column name="START_TIME" type="LONG" required="true"/> + <column name="END_TIME" type="LONG" required="false"/> + <column name="RESULTS" type="LONGVARCHAR" required="false"/> + <column name="PERCENT_COMPLETE" type="LONG" required="false"/> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + </table> + + + <table name="RHQ_PACKAGE_INST_STEP"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="STEP_KEY" type="VARCHAR2" size="500" required="true"/> + <column name="STEP_ORDER" type="INTEGER" required="true"/> + <column name="DESCRIPTION" type="VARCHAR2" size="4000" required="true"/> + <column name="ERROR_MSG" type="LONGVARCHAR" required="false"/> + <column name="RESULT" type="VARCHAR2" size="25" required="true"/> + + <column name="INSTALLED_PKG_HIST_ID" type="INTEGER" references="RHQ_INSTALLED_PKG_HIST"/> + </table> + + <table name="RHQ_REPO_RESOURCE_MAP"> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_REPO_RESOURCE_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="RESOURCE_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_REPO_CONTENT_SRC_MAP"> 1 + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_REPO_CONTENT_SRC_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="CONTENT_SRC_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_REPO_REPO_GROUP_MAP"> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="REPO_GROUP_ID" type="INTEGER" required="true" references="RHQ_REPO_GROUP"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_REPO_REPO_GROUP_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="REPO_GROUP_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_REPO_REPO_RELATION_MAP"> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="REPO_RELATION_ID" type="INTEGER" required="true" references="RHQ_REPO_RELATION"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_REPO_REPO_RELATION_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="REPO_RELATION_ID"/> + </primaryKey> + </constraint> + </table> + + + <table name="RHQ_REPO_PKG_VERSION_MAP"> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_REPO_PKG_VER_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="PACKAGE_VERSION_ID"/> + </primaryKey> + </constraint> + <index name="RHQ_REPO_PKG_VER_MAP_IDX" unique="false"> + <field ref="PACKAGE_VERSION_ID"/> + </index> + </table> + + <table name="RHQ_PKG_VER_CONTENT_SRC_MAP"> + <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> + <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> + <column name="LOCATION" type="VARCHAR2" size="4000" required="true"/> + + <constraint name="RHQ_PKG_VER_CONTENT_SRC_KEY"> + <primaryKey> + <field ref="PACKAGE_VERSION_ID"/> + <field ref="CONTENT_SRC_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_PKG_PRD_MAP"> + <column name="PKG_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> + <column name="PRD_ID" type="INTEGER" required="true" references="RHQ_PRD_VER"/> + + <constraint name="RHQ_PKG_PRD_KEY"> + <primaryKey> + <field ref="PKG_ID"/> + <field ref="PRD_ID"/> + </primaryKey> + </constraint> + + </table> + + <table name="RHQ_DISTRIBUTION_TYPE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + + </table> + + <table name="RHQ_DISTRIBUTION"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="DISTRIBUTION_TYPE_ID" type="INTEGER" required="true" references="RHQ_DISTRIBUTION_TYPE"/> + <column name="LABEL" size="64" type="VARCHAR2" required="true"/> + <column name="BASE_PATH" size="256" type="VARCHAR2" required="true"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + + <index name="RHQ_DISTRIBUTION_IDX" unique="true"> + <field ref="LABEL"/> + <field ref="BASE_PATH"/> + </index> + + </table> + + <table name="RHQ_REPO_DISTRIBUTION"> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="DISTRIBUTION_ID" type="INTEGER" required="true" references="RHQ_DISTRIBUTION"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + + <constraint name="RHQ_REPO_DIST_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="DISTRIBUTION_ID"/> + </primaryKey> + </constraint> + </table> + + + + <table name="RHQ_DISTRIBUTION_FILE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="DISTRIBUTION_ID" type="INTEGER" required="true" references="RHQ_DISTRIBUTION"/> + <column name="RELATIVE_FILENAME" size="256" type="VARCHAR2" required="true"/> + <!--<column name="FILE_SIZE" type="NUMBER" required="true"/>--> + <column name="MD5SUM" size="64" type="VARCHAR2" required="true"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + <!--<column name="CTIME" type="LONG" required="true"/>--> + + <index name="RHQ_DISTRIBUTION_FILE_IDX" unique="true"> + <field ref="DISTRIBUTION_ID"/> + <field ref="RELATIVE_FILENAME"/> + </index> + </table> + + + + + <table name="RHQ_ADVISORY"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="ADVISORY" size="64" type="VARCHAR2" required="true"/> + <column name="ADVISORY_TYPE" size="64" type="VARCHAR2" required="true" /> + <column name="ADVISORY_REL" size="64" type="VARCHAR2" required="false"/> + <column name="ADVISORY_NAME" size="64" type="VARCHAR2" required="false"/> + <column name="DESCRIPTION" size="4000" type="VARCHAR2" required="false"/> + <column name="SYNOPSIS" size="4000" type="VARCHAR2" required="true"/> + <column name="TOPIC" size="4000" type="VARCHAR2" required="false"/> + <column name="SOLUTION" size="4000" type="VARCHAR2" required="false"/> + <column name="SEVERITY" size="64" type="VARCHAR2" required="false"/> + <column name="ISSUE_DATE" type="LONG" required="false"/> + <column name="UPDATE_DATE" type="LONG" required="false"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + + <index name="RHQ_ADVISORY_NAME_UQ" unique="true"> + <field ref="ADVISORY_NAME"/> + </index> + + <index name="RHQ_ADVISORY_UQ" unique="true"> + <field ref="ADVISORY"/> + </index> + + <index name="RHQ_ADVISORY_UDATE_IDX" unique="false"> + <field ref="UPDATE_DATE"/> + </index> + </table> + + <table name="RHQ_ADVISORY_PACKAGE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> + <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + + <index name="RHQ_ADVISORY_PKG_IDX" unique="true"> + <field ref="ADVISORY_ID"/> + <field ref="PACKAGE_VERSION_ID"/> + </index> + </table> + + <table name="RHQ_CVE"> + <column name="ID" default="sequence-only" initial="101" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="64" type="VARCHAR2" required="true"/> + </table> + + <table name="RHQ_ADVISORY_CVE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> + <column name="CVE_ID" type="INTEGER" required="true" references="RHQ_CVE"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + + <index name="RHQ_ADVISORY_CVE_IDX" unique="true"> + <field ref="ADVISORY_ID"/> + <field ref="CVE_ID"/> + </index> + + </table> + + <table name="RHQ_ADVISORY_BUGLIST"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> + <column name="BUG_ID" size="256" type="VARCHAR2" required="true"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + + <index name="RHQ_ADVISORY_BUG_IDX" unique="true"> + <field ref="ADVISORY_ID"/> + <field ref="BUG_ID"/> + </index> + </table> + + + <table name="RHQ_REPO_ADVISORY"> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/> + + <constraint name="RHQ_REPO_ADV_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="ADVISORY_ID"/> + </primaryKey> + </constraint> + </table> + + <!-- BUNDLE_TYPE is things like "Cobbler profile" or "file-based bundle" or "puppet recipe" --> + <table name="RHQ_BUNDLE_TYPE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> + + <!-- This index is for constraint, not performance --> + <index name="RHQ_BUNDLE_TYPE_UNIQUE" unique="true"> + <field ref="NAME"/> + </index> + </table> + + <!-- BUNDLE is a named piece of content that can be versioned and installed somewhere --> + <table name="RHQ_BUNDLE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="BUNDLE_TYPE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_TYPE"/> + <column name="PACKAGE_TYPE_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_TYPE"/> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + + <!-- This index is for constraint, not performance --> + <index name="RHQ_BUNDLE_UNIQUE" unique="true"> + <field ref="BUNDLE_TYPE_ID"/> + <field ref="NAME"/> + </index> + </table> + + <!-- BUNDLE_VERSION represents an actual piece of content that needs to be installed somewhere --> + <table name="RHQ_BUNDLE_VERSION"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="VERSION" size="500" type="VARCHAR2" required="true"/> + <column name="VERSION_ORDER" type="INTEGER" required="true"/> + <column name="ACTION" type="CLOB" required="true"/> + <column name="CONFIG_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_DEF" /> + <column name="BUNDLE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE"/> + + <!-- This index is for constraint, not performance --> + <index name="RHQ_BUNDLE_VERSION_UNIQUE" unique="true"> + <field ref="BUNDLE_ID"/> + <field ref="NAME"/> + <field ref="VERSION"/> + </index> + </table> + + <!-- Many-to-many table that links many repos to a particular bundle version. destination platforms --> + <!-- would be required to have associations to the specified repos (to access required content --> + <table name="RHQ_BUNDLE_VERSION_REPO"> + <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + + <constraint name="RHQ_BUNDLE_VERSION_REPO_KEY"> + <primaryKey> + <field ref="BUNDLE_VERSION_ID"/> + <field ref="REPO_ID"/> + </primaryKey> + </constraint> + </table> + + <!-- BUNDLE_FILE represents a file that is associated with (possibly bundled inside) a bundle version --> + <table name="RHQ_BUNDLE_FILE"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> + <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> + </table> + + <!-- A logical destination for a bundle deployment. Defines the platforms and directory on those targets. --> + <table name="RHQ_BUNDLE_DESTINATION"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="BUNDLE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE"/> + <column name="GROUP_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_GROUP"/> + <column name="DEPLOY_DIR" size="256" type="VARCHAR2" required="true"/> + <column name="DEST_BASE_DIR_NAME" size="200" type="VARCHAR2" required="true"/> + + <!-- This index is for constraint, not performance --> + <index name="RHQ_BUNDLE_DESTINATION_UNIQUE" unique="true"> + <field ref="BUNDLE_ID"/> + <field ref="GROUP_ID"/> + <field ref="DEPLOY_DIR"/> + </index> + </table> + + <!-- An actual deployment of a bundle version to a destination, with a specific config. Bundle deployments + can differ only on ctime, which is assumed to be different --> + <table name="RHQ_BUNDLE_DEPLOYMENT"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> + <column name="BUNDLE_DESTINATION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DESTINATION"/> + <column name="CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG" /> + <column name="SUBJECT_NAME" type="VARCHAR2" required="false" size="255"/> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="IS_LIVE" type="BOOLEAN" required="true"/> + <column name="REPLACED_BUNDLE_DEPLOYMENT_ID" type="INTEGER" required="false" references="RHQ_BUNDLE_DEPLOYMENT"/> + </table> + + <!-- Represents a bundle version that is deployed on a platform resource --> + <table name="RHQ_BUNDLE_RES_DEPLOY"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="BUNDLE_DEPLOYMENT_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DEPLOYMENT" /> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE" /> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="CTIME" type="LONG" required="true"/> + + <index name="RHQ_BUNDLE_RES_DEPLOY_IDX" unique="true"> + <field ref="BUNDLE_DEPLOYMENT_ID"/> + <field ref="RESOURCE_ID"/> + </index> + </table> + + <table name="RHQ_BUNDLE_RES_DEP_HIST"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="BUNDLE_RES_DEPLOY_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_RES_DEPLOY" /> + <column name="SUBJECT_NAME" required="false" size="255" type="VARCHAR2"/> + <column name="AUDIT_TIME" required="true" type="LONG"/> + <column name="ACTION" required="true" size="128" type="VARCHAR2"/> + <column name="INFO" required="true" size="512" type="VARCHAR2"/> + <column name="CATEGORY" required="false" size="32" type="VARCHAR2"/> + <column name="STATUS" required="true" type="VARCHAR2" size="16"/> + <column name="MESSAGE" required="false" type="LONGVARCHAR"/> + <column name="ATTACHMENT" required="false" type="LONGVARCHAR"/> + </table> + + <table name="RHQ_TAGGING_BUNDLE_MAP"> + <column name="BUNDLE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE"/> + <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> + <constraint name="RHQ_TAGGING_BUNDLE_MAP_KEY"> + <primaryKey> + <field ref="BUNDLE_ID"/> + <field ref="TAG_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_TAGGING_BUNDLE_VERSION_MAP"> + <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> + <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> + <constraint name="RHQ_TAGGING_BUNDLE_VER_MAP_KEY"> + <primaryKey> + <field ref="BUNDLE_VERSION_ID"/> + <field ref="TAG_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_TAGGING_BUNDLE_DEPLOY_MAP"> + <column name="BUNDLE_DEPLOYMENT_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DEPLOYMENT"/> + <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> + <constraint name="RHQ_TAGGING_BUNDLE_DEP_MAP_KEY"> + <primaryKey> + <field ref="BUNDLE_DEPLOYMENT_ID"/> + <field ref="TAG_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_TAGGING_BUNDLE_DEST_MAP"> + <column name="BUNDLE_DESTINATION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DESTINATION"/> + <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAGGING"/> + <constraint name="RHQ_TAGGING_BUNDLE_DES_MAP_KEY"> + <primaryKey> + <field ref="BUNDLE_DESTINATION_ID"/> + <field ref="TAG_ID"/> + </primaryKey> + </constraint> + </table> + + <!-- Drift Management Tables --> + <table name="RHQ_DRIFT_DEF_TEMPLATE"> + <column name="ID" default="sequence-only" initial="1001" primarykey="true" required="true" type="INTEGER"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> + <column name="CONFIG_ID" type="INTEGER" required="true" references="RHQ_CONFIG"/> + <column name="NAME" type="VARCHAR2" size="128" required="true"/> + <column name="DESCRIPTION" type="VARCHAR2" size="512" required="false"/> + <!-- true if defined by user, false if provided by plugin --> + <column name="IS_USER_DEFINED" type="BOOLEAN" required="true"/> + <!-- + Change sets are managed by the drift server plugins; therefore, we cannot maintain + a FK constraint on the change set id. And the type cannot be integer because + other back ends like MongoDB use other types that are basically variants of a + UUID + + jsanda + --> + <column name="DRIFT_CHANGE_SET_ID" type="VARCHAR2" size="64" required="false"/> + <column name="CTIME" type="LONG" required="true"/> + + <index name="RHQ_DRIFT_DEF_TEMPLATE_UNIQUE" unique="true"> + <field ref="RESOURCE_TYPE_ID"/> + <field ref="NAME"/> + </index> + </table> + + <!-- Content of a file being managed for drift. Used for diff and/or remediation --> + <table name="RHQ_DRIFT_FILE"> + <column name="HASH_ID" type="VARCHAR2" size="64" primarykey="true" required="true"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="DATA" type="LARGEOBJECT" required="false"/> + <column name="DATA_SIZE" type="LONG" required="false"/> + <column name="STATUS" type="VARCHAR2" size="20" required="true"/> + </table> + + <!-- A single drift definition defining file tracking + Note: A resource or group (todo: group, other?) can have zero or more drift configurations. + Note: The name, interval and is_enabled values are also stored withing the referenced config. + This allows us to use the config editor to manipulate all fields. + Note: Name is read-only + Note: Interval unit is millis + --> + <table name="RHQ_DRIFT_DEFINITION"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="CONFIG_ID" type="INTEGER" required="true" references="RHQ_CONFIG"/> + <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> + <column name="DRIFT_DEF_TEMPLATE_ID" type="INTEGER" required="false" references="RHQ_DRIFT_DEF_TEMPLATE"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="NAME" type="VARCHAR2" size="512" required="true"/> + <column name="DESCRIPTION" type="VARCHAR2" size="512" required="false"/> + <column name="INTERVAL" type="LONG" required="true"/> + <column name="IS_ENABLED" type="BOOLEAN" required="true"/> + <column name="DRIFT_HANDLING_MODE" type="VARCHAR2" size="20" required="true"/> + <column name="IS_PINNED" type="BOOLEAN" required="true"/> + <column name="IS_ATTACHED" type="BOOLEAN" required="true"/> + <column name="COMPLIANCE_STATUS" type="INTEGER" required="true"/> + </table> + + <!-- A set of drift records (note, this is for the JPA server plugin impl only) --> + <table name="RHQ_DRIFT_SET"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + </table> + + <!-- A drift change-set report for a resource (note, this is for the JPA server plugin impl only) --> + <table name="RHQ_DRIFT_CHANGE_SET"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="DRIFT_SET_ID" type="INTEGER" required="false" references="RHQ_DRIFT_SET"/> + <column name="CTIME" type="LONG" required="true"/> + <!-- Version 0 is initial change-set --> + <column name="VERSION" type="INTEGER" required="true"/> + <column name="CATEGORY" type="VARCHAR2" size="20" required="true"/> + <column name="RESOURCE_ID" type="INTEGER" required="false" references="RHQ_RESOURCE"/> + <column name="DRIFT_DEFINITION_ID" type="INTEGER" required="false" references="RHQ_DRIFT_DEFINITION"/> + <!-- the drift handling mode at changeset creation time --> + <column name="DRIFT_HANDLING_MODE" type="VARCHAR2" size="20" required="true"/> + </table> + + <!-- A single occurence of drift for a resource (note, this is for the JPA server plugin impl only) --> + <table name="RHQ_DRIFT"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="CATEGORY" type="VARCHAR2" size="20" required="true"/> + <column name="DRIFT_SET_ID" type="INTEGER" required="false" references="RHQ_DRIFT_SET"/> + <column name="DRIFT_CHANGE_SET_ID" type="INTEGER" required="true" references="RHQ_DRIFT_CHANGE_SET"/> + <!-- the file path not including the base directory --> + <column name="PATH" type="VARCHAR2" size="1024" required="true"/> + <!-- the same as PATH less [/]filename.ext. Redundant storage for the purpose of strict directory search. + this field can be considered transient for serialization purposes --> + <column name="PATH_DIRECTORY" type="VARCHAR2" size="1024" required="true"/> + <column name="OLD_DRIFT_FILE" type="VARCHAR2" size="64" required="false" references="RHQ_DRIFT_FILE"/> + <column name="NEW_DRIFT_FILE" type="VARCHAR2" size="64" required="false" references="RHQ_DRIFT_FILE"/> + </table> + + +<!-- END: content-schema.xml --> +<!-- BEGIN: resource-request-schema.xml --> + + + <table name="RHQ_CREATE_RES_HIST"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="PARENT_RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> + <column name="CREATED_RESOURCE_NAME" type="VARCHAR2" size="500" required="false"/> + <column name="NEW_RESOURCE_KEY" type="VARCHAR2" required="false" size="500"/> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> + <column name="CONFIGURATION_ID" type="INTEGER" required="false" references="RHQ_CONFIG"/> + <column name="INSTALLED_PACKAGE_ID" type="INTEGER" required="false" references="RHQ_INSTALLED_PACKAGE"/> + </table> + + <table name="RHQ_DELETE_RES_HIST"> + <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> + <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/> + <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="100"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="MTIME" type="LONG" required="true"/> + <column name="STATUS" type="VARCHAR2" required="true" size="16"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> + </table> + +<!-- END: resource-request-schema.xml --> +<!-- BEGIN: jms-schema.xml --> + +<!-- the schema matches that which would be automatically created by the JMS subsystem --> +<!-- see deploy/jms/rhq-jdbc-state-service.xml and rhq-jdbc2-service.xml --> + + + <table name="JMS_MESSAGES"> + <column name="MESSAGEID" required="true" type="INTEGER" /> + <column name="DESTINATION" required="true" type="VARCHAR2" size="255" /> + <column name="TXID" required="false" type="INTEGER" /> + <column name="TXOP" required="false" type="CHAR" size="1" /> + <column name="MESSAGEBLOB" required="false" type="BLOB" /> + + <constraint name="JMS_MESSAGES_PKEY"> + <primaryKey> + <field ref="MESSAGEID"/> + <field ref="DESTINATION"/> + </primaryKey> + </constraint> + + <index name="JMS_MESSAGES_TXOP_TXID"> + <field ref="TXOP"/> + <field ref="TXID"/> + </index> + <index name="JMS_MESSAGES_DESTINATION"> + <field ref="DESTINATION"/> + </index> + </table> + + <table name="JMS_TRANSACTIONS"> + <column name="TXID" required="true" type="INTEGER" primarykey="true" /> + </table> + + <table name="JMS_USERS"> + <column name="USERID" required="true" type="VARCHAR2" size="32" primarykey="true" /> + <column name="PASSWD" required="true" type="VARCHAR2" size="32" /> + <column name="CLIENTID" required="false" type="VARCHAR2" size="128" /> + </table> + + <table name="JMS_ROLES"> + <column name="ROLEID" required="true" type="VARCHAR2" size="32" /> + <column name="USERID" required="true" type="VARCHAR2" size="32" /> + + <constraint name="JMS_ROLES_PKEY"> + <primaryKey> + <field ref="USERID"/> + <field ref="ROLEID"/> + </primaryKey> + </constraint> + </table> + + <table name="JMS_SUBSCRIPTIONS"> + <column name="CLIENTID" required="true" type="VARCHAR2" size="128" /> + <column name="SUBNAME" required="true" type="VARCHAR2" size="128" /> + <column name="TOPIC" required="true" type="VARCHAR2" size="255" /> + <column name="SELECTOR" required="false" type="VARCHAR2" size="255" /> + + <constraint name="JMS_SUBSCRIPTIONS_PKEY"> + <primaryKey> + <field ref="CLIENTID"/> + <field ref="SUBNAME"/> + </primaryKey> + </constraint> + </table> + +<!-- END: jms-schema.xml --> +<!-- BEGIN: obsolete-schema.xml --> + + + <!-- NOTE: The tables will be dropped in the *** REVERSE ORDER *** as listed in this file! --> + <!-- NOTE: So, put the table you want dropped first at the bottom, and so on... --> + + + <!-- !!! REMOVED FROM CONTENT-SCHEMA !!!! --> + + <table name="RHQ_DRIFT_TEMPLATE_MAP" obsolete="true"> + <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> + <column name="CONFIG_TEMPLATE_ID" type="INTEGER" required="true" references="RHQ_CONFIG_TEMPLATE"/> + </table> + + <table name="RHQ_BUNDLE_CONFIG" obsolete="true"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="CONFIG_ID" type="INTEGER" required="false" references="RHQ_CONFIG" /> + <!-- this probably needs a DTYPE discriminator so we know if its a bundle or a specific bundle version --> + <column name="BUNDLE_VERSION_ID" type="INTEGER" required="false" references="RHQ_BUNDLE_VERSION"/> + <column name="BUNDLE_ID" type="INTEGER" required="false" references="RHQ_BUNDLE"/> + </table> + + <table name="RHQ_CHANNEL" obsolete="true"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + <column name="CREATION_TIME" type="LONG" required="true"/> + <column name="LAST_MODIFIED_TIME" type="LONG" required="true"/> + + <index name="RHQ_CHANNEL_IDX" unique="true"> + <field ref="NAME"/> + </index> + </table> + + <table name="RHQ_CHANNEL_RESOURCE_MAP" obsolete="true"> + <column name="CHANNEL_ID" type="INTEGER" required="true" references="RHQ_CHANNEL"/> + <column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_CHANNEL_RESOURCE_MAP_KEY"> + <primaryKey> + <field ref="CHANNEL_ID"/> + <field ref="RESOURCE_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_CHANNEL_CONTENT_SRC_MAP" obsolete="true"> + <column name="CHANNEL_ID" type="INTEGER" required="true" references="RHQ_CHANNEL"/> + <column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_CHAN_CONTENT_SRC_MAP_KEY"> + <primaryKey> + <field ref="CHANNEL_ID"/> + <field ref="CONTENT_SRC_ID"/> + </primaryKey> + </constraint> + </table> + + <table name="RHQ_CHANNEL_PKG_VERSION_MAP" obsolete="true"> + <column name="CHANNEL_ID" type="INTEGER" required="true" references="RHQ_CHANNEL"/> + <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> + <column name="CTIME" type="LONG" required="true"/> + + <constraint name="RHQ_CHANNEL_PKG_VER_MAP_KEY"> + <primaryKey> + <field ref="CHANNEL_ID"/> + <field ref="PACKAGE_VERSION_ID"/> + </primaryKey> + </constraint> + </table> + + <!-- !!! REMOVED FROM MEASUREMENT-SCHEMA !!!! --> + + <table name="RHQ_MEASUREMENT_OOB" obsolete="true"> + <column name="ID" type="INTEGER" default="sequence-only" initial="10001" primarykey="true" required="true"/> + <column name="SCHEDULE_ID" type="INTEGER" references="RHQ_MEASUREMENT_SCHED(ID)" required="true"/> + <column name="OCCURRED" type="LONG" required="true"/> + <column name="DIFF" type="DOUBLE" required="true"/> + + <index name="RHQ_MEASUREMENT_OOB_IDX" unique="true"> + <field ref="SCHEDULE_ID" /> + <field ref="OCCURRED" /> + </index> + </table> + + + <table name="RHQ_TAG" obsolete="true"> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="NAME" size="200" type="VARCHAR2" required="true"/> + <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> + </table> + + <table name="RHQ_REPO_TAG_MAP" obsolete="true"> + <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + <column name="TAG_ID" type="INTEGER" required="true" references="RHQ_TAG"/> + + <constraint name="RHQ_REPO_TAG_MAP_KEY"> + <primaryKey> + <field ref="REPO_ID"/> + <field ref="TAG_ID"/> + </primaryKey> + </constraint> + </table> + + +<!-- END: obsolete-schema.xml --> +</dbsetup> diff --git a/modules/enterprise/server/pom.xml b/modules/enterprise/server/pom.xml index db001bd..15f3580 100644 --- a/modules/enterprise/server/pom.xml +++ b/modules/enterprise/server/pom.xml @@ -31,6 +31,7 @@ <module>plugins</module> <module>ear</module> <module>startup-subsystem</module> + <module>installer</module> <module>safe-invoker</module> <module>client-api</module> <module>itests</module> diff --git a/modules/enterprise/server/sars/services-sar/src/main/resources/META-INF/jboss-service.xml b/modules/enterprise/server/sars/services-sar/src/main/resources/META-INF/jboss-service.xml index 2f1ad89..b8eb098 100644 --- a/modules/enterprise/server/sars/services-sar/src/main/resources/META-INF/jboss-service.xml +++ b/modules/enterprise/server/sars/services-sar/src/main/resources/META-INF/jboss-service.xml @@ -21,9 +21,9 @@ <mbean code="org.rhq.enterprise.server.core.plugin.PluginDeploymentScanner" name="rhq:service=PluginDeploymentScanner"> <attribute name="ScanPeriod">${rhq.server.plugin-scan-period-ms:300000}</attribute> - <attribute name="AgentPluginDir">${jboss.server.base.dir}/deployments/rhq.ear/rhq-downloads/rhq-plugins</attribute> - <attribute name="ServerPluginDir">${jboss.server.base.dir}/deployments/rhq.ear/rhq-serverplugins</attribute> - <attribute name="UserPluginDir">${jboss.home.dir}/../plugins</attribute> + <attribute name="AgentPluginDir">${rhq.server.home}/modules/org/rhq/rhq-enterprise-server-startup-subsystem/main/deployments/rhq.ear/rhq-downloads/rhq-plugins</attribute> + <attribute name="ServerPluginDir">${rhq.server.home}/modules/org/rhq/rhq-enterprise-server-startup-subsystem/main/deployments/rhq.ear/rhq-serverplugins</attribute> + <attribute name="UserPluginDir">${rhq.server.home}/plugins</attribute> </mbean>
<mbean code="org.rhq.enterprise.server.scheduler.SchedulerService" diff --git a/modules/enterprise/server/startup-subsystem/pom.xml b/modules/enterprise/server/startup-subsystem/pom.xml index 2a5df22..8f97035 100644 --- a/modules/enterprise/server/startup-subsystem/pom.xml +++ b/modules/enterprise/server/startup-subsystem/pom.xml @@ -20,6 +20,7 @@ <properties> <!-- this is used to replace the variable in module.xml --> <moduleName>${project.groupId}.${project.artifactId}</moduleName> + <moduleDir>org/rhq/${project.artifactId}</moduleDir> </properties>
<build> @@ -38,7 +39,7 @@ <id>copy-ear</id> <phase>process-resources</phase> <goals> - <goal>copy</goal> + <goal>unpack</goal> </goals> <configuration> <artifactItems> @@ -46,10 +47,9 @@ <groupId>org.rhq</groupId> <artifactId>rhq-enterprise-server-ear</artifactId> <type>ear</type> - <destFileName>rhq.ear</destFileName> + <outputDirectory>${project.build.directory}/deployments/rhq.ear</outputDirectory> </artifactItem> </artifactItems> - <outputDirectory>${project.build.directory}/deployments</outputDirectory> </configuration> </execution> </executions> @@ -120,4 +120,59 @@ </dependency> </dependencies>
+ <profiles> + <profile> + <id>dev</id> + + <properties> + <rhq.rootDir>../../../..</rhq.rootDir> + <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> + <rhq.deploymentName>${project.build.finalName}.zip</rhq.deploymentName> + <rhq.deploymentDir>${rhq.containerDir}/modules/</rhq.deploymentDir> + </properties> + + <build> + <plugins> + + <plugin> + <artifactId>maven-antrun-plugin</artifactId> + <executions> + + <execution> + <id>deploy</id> + <phase>package</phase> + <configuration> + <target> + <echo>*** Deploying main EAR startup module to ${rhq.deploymentDir}</echo> + <unzip src="target/${rhq.deploymentName}" + dest="${rhq.deploymentDir}"/> + </target> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + + <execution> + <id>undeploy</id> + <phase>clean</phase> + <configuration> + <target> + <echo>*** Deleting main EAR startup module... ${rhq.deploymentDir}/${moduleDir}</echo> + <delete dir="${rhq.deploymentDir}/${moduleDir}" /> + </target> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + + </executions> + </plugin> + + </plugins> + </build> + </profile> + </profiles> + </project> diff --git a/modules/enterprise/server/startup-subsystem/src/main/java/org/rhq/enterprise/startup/StartupExtension.java b/modules/enterprise/server/startup-subsystem/src/main/java/org/rhq/enterprise/startup/StartupExtension.java index 5354e7e..265625a 100644 --- a/modules/enterprise/server/startup-subsystem/src/main/java/org/rhq/enterprise/startup/StartupExtension.java +++ b/modules/enterprise/server/startup-subsystem/src/main/java/org/rhq/enterprise/startup/StartupExtension.java @@ -24,6 +24,7 @@ import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP; import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP_ADDR; import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SUBSYSTEM;
+import java.io.File; import java.util.List;
import javax.xml.stream.XMLStreamConstants; @@ -75,6 +76,9 @@ public class StartupExtension implements Extension { // used to read and write the XML of our subsystem config private static final StartupSubsystemParser parser = new StartupSubsystemParser();
+ private static final String RHQ_SERVER_HOME_ENVVAR = "RHQ_SERVER_HOME"; + private static final String RHQ_SERVER_HOME_SYSPROP = "rhq.server.home"; + static StandardResourceDescriptionResolver getResourceDescriptionResolver(final String... keyPrefix) { StringBuilder prefix = new StringBuilder(SUBSYSTEM_NAME); for (String kp : keyPrefix) { @@ -91,6 +95,26 @@ public class StartupExtension implements Extension {
@Override public void initialize(ExtensionContext context) { + // we know our app needs to know where RHQ is installed, so setup our sys prop now + String serverHome = System.getProperty(RHQ_SERVER_HOME_SYSPROP); + if (serverHome == null) { + serverHome = System.getenv(RHQ_SERVER_HOME_ENVVAR); + if (serverHome == null) { + // assume we are running our own embedded AS, so RHQ home is the parent dir of the AS home + try { + serverHome = new File(System.getProperty("jboss.home.dir"), "..").getCanonicalPath(); + } catch (Exception e) { + throw new RuntimeException("Failed to locate server home", e); + } + } + System.setProperty(RHQ_SERVER_HOME_SYSPROP, serverHome); + } + + File modulesDir = new File(serverHome, "modules"); // if this is a correct home dir, RHQ's modules directory should be here + if (!modulesDir.isDirectory()) { + throw new IllegalStateException("Invalid RHQ server home dir: " + serverHome); + } + // register subsystem with its model version final SubsystemRegistration subsystem; subsystem = context.registerSubsystem(SUBSYSTEM_NAME, API_MAJOR_VERSION, API_MINOR_VERSION); diff --git a/modules/enterprise/server/startup-subsystem/src/main/java/org/rhq/enterprise/startup/StartupSubsystemAdd.java b/modules/enterprise/server/startup-subsystem/src/main/java/org/rhq/enterprise/startup/StartupSubsystemAdd.java index c3f28ed..63b65f5 100644 --- a/modules/enterprise/server/startup-subsystem/src/main/java/org/rhq/enterprise/startup/StartupSubsystemAdd.java +++ b/modules/enterprise/server/startup-subsystem/src/main/java/org/rhq/enterprise/startup/StartupSubsystemAdd.java @@ -19,12 +19,15 @@ package org.rhq.enterprise.startup;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ADD; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ARCHIVE; import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.CONTENT; import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DEPLOYMENT; import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ENABLED; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.PATH; import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.PERSISTENT; import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.URL;
+import java.io.File; import java.net.URL;
import org.jboss.as.controller.AbstractAddStepHandler; @@ -63,10 +66,17 @@ class StartupSubsystemAdd extends AbstractAddStepHandler { Module module = Module.forClass(getClass());
URL url = module.getExportedResource(StartupExtension.DEPLOYMENT_APP_EAR); - String urlString = url.toExternalForm(); - ModelNode contentItem = new ModelNode(); - contentItem.get(URL).set(urlString); + + boolean explodedDeployment = true; // this is here just to keep the code around that deploys if we are unexploded + if (explodedDeployment) { + String urlString = new File(url.toURI()).getAbsolutePath(); + contentItem.get(PATH).set(urlString); + contentItem.get(ARCHIVE).set(false); + } else { + String urlString = url.toExternalForm(); + contentItem.get(URL).set(urlString); + }
op.get(CONTENT).add(contentItem);
rhq-commits@lists.fedorahosted.org