From 0a0baee45ebcff44635907d457c4ff6810b09c87 Mon Sep 17 00:00:00 2001 From: Alex Rudyy Date: Wed, 15 Apr 2015 09:47:28 +0000 Subject: QPID-6481: Move java source tree to top level git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1673693 13f79535-47bb-0310-9956-ffa450edef68 --- .../main/appended-resources/META-INF/LICENSE.vm | 33 - .../qpid/server/management/plugin/DojoHelper.java | 119 --- .../server/management/plugin/HttpManagement.java | 613 --------------- .../plugin/HttpManagementConfiguration.java | 82 -- .../management/plugin/HttpManagementUtil.java | 270 ------- .../connector/TcpAndSslSelectChannelConnector.java | 378 --------- .../filter/ForbiddingAuthorisationFilter.java | 93 --- .../plugin/filter/ForbiddingTraceFilter.java | 68 -- .../filter/RedirectingAuthorisationFilter.java | 83 -- .../management/plugin/log/LogFileDetails.java | 78 -- .../management/plugin/log/LogFileHelper.java | 243 ------ .../plugin/report/QueueBinaryReport.java | 28 - .../management/plugin/report/QueueReport.java | 161 ---- .../management/plugin/report/QueueTextReport.java | 28 - .../management/plugin/report/ReportRunner.java | 408 ---------- .../plugin/report/ReportableMessage.java | 42 - .../plugin/report/ReportableMessageHeader.java | 58 -- .../plugin/servlet/DefinedFileServlet.java | 84 -- .../management/plugin/servlet/FileServlet.java | 127 ---- .../management/plugin/servlet/LogFileServlet.java | 107 --- .../plugin/servlet/ServletConnectionPrincipal.java | 84 -- .../plugin/servlet/rest/AbstractServlet.java | 291 ------- .../management/plugin/servlet/rest/Action.java | 32 - .../plugin/servlet/rest/ApiDocsServlet.java | 423 ----------- .../rest/ConfiguredObjectToMapConverter.java | 314 -------- .../plugin/servlet/rest/HelperServlet.java | 126 --- .../plugin/servlet/rest/KeyComparator.java | 53 -- .../plugin/servlet/rest/LogFileListingServlet.java | 68 -- .../plugin/servlet/rest/LogRecordsServlet.java | 104 --- .../rest/LoggedOnUserPreferencesServlet.java | 138 ---- .../plugin/servlet/rest/LogoutServlet.java | 65 -- .../plugin/servlet/rest/MapComparator.java | 74 -- .../plugin/servlet/rest/MessageContentServlet.java | 174 ----- .../plugin/servlet/rest/MessageServlet.java | 568 -------------- .../plugin/servlet/rest/MetaDataServlet.java | 200 ----- .../servlet/rest/PluginClassProviderAction.java | 60 -- .../plugin/servlet/rest/QueueReportServlet.java | 103 --- .../plugin/servlet/rest/RestServlet.java | 774 ------------------- .../plugin/servlet/rest/SaslServlet.java | 319 -------- .../plugin/servlet/rest/StructureServlet.java | 100 --- .../servlet/rest/UserPreferencesServlet.java | 237 ------ .../action/AbstractSpecialisedAttributeLister.java | 78 -- .../ListAccessControlProviderAttributes.java | 38 - .../servlet/rest/action/ListBrokerAttribute.java | 52 -- .../rest/action/ListGroupProviderAttributes.java | 38 - .../plugin/servlet/rest/action/ListTimeZones.java | 117 --- .../plugin/session/LoginLogoutReporter.java | 110 --- .../accesscontrolprovider/aclfile/add.html | 64 -- .../accesscontrolprovider/showAclFile.html | 27 - .../java/resources/addAccessControlProvider.html | 66 -- .../java/resources/addAuthenticationProvider.html | 64 -- .../src/main/java/resources/addBinding.html | 64 -- .../src/main/java/resources/addExchange.html | 74 -- .../src/main/java/resources/addGroupProvider.html | 66 -- .../src/main/java/resources/addPort.html | 260 ------- .../java/resources/addPreferencesProvider.html | 28 - .../src/main/java/resources/addQueue.html | 344 --------- .../src/main/java/resources/addStore.html | 66 -- .../addVirtualHostNodeAndVirtualHost.html | 136 ---- .../resources/authenticationprovider/addUser.html | 42 - .../authenticationprovider/external/add.html | 30 - .../authenticationprovider/external/show.html | 26 - .../authenticationprovider/filebased/add.html | 31 - .../authenticationprovider/filebased/show.html | 26 - .../authenticationprovider/setPassword.html | 42 - ...showPrincipalDatabaseAuthenticationManager.html | 27 - .../authenticationprovider/simpleldap/add.html | 133 ---- .../authenticationprovider/simpleldap/show.html | 58 -- .../resources/common/ContextVariablesEditor.html | 35 - .../main/java/resources/common/ResourceWidget.html | 48 -- .../java/resources/common/TimeZoneSelector.html | 66 -- .../src/main/java/resources/css/apidocs.css | 86 --- .../src/main/java/resources/css/common.css | 339 --------- .../src/main/java/resources/editBroker.html | 119 --- .../src/main/java/resources/editQueue.html | 300 -------- .../src/main/java/resources/editVirtualHost.html | 137 ---- .../main/java/resources/editVirtualHostNode.html | 56 -- .../src/main/java/resources/footer.html | 28 - .../java/resources/grid/showColumnDefDialog.html | 32 - .../resources/grid/showRowNumberLimitDialog.html | 33 - .../main/java/resources/group/addGroupMember.html | 38 - .../src/main/java/resources/group/showGroup.html | 32 - .../java/resources/groupprovider/addGroup.html | 39 - .../resources/groupprovider/groupfile/add.html | 37 - .../resources/groupprovider/groupfile/show.html | 25 - .../showGroupManagingGroupProvider.html | 30 - .../main/java/resources/images/auto-refresh.png | Bin 535 -> 0 bytes .../src/main/java/resources/images/download.png | Bin 803 -> 0 bytes .../src/main/java/resources/images/gear.png | Bin 3512 -> 0 bytes .../src/main/java/resources/images/help.png | Bin 932 -> 0 bytes .../src/main/java/resources/images/log-viewer.png | Bin 719 -> 0 bytes .../src/main/java/resources/images/qpid-logo.png | Bin 6798 -> 0 bytes .../src/main/java/resources/images/refresh.png | Bin 468 -> 0 bytes .../src/main/java/resources/index.html | 137 ---- .../main/java/resources/js/crypto-js/README.txt | 8 - .../java/resources/js/crypto-js/enc-base64-min.js | 8 - .../main/java/resources/js/crypto-js/hmac-sha1.js | 17 - .../java/resources/js/crypto-js/hmac-sha256.js | 18 - .../resources/js/qpid/authorization/checkUser.js | 45 -- .../java/resources/js/qpid/authorization/sasl.js | 351 --------- .../java/resources/js/qpid/common/ConsoleHelper.js | 72 -- .../js/qpid/common/ContextVariablesEditor.js | 558 -------------- .../resources/js/qpid/common/FormWidgetMixin.js | 102 --- .../resources/js/qpid/common/ResourceWidget.js | 196 ----- .../resources/js/qpid/common/TimeZoneSelector.js | 217 ------ .../resources/js/qpid/common/UpdatableStore.js | 189 ----- .../main/java/resources/js/qpid/common/footer.js | 30 - .../java/resources/js/qpid/common/formatter.js | 99 --- .../js/qpid/common/grid/ColumnDefDialog.js | 145 ---- .../js/qpid/common/grid/EnhancedFilter.js | 230 ------ .../js/qpid/common/grid/EnhancedFilterTools.js | 310 -------- .../resources/js/qpid/common/grid/FilterSummary.js | 173 ----- .../resources/js/qpid/common/grid/GridUpdater.js | 297 -------- .../js/qpid/common/grid/RowNumberLimitDialog.js | 102 --- .../resources/js/qpid/common/grid/UpdatableGrid.js | 56 -- .../main/java/resources/js/qpid/common/metadata.js | 89 --- .../java/resources/js/qpid/common/properties.js | 26 - .../main/java/resources/js/qpid/common/timezone.js | 95 --- .../main/java/resources/js/qpid/common/updater.js | 65 -- .../src/main/java/resources/js/qpid/common/util.js | 842 --------------------- .../resources/js/qpid/common/widgetconfigurer.js | 152 ---- .../js/qpid/management/AccessControlProvider.js | 132 ---- .../js/qpid/management/AuthenticationProvider.js | 243 ------ .../java/resources/js/qpid/management/Broker.js | 715 ----------------- .../resources/js/qpid/management/Connection.js | 243 ------ .../java/resources/js/qpid/management/Exchange.js | 301 -------- .../resources/js/qpid/management/GroupProvider.js | 199 ----- .../java/resources/js/qpid/management/KeyStore.js | 172 ----- .../java/resources/js/qpid/management/Plugin.js | 94 --- .../main/java/resources/js/qpid/management/Port.js | 220 ------ .../resources/js/qpid/management/Preferences.js | 281 ------- .../js/qpid/management/PreferencesProvider.js | 187 ----- .../java/resources/js/qpid/management/Queue.js | 566 -------------- .../resources/js/qpid/management/TrustStore.js | 169 ----- .../js/qpid/management/UserPreferences.js | 313 -------- .../resources/js/qpid/management/VirtualHost.js | 483 ------------ .../js/qpid/management/VirtualHostNode.js | 220 ------ .../management/accesscontrolprovider/AclFile.js | 96 --- .../accesscontrolprovider/aclfile/add.js | 125 --- .../js/qpid/management/addAccessControlProvider.js | 149 ---- .../qpid/management/addAuthenticationProvider.js | 221 ------ .../resources/js/qpid/management/addBinding.js | 423 ----------- .../resources/js/qpid/management/addExchange.js | 135 ---- .../js/qpid/management/addGroupProvider.js | 178 ----- .../java/resources/js/qpid/management/addPort.js | 476 ------------ .../js/qpid/management/addPreferencesProvider.js | 94 --- .../java/resources/js/qpid/management/addQueue.js | 185 ----- .../java/resources/js/qpid/management/addStore.js | 189 ----- .../management/addVirtualHostNodeAndVirtualHost.js | 409 ---------- .../PrincipalDatabaseAuthenticationManager.js | 279 ------- .../authenticationprovider/anonymous/add.js | 21 - .../authenticationprovider/anonymous/show.js | 35 - .../base64md5passwordfile/add.js | 40 - .../base64md5passwordfile/show.js | 38 - .../authenticationprovider/external/add.js | 40 - .../authenticationprovider/external/show.js | 38 - .../authenticationprovider/kerberos/add.js | 22 - .../authenticationprovider/kerberos/show.js | 35 - .../management/authenticationprovider/md5/add.js | 21 - .../management/authenticationprovider/md5/show.js | 35 - .../management/authenticationprovider/plain/add.js | 21 - .../authenticationprovider/plain/show.js | 35 - .../plainpasswordfile/add.js | 40 - .../plainpasswordfile/show.js | 38 - .../authenticationprovider/scram-sha-1/add.js | 21 - .../authenticationprovider/scram-sha-1/show.js | 35 - .../authenticationprovider/scram-sha-256/add.js | 21 - .../authenticationprovider/scram-sha-256/show.js | 35 - .../authenticationprovider/simpleldap/add.js | 82 -- .../authenticationprovider/simpleldap/show.js | 43 -- .../resources/js/qpid/management/controller.js | 140 ---- .../resources/js/qpid/management/editBroker.js | 188 ----- .../java/resources/js/qpid/management/editQueue.js | 219 ------ .../js/qpid/management/editVirtualHost.js | 207 ----- .../js/qpid/management/editVirtualHostNode.js | 177 ----- .../resources/js/qpid/management/group/Group.js | 204 ----- .../js/qpid/management/group/addGroupMember.js | 97 --- .../groupprovider/GroupManagingGroupProvider.js | 196 ----- .../qpid/management/groupprovider/groupfile/add.js | 40 - .../management/groupprovider/groupfile/show.js | 37 - .../groupprovider/managedgroupprovider/add.js | 26 - .../groupprovider/managedgroupprovider/show.js | 35 - .../qpid/management/logs/LogFileDownloadDialog.js | 178 ----- .../resources/js/qpid/management/logs/LogViewer.js | 228 ------ .../js/qpid/management/moveCopyMessages.js | 137 ---- .../js/qpid/management/plugin/managementhttp.js | 185 ----- .../js/qpid/management/plugin/managementjmx.js | 121 --- .../preferencesprovider/PreferencesProviderForm.js | 198 ----- .../filesystempreferences/add.js | 38 - .../filesystempreferences/show.js | 48 -- .../resources/js/qpid/management/showMessage.js | 142 ---- .../js/qpid/management/store/filekeystore/add.js | 101 --- .../js/qpid/management/store/filekeystore/show.js | 42 - .../js/qpid/management/store/filetruststore/add.js | 96 --- .../qpid/management/store/filetruststore/show.js | 42 - .../qpid/management/store/nonjavakeystore/add.js | 102 --- .../qpid/management/store/nonjavakeystore/show.js | 61 -- .../qpid/management/store/nonjavatruststore/add.js | 94 --- .../management/store/nonjavatruststore/show.js | 70 -- .../java/resources/js/qpid/management/treeView.js | 365 --------- .../management/virtualhost/providedstore/add.js | 52 -- .../management/virtualhost/providedstore/edit.js | 35 - .../management/virtualhost/providedstore/show.js | 37 - .../js/qpid/management/virtualhostnode/json/add.js | 41 - .../qpid/management/virtualhostnode/json/edit.js | 33 - .../qpid/management/virtualhostnode/json/show.js | 39 - .../src/main/java/resources/login.html | 120 --- .../resources/logs/showLogFileDownloadDialog.html | 33 - .../main/java/resources/logs/showLogViewer.html | 29 - .../src/main/java/resources/moveCopyMessages.html | 36 - .../java/resources/plugin/showManagementHttp.html | 52 -- .../java/resources/plugin/showManagementJmx.html | 32 - .../filesystempreferences/add.html | 37 - .../filesystempreferences/show.html | 21 - .../preferencesProviderForm.html | 62 -- .../java/resources/showAccessControlProvider.html | 44 -- .../src/main/java/resources/showAuthProvider.html | 45 -- .../src/main/java/resources/showBroker.html | 136 ---- .../src/main/java/resources/showConnection.html | 96 --- .../src/main/java/resources/showExchange.html | 83 -- .../src/main/java/resources/showGroupProvider.html | 45 -- .../src/main/java/resources/showMessage.html | 81 -- .../src/main/java/resources/showPlugin.html | 33 - .../src/main/java/resources/showPort.html | 102 --- .../src/main/java/resources/showPreferences.html | 79 -- .../java/resources/showPreferencesProvider.html | 38 - .../src/main/java/resources/showQueue.html | 215 ------ .../src/main/java/resources/showStore.html | 46 -- .../src/main/java/resources/showVirtualHost.html | 140 ---- .../main/java/resources/showVirtualHostNode.html | 52 -- .../java/resources/store/filekeystore/add.html | 86 --- .../java/resources/store/filekeystore/show.html | 39 - .../java/resources/store/filetruststore/add.html | 84 -- .../java/resources/store/filetruststore/show.html | 39 - .../java/resources/store/nonjavakeystore/add.html | 66 -- .../java/resources/store/nonjavakeystore/show.html | 47 -- .../resources/store/nonjavatruststore/add.html | 38 - .../resources/store/nonjavatruststore/show.html | 31 - .../src/main/java/resources/strings.html | 21 - .../resources/virtualhost/providedstore/add.html | 51 -- .../resources/virtualhost/providedstore/edit.html | 53 -- .../resources/virtualhost/providedstore/show.html | 30 - .../resources/virtualhost/sizemonitoring/add.html | 61 -- .../resources/virtualhost/sizemonitoring/edit.html | 65 -- .../resources/virtualhost/sizemonitoring/show.html | 34 - .../resources/virtualhostnode/filebased/edit.html | 36 - .../java/resources/virtualhostnode/json/add.html | 34 - .../java/resources/virtualhostnode/json/show.html | 21 - .../src/main/resources-maven/dojoconfig.properties | 25 - .../management/plugin/HttpManagementTest.java | 117 --- .../management/plugin/log/LogFileHelperTest.java | 339 --------- .../management/plugin/report/ReportRunnerTest.java | 186 ----- .../management/plugin/report/TestBinaryReport.java | 114 --- .../management/plugin/report/TestTextReport.java | 84 -- .../rest/ConfiguredObjectToMapConverterTest.java | 410 ---------- .../plugin/session/LoginLogoutReporterTest.java | 84 -- ...pid.server.management.plugin.report.QueueReport | 2 - 257 files changed, 31724 deletions(-) delete mode 100644 qpid/java/broker-plugins/management-http/src/main/appended-resources/META-INF/LICENSE.vm delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/DojoHelper.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagementConfiguration.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagementUtil.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/connector/TcpAndSslSelectChannelConnector.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/filter/ForbiddingAuthorisationFilter.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/filter/ForbiddingTraceFilter.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/filter/RedirectingAuthorisationFilter.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/log/LogFileDetails.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/log/LogFileHelper.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/report/QueueBinaryReport.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/report/QueueReport.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/report/QueueTextReport.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/report/ReportRunner.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/report/ReportableMessage.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/report/ReportableMessageHeader.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/DefinedFileServlet.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/FileServlet.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/LogFileServlet.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/ServletConnectionPrincipal.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/AbstractServlet.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/Action.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/ApiDocsServlet.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverter.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/HelperServlet.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/KeyComparator.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/LogFileListingServlet.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/LogRecordsServlet.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/LoggedOnUserPreferencesServlet.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/LogoutServlet.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/MapComparator.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/MessageContentServlet.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/MessageServlet.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/MetaDataServlet.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/PluginClassProviderAction.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/QueueReportServlet.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/RestServlet.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/SaslServlet.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/StructureServlet.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/UserPreferencesServlet.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/AbstractSpecialisedAttributeLister.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/ListAccessControlProviderAttributes.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/ListBrokerAttribute.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/ListGroupProviderAttributes.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/ListTimeZones.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/session/LoginLogoutReporter.java delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/accesscontrolprovider/aclfile/add.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/accesscontrolprovider/showAclFile.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/addAccessControlProvider.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/addAuthenticationProvider.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/addBinding.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/addExchange.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/addGroupProvider.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/addPort.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/addPreferencesProvider.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/addQueue.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/addStore.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/addVirtualHostNodeAndVirtualHost.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/addUser.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/external/add.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/external/show.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/filebased/add.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/filebased/show.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/setPassword.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/showPrincipalDatabaseAuthenticationManager.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/simpleldap/add.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/simpleldap/show.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/common/ContextVariablesEditor.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/common/ResourceWidget.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/common/TimeZoneSelector.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/css/apidocs.css delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/css/common.css delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/editBroker.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/editQueue.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/editVirtualHost.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/editVirtualHostNode.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/footer.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/grid/showColumnDefDialog.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/grid/showRowNumberLimitDialog.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/group/addGroupMember.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/group/showGroup.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/groupprovider/addGroup.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/groupprovider/groupfile/add.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/groupprovider/groupfile/show.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/groupprovider/showGroupManagingGroupProvider.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/images/auto-refresh.png delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/images/download.png delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/images/gear.png delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/images/help.png delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/images/log-viewer.png delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/images/qpid-logo.png delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/images/refresh.png delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/index.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/crypto-js/README.txt delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/crypto-js/enc-base64-min.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/crypto-js/hmac-sha1.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/crypto-js/hmac-sha256.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/authorization/checkUser.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/authorization/sasl.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ConsoleHelper.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ContextVariablesEditor.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/FormWidgetMixin.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ResourceWidget.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/TimeZoneSelector.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/UpdatableStore.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/footer.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/formatter.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/ColumnDefDialog.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/EnhancedFilter.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/EnhancedFilterTools.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/FilterSummary.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/GridUpdater.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/RowNumberLimitDialog.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/UpdatableGrid.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/metadata.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/properties.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/timezone.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/updater.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/util.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/widgetconfigurer.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/AccessControlProvider.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/AuthenticationProvider.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Broker.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Connection.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Exchange.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/GroupProvider.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/KeyStore.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Plugin.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Port.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Preferences.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/PreferencesProvider.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Queue.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/TrustStore.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/UserPreferences.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHost.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHostNode.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/accesscontrolprovider/AclFile.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/accesscontrolprovider/aclfile/add.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addAccessControlProvider.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addAuthenticationProvider.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addBinding.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addExchange.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addGroupProvider.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addPort.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addPreferencesProvider.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addQueue.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addStore.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHostNodeAndVirtualHost.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/PrincipalDatabaseAuthenticationManager.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/anonymous/add.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/anonymous/show.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/base64md5passwordfile/add.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/base64md5passwordfile/show.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/external/add.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/external/show.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/kerberos/add.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/kerberos/show.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/md5/add.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/md5/show.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/plain/add.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/plain/show.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/plainpasswordfile/add.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/plainpasswordfile/show.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/scram-sha-1/add.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/scram-sha-1/show.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/scram-sha-256/add.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/scram-sha-256/show.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/simpleldap/add.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/simpleldap/show.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/controller.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editBroker.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editQueue.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editVirtualHost.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editVirtualHostNode.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/group/Group.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/group/addGroupMember.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/groupprovider/GroupManagingGroupProvider.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/groupprovider/groupfile/add.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/groupprovider/groupfile/show.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/groupprovider/managedgroupprovider/add.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/groupprovider/managedgroupprovider/show.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/logs/LogFileDownloadDialog.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/logs/LogViewer.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/moveCopyMessages.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/plugin/managementhttp.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/plugin/managementjmx.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/preferencesprovider/PreferencesProviderForm.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/preferencesprovider/filesystempreferences/add.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/preferencesprovider/filesystempreferences/show.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/showMessage.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/filekeystore/add.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/filekeystore/show.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/filetruststore/add.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/filetruststore/show.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/nonjavakeystore/add.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/nonjavakeystore/show.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/nonjavatruststore/add.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/nonjavatruststore/show.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/treeView.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/providedstore/add.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/providedstore/edit.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/providedstore/show.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhostnode/json/add.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhostnode/json/edit.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhostnode/json/show.js delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/login.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/logs/showLogFileDownloadDialog.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/logs/showLogViewer.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/moveCopyMessages.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/plugin/showManagementHttp.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/plugin/showManagementJmx.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/preferencesprovider/filesystempreferences/add.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/preferencesprovider/filesystempreferences/show.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/preferencesprovider/preferencesProviderForm.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/showAccessControlProvider.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/showAuthProvider.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/showBroker.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/showConnection.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/showExchange.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/showGroupProvider.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/showMessage.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/showPlugin.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/showPort.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/showPreferences.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/showPreferencesProvider.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/showQueue.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/showStore.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/showVirtualHost.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/showVirtualHostNode.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/store/filekeystore/add.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/store/filekeystore/show.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/store/filetruststore/add.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/store/filetruststore/show.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/store/nonjavakeystore/add.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/store/nonjavakeystore/show.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/store/nonjavatruststore/add.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/store/nonjavatruststore/show.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/strings.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/providedstore/add.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/providedstore/edit.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/providedstore/show.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/sizemonitoring/add.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/sizemonitoring/edit.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/sizemonitoring/show.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhostnode/filebased/edit.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhostnode/json/add.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhostnode/json/show.html delete mode 100644 qpid/java/broker-plugins/management-http/src/main/resources-maven/dojoconfig.properties delete mode 100644 qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/HttpManagementTest.java delete mode 100644 qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/log/LogFileHelperTest.java delete mode 100644 qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/report/ReportRunnerTest.java delete mode 100644 qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/report/TestBinaryReport.java delete mode 100644 qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/report/TestTextReport.java delete mode 100644 qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverterTest.java delete mode 100644 qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/session/LoginLogoutReporterTest.java delete mode 100644 qpid/java/broker-plugins/management-http/src/test/resources/META-INF/services/org.apache.qpid.server.management.plugin.report.QueueReport (limited to 'qpid/java/broker-plugins/management-http/src') diff --git a/qpid/java/broker-plugins/management-http/src/main/appended-resources/META-INF/LICENSE.vm b/qpid/java/broker-plugins/management-http/src/main/appended-resources/META-INF/LICENSE.vm deleted file mode 100644 index 7a7430e2e3..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/appended-resources/META-INF/LICENSE.vm +++ /dev/null @@ -1,33 +0,0 @@ - - -#============================================== -# Third Party Dependency Licensing Information: -#============================================== - -resources/js/crypto-js/ - -This bundles portions of crypto-js, which is under the MIT licence: - - -Copyright (c) 2009-2013 Jeff Mott - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -#=============================================== diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/DojoHelper.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/DojoHelper.java deleted file mode 100644 index 31a777d0bb..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/DojoHelper.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - * - */ -package org.apache.qpid.server.management.plugin; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; -import java.io.InputStream; -import java.util.Map; -import java.util.Properties; - -public class DojoHelper -{ - private static final Logger _logger = LoggerFactory.getLogger(DojoHelper.class); - - public static final String VERSION_FILE = "dojoconfig.properties"; - public static final String DOJO_VERSION_PROPERTY = "dojo-version"; - public static final String DOJO_PATH_PROPERTY = "dojo-path"; - public static final String DIJIT_PATH_PROPERTY = "dijit-path"; - public static final String DOJOX_PATH_PROPERTY = "dojox-path"; - - private static String _version = "undefined"; - private static String _dojoPath = "/dojo-undefined/dojo"; - private static String _dijitPath = "/dojo-undefined/dijit"; - private static String _dojoxPath = "/dojo-undefined/dojox"; - - // Loads the value from the properties file. - static - { - Properties props = new Properties(); - - try - { - InputStream propertyStream = DojoHelper.class.getClassLoader().getResourceAsStream(VERSION_FILE); - if (propertyStream == null) - { - _logger.warn("Unable to find resource " + VERSION_FILE + " from classloader"); - } - else - { - try - { - props.load(propertyStream); - } - finally - { - try - { - propertyStream.close(); - } - catch (IOException e) - { - _logger.warn("Exception closing InputStream for " + VERSION_FILE + " resource:", e); - } - } - - if (_logger.isDebugEnabled()) - { - _logger.debug("Dumping Dojo Config:"); - for (Map.Entry entry : props.entrySet()) - { - _logger.debug("Property: " + entry.getKey() + " Value: " + entry.getValue()); - } - - _logger.debug("End of property dump"); - } - - _version = props.getProperty(DOJO_VERSION_PROPERTY, _version); - _dojoPath = props.getProperty(DOJO_PATH_PROPERTY, _dojoPath); - _dijitPath = props.getProperty(DIJIT_PATH_PROPERTY, _dijitPath); - _dojoxPath = props.getProperty(DOJOX_PATH_PROPERTY, _dojoxPath); - } - } - catch (IOException e) - { - // Log a warning about this and leave the values initialized to unknown. - _logger.error("Exception loading " + VERSION_FILE + " resource:", e); - } - } - - public static String getDojoVersion() - { - return _version; - } - - public static String getDojoPath() - { - return _dojoPath; - } - - public static String getDijitPath() - { - return _dijitPath; - } - - public static String getDojoxPath() - { - return _dojoxPath; - } -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java deleted file mode 100644 index fbe9f068b9..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java +++ /dev/null @@ -1,613 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin; - -import java.io.IOException; -import java.io.Writer; -import java.security.GeneralSecurityException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.EnumSet; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.net.ssl.KeyManager; -import javax.net.ssl.SSLContext; -import javax.net.ssl.TrustManager; -import javax.net.ssl.X509TrustManager; -import javax.servlet.DispatcherType; -import javax.servlet.MultipartConfigElement; -import javax.servlet.http.HttpServletRequest; - -import com.google.common.util.concurrent.Futures; -import com.google.common.util.concurrent.ListenableFuture; -import org.eclipse.jetty.io.EndPoint; -import org.eclipse.jetty.server.Connector; -import org.eclipse.jetty.server.Request; -import org.eclipse.jetty.server.Server; -import org.eclipse.jetty.server.SessionManager; -import org.eclipse.jetty.server.handler.ErrorHandler; -import org.eclipse.jetty.server.nio.SelectChannelConnector; -import org.eclipse.jetty.server.ssl.SslSelectChannelConnector; -import org.eclipse.jetty.servlet.FilterHolder; -import org.eclipse.jetty.servlet.ServletContextHandler; -import org.eclipse.jetty.servlet.ServletHolder; -import org.eclipse.jetty.util.ssl.SslContextFactory; -import org.eclipse.jetty.util.thread.QueuedThreadPool; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.apache.qpid.server.configuration.IllegalConfigurationException; -import org.apache.qpid.server.logging.messages.ManagementConsoleMessages; -import org.apache.qpid.server.management.plugin.connector.TcpAndSslSelectChannelConnector; -import org.apache.qpid.server.management.plugin.filter.ForbiddingAuthorisationFilter; -import org.apache.qpid.server.management.plugin.filter.ForbiddingTraceFilter; -import org.apache.qpid.server.management.plugin.filter.RedirectingAuthorisationFilter; -import org.apache.qpid.server.management.plugin.servlet.DefinedFileServlet; -import org.apache.qpid.server.management.plugin.servlet.FileServlet; -import org.apache.qpid.server.management.plugin.servlet.LogFileServlet; -import org.apache.qpid.server.management.plugin.servlet.rest.ApiDocsServlet; -import org.apache.qpid.server.management.plugin.servlet.rest.HelperServlet; -import org.apache.qpid.server.management.plugin.servlet.rest.LogFileListingServlet; -import org.apache.qpid.server.management.plugin.servlet.rest.LogRecordsServlet; -import org.apache.qpid.server.management.plugin.servlet.rest.LoggedOnUserPreferencesServlet; -import org.apache.qpid.server.management.plugin.servlet.rest.LogoutServlet; -import org.apache.qpid.server.management.plugin.servlet.rest.MessageContentServlet; -import org.apache.qpid.server.management.plugin.servlet.rest.MessageServlet; -import org.apache.qpid.server.management.plugin.servlet.rest.MetaDataServlet; -import org.apache.qpid.server.management.plugin.servlet.rest.QueueReportServlet; -import org.apache.qpid.server.management.plugin.servlet.rest.RestServlet; -import org.apache.qpid.server.management.plugin.servlet.rest.SaslServlet; -import org.apache.qpid.server.management.plugin.servlet.rest.StructureServlet; -import org.apache.qpid.server.management.plugin.servlet.rest.UserPreferencesServlet; -import org.apache.qpid.server.model.*; -import org.apache.qpid.server.model.adapter.AbstractPluginAdapter; -import org.apache.qpid.server.model.port.HttpPort; -import org.apache.qpid.server.model.port.PortManager; -import org.apache.qpid.server.util.ServerScopedRuntimeException; -import org.apache.qpid.transport.network.security.ssl.QpidMultipleTrustManager; -import org.apache.qpid.transport.network.security.ssl.SSLUtil; - -@ManagedObject( category = false, type = "MANAGEMENT-HTTP" ) -public class HttpManagement extends AbstractPluginAdapter implements HttpManagementConfiguration, PortManager -{ - private static final String PORT_SERVLET_ATTRIBUTE = "org.apache.qpid.server.model.Port"; - private final Logger _logger = LoggerFactory.getLogger(HttpManagement.class); - - // 10 minutes by default - public static final int DEFAULT_TIMEOUT_IN_SECONDS = 60 * 10; - public static final String TIME_OUT = "sessionTimeout"; - public static final String HTTP_BASIC_AUTHENTICATION_ENABLED = "httpBasicAuthenticationEnabled"; - public static final String HTTPS_BASIC_AUTHENTICATION_ENABLED = "httpsBasicAuthenticationEnabled"; - public static final String HTTP_SASL_AUTHENTICATION_ENABLED = "httpSaslAuthenticationEnabled"; - public static final String HTTPS_SASL_AUTHENTICATION_ENABLED = "httpsSaslAuthenticationEnabled"; - - public static final String PLUGIN_TYPE = "MANAGEMENT-HTTP"; - - private static final String OPERATIONAL_LOGGING_NAME = "Web"; - - private static final String JSESSIONID_COOKIE_PREFIX = "JSESSIONID_"; - - private Server _server; - - @ManagedAttributeField - private boolean _httpsSaslAuthenticationEnabled; - - @ManagedAttributeField - private boolean _httpSaslAuthenticationEnabled; - - @ManagedAttributeField - private boolean _httpsBasicAuthenticationEnabled; - - @ManagedAttributeField - private boolean _httpBasicAuthenticationEnabled; - - @ManagedAttributeField - private int _sessionTimeout; - - @ManagedAttributeField - private boolean _compressResponses; - - private boolean _allowPortActivation; - - @ManagedObjectFactoryConstructor - public HttpManagement(Map attributes, Broker broker) - { - super(attributes, broker); - } - - @StateTransition(currentState = {State.UNINITIALIZED,State.ERRORED}, desiredState = State.ACTIVE) - private ListenableFuture doStart() - { - getBroker().getEventLogger().message(ManagementConsoleMessages.STARTUP(OPERATIONAL_LOGGING_NAME)); - - Collection> httpPorts = getHttpPorts(getBroker().getPorts()); - _server = createServer(httpPorts); - try - { - _server.start(); - logOperationalListenMessages(httpPorts); - } - catch (Exception e) - { - throw new ServerScopedRuntimeException("Failed to start HTTP management on ports : " + httpPorts, e); - } - - getBroker().getEventLogger().message(ManagementConsoleMessages.READY(OPERATIONAL_LOGGING_NAME)); - setState(State.ACTIVE); - return Futures.immediateFuture(null); - } - - @Override - protected void onClose() - { - if (_server != null) - { - try - { - _server.stop(); - logOperationalShutdownMessage(_server); - } - catch (Exception e) - { - throw new ServerScopedRuntimeException("Failed to stop HTTP management on ports : " + getHttpPorts(getBroker().getPorts()), e); - } - } - - getBroker().getEventLogger().message(ManagementConsoleMessages.STOPPED(OPERATIONAL_LOGGING_NAME)); - } - - public int getSessionTimeout() - { - return _sessionTimeout; - } - - private Server createServer(Collection> ports) - { - if (_logger.isInfoEnabled()) - { - _logger.info("Starting up web server on " + ports); - } - _allowPortActivation = true; - - Server server = new Server(); - - QueuedThreadPool threadPool = new QueuedThreadPool(); - threadPool.setName("HttpManagement"); - threadPool.setMaxQueued(getContextValue(Integer.class, JETTY_THREAD_POOL_MAX_QUEUED)); - threadPool.setMaxThreads(getContextValue(Integer.class, JETTY_THREAD_POOL_MAX_THREADS)); - threadPool.setMinThreads(getContextValue(Integer.class, JETTY_THREAD_POOL_MIN_THREADS)); - - server.setThreadPool(threadPool); - - int lastPort = -1; - for (Port port : ports) - { - if(port instanceof HttpPort) - { - - if (!State.ACTIVE.equals(port.getDesiredState())) - { - continue; - } - ((HttpPort)port).setPortManager(this); - - if(port.getState() != State.ACTIVE) - { - - // TODO - RG - probably does nothing - port.startAsync(); - } - Connector connector = null; - - Collection transports = port.getTransports(); - if (!transports.contains(Transport.SSL)) - { - final Port thePort = port; - connector = new SelectChannelConnector() - { - @Override - public void customize(final EndPoint endpoint, final Request request) throws IOException - { - super.customize(endpoint, request); - request.setAttribute(PORT_SERVLET_ATTRIBUTE, thePort); - } - }; - } - else if (transports.contains(Transport.SSL)) - { - connector = createSslConnector((HttpPort) port); - } - else - { - throw new IllegalArgumentException("Unexpected transport on port " - + port.getName() - + ":" - + transports); - } - lastPort = port.getPort(); - String bindingAddress = ((HttpPort)port).getBindingAddress(); - if (bindingAddress != null && !bindingAddress.trim().equals("") && !bindingAddress.trim().equals("*")) - { - connector.setHost(bindingAddress.trim()); - } - connector.setPort(port.getPort()); - server.addConnector(connector); - } - else - { - throw new IllegalArgumentException("Http management can only be added to an Http port"); - } - - } - - _allowPortActivation = false; - - ServletContextHandler root = new ServletContextHandler(ServletContextHandler.SESSIONS); - root.setContextPath("/"); - root.setCompactPath(true); - server.setHandler(root); - server.setSendServerVersion(false); - final ErrorHandler errorHandler = new ErrorHandler() - { - @Override - protected void writeErrorPageBody(HttpServletRequest request, Writer writer, int code, String message, boolean showStacks) - throws IOException - { - String uri= request.getRequestURI(); - - writeErrorPageMessage(request,writer,code,message,uri); - - for (int i= 0; i < 20; i++) - writer.write("
\n"); - } - }; - root.setErrorHandler(errorHandler); - - // set servlet context attributes for broker and configuration - root.getServletContext().setAttribute(HttpManagementUtil.ATTR_BROKER, getBroker()); - root.getServletContext().setAttribute(HttpManagementUtil.ATTR_MANAGEMENT_CONFIGURATION, this); - - root.addFilter(new FilterHolder(new ForbiddingTraceFilter()), "/*", EnumSet.of(DispatcherType.REQUEST)); - FilterHolder restAuthorizationFilter = new FilterHolder(new ForbiddingAuthorisationFilter()); - restAuthorizationFilter.setInitParameter(ForbiddingAuthorisationFilter.INIT_PARAM_ALLOWED, "/service/sasl"); - root.addFilter(restAuthorizationFilter, "/api/*", EnumSet.of(DispatcherType.REQUEST)); - root.addFilter(restAuthorizationFilter, "/apidocs/*", EnumSet.of(DispatcherType.REQUEST)); - root.addFilter(restAuthorizationFilter, "/service/*", EnumSet.of(DispatcherType.REQUEST)); - root.addFilter(new FilterHolder(new RedirectingAuthorisationFilter()), HttpManagementUtil.ENTRY_POINT_PATH, EnumSet.of(DispatcherType.REQUEST)); - root.addFilter(new FilterHolder(new RedirectingAuthorisationFilter()), "/index.html", EnumSet.of(DispatcherType.REQUEST)); - root.addFilter(new FilterHolder(new RedirectingAuthorisationFilter()), "/", EnumSet.of(DispatcherType.REQUEST)); - - addRestServlet(root, "broker"); - addRestServlet(root, "virtualhostnode", VirtualHostNode.class); - addRestServlet(root, "authenticationprovider", AuthenticationProvider.class); - addRestServlet(root, "accesscontrolprovider", AccessControlProvider.class); - addRestServlet(root, "user", AuthenticationProvider.class, User.class); - addRestServlet(root, "groupprovider", GroupProvider.class); - addRestServlet(root, "group", GroupProvider.class, Group.class); - addRestServlet(root, "groupmember", GroupProvider.class, Group.class, GroupMember.class); - addRestServlet(root, "port", Port.class); - addRestServlet(root, "keystore", KeyStore.class); - addRestServlet(root, "truststore", TrustStore.class); - addRestServlet(root, "plugin", Plugin.class); - addRestServlet(root, "preferencesprovider", AuthenticationProvider.class, PreferencesProvider.class); - - addRestServlet(root, "replicationnode", VirtualHostNode.class, RemoteReplicationNode.class); - - addRestServlet(root, "virtualhost", VirtualHostNode.class, VirtualHost.class); - addRestServlet(root, "exchange", VirtualHostNode.class, VirtualHost.class, Exchange.class); - addRestServlet(root, "queue", VirtualHostNode.class, VirtualHost.class, Queue.class); - addRestServlet(root, "connection", VirtualHostNode.class, VirtualHost.class, Connection.class); - addRestServlet(root, "binding", VirtualHostNode.class, VirtualHost.class, Exchange.class, Queue.class, Binding.class); - addRestServlet(root, "session", VirtualHostNode.class, VirtualHost.class, Connection.class, Session.class); - - ServletHolder apiDocsServlet = new ServletHolder(new ApiDocsServlet(getModel(), Collections.emptyList())); - root.addServlet(apiDocsServlet, "/apidocs"); - root.addServlet(apiDocsServlet, "/apidocs/"); - root.addServlet(apiDocsServlet, "/apidocs/latest"); - root.addServlet(apiDocsServlet, "/apidocs/latest/"); - root.addServlet(new ServletHolder(new UserPreferencesServlet()), "/service/userpreferences/*"); - root.addServlet(new ServletHolder(new LoggedOnUserPreferencesServlet()), "/service/preferences"); - root.addServlet(new ServletHolder(new StructureServlet()), "/service/structure"); - root.addServlet(new ServletHolder(new MessageServlet()), "/service/message/*"); - root.addServlet(new ServletHolder(new MessageContentServlet()), "/service/message-content/*"); - root.addServlet(new ServletHolder(new QueueReportServlet()), "/service/queuereport/*"); - - - root.addServlet(new ServletHolder(new LogRecordsServlet()), "/service/logrecords"); - - root.addServlet(new ServletHolder(new MetaDataServlet(getModel())), "/service/metadata"); - - root.addServlet(new ServletHolder(new SaslServlet()), "/service/sasl"); - - root.addServlet(new ServletHolder(new DefinedFileServlet("index.html")), HttpManagementUtil.ENTRY_POINT_PATH); - root.addServlet(new ServletHolder(new DefinedFileServlet("index.html")), "/"); - root.addServlet(new ServletHolder(new LogoutServlet()), "/logout"); - - root.addServlet(new ServletHolder(new FileServlet(DojoHelper.getDojoPath(), true)), "/dojo/dojo/*"); - root.addServlet(new ServletHolder(new FileServlet(DojoHelper.getDijitPath(), true)), "/dojo/dijit/*"); - root.addServlet(new ServletHolder(new FileServlet(DojoHelper.getDojoxPath(), true)), "/dojo/dojox/*"); - - root.addServlet(new ServletHolder(new FileServlet()), "*.js"); - root.addServlet(new ServletHolder(new FileServlet()), "*.css"); - root.addServlet(new ServletHolder(new FileServlet()), "*.html"); - root.addServlet(new ServletHolder(new FileServlet()), "*.png"); - root.addServlet(new ServletHolder(new FileServlet()), "*.gif"); - root.addServlet(new ServletHolder(new FileServlet()), "*.jpg"); - root.addServlet(new ServletHolder(new FileServlet()), "*.jpeg"); - root.addServlet(new ServletHolder(new FileServlet()), "*.json"); - root.addServlet(new ServletHolder(new FileServlet()), "*.txt"); - root.addServlet(new ServletHolder(new FileServlet()), "*.xsl"); - root.addServlet(new ServletHolder(new HelperServlet()), "/service/helper"); - root.addServlet(new ServletHolder(new LogFileListingServlet()), "/service/logfilenames"); - root.addServlet(new ServletHolder(new LogFileServlet()), "/service/logfile"); - - final SessionManager sessionManager = root.getSessionHandler().getSessionManager(); - sessionManager.getSessionCookieConfig().setName(JSESSIONID_COOKIE_PREFIX + lastPort); - sessionManager.setMaxInactiveInterval((Integer)getAttribute(TIME_OUT)); - - return server; - } - - private Connector createSslConnector(final HttpPort port) - { - final Connector connector; - KeyStore keyStore = port.getKeyStore(); - Collection trustStores = port.getTrustStores(); - if (keyStore == null) - { - throw new IllegalConfigurationException("Key store is not configured. Cannot start management on HTTPS port without keystore"); - } - SslContextFactory factory = new SslContextFactory(); - factory.addExcludeProtocols(SSLUtil.SSLV3_PROTOCOL); - - if(port.getDisabledCipherSuites() != null) - { - factory.addExcludeCipherSuites(port.getDisabledCipherSuites().toArray(new String[port.getDisabledCipherSuites().size()])); - } - - if(port.getEnabledCipherSuites() != null && !port.getEnabledCipherSuites().isEmpty()) - { - factory.setIncludeCipherSuites(port.getEnabledCipherSuites().toArray(new String[port.getEnabledCipherSuites().size()])); - } - - boolean needClientCert = port.getNeedClientAuth() || port.getWantClientAuth(); - - if (needClientCert && trustStores.isEmpty()) - { - throw new IllegalConfigurationException("Client certificate authentication is enabled on AMQP port '" - + this.getName() + "' but no trust store defined"); - } - - try - { - SSLContext sslContext = SSLContext.getInstance("TLS"); - KeyManager[] keyManagers = keyStore.getKeyManagers(); - - TrustManager[] trustManagers; - if(trustStores == null || trustStores.isEmpty()) - { - trustManagers = null; - } - else if(trustStores.size() == 1) - { - trustManagers = trustStores.iterator().next().getTrustManagers(); - } - else - { - Collection trustManagerList = new ArrayList<>(); - final QpidMultipleTrustManager mulTrustManager = new QpidMultipleTrustManager(); - - for(TrustStore ts : trustStores) - { - TrustManager[] managers = ts.getTrustManagers(); - if(managers != null) - { - for(TrustManager manager : managers) - { - if(manager instanceof X509TrustManager) - { - mulTrustManager.addTrustManager((X509TrustManager)manager); - } - else - { - trustManagerList.add(manager); - } - } - } - } - if(!mulTrustManager.isEmpty()) - { - trustManagerList.add(mulTrustManager); - } - trustManagers = trustManagerList.toArray(new TrustManager[trustManagerList.size()]); - } - sslContext.init(keyManagers, trustManagers, null); - - factory.setSslContext(sslContext); - if(port.getNeedClientAuth()) - { - factory.setNeedClientAuth(true); - } - else if(port.getWantClientAuth()) - { - factory.setWantClientAuth(true); - } - } - catch (GeneralSecurityException e) - { - throw new ServerScopedRuntimeException("Cannot configure port " + port.getName() + " for transport " + Transport.SSL, e); - } - connector = port.getTransports().contains(Transport.TCP) - ? new TcpAndSslSelectChannelConnector(factory) - { - @Override - public void customize(final EndPoint endpoint, final Request request) throws IOException - { - super.customize(endpoint, request); - request.setAttribute(PORT_SERVLET_ATTRIBUTE, port); - } - } - : new SslSelectChannelConnector(factory) - { - @Override - public void customize(final EndPoint endpoint, final Request request) throws IOException - { - super.customize(endpoint, request); - request.setAttribute(PORT_SERVLET_ATTRIBUTE, port); - } - }; - return connector; - } - - private void addRestServlet(ServletContextHandler root, String name, Class... hierarchy) - { - ServletHolder servletHolder = new ServletHolder(name, new RestServlet(hierarchy)); - servletHolder.getRegistration().setMultipartConfig( - new MultipartConfigElement("", - getContextValue(Long.class, MAX_HTTP_FILE_UPLOAD_SIZE_CONTEXT_NAME), - -1l, - getContextValue(Integer.class, MAX_HTTP_FILE_UPLOAD_SIZE_CONTEXT_NAME))); - - List paths = Arrays.asList("/api/latest/" + name , - "/api/v" + BrokerModel.MODEL_MAJOR_VERSION + "/" + name ); - - for(String path : paths) - { - root.addServlet(servletHolder, path + "/*"); - } - ServletHolder docServletHolder = new ServletHolder(name+"docs", new ApiDocsServlet(getModel(), - paths, - hierarchy)); - root.addServlet(docServletHolder, "/apidocs/latest/" + name + "/"); - root.addServlet(docServletHolder, "/apidocs/v" + BrokerModel.MODEL_MAJOR_VERSION + "/" + name +"/"); - root.addServlet(docServletHolder, "/apidocs/latest/" + name ); - root.addServlet(docServletHolder, "/apidocs/v" + BrokerModel.MODEL_MAJOR_VERSION + "/" + name); - - - } - - private void logOperationalListenMessages(Collection> ports) - { - for (Port port : ports) - { - Set transports = port.getTransports(); - for (Transport transport: transports) - { - getBroker().getEventLogger().message(ManagementConsoleMessages.LISTENING(Protocol.HTTP.name(), transport.name(), port.getPort())); - } - } - } - - private void logOperationalShutdownMessage(Server server) - { - Connector[] connectors = server.getConnectors(); - for (Connector connector : connectors) - { - getBroker().getEventLogger().message(ManagementConsoleMessages.SHUTTING_DOWN(Protocol.HTTP.name(), connector.getPort())); - } - } - - - private Collection> getHttpPorts(Collection> ports) - { - Collection> httpPorts = new HashSet<>(); - for (Port port : ports) - { - if (port.getProtocols().contains(Protocol.HTTP)) - { - httpPorts.add(port); - } - } - return httpPorts; - } - - @Override - public boolean isActivationAllowed(final Port port) - { - return _allowPortActivation; - } - - @Override - public boolean isHttpsSaslAuthenticationEnabled() - { - return _httpsSaslAuthenticationEnabled; - } - - @Override - public boolean isHttpSaslAuthenticationEnabled() - { - return _httpSaslAuthenticationEnabled; - } - - @Override - public boolean isHttpsBasicAuthenticationEnabled() - { - return _httpsBasicAuthenticationEnabled; - } - - @Override - public boolean isHttpBasicAuthenticationEnabled() - { - return _httpBasicAuthenticationEnabled; - } - - @Override - public boolean isCompressResponses() - { - return _compressResponses; - } - - @Override - public AuthenticationProvider getAuthenticationProvider(HttpServletRequest request) - { - HttpPort port = (HttpPort)request.getAttribute(PORT_SERVLET_ATTRIBUTE); - return port == null ? null : port.getAuthenticationProvider(); - } - - @Override - protected void validateChange(final ConfiguredObject proxyForValidation, final Set changedAttributes) - { - super.validateChange(proxyForValidation, changedAttributes); - - HttpManagementConfiguration updated = (HttpManagementConfiguration)proxyForValidation; - if(changedAttributes.contains(HttpManagement.NAME)) - { - if(!getName().equals(updated.getName())) - { - throw new IllegalConfigurationException("Changing the name of http management plugin is not allowed"); - } - } - if (changedAttributes.contains(TIME_OUT)) - { - int value = updated.getSessionTimeout(); - if (value < 0) - { - throw new IllegalConfigurationException("Only positive integer value can be specified for the session time out attribute"); - } - } - } - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagementConfiguration.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagementConfiguration.java deleted file mode 100644 index d3d9770912..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagementConfiguration.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin; - -import java.net.SocketAddress; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.qpid.server.model.AuthenticationProvider; -import org.apache.qpid.server.model.ManagedAttribute; -import org.apache.qpid.server.model.ManagedContextDefault; -import org.apache.qpid.server.model.Plugin; - -public interface HttpManagementConfiguration> extends Plugin -{ - - @ManagedAttribute( defaultValue = "true" ) - boolean isHttpsSaslAuthenticationEnabled(); - - @ManagedAttribute( defaultValue = "true" ) - boolean isHttpSaslAuthenticationEnabled(); - - @ManagedAttribute( defaultValue = "true" ) - boolean isHttpsBasicAuthenticationEnabled(); - - @ManagedAttribute( defaultValue = "false" ) - boolean isHttpBasicAuthenticationEnabled(); - - @ManagedAttribute( defaultValue = "600" ) - public int getSessionTimeout(); - - String QPID_HELP_URL = "qpid.helpURL"; - @ManagedContextDefault(name = QPID_HELP_URL) - String DEFAULT_HELP_URL = "http://qpid.apache.org/releases/qpid-${qpid.version}/java-broker/book"; - - String HTTP_MANAGEMENT_COMPRESS_RESPONSES = "httpManagement.compressResponses"; - @ManagedContextDefault(name = HTTP_MANAGEMENT_COMPRESS_RESPONSES) - boolean DEFAULT_COMPRESS_RESPONSES = false; - - @ManagedAttribute( defaultValue = "${"+HTTP_MANAGEMENT_COMPRESS_RESPONSES+"}" ) - public boolean isCompressResponses(); - - String MAX_HTTP_FILE_UPLOAD_SIZE_CONTEXT_NAME = "maxHttpFileUploadSize"; - @ManagedContextDefault( name = MAX_HTTP_FILE_UPLOAD_SIZE_CONTEXT_NAME) - static final long DEFAULT_MAX_UPLOAD_SIZE = 100 * 1024; - - - String JETTY_THREAD_POOL_MAX_QUEUED = "jetty.threadPool.maxQueued"; - @ManagedContextDefault( name = JETTY_THREAD_POOL_MAX_QUEUED) - static final long DEFAULT_JETTY_THREAD_POOL_MAX_QUEUED = 1000; - - String JETTY_THREAD_POOL_MAX_THREADS = "jetty.threadPool.maxThreads"; - @ManagedContextDefault( name = JETTY_THREAD_POOL_MAX_THREADS) - static final long DEFAULT_JETTY_THREAD_POOL_MAX_THREADS = 50; - - - String JETTY_THREAD_POOL_MIN_THREADS = "jetty.threadPool.minThreads"; - @ManagedContextDefault( name = JETTY_THREAD_POOL_MIN_THREADS) - static final long DEFAULT_JETTY_THREAD_POOL_MIN_THREADS = 5; - - - - AuthenticationProvider getAuthenticationProvider(HttpServletRequest request); -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagementUtil.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagementUtil.java deleted file mode 100644 index 90906538d2..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagementUtil.java +++ /dev/null @@ -1,270 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin; - -import java.io.BufferedWriter; -import java.io.IOException; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.Writer; -import java.net.InetSocketAddress; -import java.net.SocketAddress; -import java.security.Principal; -import java.security.PrivilegedAction; -import java.security.cert.X509Certificate; -import java.util.Collections; -import java.util.zip.GZIPOutputStream; - -import javax.security.auth.Subject; -import javax.security.auth.x500.X500Principal; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import org.apache.commons.codec.binary.Base64; - -import org.apache.qpid.server.management.plugin.servlet.ServletConnectionPrincipal; -import org.apache.qpid.server.management.plugin.session.LoginLogoutReporter; -import org.apache.qpid.server.model.AuthenticationProvider; -import org.apache.qpid.server.model.Broker; -import org.apache.qpid.server.security.SecurityManager; -import org.apache.qpid.server.security.SubjectCreator; -import org.apache.qpid.server.security.auth.AuthenticatedPrincipal; -import org.apache.qpid.server.security.auth.AuthenticationResult.AuthenticationStatus; -import org.apache.qpid.server.security.auth.SubjectAuthenticationResult; -import org.apache.qpid.server.security.auth.UsernamePrincipal; -import org.apache.qpid.server.security.auth.manager.AnonymousAuthenticationManager; -import org.apache.qpid.server.security.auth.manager.ExternalAuthenticationManager; -import org.apache.qpid.transport.network.security.ssl.SSLUtil; - -public class HttpManagementUtil -{ - - /** - * Servlet context attribute holding a reference to a broker instance - */ - public static final String ATTR_BROKER = "Qpid.broker"; - - /** - * Servlet context attribute holding a reference to plugin configuration - */ - public static final String ATTR_MANAGEMENT_CONFIGURATION = "Qpid.managementConfiguration"; - - /** - * Default management entry URL - */ - public static final String ENTRY_POINT_PATH = "/management"; - - private static final String ATTR_LOGIN_LOGOUT_REPORTER = "Qpid.loginLogoutReporter"; - private static final String ATTR_SUBJECT = "Qpid.subject"; - private static final String ATTR_LOG_ACTOR = "Qpid.logActor"; - - private static final String ACCEPT_ENCODING_HEADER = "Accept-Encoding"; - private static final String CONTENT_ENCODING_HEADER = "Content-Encoding"; - private static final String GZIP_CONTENT_ENCODING = "gzip"; - - public static Broker getBroker(ServletContext servletContext) - { - return (Broker) servletContext.getAttribute(ATTR_BROKER); - } - - public static HttpManagementConfiguration getManagementConfiguration(ServletContext servletContext) - { - return (HttpManagementConfiguration) servletContext.getAttribute(ATTR_MANAGEMENT_CONFIGURATION); - } - - public static SocketAddress getSocketAddress(HttpServletRequest request) - { - return InetSocketAddress.createUnresolved(request.getServerName(), request.getServerPort()); - } - - public static Subject getAuthorisedSubject(HttpSession session) - { - return (Subject) session.getAttribute(ATTR_SUBJECT); - } - - public static void checkRequestAuthenticatedAndAccessAuthorized(HttpServletRequest request, Broker broker, - HttpManagementConfiguration managementConfig) - { - HttpSession session = request.getSession(); - Subject subject = getAuthorisedSubject(session); - if (subject == null) - { - subject = tryToAuthenticate(request, managementConfig); - if (subject == null) - { - throw new SecurityException("Only authenticated users can access the management interface"); - } - - Subject original = subject; - subject = new Subject(false, - original.getPrincipals(), - original.getPublicCredentials(), - original.getPrivateCredentials()); - subject.getPrincipals().add(new ServletConnectionPrincipal(request)); - subject.setReadOnly(); - - assertManagementAccess(broker.getSecurityManager(), subject); - - saveAuthorisedSubject(session, subject); - - - } - } - - public static void assertManagementAccess(final SecurityManager securityManager, Subject subject) - { - Subject.doAs(subject, new PrivilegedAction() - { - @Override - public Void run() - { - securityManager.accessManagement(); - return null; - } - }); - } - - public static void saveAuthorisedSubject(HttpSession session, Subject subject) - { - session.setAttribute(ATTR_SUBJECT, subject); - - // Cause the user logon to be logged. - session.setAttribute(ATTR_LOGIN_LOGOUT_REPORTER, - new LoginLogoutReporter(subject, getBroker(session.getServletContext()))); - } - - public static Subject tryToAuthenticate(HttpServletRequest request, HttpManagementConfiguration managementConfig) - { - Subject subject = null; - final AuthenticationProvider authenticationProvider = managementConfig.getAuthenticationProvider(request); - SubjectCreator subjectCreator = authenticationProvider.getSubjectCreator(request.isSecure()); - String remoteUser = request.getRemoteUser(); - - if (remoteUser != null || authenticationProvider instanceof AnonymousAuthenticationManager) - { - subject = authenticateUser(subjectCreator, remoteUser, null); - } - else if(authenticationProvider instanceof ExternalAuthenticationManager - && Collections.list(request.getAttributeNames()).contains("javax.servlet.request.X509Certificate")) - { - Principal principal = null; - X509Certificate[] certificates = - (X509Certificate[]) request.getAttribute("javax.servlet.request.X509Certificate"); - if(certificates != null && certificates.length != 0) - { - principal = certificates[0].getSubjectX500Principal(); - - if(!Boolean.valueOf(String.valueOf(authenticationProvider.getAttribute(ExternalAuthenticationManager.ATTRIBUTE_USE_FULL_DN)))) - { - String username; - String dn = ((X500Principal) principal).getName(X500Principal.RFC2253); - - - username = SSLUtil.getIdFromSubjectDN(dn); - principal = new UsernamePrincipal(username); - } - - subject = subjectCreator.createSubjectWithGroups(new AuthenticatedPrincipal(principal)); - } - } - else - { - String header = request.getHeader("Authorization"); - if (header != null) - { - String[] tokens = header.split("\\s"); - if (tokens.length >= 2 && "BASIC".equalsIgnoreCase(tokens[0])) - { - boolean isBasicAuthSupported = false; - if (request.isSecure()) - { - isBasicAuthSupported = managementConfig.isHttpsBasicAuthenticationEnabled(); - } - else - { - isBasicAuthSupported = managementConfig.isHttpBasicAuthenticationEnabled(); - } - if (isBasicAuthSupported) - { - String base64UsernameAndPassword = tokens[1]; - String[] credentials = (new String(Base64.decodeBase64(base64UsernameAndPassword.getBytes()))).split(":", 2); - if (credentials.length == 2) - { - subject = authenticateUser(subjectCreator, credentials[0], credentials[1]); - } - } - } - } - } - return subject; - } - - private static Subject authenticateUser(SubjectCreator subjectCreator, String username, String password) - { - SubjectAuthenticationResult authResult = subjectCreator.authenticate(username, password); - if (authResult.getStatus() == AuthenticationStatus.SUCCESS) - { - return authResult.getSubject(); - } - return null; - } - - public static Writer getOutputWriter(final HttpServletRequest request, final HttpServletResponse response) - throws IOException - { - return getOutputWriter(request, response, getManagementConfiguration(request.getServletContext())); - } - - public static Writer getOutputWriter(final HttpServletRequest request, final HttpServletResponse response, HttpManagementConfiguration managementConfiguration) - throws IOException - { - Writer writer; - writer = new BufferedWriter(new OutputStreamWriter(getOutputStream(request,response, managementConfiguration))); - - return writer; - } - - public static OutputStream getOutputStream(final HttpServletRequest request, final HttpServletResponse response) - throws IOException - { - return getOutputStream(request, response, getManagementConfiguration(request.getServletContext())); - } - - public static OutputStream getOutputStream(final HttpServletRequest request, final HttpServletResponse response, HttpManagementConfiguration managementConfiguration) - throws IOException - { - OutputStream outputStream; - if(managementConfiguration.isCompressResponses() - && Collections.list(request.getHeaderNames()).contains(ACCEPT_ENCODING_HEADER) - && request.getHeader(ACCEPT_ENCODING_HEADER).contains(GZIP_CONTENT_ENCODING)) - { - outputStream = new GZIPOutputStream(response.getOutputStream()); - response.setHeader(CONTENT_ENCODING_HEADER, GZIP_CONTENT_ENCODING); - } - else - { - outputStream = response.getOutputStream(); - } - return outputStream; - } -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/connector/TcpAndSslSelectChannelConnector.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/connector/TcpAndSslSelectChannelConnector.java deleted file mode 100644 index 197032398e..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/connector/TcpAndSslSelectChannelConnector.java +++ /dev/null @@ -1,378 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.connector; - -import java.io.IOException; -import java.nio.channels.SelectionKey; -import java.nio.channels.SocketChannel; - -import javax.net.ssl.SSLEngine; -import javax.net.ssl.SSLSession; - -import org.eclipse.jetty.http.HttpSchemes; -import org.eclipse.jetty.io.AsyncEndPoint; -import org.eclipse.jetty.io.Buffer; -import org.eclipse.jetty.io.Connection; -import org.eclipse.jetty.io.EndPoint; -import org.eclipse.jetty.io.nio.AsyncConnection; -import org.eclipse.jetty.io.nio.IndirectNIOBuffer; -import org.eclipse.jetty.io.nio.SelectChannelEndPoint; -import org.eclipse.jetty.io.nio.SelectorManager; -import org.eclipse.jetty.io.nio.SslConnection; -import org.eclipse.jetty.server.AsyncHttpConnection; -import org.eclipse.jetty.server.Request; -import org.eclipse.jetty.server.nio.SelectChannelConnector; -import org.eclipse.jetty.server.ssl.SslCertificates; -import org.eclipse.jetty.util.log.Log; -import org.eclipse.jetty.util.log.Logger; -import org.eclipse.jetty.util.ssl.SslContextFactory; - -public class TcpAndSslSelectChannelConnector extends SelectChannelConnector -{ - - private static final Logger LOG = Log.getLogger(TcpAndSslSelectChannelConnector.class); - - private final SslContextFactory _sslContextFactory; - - public TcpAndSslSelectChannelConnector(SslContextFactory factory) - { - _sslContextFactory = factory; - addBean(_sslContextFactory); - setUseDirectBuffers(false); - setSoLingerTime(30000); - } - - - @Override - public void customize(EndPoint endpoint, Request request) throws IOException - { - if(endpoint instanceof SslConnection.SslEndPoint) - { - request.setScheme(HttpSchemes.HTTPS); - } - - super.customize(endpoint,request); - - if(endpoint instanceof SslConnection.SslEndPoint) - { - SslConnection.SslEndPoint sslEndpoint = (SslConnection.SslEndPoint) endpoint; - SSLEngine sslEngine = sslEndpoint.getSslEngine(); - SSLSession sslSession = sslEngine.getSession(); - - SslCertificates.customize(sslSession, endpoint, request); - } - } - - @Override - protected AsyncConnection newConnection(SocketChannel channel, AsyncEndPoint endpoint) - { - return new ProtocolIdentifyingConnection((ProtocolIdentifyingEndpoint) endpoint); - } - - @Override - protected SelectChannelEndPoint newEndPoint(final SocketChannel channel, - final SelectorManager.SelectSet selectSet, - final SelectionKey key) throws IOException - { - - ProtocolIdentifyingEndpoint endpoint = new ProtocolIdentifyingEndpoint(channel,selectSet,key, getMaxIdleTime()); - endpoint.setConnection(selectSet.getManager().newConnection(channel, endpoint, key.attachment())); - return endpoint; - } - - protected SSLEngine createSSLEngine(SocketChannel channel) throws IOException - { - SSLEngine engine; - if (channel != null) - { - String peerHost = channel.socket().getInetAddress().getHostAddress(); - int peerPort = channel.socket().getPort(); - engine = _sslContextFactory.newSslEngine(peerHost, peerPort); - } - else - { - engine = _sslContextFactory.newSslEngine(); - } - - engine.setUseClientMode(false); - return engine; - } - - @Override - protected void doStart() throws Exception - { - _sslContextFactory.checkKeyStore(); - _sslContextFactory.start(); - - SSLEngine sslEngine = _sslContextFactory.newSslEngine(); - - sslEngine.setUseClientMode(false); - - SSLSession sslSession = sslEngine.getSession(); - - if (getRequestHeaderSize() _appenders; - - public LogFileHelper(Collection appenders) - { - super(); - _appenders = appenders; - } - - public List findLogFileDetails(String[] requestedFiles) - { - List logFiles = new ArrayList(); - Map> cache = new HashMap>(); - for (int i = 0; i < requestedFiles.length; i++) - { - String logFile = requestedFiles[i]; - if ("".equals(logFile)) - { - throw new IllegalArgumentException("Log file parameter is empty"); - } - int pos = logFile.indexOf("/"); - if (pos == -1) - { - throw new IllegalArgumentException("Log file parameter '" + logFile + "' does not include an appender name"); - } - if (pos == logFile.length()) - { - throw new IllegalArgumentException("Log file parameter '" + logFile + "' does not include an file name"); - } - - String appenderName = logFile.substring(0, pos); - String fileName = logFile.substring(pos + 1); - - List appenderFiles = cache.get(appenderName); - if (appenderFiles == null) - { - Appender fileAppender = null; - for (Appender appender : _appenders) - { - if (appenderName.equals(appender.getName())) - { - fileAppender = appender; - break; - } - } - if (fileAppender == null) - { - continue; - } - appenderFiles = getAppenderFiles(fileAppender, true); - if (appenderFiles == null) - { - continue; - } - cache.put(appenderName, appenderFiles); - } - for (LogFileDetails logFileDetails : appenderFiles) - { - if (logFileDetails.getName().equals(fileName)) - { - logFiles.add(logFileDetails); - break; - } - } - } - return logFiles; - } - - public List getLogFileDetails(boolean includeLogFileLocation) - { - List results = new ArrayList(); - for (Appender appender : _appenders) - { - List appenderFiles = getAppenderFiles(appender, includeLogFileLocation); - if (appenderFiles != null) - { - results.addAll(appenderFiles); - } - } - return results; - } - - public void writeLogFiles(List logFiles, OutputStream os) throws IOException - { - ZipOutputStream out = new ZipOutputStream(os); - try - { - addLogFileEntries(logFiles, out); - } - finally - { - out.close(); - } - } - - public void writeLogFile(File file, OutputStream os) throws IOException - { - FileInputStream fis = new FileInputStream(file); - try - { - byte[] bytes = new byte[BUFFER_LENGTH]; - int length = 1; - while ((length = fis.read(bytes)) != -1) - { - os.write(bytes, 0, length); - } - } - finally - { - fis.close(); - } - } - - private List getAppenderFiles(Appender appender, boolean includeLogFileLocation) - { - if (appender instanceof QpidCompositeRollingAppender) - { - return listQpidCompositeRollingAppenderFiles((QpidCompositeRollingAppender) appender, includeLogFileLocation); - } - else if (appender instanceof FileAppender) - { - return listFileAppenderFiles((FileAppender) appender, includeLogFileLocation); - } - return null; - } - - private List listFileAppenderFiles(FileAppender appender, boolean includeLogFileLocation) - { - String appenderFilePath = appender.getFile(); - File appenderFile = new File(appenderFilePath); - if (appenderFile.exists()) - { - return listLogFiles(appenderFile.getParentFile(), appenderFile.getName(), appender.getName(), "", includeLogFileLocation); - } - return Collections.emptyList(); - } - - private List listQpidCompositeRollingAppenderFiles(QpidCompositeRollingAppender appender, boolean includeLogFileLocation) - { - List files = listFileAppenderFiles((FileAppender) appender, includeLogFileLocation); - String appenderFilePath = appender.getFile(); - File appenderFile = new File(appenderFilePath); - File backupFolder = new File(appender.getBackupFilesToPath()); - if (backupFolder.exists()) - { - String backupFolderName = backupFolder.getName() + "/"; - List backedUpFiles = listLogFiles(backupFolder, appenderFile.getName(), appender.getName(), - backupFolderName, includeLogFileLocation); - files.addAll(backedUpFiles); - } - return files; - } - - private List listLogFiles(File parent, String baseFileName, String appenderName, String relativePath, - boolean includeLogFileLocation) - { - List files = new ArrayList(); - for (File file : parent.listFiles()) - { - String name = file.getName(); - if (name.startsWith(baseFileName)) - { - String displayPath = name; - if (!relativePath.equals("")) - { - displayPath = relativePath + name; - } - files.add(new LogFileDetails(displayPath, appenderName, includeLogFileLocation ? file : null, getMimeType(name), file.length(), - file.lastModified())); - } - } - return files; - } - - private String getMimeType(String fileName) - { - if (fileName.endsWith(GZIP_EXTENSION)) - { - return GZIP_MIME_TYPE; - } - return TEXT_MIME_TYPE; - } - - private void addLogFileEntries(List files, ZipOutputStream out) throws IOException - { - for (LogFileDetails logFileDetails : files) - { - File file = logFileDetails.getLocation(); - if (file.exists()) - { - ZipEntry entry = new ZipEntry(logFileDetails.getAppenderName() + "/" + logFileDetails.getName()); - entry.setSize(file.length()); - out.putNextEntry(entry); - writeLogFile(file, out); - out.closeEntry(); - } - out.flush(); - } - } - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/report/QueueBinaryReport.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/report/QueueBinaryReport.java deleted file mode 100644 index d842de3f1b..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/report/QueueBinaryReport.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.report; - -public abstract class QueueBinaryReport extends QueueReport -{ - public QueueBinaryReport() - { - } -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/report/QueueReport.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/report/QueueReport.java deleted file mode 100644 index 23b24aaf8d..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/report/QueueReport.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.report; - -import org.apache.qpid.server.model.Queue; -import org.apache.qpid.server.model.VirtualHost; - -/** - *

- * The QueueReport class provides an extension point for installations to provide custom management reporting on - * queues through the REST API. - *

- * - *

- * A custom QueueReport must extend either {@link org.apache.qpid.server.management.plugin.report.QueueTextReport} - * or {@link org.apache.qpid.server.management.plugin.report.QueueBinaryReport}. The report implementation must - * define a {@link #getName() name} which is unique amongst all installed reports. The report class must be present - * in the classpath of the broker, and a provider-configuration file named - * org.apache.qpid.server.management.plugin.report.QueueReport must be added in the resource directory - * META-INF/services directory with the binary name of the implementation (as described in - * {@link java.util.ServiceLoader ServiceLoader}). - *

- * - *

Running reports

- *

- * The report can be run using the URL: - * {@code http:///service/queuereport///[?param1=x¶m2=y...]} - *

- * - *

Report Parameters

- * - *

- * Reports can take parameters from the query string of the HTTP request. For every parameter in the query string - * the system will look for a setter on the report object with either a String or String[] parameter. Thus if - * the query string contains {@code foo=bar}, then the system will look for a setter {@code setFoo(String value)} or - * {@code setFoo(String[] value)}. If the same parameter occurs multiple times in the query string then only the - * array variant of the setter will be called. - *

- *

- * Setters for the parameters are guaranteed to be called before the first message is added to the report. - *

- * - *

- * NOTE: In order to comply with the requirements of the {@link java.util.ServiceLoader ServiceLoader} api, all - * implementations of QueueReport MUST provide a public no-args constructor. - *

- * @param - */ -public abstract class QueueReport -{ - private Queue _queue; - - QueueReport() - { - - } - - /** - * Gets the name of the report. - *

- * The name of the report must be unique amongst all installed implementations. The name of the report - * is examined by the Qpid immediately upon construction. The name should not change during - * the lifetime of the object (the value is only meaningful to the system at the time of initial construction) - * and all instances of the same concrete implementation should have the same name. - *

- * @return the name of the report - */ - public abstract String getName(); - - /** - * Get the name of the queue against which the report is being run. - * - * @return the name of the queue - */ - public final String getQueueName() - { - return _queue.getName(); - } - - final void setQueue(final Queue queue) - { - _queue = queue; - } - - /** - * Get the name of the virtual host against which the report is being run. - * - * @return the name of the virtual host - */ - public final String getVirtualHostName() - { - return _queue.getParent(VirtualHost.class).getName(); - } - - /** - * - * The value returned by getContentType() will be used to set the Content-Type HTTP header field - * - * @return the value to use for the content-type HTTP header field - */ - public abstract String getContentType(); - - /** - * Called by the system to add a message to the report. - * - *

- * The method is called by the system for every message on the queue, or until {@link #isComplete()} returns true. - *

- * @param reportableMessage the message to add to the report - */ - public abstract void addMessage(final ReportableMessage reportableMessage); - - /** - * Informs the system if the report is complete (i.e. does not need to report on any more messages). - * - *

- * This method will be called by the system after each message is {@link #addMessage(ReportableMessage) added} - * to the report. If a report is only interested in some messages, and can determine that the addition of more - * messages will not vary the content of the report, then it can return true. - *

- *

- * If this method always returns false, then all messages from the queue will be added to the report. - *

- *

- * NOTE: Retrieving content or properties of the message may require it to be reloaded from disk, and so care - * should be taken by reports to only access properties/content of the message if it is going to be required - * for the report production. - *

- * - * @return true if the report does not want to report on any more messages in the queue - */ - public abstract boolean isComplete(); - - /** - * Called by the system to get the content of the report to retrun to the user. - *

- * The system guarantees to only call this method once - *

- * @return the report content. - */ - public abstract T getReport(); - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/report/QueueTextReport.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/report/QueueTextReport.java deleted file mode 100644 index 09bc5c4229..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/report/QueueTextReport.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.report; - -public abstract class QueueTextReport extends QueueReport -{ - public QueueTextReport() - { - } -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/report/ReportRunner.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/report/ReportRunner.java deleted file mode 100644 index 2a05cfc9a1..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/report/ReportRunner.java +++ /dev/null @@ -1,408 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.report; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.nio.ByteBuffer; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Date; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.ServiceLoader; -import java.util.Set; -import java.util.UUID; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.apache.qpid.server.message.AMQMessageHeader; -import org.apache.qpid.server.message.ServerMessage; -import org.apache.qpid.server.model.Queue; -import org.apache.qpid.server.queue.QueueEntry; -import org.apache.qpid.server.queue.QueueEntryVisitor; - -public class ReportRunner -{ - private static final Logger LOGGER = LoggerFactory.getLogger(ReportRunner.class); - - private static final Set IMMUTABLE_CLASSES = new HashSet<>(Arrays.asList( - Boolean.class, - Byte.class, - Short.class, - Character.class, - Integer.class, - Long.class, - Float.class, - Double.class, - UUID.class, - Date.class, - String.class - )); - - private ReportRunner(final QueueReport report) - { - _report = report; - } - - public boolean isBinaryReport() - { - return _report instanceof QueueBinaryReport; - } - - public static ReportRunner createRunner(final String reportName, final Map parameterMap) - { - QueueReport report = getReport(reportName); - setReportParameters(report, parameterMap); - return new ReportRunner<>(report); - } - - private static void setReportParameters(final QueueReport report, final Map parameterMap) - { - if(parameterMap != null && !parameterMap.isEmpty()) - { - Class clazz = report.getClass(); - for(Map.Entry entry : parameterMap.entrySet()) - { - String key = entry.getKey(); - String[] value = entry.getValue(); - if(isValidName(key)) - { - - StringBuilder setterName = new StringBuilder("set"); - setterName.append(key.substring(0,1).toUpperCase()); - if(key.length()>1) - { - setterName.append(key.substring(1)); - } - Method method = null; - try - { - - if (value == null || value.length == 0 || value.length == 1) - { - try - { - method = clazz.getMethod(setterName.toString(), String.class); - method.invoke(report, value == null || value.length == 0 ? null : value[0]); - } - catch (NoSuchMethodException | IllegalAccessException e) - { - method = null; - } - } - if (method == null) - { - try - { - method = clazz.getMethod(setterName.toString(), String[].class); - method.invoke(report, new Object[] { value }); - } - catch (NoSuchMethodException | IllegalAccessException e) - { - LOGGER.info("Unknown parameter '" - + key - + "' (no setter) for report " - + report.getName()); - } - } - } - catch (InvocationTargetException e) - { - LOGGER.info("Error setting parameter '" + key + "' for report " + report.getName(), e); - } - } - else - { - LOGGER.info("Invalid parameter name '" + key + "' running report " + report.getName()); - } - } - } - } - - private static boolean isValidName(final String key) - { - if(key != null && key.length() != 0) - { - if(Character.isJavaIdentifierStart(key.charAt(0))) - { - for(int i = 1; i < key.length(); i++) - { - if(!Character.isJavaIdentifierPart(key.charAt(i))) - { - return false; - } - } - return true; - } - - } - return false; - - } - - private static QueueReport getReport(final String reportName) - { - ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); - for (final QueueReport report : ServiceLoader.load(QueueReport.class, classLoader)) - { - if (report.getName().equals(reportName)) - { - try - { - return report.getClass().newInstance(); - } - catch (InstantiationException | IllegalAccessException e) - { - // can't happen as by definition must have public noargs constructor - } - } - } - throw new IllegalArgumentException("Unknown report: " + reportName); - } - - public String getContentType() - { - return _report.getContentType(); - } - - - private static class ReportVisitor implements QueueEntryVisitor - { - - private final QueueReport _report; - - public ReportVisitor(final QueueReport report) - { - _report = report; - } - - @Override - public boolean visit(final QueueEntry entry) - { - _report.addMessage(convertMessage(entry.getMessage())); - return _report.isComplete(); - } - - - } - - - private static ReportableMessage convertMessage(final ServerMessage message) - { - return new ReportableMessage() - { - @Override - public String getInitialRoutingAddress() - { - return message.getInitialRoutingAddress(); - } - - @Override - public ReportableMessageHeader getMessageHeader() - { - return convertMessageHeader(message.getMessageHeader()); - } - - @Override - public ByteBuffer getContent() - { - ByteBuffer content = message.getContent(0, (int) getSize()); - - return content.asReadOnlyBuffer(); - } - - @Override - public boolean isPersistent() - { - return message.isPersistent(); - } - - @Override - public long getSize() - { - return message.getSize(); - } - - @Override - public long getExpiration() - { - return message.getExpiration(); - } - - @Override - public long getMessageNumber() - { - return message.getMessageNumber(); - } - - @Override - public long getArrivalTime() - { - return message.getArrivalTime(); - } - }; - } - - private static ReportableMessageHeader convertMessageHeader(final AMQMessageHeader messageHeader) - { - return new ReportableMessageHeader() - { - @Override - public String getCorrelationId() - { - return messageHeader.getCorrelationId(); - } - - @Override - public long getExpiration() - { - return messageHeader.getExpiration(); - } - - @Override - public String getUserId() - { - return messageHeader.getUserId(); - } - - @Override - public String getAppId() - { - return messageHeader.getAppId(); - } - - @Override - public String getMessageId() - { - return messageHeader.getMessageId(); - } - - @Override - public String getMimeType() - { - return messageHeader.getMimeType(); - } - - @Override - public String getEncoding() - { - return messageHeader.getEncoding(); - } - - @Override - public byte getPriority() - { - return messageHeader.getPriority(); - } - - @Override - public long getTimestamp() - { - return messageHeader.getTimestamp(); - } - - @Override - public String getType() - { - return messageHeader.getType(); - } - - @Override - public String getReplyTo() - { - return messageHeader.getReplyTo(); - } - - @Override - public Object getHeader(final String name) - { - return makeImmutable(messageHeader.getHeader(name)); - } - - @Override - public boolean containsHeaders(final Set names) - { - return messageHeader.containsHeaders(names); - } - - @Override - public boolean containsHeader(final String name) - { - return messageHeader.containsHeader(name); - } - - @Override - public Collection getHeaderNames() - { - return Collections.unmodifiableCollection(messageHeader.getHeaderNames()); - } - }; - } - - private static Object makeImmutable(final Object value) - { - if(value == null || IMMUTABLE_CLASSES.contains(value.getClass())) - { - return value; - } - else if(value instanceof byte[]) - { - return ByteBuffer.wrap((byte[])value).asReadOnlyBuffer(); - } - else if(value instanceof List) - { - List orig = (List) value; - List copy = new ArrayList<>(orig.size()); - for(Object element : orig) - { - copy.add(makeImmutable(element)); - } - return copy; - } - else if(value instanceof Map) - { - Map orig = (Map) value; - LinkedHashMap copy = new LinkedHashMap<>(); - for(Map.Entry entry : orig.entrySet()) - { - copy.put(makeImmutable(entry.getKey()),makeImmutable(entry.getValue())); - } - return copy; - } - else return null; - } - - private final QueueReport _report; - - public final T runReport(Queue queue) - { - _report.setQueue(queue); - ReportVisitor visitor = new ReportVisitor(_report); - queue.visit(visitor); - return _report.getReport(); - } -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/report/ReportableMessage.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/report/ReportableMessage.java deleted file mode 100644 index 00b6c4abeb..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/report/ReportableMessage.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.report; - -import java.nio.ByteBuffer; - -public interface ReportableMessage -{ - String getInitialRoutingAddress(); - - ReportableMessageHeader getMessageHeader(); - - public ByteBuffer getContent(); - - boolean isPersistent(); - - long getSize(); - - long getExpiration(); - - long getMessageNumber(); - - long getArrivalTime(); -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/report/ReportableMessageHeader.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/report/ReportableMessageHeader.java deleted file mode 100644 index e78415f8d0..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/report/ReportableMessageHeader.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.report; - -import java.util.Collection; -import java.util.Set; - -public interface ReportableMessageHeader -{ - String getCorrelationId(); - - long getExpiration(); - - String getUserId(); - - String getAppId(); - - String getMessageId(); - - String getMimeType(); - - String getEncoding(); - - byte getPriority(); - - long getTimestamp(); - - String getType(); - - String getReplyTo(); - - Object getHeader(String name); - - boolean containsHeaders(Set names); - - boolean containsHeader(String name); - - Collection getHeaderNames(); - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/DefinedFileServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/DefinedFileServlet.java deleted file mode 100644 index 2f6f55e042..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/DefinedFileServlet.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.qpid.server.management.plugin.servlet; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.qpid.server.management.plugin.HttpManagementUtil; - -public class DefinedFileServlet extends HttpServlet -{ - - private static final String FILENAME_INIT_PARAMETER = "filename"; - - private String _filename; - - public DefinedFileServlet() - { - super(); - } - - public DefinedFileServlet(String filename) - { - _filename = filename; - } - - @Override - public void init() throws ServletException - { - ServletConfig config = getServletConfig(); - String fileName = config.getInitParameter(FILENAME_INIT_PARAMETER); - if (fileName != null && !"".equals(fileName)) - { - _filename = fileName; - } - } - - @Override - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException - { - try (OutputStream output = HttpManagementUtil.getOutputStream(request, response)) - { - try(InputStream fileInput = getClass().getResourceAsStream("/resources/" + _filename)) - { - if (fileInput != null) - { - byte[] buffer = new byte[1024]; - response.setStatus(HttpServletResponse.SC_OK); - int read = 0; - - while ((read = fileInput.read(buffer)) > 0) - { - output.write(buffer, 0, read); - } - } - else - { - response.sendError(HttpServletResponse.SC_NOT_FOUND, "unknown file: " + _filename); - } - } - } - } -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/FileServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/FileServlet.java deleted file mode 100644 index 1c741d97e8..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/FileServlet.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.servlet; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.URL; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.qpid.server.management.plugin.HttpManagementUtil; - -public class FileServlet extends HttpServlet -{ - private static final String RESOURCES_PREFIX = "/resources"; - private static final Map CONTENT_TYPES; - - static - { - - Map contentTypes = new HashMap(); - contentTypes.put("js", "application/javascript"); - contentTypes.put("html", "text/html"); - contentTypes.put("css", "text/css"); - contentTypes.put("json", "application/json"); - contentTypes.put("jpg", "image/jpg"); - contentTypes.put("png", "image/png"); - contentTypes.put("gif", "image/gif"); - CONTENT_TYPES = Collections.unmodifiableMap(contentTypes); - } - - private final String _resourcePathPrefix; - private final boolean _usePathInfo; - - public FileServlet() - { - this(RESOURCES_PREFIX, false); - } - - public FileServlet(String resourcePathPrefix, boolean usePathInfo) - { - _resourcePathPrefix = resourcePathPrefix; - _usePathInfo = usePathInfo; - } - - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException - { - String filename = null; - if(_usePathInfo) - { - filename = request.getPathInfo(); - } - else - { - filename = request.getServletPath(); - } - - if(filename.contains(".")) - { - String suffix = filename.substring(filename.lastIndexOf('.')+1); - String contentType = CONTENT_TYPES.get(suffix); - if(contentType != null) - { - response.setContentType(contentType); - } - } - - URL resourceURL = getClass().getResource(_resourcePathPrefix + filename); - if(resourceURL != null) - { - response.setStatus(HttpServletResponse.SC_OK); - InputStream fileInput = resourceURL.openStream(); - try - { - byte[] buffer = new byte[1024]; - int read = 0; - OutputStream output = HttpManagementUtil.getOutputStream(request, response); - try - { - while((read = fileInput.read(buffer)) != -1) - { - output.write(buffer, 0, read); - } - } - finally - { - output.close(); - } - } - finally - { - fileInput.close(); - } - } - else - { - response.sendError(HttpServletResponse.SC_NOT_FOUND, "unknown file"); - } - - } - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/LogFileServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/LogFileServlet.java deleted file mode 100644 index 321cfae66c..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/LogFileServlet.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.qpid.server.management.plugin.servlet; - -import java.io.IOException; -import java.io.OutputStream; -import java.text.SimpleDateFormat; -import java.util.Collections; -import java.util.Date; -import java.util.List; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.log4j.LogManager; -import org.apache.qpid.server.management.plugin.log.LogFileDetails; -import org.apache.qpid.server.management.plugin.log.LogFileHelper; -import org.apache.qpid.server.management.plugin.servlet.rest.AbstractServlet; - -public class LogFileServlet extends AbstractServlet -{ - private static final String PARAMETER_LOG_FILE = "l"; - - private static final long serialVersionUID = 1L; - - public static final String LOGS_FILE_NAME = "qpid-logs-%s.zip"; - public static final String DATE_FORMAT = "yyyy-MM-dd-mmHHss"; - - @Override - protected void doGetWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws IOException, - ServletException - { - response.setHeader("Cache-Control", "no-cache"); - response.setHeader("Pragma", "no-cache"); - response.setDateHeader("Expires", 0); - - if (!getBroker().getSecurityManager().authoriseLogsAccess()) - { - response.sendError(HttpServletResponse.SC_FORBIDDEN, "Log files download is denied"); - return; - } - - String[] requestedFiles = request.getParameterValues(PARAMETER_LOG_FILE); - - if (requestedFiles == null || requestedFiles.length == 0) - { - response.setStatus(HttpServletResponse.SC_BAD_REQUEST); - return; - } - - @SuppressWarnings("unchecked") - LogFileHelper helper = new LogFileHelper(Collections.list(LogManager.getRootLogger().getAllAppenders())); - - List logFiles = null; - - try - { - logFiles = helper.findLogFileDetails(requestedFiles); - } - catch(IllegalArgumentException e) - { - response.sendError(HttpServletResponse.SC_BAD_REQUEST); - return; - } - - if (logFiles.size() == 0) - { - response.sendError(HttpServletResponse.SC_NOT_FOUND); - return; - } - - String fileName = String.format(LOGS_FILE_NAME, new SimpleDateFormat(DATE_FORMAT).format(new Date())); - response.setStatus(HttpServletResponse.SC_OK); - response.setHeader("Content-Disposition", "attachment;filename=" + fileName); - response.setContentType(LogFileHelper.ZIP_MIME_TYPE); - - OutputStream os = response.getOutputStream(); - try - { - helper.writeLogFiles(logFiles, os); - } - finally - { - if (os != null) - { - os.close(); - } - } - } - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/ServletConnectionPrincipal.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/ServletConnectionPrincipal.java deleted file mode 100644 index 18a026ec93..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/ServletConnectionPrincipal.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.servlet; - -import org.apache.qpid.server.security.auth.ManagementConnectionPrincipal; -import org.apache.qpid.server.security.auth.SocketConnectionPrincipal; - -import javax.servlet.ServletRequest; -import java.net.InetSocketAddress; -import java.net.SocketAddress; - -public class ServletConnectionPrincipal implements ManagementConnectionPrincipal -{ - private final InetSocketAddress _address; - - public ServletConnectionPrincipal(ServletRequest request) - { - _address = new InetSocketAddress(request.getRemoteHost(), request.getRemotePort()); - } - - @Override - public SocketAddress getRemoteAddress() - { - return _address; - } - - @Override - public String getName() - { - return _address.toString(); - } - - @Override - public boolean equals(final Object o) - { - if (this == o) - { - return true; - } - if (o == null || getClass() != o.getClass()) - { - return false; - } - - final ServletConnectionPrincipal that = (ServletConnectionPrincipal) o; - - if (!_address.equals(that._address)) - { - return false; - } - - return true; - } - - @Override - public int hashCode() - { - return _address.hashCode(); - } - - @Override - public String getType() - { - return "HTTP"; - } -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/AbstractServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/AbstractServlet.java deleted file mode 100644 index ef32d352bb..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/AbstractServlet.java +++ /dev/null @@ -1,291 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.servlet.rest; - -import java.io.IOException; -import java.io.OutputStream; -import java.io.Writer; -import java.security.PrivilegedActionException; -import java.security.PrivilegedExceptionAction; - -import javax.security.auth.Subject; -import javax.servlet.ServletConfig; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.codehaus.jackson.JsonGenerationException; -import org.codehaus.jackson.map.JsonMappingException; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.SerializationConfig; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.apache.qpid.server.management.plugin.HttpManagementConfiguration; -import org.apache.qpid.server.management.plugin.HttpManagementUtil; -import org.apache.qpid.server.model.Broker; -import org.apache.qpid.server.util.ConnectionScopedRuntimeException; - -public abstract class AbstractServlet extends HttpServlet -{ - private static final Logger LOGGER = LoggerFactory.getLogger(AbstractServlet.class); - - private Broker _broker; - private HttpManagementConfiguration _managementConfiguration; - - protected AbstractServlet() - { - super(); - } - - @Override - public void init() throws ServletException - { - ServletConfig servletConfig = getServletConfig(); - ServletContext servletContext = servletConfig.getServletContext(); - _broker = HttpManagementUtil.getBroker(servletContext); - _managementConfiguration = HttpManagementUtil.getManagementConfiguration(servletContext); - super.init(); - } - - @Override - protected final void doGet(final HttpServletRequest request, final HttpServletResponse resp) - { - doWithSubjectAndActor( - new PrivilegedExceptionAction() - { - @Override - public Void run() throws Exception - { - doGetWithSubjectAndActor(request, resp); - return null; - } - }, - request, - resp - ); - } - - /** - * Performs the GET action as the logged-in {@link Subject}. - * Subclasses commonly override this method - */ - protected void doGetWithSubjectAndActor(HttpServletRequest request, HttpServletResponse resp) throws ServletException, IOException - { - throw new UnsupportedOperationException("GET not supported by this servlet"); - } - - - @Override - protected final void doPost(final HttpServletRequest request, final HttpServletResponse resp) - { - doWithSubjectAndActor( - new PrivilegedExceptionAction() - { - @Override - public Void run() throws Exception - { - doPostWithSubjectAndActor(request, resp); - return null; - } - }, - request, - resp - ); - } - - /** - * Performs the POST action as the logged-in {@link Subject}. - * Subclasses commonly override this method - */ - protected void doPostWithSubjectAndActor(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException - { - throw new UnsupportedOperationException("POST not supported by this servlet"); - } - - @Override - protected final void doPut(final HttpServletRequest request, final HttpServletResponse resp) - { - doWithSubjectAndActor( - new PrivilegedExceptionAction() - { - @Override - public Void run() throws Exception - { - doPutWithSubjectAndActor(request, resp); - return null; - } - }, - request, - resp - ); - } - - public Writer getOutputWriter(final HttpServletRequest request, final HttpServletResponse response) - throws IOException - { - return HttpManagementUtil.getOutputWriter(request, response, _managementConfiguration); - } - - public OutputStream getOutputStream(final HttpServletRequest request, final HttpServletResponse response) - throws IOException - { - return HttpManagementUtil.getOutputStream(request, response, _managementConfiguration); - } - - /** - * Performs the PUT action as the logged-in {@link Subject}. - * Subclasses commonly override this method - */ - protected void doPutWithSubjectAndActor(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException - { - throw new UnsupportedOperationException("PUT not supported by this servlet"); - } - - @Override - protected final void doDelete(final HttpServletRequest request, final HttpServletResponse resp) - throws ServletException, IOException - { - doWithSubjectAndActor( - new PrivilegedExceptionAction() - { - @Override - public Void run() throws Exception - { - doDeleteWithSubjectAndActor(request, resp); - return null; - } - }, - request, - resp - ); - } - - /** - * Performs the PUT action as the logged-in {@link Subject}. - * Subclasses commonly override this method - */ - protected void doDeleteWithSubjectAndActor(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException - { - throw new UnsupportedOperationException("DELETE not supported by this servlet"); - } - - private void doWithSubjectAndActor( - PrivilegedExceptionAction privilegedExceptionAction, - final HttpServletRequest request, - final HttpServletResponse resp) - { - Subject subject; - try - { - subject = getAuthorisedSubject(request); - } - catch (SecurityException e) - { - sendError(resp, HttpServletResponse.SC_UNAUTHORIZED); - return; - } - - try - { - Subject.doAs(subject, privilegedExceptionAction); - } - catch(RuntimeException e) - { - LOGGER.error("Unable to perform action", e); - throw e; - } - catch (PrivilegedActionException e) - { - LOGGER.error("Unable to perform action", e); - Throwable cause = e.getCause(); - if(cause instanceof RuntimeException) - { - throw (RuntimeException)cause; - } - if(cause instanceof Error) - { - throw (Error)cause; - } - throw new ConnectionScopedRuntimeException(e.getCause()); - } - } - - protected Subject getAuthorisedSubject(HttpServletRequest request) - { - Subject subject = HttpManagementUtil.getAuthorisedSubject(request.getSession()); - if (subject == null) - { - throw new SecurityException("Access to management rest interfaces is denied for un-authorised user"); - } - return subject; - } - - protected Broker getBroker() - { - return _broker; - } - - protected HttpManagementConfiguration getManagementConfiguration() - { - return _managementConfiguration; - } - - protected void sendError(final HttpServletResponse resp, int errorCode) - { - try - { - resp.sendError(errorCode); - } - catch (IOException e) - { - throw new ConnectionScopedRuntimeException("Failed to send error response code " + errorCode, e); - } - } - - protected void sendJsonResponse(Object object, HttpServletRequest request, HttpServletResponse response) throws IOException, - JsonGenerationException, JsonMappingException - { - response.setStatus(HttpServletResponse.SC_OK); - - response.setHeader("Cache-Control","no-cache"); - response.setHeader("Pragma","no-cache"); - response.setDateHeader ("Expires", 0); - response.setContentType("application/json"); - - final Writer writer = getOutputWriter(request, response); - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true); - mapper.writeValue(writer, object); - } - - protected String[] getPathInfoElements(HttpServletRequest request) - { - String pathInfo = request.getPathInfo(); - if (pathInfo != null && pathInfo.length() > 0) - { - return pathInfo.substring(1).split("/"); - } - return null; - } -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/Action.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/Action.java deleted file mode 100644 index 3241a7560e..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/Action.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - * - */ -package org.apache.qpid.server.management.plugin.servlet.rest; - -import java.util.Map; - -import org.apache.qpid.server.model.Broker; - - -public interface Action -{ - String getName(); - Object perform(Map request, Broker broker); -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/ApiDocsServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/ApiDocsServlet.java deleted file mode 100644 index 5c30378fc6..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/ApiDocsServlet.java +++ /dev/null @@ -1,423 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.qpid.server.management.plugin.servlet.rest; - -import java.io.IOException; -import java.io.PrintWriter; -import java.io.Writer; -import java.security.AccessControlException; -import java.util.*; - -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.Part; - -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.SerializationConfig; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.apache.qpid.server.configuration.IllegalConfigurationException; -import org.apache.qpid.server.model.AbstractConfiguredObject; -import org.apache.qpid.server.model.Broker; -import org.apache.qpid.server.model.ConfiguredAutomatedAttribute; -import org.apache.qpid.server.model.ConfiguredObject; -import org.apache.qpid.server.model.ConfiguredObjectAttribute; -import org.apache.qpid.server.model.IllegalStateTransitionException; -import org.apache.qpid.server.model.IntegrityViolationException; -import org.apache.qpid.server.model.ManagedObject; -import org.apache.qpid.server.model.Model; -import org.apache.qpid.server.util.urlstreamhandler.data.Handler; -import org.apache.qpid.server.virtualhost.ExchangeExistsException; -import org.apache.qpid.server.virtualhost.QueueExistsException; -import org.apache.qpid.util.DataUrlUtils; - -public class ApiDocsServlet extends AbstractServlet -{ - private static final Logger LOGGER = LoggerFactory.getLogger(ApiDocsServlet.class); - private final Model _model; - private final List> _types; - - private Class[] _hierarchy; - - private static final Set VOWELS = new HashSet<>(Arrays.asList('a','e','i','o','u')); - - public static final Comparator> CLASS_COMPARATOR = - new Comparator>() - { - @Override - public int compare(final Class o1, - final Class o2) - { - return o1.getSimpleName().compareTo(o2.getSimpleName()); - } - - }; - private static final Map, List> REGISTERED_CLASSES = new TreeMap<>(CLASS_COMPARATOR); - - - public ApiDocsServlet(final Model model, final List registeredPaths, Class... hierarchy) - { - super(); - _model = model; - _hierarchy = hierarchy; - _types = hierarchy.length == 0 ? null : new ArrayList<>(_model.getTypeRegistry().getTypeSpecialisations(getConfiguredClass())); - if(_types != null) - { - Collections.sort(_types, CLASS_COMPARATOR); - } - if(_hierarchy.length != 0) - { - List paths = REGISTERED_CLASSES.get(getConfiguredClass()); - if(paths == null) - { - paths = new ArrayList<>(); - REGISTERED_CLASSES.put(getConfiguredClass(), paths); - } - paths.addAll(registeredPaths); - - } - - } - - @Override - protected void doGetWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException - { - response.setContentType("text/html"); - response.setStatus(HttpServletResponse.SC_OK); - - - PrintWriter writer = response.getWriter(); - - writePreamble(writer); - writeHead(writer); - - if(_hierarchy.length == 0) - { - writer.println(""); - writer.println(""); - writer.println(""); - writer.println(""); - writer.println(""); - writer.println(""); - writer.println(""); - writer.println(""); - writer.println(""); - for(Map.Entry, List> entry : REGISTERED_CLASSES.entrySet()) - { - List paths = entry.getValue(); - Class objClass = entry.getKey(); - writer.println(""); - writer.println(""); - writer.println(""); - writer.println(""); - writer.println(""); - for(int i = 1; i < paths.size(); i++) - { - writer.println(""); - writer.println(""); - writer.println(""); - } - - } - writer.println(""); - writer.println("
TypePathDescription
"+objClass.getSimpleName()+"" + paths.get(0) + ""+ - objClass.getAnnotation(ManagedObject.class).description()+"
" + paths.get(i) + "
"); - - } - else - { - writeCategoryDescription(writer); - writeUsage(writer, request); - writeTypes(writer); - writeAttributes(writer); - } - - writeFoot(writer); - } - - private void writePreamble(final PrintWriter writer) - { - writer.println(""); - writer.println(""); - - - } - - private void writeHead(final PrintWriter writer) - { - writer.println(""); - writer.println(""); - writeTitle(writer); - - writer.println(""); - writer.println(""); - } - - private void writeTitle(final PrintWriter writer) - { - writer.print(""); - if(_hierarchy.length == 0) - { - writer.print("Qpid API"); - } - else - { - writer.print("Qpid API: " + getConfiguredClass().getSimpleName()); - } - writer.println(""); - } - - private void writeCategoryDescription(PrintWriter writer) - { - writer.println("

"+getConfiguredClass().getSimpleName()+"

"); - writer.println(getConfiguredClass().getAnnotation(ManagedObject.class).description()); - } - - private void writeUsage(final PrintWriter writer, final HttpServletRequest request) - { - writer.println("

Usage

"); - writer.println(""); - writer.println(""); - writer.print(""); - - writer.print(""); - writer.println("
ReadGET" + request.getServletPath() - .replace("apidocs", "api")); - - for (final Class category : _hierarchy) - { - writer.print("[/<" + category.getSimpleName().toLowerCase() + " name or id>"); - } - for(int i = 0; i < _hierarchy.length; i++) - { - writer.print("] "); - } - writer.println("
UpdatePUT or POST" - + request.getServletPath().replace("apidocs", "api")); - for (final Class category : _hierarchy) - { - writer.print("/<" + category.getSimpleName().toLowerCase() + " name or id>"); - } - - writer.print( - "
CreatePUT or POST" - + request.getServletPath().replace("apidocs", "api")); - for (int i = 0; i < _hierarchy.length - 1; i++) - { - writer.print("/<" + _hierarchy[i].getSimpleName().toLowerCase() + " name or id>"); - } - - writer.print("
DeleteDELETE" - + request.getServletPath().replace("apidocs", "api")); - for (final Class category : _hierarchy) - { - writer.print("/<" + category.getSimpleName().toLowerCase() + " name or id>"); - } - - writer.println("
"); - - } - - - private void writeTypes(final PrintWriter writer) - { - if(!_types.isEmpty() && !(_types.size() == 1 && getTypeName(_types.iterator().next()).trim().equals(""))) - { - writer.println("

Types

"); - writer.println(""); - writer.println(""); - writer.println(""); - writer.println(""); - - writer.println(""); - for (Class type : _types) - { - writer.print(""); - - } - writer.println(""); - } - - writer.println("
TypeDescription
"); - writer.print(getTypeName(type)); - writer.print(""); - writer.print(type.getAnnotation(ManagedObject.class).description()); - writer.println("
"); - } - - private String getTypeName(final Class type) - { - return type.getAnnotation(ManagedObject.class).type() == null - ? _model.getTypeRegistry().getTypeClass(type).getSimpleName() - : type.getAnnotation(ManagedObject.class).type(); - } - - private void writeAttributes(final PrintWriter writer) - { - writer.println("

Attributes

"); - writer.println("

Common Attributes

"); - - writeAttributesTable(writer, _model.getTypeRegistry().getAttributeTypes(getConfiguredClass()).values()); - - for(Class type : _types) - { - - ManagedObject typeAnnotation = type.getAnnotation(ManagedObject.class); - String typeName = typeAnnotation.type() == null ? _model.getTypeRegistry().getTypeClass(type).getSimpleName() : typeAnnotation.type(); - Collection> typeSpecificAttributes = - _model.getTypeRegistry().getTypeSpecificAttributes(type); - if(!typeSpecificAttributes.isEmpty()) - { - writer.println("

"+typeName+" Specific Attributes

"); - writeAttributesTable(writer, typeSpecificAttributes); - } - - - } - - } - - private void writeAttributesTable(final PrintWriter writer, - final Collection> attributeTypes) - { - writer.println(""); - writer.println(""); - writer.println(""); - writer.println(""); - writer.println(""); - - for(ConfiguredObjectAttribute attribute : attributeTypes) - { - if(!attribute.isDerived()) - { - writer.println(""); - } - } - writer.println(""); - - writer.println("
Attribute NameTypeDescription
" - + attribute.getName() - + "" - + renderType(attribute) - + "" - + attribute.getDescription() - + "
"); - - } - - private String renderType(final ConfiguredObjectAttribute attribute) - { - final Class type = attribute.getType(); - if(Enum.class.isAssignableFrom(type)) - { - return "
string
"; - } - else if(ConfiguredObject.class.isAssignableFrom(type)) - { - return "
string
"; - } - else if(UUID.class == type) - { - return "
string
"; - } - else - { - boolean hasValuesRestriction = attribute instanceof ConfiguredAutomatedAttribute - && ((ConfiguredAutomatedAttribute)attribute).hasValidValues(); - - StringBuilder returnVal = new StringBuilder(); - if(hasValuesRestriction) - { - returnVal.append("
"); - } - - if(Number.class.isAssignableFrom(type)) - { - returnVal.append("number"); - } - else if(Boolean.class == type) - { - returnVal.append("boolean"); - } - else if(String.class == type) - { - returnVal.append("string"); - } - else if(Collection.class.isAssignableFrom(type)) - { - // TODO - generate a description of the type in the array - returnVal.append("array"); - } - else if(Map.class.isAssignableFrom(type)) - { - // TODO - generate a description of the type in the object - returnVal.append("object"); - } - else - { - returnVal.append(type.getSimpleName()); - } - if(hasValuesRestriction) - { - returnVal.append("
"); - } - return returnVal.toString(); - } - } - - private void writeFoot(final PrintWriter writer) - { - writer.println(""); - writer.println(""); - } - private Class getConfiguredClass() - { - return _hierarchy.length == 0 ? Broker.class : _hierarchy[_hierarchy.length-1]; - } - - - private int getIntParameterFromRequest(final HttpServletRequest request, - final String paramName, - final int defaultValue) - { - int intValue = defaultValue; - final String stringValue = request.getParameter(paramName); - if(stringValue!=null) - { - try - { - intValue = Integer.parseInt(stringValue); - } - catch (NumberFormatException e) - { - LOGGER.warn("Could not parse " + stringValue + " as integer for parameter " + paramName); - } - } - return intValue; - } - - private boolean getBooleanParameterFromRequest(HttpServletRequest request, final String paramName) - { - return Boolean.parseBoolean(request.getParameter(paramName)); - } - - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverter.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverter.java deleted file mode 100644 index 0f1b7d03e9..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverter.java +++ /dev/null @@ -1,314 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.servlet.rest; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeMap; - -import org.apache.qpid.server.model.ConfiguredObject; -import org.apache.qpid.server.model.ConfiguredObjectAttribute; -import org.apache.qpid.server.model.Model; - -public class ConfiguredObjectToMapConverter -{ - /** Name of the key used for the statistics map */ - public static final String STATISTICS_MAP_KEY = "statistics"; - - private static Set CONFIG_EXCLUDED_ATTRIBUTES = - new HashSet<>(Arrays.asList(ConfiguredObject.ID, - ConfiguredObject.DURABLE, - ConfiguredObject.CREATED_BY, - ConfiguredObject.CREATED_TIME, - ConfiguredObject.LAST_UPDATED_BY, - ConfiguredObject.LAST_UPDATED_TIME)); - - public Map convertObjectToMap(final ConfiguredObject confObject, - Class clazz, - int depth, - final boolean useActualValues, - final boolean inheritedActuals, - final boolean includeSystemContext, - final boolean extractAsConfig, - final int oversizeThreshold, - final boolean isSecureTransport - ) - { - Map object = new LinkedHashMap<>(); - - incorporateAttributesIntoMap(confObject, object, useActualValues, inheritedActuals, includeSystemContext, - extractAsConfig, oversizeThreshold, isSecureTransport); - if(!extractAsConfig) - { - incorporateStatisticsIntoMap(confObject, object); - } - - if(depth > 0) - { - incorporateChildrenIntoMap(confObject, clazz, depth, object, useActualValues, inheritedActuals, - includeSystemContext, extractAsConfig, oversizeThreshold, isSecureTransport); - } - return object; - } - - - private void incorporateAttributesIntoMap( - final ConfiguredObject confObject, - Map object, - final boolean useActualValues, - final boolean inheritedActuals, - final boolean includeSystemContext, - final boolean extractAsConfig, - final int oversizeThreshold, - final boolean isSecureTransport) - { - // if extracting as config add a fake attribute for each secondary parent - if(extractAsConfig && confObject.getModel().getParentTypes(confObject.getCategoryClass()).size()>1) - { - Iterator> parentClasses = - confObject.getModel().getParentTypes(confObject.getCategoryClass()).iterator(); - - // ignore the first parent which is supplied by structure - parentClasses.next(); - - while(parentClasses.hasNext()) - { - Class parentClass = parentClasses.next(); - ConfiguredObject parent = confObject.getParent(parentClass); - if(parent != null) - { - String categoryName = parentClass.getSimpleName(); - object.put(categoryName.substring(0,1).toLowerCase()+categoryName.substring(1), parent.getName()); - } - } - } - - for(String name : confObject.getAttributeNames()) - { - if (!(extractAsConfig && CONFIG_EXCLUDED_ATTRIBUTES.contains(name))) - { - Object value = - useActualValues ? confObject.getActualAttributes().get(name) : confObject.getAttribute(name); - if (value instanceof ConfiguredObject) - { - object.put(name, ((ConfiguredObject) value).getName()); - } - else if (ConfiguredObject.CONTEXT.equals(name)) - { - Map contextValues = new HashMap<>(); - if (useActualValues) - { - collectContext(contextValues, confObject.getModel(), confObject, inheritedActuals); - } - else - { - for (String contextName : confObject.getContextKeys(!includeSystemContext)) - { - contextValues.put(contextName, confObject.getContextValue(String.class, contextName)); - } - } - if (!contextValues.isEmpty()) - { - object.put(ConfiguredObject.CONTEXT, contextValues); - } - } - else if (value instanceof Collection) - { - List converted = new ArrayList<>(); - for (Object member : (Collection) value) - { - if (member instanceof ConfiguredObject) - { - converted.add(((ConfiguredObject) member).getName()); - } - else - { - converted.add(member); - } - } - object.put(name, converted); - } - else if (value != null) - { - ConfiguredObjectAttribute attribute = confObject.getModel() - .getTypeRegistry() - .getAttributeTypes(confObject.getClass()) - .get(name); - - if (attribute.isSecureValue(value) && !(isSecureTransport && extractAsConfig)) - { - // do not expose actual secure attribute value - // getAttribute() returns encoded value - value = confObject.getAttribute(name); - } - - if(attribute.isOversized() && !extractAsConfig && !useActualValues) - { - String valueString = String.valueOf(value); - if(valueString.length() > oversizeThreshold) - { - - String replacementValue = "".equals(attribute.getOversizedAltText()) - ? String.valueOf(value).substring(0, oversizeThreshold - 4) + "..." - : attribute.getOversizedAltText(); - - object.put(name, replacementValue); - } - else - { - object.put(name, value); - } - } - else - { - object.put(name, value); - } - } - else if (extractAsConfig) - { - ConfiguredObjectAttribute attribute = confObject.getModel() - .getTypeRegistry() - .getAttributeTypes(confObject.getClass()) - .get(name); - - if(attribute.isPersisted() && attribute.isDerived()) - { - object.put(name, confObject.getAttribute(name)); - } - } - } - } - } - - private void collectContext(Map contextValues, Model model, ConfiguredObject confObject, boolean inheritedContext) - { - Object value = confObject.getActualAttributes().get(ConfiguredObject.CONTEXT); - if (inheritedContext) - { - Collection> parents = model.getParentTypes(confObject.getCategoryClass()); - if(parents != null && !parents.isEmpty()) - { - ConfiguredObject parent = confObject.getParent(parents.iterator().next()); - if(parent != null) - { - collectContext(contextValues, model, parent, inheritedContext); - } - } - } - if (value instanceof Map) - { - contextValues.putAll((Map)value); - } - } - - private void incorporateStatisticsIntoMap( - final ConfiguredObject confObject, Map object) - { - - Map statMap = new TreeMap(confObject.getStatistics()); - - if(!statMap.isEmpty()) - { - object.put(STATISTICS_MAP_KEY, statMap); - } - - } - - private void incorporateChildrenIntoMap( - final ConfiguredObject confObject, - Class clazz, - int depth, - Map object, - final boolean useActualValues, - final boolean inheritedActuals, - final boolean includeSystemContext, - final boolean extractAsConfig, - final int oversizeThreshold, - final boolean isSecure) - { - List> childTypes = new ArrayList<>(confObject.getModel().getChildTypes(clazz)); - - Collections.sort(childTypes, new Comparator>() - { - @Override - public int compare(final Class o1, final Class o2) - { - return o1.getSimpleName().compareTo(o2.getSimpleName()); - } - }); - for(Class childClass : childTypes) - { - if(!(extractAsConfig && confObject.getModel().getParentTypes(childClass).iterator().next() != confObject.getCategoryClass())) - { - - Collection children = confObject.getChildren(childClass); - if(children != null) - { - List sortedChildren = new ArrayList(children); - Collections.sort(sortedChildren, new Comparator() - { - @Override - public int compare(final ConfiguredObject o1, final ConfiguredObject o2) - { - return o1.getName().compareTo(o2.getName()); - } - }); - - List> childObjects = new ArrayList<>(); - - for (ConfiguredObject child : sortedChildren) - { - if (!(extractAsConfig && !child.isDurable())) - { - childObjects.add(convertObjectToMap(child, - childClass, - depth - 1, - useActualValues, - inheritedActuals, - includeSystemContext, - extractAsConfig, - oversizeThreshold, - isSecure)); - } - } - - if (!childObjects.isEmpty()) - { - String childTypeSingular = childClass.getSimpleName().toLowerCase(); - object.put(childTypeSingular + (childTypeSingular.endsWith("s") ? "es" : "s"), childObjects); - } - } - } - } - } - - - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/HelperServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/HelperServlet.java deleted file mode 100644 index cafde3b7f9..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/HelperServlet.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - * - */ -package org.apache.qpid.server.management.plugin.servlet.rest; - -import java.io.IOException; -import java.io.Writer; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Map; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.SerializationConfig; - -import org.apache.qpid.server.management.plugin.servlet.rest.action.ListAccessControlProviderAttributes; -import org.apache.qpid.server.management.plugin.servlet.rest.action.ListBrokerAttribute; -import org.apache.qpid.server.management.plugin.servlet.rest.action.ListGroupProviderAttributes; -import org.apache.qpid.server.management.plugin.servlet.rest.action.ListTimeZones; -import org.apache.qpid.server.model.Broker; - -public class HelperServlet extends AbstractServlet -{ - private static final long serialVersionUID = 1L; - - private static final String PARAM_ACTION = "action"; - - private Map _actions; - private ObjectMapper _mapper; - - public HelperServlet() - { - _mapper = new ObjectMapper(); - _mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true); - - Action[] supportedActions = { - new ListBrokerAttribute(Broker.PRODUCT_VERSION, "version"), - new ListGroupProviderAttributes(), - new ListAccessControlProviderAttributes(), - new PluginClassProviderAction(), - new ListTimeZones() - }; - - _actions = new HashMap(); - - for(Action action : supportedActions) - { - _actions.put(action.getName(), action); - } - } - - @Override - protected void doGetWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws ServletException, - IOException - { - perform(request, response); - } - - @Override - protected void doPostWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws ServletException, - IOException - { - perform(request, response); - } - - private void perform(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException - { - String actionName = request.getParameter(PARAM_ACTION); - Action action = _actions.get(actionName); - if (action == null) - { - response.setStatus(HttpServletResponse.SC_NOT_FOUND); - return; - } - - Map parameters = new HashMap(); - @SuppressWarnings("unchecked") - Enumeration names = request.getParameterNames(); - while (names.hasMoreElements()) - { - String name = (String) names.nextElement(); - String[] values = request.getParameterValues(name); - if (values.length == 1) - { - parameters.put(name, values[0]); - } - else - { - parameters.put(name, values); - } - } - - Object output = action.perform(parameters, getBroker()); - if (output == null) - { - response.setStatus(HttpServletResponse.SC_NOT_FOUND); - return; - } - response.setContentType("application/json"); - final Writer writer = getOutputWriter(request, response); - _mapper.writeValue(writer, output); - - response.setStatus(HttpServletResponse.SC_OK); - - } -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/KeyComparator.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/KeyComparator.java deleted file mode 100644 index 3d862ce321..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/KeyComparator.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.servlet.rest; - -import java.util.Comparator; -import java.util.Map; - -class KeyComparator implements Comparator -{ - private String _key; - - public KeyComparator(final String key) - { - _key = key; - } - - public int compare(final Map o1, final Map o2) - { - Comparable left = (Comparable) o1.get(_key); - Comparable right = (Comparable) o2.get(_key); - - int result; - if(left == null) - { - result = right == null ? 0 : -1; - } - else - { - result = left.compareTo(right); - } - - return result; - - } -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/LogFileListingServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/LogFileListingServlet.java deleted file mode 100644 index a7889e4890..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/LogFileListingServlet.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.qpid.server.management.plugin.servlet.rest; - -import java.io.IOException; -import java.io.Writer; -import java.util.Collections; -import java.util.List; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.log4j.LogManager; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.SerializationConfig; - -import org.apache.qpid.server.management.plugin.log.LogFileDetails; -import org.apache.qpid.server.management.plugin.log.LogFileHelper; - -public class LogFileListingServlet extends AbstractServlet -{ - private static final long serialVersionUID = 1L; - - @Override - protected void doGetWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws IOException, - ServletException - { - response.setHeader("Cache-Control", "no-cache"); - response.setHeader("Pragma", "no-cache"); - response.setDateHeader("Expires", 0); - - if (!getBroker().getSecurityManager().authoriseLogsAccess()) - { - response.sendError(HttpServletResponse.SC_FORBIDDEN, "Log files access is denied"); - return; - } - - @SuppressWarnings("unchecked") - LogFileHelper helper = new LogFileHelper(Collections.list(LogManager.getRootLogger().getAllAppenders())); - List logFiles = helper.getLogFileDetails(false); - response.setContentType("application/json"); - response.setStatus(HttpServletResponse.SC_OK); - - final Writer writer = getOutputWriter(request, response); - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true); - mapper.writeValue(writer, logFiles); - - response.setStatus(HttpServletResponse.SC_OK); - } - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/LogRecordsServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/LogRecordsServlet.java deleted file mode 100644 index b9d58c8868..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/LogRecordsServlet.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.qpid.server.management.plugin.servlet.rest; - -import java.io.IOException; -import java.io.Writer; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.SerializationConfig; - -import org.apache.qpid.server.logging.LogRecorder; - -public class LogRecordsServlet extends AbstractServlet -{ - private static final long serialVersionUID = 2L; - - public static final String PARAM_LAST_LOG_ID = "lastLogId"; - - public LogRecordsServlet() - { - super(); - } - - @Override - protected void doGetWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException - { - response.setContentType("application/json"); - response.setStatus(HttpServletResponse.SC_OK); - - response.setHeader("Cache-Control","no-cache"); - response.setHeader("Pragma","no-cache"); - response.setDateHeader ("Expires", 0); - - if (!getBroker().getSecurityManager().authoriseLogsAccess()) - { - response.sendError(HttpServletResponse.SC_FORBIDDEN, "Broker logs access is denied"); - return; - } - - long lastLogId = 0; - try - { - lastLogId = Long.parseLong(request.getParameter(PARAM_LAST_LOG_ID)); - } - catch(Exception e) - { - // ignore null and incorrect parameter values - } - - List> logRecords = new ArrayList>(); - - LogRecorder logRecorder = getBroker().getLogRecorder(); - for(LogRecorder.Record record : logRecorder) - { - if (record.getId() > lastLogId) - { - logRecords.add(logRecordToObject(record)); - } - } - - final Writer writer = getOutputWriter(request,response); - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true); - mapper.writeValue(writer, logRecords); - - response.setStatus(HttpServletResponse.SC_OK); - - } - - private Map logRecordToObject(LogRecorder.Record record) - { - Map recordMap = new LinkedHashMap(); - recordMap.put("id",record.getId()); - recordMap.put("timestamp", record.getTimestamp()); - recordMap.put("level", record.getLevel()); - recordMap.put("thread", record.getThreadName()); - recordMap.put("logger", record.getLogger()); - recordMap.put("message", record.getMessage()); - return recordMap; - } - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/LoggedOnUserPreferencesServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/LoggedOnUserPreferencesServlet.java deleted file mode 100644 index 6984a32e09..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/LoggedOnUserPreferencesServlet.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.apache.qpid.server.management.plugin.servlet.rest; - -import java.io.IOException; -import java.net.SocketAddress; -import java.security.Principal; -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -import javax.security.auth.Subject; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.codehaus.jackson.map.ObjectMapper; - -import org.apache.qpid.server.management.plugin.HttpManagementUtil; -import org.apache.qpid.server.model.AuthenticationProvider; -import org.apache.qpid.server.model.PreferencesProvider; -import org.apache.qpid.server.security.auth.AuthenticatedPrincipal; - -public class LoggedOnUserPreferencesServlet extends AbstractServlet -{ - private static final long serialVersionUID = 1L; - - @Override - protected void doGetWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws IOException, - ServletException - { - PreferencesProvider preferencesProvider = getPreferencesProvider(request); - if (preferencesProvider == null) - { - response.sendError(HttpServletResponse.SC_NOT_FOUND, "Preferences provider is not configured"); - return; - } - String userName = getAuthenticatedUserName(request); - Map preferences = preferencesProvider.getPreferences(userName); - if (preferences == null) - { - preferences = Collections.emptyMap(); - } - sendJsonResponse(preferences, request, response); - } - - /* - * replace preferences - */ - @Override - protected void doPutWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException - { - PreferencesProvider preferencesProvider = getPreferencesProvider(request); - if (preferencesProvider == null) - { - response.sendError(HttpServletResponse.SC_NOT_FOUND, "Preferences provider is not configured"); - return; - } - String userName = getAuthenticatedUserName(request); - - ObjectMapper mapper = new ObjectMapper(); - - @SuppressWarnings("unchecked") - Map newPreferences = mapper.readValue(request.getInputStream(), LinkedHashMap.class); - - preferencesProvider.deletePreferences(userName); - Map preferences = preferencesProvider.setPreferences(userName, newPreferences); - if (preferences == null) - { - preferences = Collections.emptyMap(); - } - sendJsonResponse(preferences, request, response); - } - - /* - * update preferences - */ - @Override - protected void doPostWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException - { - PreferencesProvider preferencesProvider = getPreferencesProvider(request); - if (preferencesProvider == null) - { - response.sendError(HttpServletResponse.SC_NOT_FOUND, "Preferences provider is not configured"); - return; - } - String userName = getAuthenticatedUserName(request); - - ObjectMapper mapper = new ObjectMapper(); - - @SuppressWarnings("unchecked") - Map newPreferences = mapper.readValue(request.getInputStream(), LinkedHashMap.class); - Map preferences = preferencesProvider.setPreferences(userName, newPreferences); - if (preferences == null) - { - preferences = Collections.emptyMap(); - } - sendJsonResponse(preferences, request, response); - } - - private String getAuthenticatedUserName(HttpServletRequest request) - { - Subject subject = getAuthorisedSubject(request); - Principal principal = AuthenticatedPrincipal.getAuthenticatedPrincipalFromSubject(subject); - return principal.getName(); - } - - private PreferencesProvider getPreferencesProvider(HttpServletRequest request) - { - AuthenticationProvider authenticationProvider = getManagementConfiguration().getAuthenticationProvider(request); - if (authenticationProvider == null) - { - throw new IllegalStateException("Authentication provider is not found"); - } - return authenticationProvider.getPreferencesProvider(); - } -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/LogoutServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/LogoutServlet.java deleted file mode 100644 index 34b115ed13..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/LogoutServlet.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.servlet.rest; - -import java.io.IOException; - -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import org.apache.qpid.server.management.plugin.HttpManagementUtil; - -@SuppressWarnings("serial") -public class LogoutServlet extends HttpServlet -{ - public static final String RETURN_URL_INIT_PARAM = "qpid.webui_logout_redirect"; - private String _returnUrl = HttpManagementUtil.ENTRY_POINT_PATH; - - @Override - public void init(ServletConfig config) throws ServletException - { - super.init(config); - - String initValue = config.getServletContext().getInitParameter(RETURN_URL_INIT_PARAM); - if(initValue != null) - { - _returnUrl = initValue; - } - } - - @Override - protected void doGet(HttpServletRequest request, HttpServletResponse resp) throws ServletException, IOException - { - HttpSession session = request.getSession(false); - if(session != null) - { - // Invalidating the session will cause LoginLogoutReporter to log the user logoff. - session.invalidate(); - } - - resp.sendRedirect(_returnUrl); - } - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/MapComparator.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/MapComparator.java deleted file mode 100644 index 84d987813b..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/MapComparator.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.servlet.rest; - -import java.util.Collections; -import java.util.Comparator; -import java.util.Map; - -class MapComparator implements Comparator -{ - private Comparator[] _sortKeys; - - public MapComparator(final String[] sortKeys) - { - _sortKeys = parseKeys(sortKeys); - } - - private static Comparator[] parseKeys(final String[] sortKeys) - { - Comparator[] comparators = new Comparator[sortKeys.length]; - for(int i = 0; i < sortKeys.length; i++) - { - String key = sortKeys[i]; - - if(key.startsWith("+") || key.startsWith(" ")) - { - comparators[i] = new KeyComparator(key.substring(1)); - } - else if(key.startsWith("-")) - { - comparators[i] = Collections.reverseOrder(new KeyComparator(key.substring(1))); - } - else - { - comparators[i] = new KeyComparator(key); - } - } - return comparators; - } - - - public int compare(final Map o1, final Map o2) - { - int result = 0; - for(int i = 0; i < _sortKeys.length; i++) - { - result = _sortKeys[i].compare(o1, o2); - if(result != 0) - { - return result; - } - } - return 0; - } - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/MessageContentServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/MessageContentServlet.java deleted file mode 100644 index db58e49eeb..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/MessageContentServlet.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.qpid.server.management.plugin.servlet.rest; - -import java.io.IOException; -import java.nio.ByteBuffer; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.qpid.server.message.MessageDeletedException; -import org.apache.qpid.server.message.MessageReference; -import org.apache.qpid.server.message.ServerMessage; -import org.apache.qpid.server.model.Queue; -import org.apache.qpid.server.model.VirtualHost; -import org.apache.qpid.server.queue.QueueEntry; -import org.apache.qpid.server.queue.QueueEntryVisitor; - -public class MessageContentServlet extends AbstractServlet -{ - public MessageContentServlet() - { - super(); - } - - @Override - protected void doGetWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException - { - String[] pathInfoElements = getPathInfoElements(request); - if(pathInfoElements != null && pathInfoElements.length > 2) - { - getMessageContent(request, response); - } - - } - - private void getMessageContent(HttpServletRequest request, HttpServletResponse response) throws IOException - { - Queue queue = getQueueFromRequest(request); - String path[] = getPathInfoElements(request); - MessageFinder finder = new MessageFinder(Long.parseLong(path[2])); - queue.visit(finder); - if(finder.isFound()) - { - response.setContentType(finder.getMimeType()); - response.setContentLength((int) finder.getSize()); - getOutputStream(request, response).write(finder.getContent()); - - } - - } - - private Queue getQueueFromRequest(HttpServletRequest request) - { - // TODO - validation that there is a vhost and queue and only those in the path - - String[] pathInfoElements = getPathInfoElements(request); - if(pathInfoElements == null || pathInfoElements.length < 2) - { - throw new IllegalArgumentException("Invalid path is specified"); - } - String vhostName = pathInfoElements[0]; - String queueName = pathInfoElements[1]; - - VirtualHost vhost = getBroker().findVirtualHostByName(vhostName); - if (vhost == null) - { - throw new IllegalArgumentException("Could not find virtual host with name '" + vhostName + "'"); - } - return getQueueFromVirtualHost(queueName, vhost); - } - - private Queue getQueueFromVirtualHost(String queueName, VirtualHost vhost) - { - Queue queue = null; - - for(Queue q : vhost.getQueues()) - { - if(q.getName().equals(queueName)) - { - queue = q; - break; - } - } - return queue; - } - - private class MessageFinder implements QueueEntryVisitor - { - private final long _messageNumber; - private String _mimeType; - private long _size; - private byte[] _content; - private boolean _found; - - private MessageFinder(long messageNumber) - { - _messageNumber = messageNumber; - } - - - public boolean visit(QueueEntry entry) - { - ServerMessage message = entry.getMessage(); - if(message != null) - { - if(_messageNumber == message.getMessageNumber()) - { - try - { - MessageReference reference = message.newReference(); - try - { - _mimeType = message.getMessageHeader().getMimeType(); - _size = message.getSize(); - _content = new byte[(int) _size]; - _found = true; - message.getContent(ByteBuffer.wrap(_content), 0); - } - finally - { - reference.release(); - } - return true; - } - catch (MessageDeletedException e) - { - // ignore - the message was deleted as we tried too look at it, treat as if no message found - } - } - - } - return false; - } - - public String getMimeType() - { - return _mimeType; - } - - public long getSize() - { - return _size; - } - - public byte[] getContent() - { - return _content; - } - - public boolean isFound() - { - return _found; - } - } - - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/MessageServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/MessageServlet.java deleted file mode 100644 index 38f7ef06bc..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/MessageServlet.java +++ /dev/null @@ -1,568 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.qpid.server.management.plugin.servlet.rest; - -import java.io.IOException; -import java.io.Writer; -import java.security.AccessControlException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.SerializationConfig; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.apache.qpid.server.consumer.ConsumerImpl; -import org.apache.qpid.server.message.AMQMessageHeader; -import org.apache.qpid.server.message.MessageDeletedException; -import org.apache.qpid.server.message.MessageReference; -import org.apache.qpid.server.message.ServerMessage; -import org.apache.qpid.server.model.Queue; -import org.apache.qpid.server.model.VirtualHost; -import org.apache.qpid.server.queue.QueueEntry; -import org.apache.qpid.server.queue.QueueEntryVisitor; -import org.apache.qpid.server.security.SecurityManager; -import org.apache.qpid.server.security.access.Operation; -import org.apache.qpid.server.store.TransactionLogResource; - -public class MessageServlet extends AbstractServlet -{ - private static final Logger LOGGER = LoggerFactory.getLogger(MessageServlet.class); - - public MessageServlet() - { - super(); - } - - @Override - protected void doGetWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException - { - String[] pathInfoElements = getPathInfoElements(request); - if(pathInfoElements != null && pathInfoElements.length > 2) - { - getMessageContent(request, response); - } - else - { - getMessageList(request, response); - } - - } - - private void getMessageContent(HttpServletRequest request, HttpServletResponse response) throws IOException - { - Queue queue = getQueueFromRequest(request); - String path[] = getPathInfoElements(request); - MessageFinder messageFinder = new MessageFinder(Long.parseLong(path[2])); - queue.visit(messageFinder); - - response.setStatus(HttpServletResponse.SC_OK); - - response.setHeader("Cache-Control","no-cache"); - response.setHeader("Pragma","no-cache"); - response.setDateHeader ("Expires", 0); - response.setContentType("application/json"); - - final Writer writer = getOutputWriter(request,response); - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true); - mapper.writeValue(writer, messageFinder.getMessageObject()); - } - - private void getMessageList(HttpServletRequest request, HttpServletResponse response) throws IOException - { - Queue queue = getQueueFromRequest(request); - - int first = -1; - int last = -1; - String range = request.getHeader("Range"); - if(range != null) - { - String[] boundaries = range.split("=")[1].split("-"); - first = Integer.parseInt(boundaries[0]); - last = Integer.parseInt(boundaries[1]); - } - final MessageCollector messageCollector = new MessageCollector(first, last); - queue.visit(messageCollector); - - response.setContentType("application/json"); - final List> messages = messageCollector.getMessages(); - int queueSize = (int) queue.getQueueDepthMessages(); - String min = messages.isEmpty() ? "0" : messages.get(0).get("position").toString(); - String max = messages.isEmpty() ? "0" : messages.get(messages.size()-1).get("position").toString(); - response.setHeader("Content-Range", (min + "-" + max + "/" + queueSize)); - response.setStatus(HttpServletResponse.SC_OK); - - response.setHeader("Cache-Control","no-cache"); - response.setHeader("Pragma","no-cache"); - response.setDateHeader ("Expires", 0); - - final Writer writer = getOutputWriter(request,response); - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true); - mapper.writeValue(writer, messages); - } - - private Queue getQueueFromRequest(HttpServletRequest request) - { - // TODO - validation that there is a vhost and queue and only those in the path - - String[] pathInfoElements = getPathInfoElements(request); - if(pathInfoElements == null || pathInfoElements.length < 2) - { - throw new IllegalArgumentException("Invalid path is specified"); - } - String vhostName = pathInfoElements[0]; - String queueName = pathInfoElements[1]; - - VirtualHost vhost = getBroker().findVirtualHostByName(vhostName); - if (vhost == null) - { - throw new IllegalArgumentException("Could not find virtual host with name '" + vhostName + "'"); - } - - Queue queueFromVirtualHost = getQueueFromVirtualHost(queueName, vhost); - if (queueFromVirtualHost == null) - { - throw new IllegalArgumentException("Could not find queue with name '" + queueName + "' on virtual host '" + vhost.getName() + "'"); - } - return queueFromVirtualHost; - } - - private Queue getQueueFromVirtualHost(String queueName, VirtualHost vhost) - { - Queue queue = null; - - for(Queue q : vhost.getQueues()) - { - - if(q.getName().equals(queueName)) - { - queue = q; - break; - } - } - return queue; - } - - private abstract static class QueueEntryTransaction implements VirtualHost.TransactionalOperation - { - private final Queue _sourceQueue; - private final List _messageIds; - - protected QueueEntryTransaction(Queue sourceQueue, List messageIds) - { - _sourceQueue = sourceQueue; - _messageIds = messageIds; - } - - @Override - public void withinTransaction(final VirtualHost.Transaction txn) - { - - _sourceQueue.visit(new QueueEntryVisitor() - { - - public boolean visit(final QueueEntry entry) - { - final ServerMessage message = entry.getMessage(); - if(message != null) - { - final long messageId = message.getMessageNumber(); - if (_messageIds.remove(messageId) || (messageId <= (long) Integer.MAX_VALUE - && _messageIds.remove(Integer.valueOf((int)messageId)))) - { - updateEntry(entry, txn); - } - } - return _messageIds.isEmpty(); - } - }); - } - - - protected abstract void updateEntry(QueueEntry entry, VirtualHost.Transaction txn); - } - - private static class MoveTransaction extends QueueEntryTransaction - { - private final Queue _destinationQueue; - - public MoveTransaction(Queue sourceQueue, List messageIds, Queue destinationQueue) - { - super(sourceQueue, messageIds); - _destinationQueue = destinationQueue; - } - - @Override - protected void updateEntry(QueueEntry entry, VirtualHost.Transaction txn) - { - ServerMessage msg = entry.getMessage(); - if(msg != null && !msg.isReferenced((TransactionLogResource)_destinationQueue)) - { - txn.move(entry, _destinationQueue); - } - } - } - - private static class CopyTransaction extends QueueEntryTransaction - { - private final Queue _destinationQueue; - - public CopyTransaction(Queue sourceQueue, List messageIds, Queue destinationQueue) - { - super(sourceQueue, messageIds); - _destinationQueue = destinationQueue; - } - - @Override - protected void updateEntry(QueueEntry entry, VirtualHost.Transaction txn) - { - ServerMessage msg = entry.getMessage(); - if(msg != null && !msg.isReferenced((TransactionLogResource)_destinationQueue)) - { - txn.copy(entry, _destinationQueue); - } - } - } - - private static class DeleteTransaction extends QueueEntryTransaction - { - public DeleteTransaction(Queue sourceQueue, List messageIds) - { - super(sourceQueue, messageIds); - } - - @Override - protected void updateEntry(QueueEntry entry, VirtualHost.Transaction txn) - { - txn.dequeue(entry); - } - } - - - private static class ClearQueueTransaction implements VirtualHost.TransactionalOperation - { - private final Queue _queue; - - protected ClearQueueTransaction(Queue queue) - { - _queue = queue; - } - - @Override - public void withinTransaction(final VirtualHost.Transaction txn) - { - _queue.visit(new QueueEntryVisitor() - { - - public boolean visit(final QueueEntry entry) - { - final ServerMessage message = entry.getMessage(); - if(message != null) - { - txn.dequeue(entry); - } - return false; - } - }); - - } - } - - private class MessageCollector implements QueueEntryVisitor - { - private final int _first; - private final int _last; - private int _position = -1; - private final List> _messages = new ArrayList>(); - - private MessageCollector(int first, int last) - { - _first = first; - _last = last; - } - - - public boolean visit(QueueEntry entry) - { - - _position++; - if((_first == -1 || _position >= _first) && (_last == -1 || _position <= _last)) - { - final Map messageObject = convertToObject(entry, false); - messageObject.put("position", _position); - _messages.add(messageObject); - } - return _last != -1 && _position > _last; - } - - public List> getMessages() - { - return _messages; - } - } - - - private class MessageFinder implements QueueEntryVisitor - { - private final long _messageNumber; - private Map _messageObject; - - private MessageFinder(long messageNumber) - { - _messageNumber = messageNumber; - } - - - public boolean visit(QueueEntry entry) - { - ServerMessage message = entry.getMessage(); - if(message != null) - { - if(_messageNumber == message.getMessageNumber()) - { - try - { - MessageReference reference = message.newReference(); - try - { - _messageObject = convertToObject(entry, true); - } - finally - { - reference.release(); - } - return true; - } - catch (MessageDeletedException e) - { - // ignore - the message has been deleted before we got a chance to look at it - } - } - } - return false; - } - - public Map getMessageObject() - { - return _messageObject; - } - } - - private Map convertToObject(QueueEntry entry, boolean includeContent) - { - Map object = new LinkedHashMap(); - object.put("size", entry.getSize()); - object.put("deliveryCount", entry.getDeliveryCount()); - object.put("state",entry.isAvailable() - ? "Available" - : entry.isAcquired() - ? "Acquired" - : ""); - final ConsumerImpl deliveredConsumer = entry.getDeliveredConsumer(); - object.put("deliveredTo", deliveredConsumer == null ? null : deliveredConsumer.getConsumerNumber()); - ServerMessage message = entry.getMessage(); - - if(message != null) - { - convertMessageProperties(object, message); - if(includeContent) - { - convertMessageHeaders(object, message); - } - } - - return object; - } - - private void convertMessageProperties(Map object, ServerMessage message) - { - object.put("id", message.getMessageNumber()); - object.put("arrivalTime",message.getArrivalTime()); - object.put("persistent", message.isPersistent()); - - final AMQMessageHeader messageHeader = message.getMessageHeader(); - if(messageHeader != null) - { - addIfPresent(object, "messageId", messageHeader.getMessageId()); - addIfPresentAndNotZero(object, "expirationTime", messageHeader.getExpiration()); - addIfPresent(object, "applicationId", messageHeader.getAppId()); - addIfPresent(object, "correlationId", messageHeader.getCorrelationId()); - addIfPresent(object, "encoding", messageHeader.getEncoding()); - addIfPresent(object, "mimeType", messageHeader.getMimeType()); - addIfPresent(object, "priority", messageHeader.getPriority()); - addIfPresent(object, "replyTo", messageHeader.getReplyTo()); - addIfPresentAndNotZero(object, "timestamp", messageHeader.getTimestamp()); - addIfPresent(object, "type", messageHeader.getType()); - addIfPresent(object, "userId", messageHeader.getUserId()); - } - - } - - private void addIfPresentAndNotZero(Map object, String name, Object property) - { - if(property instanceof Number) - { - Number value = (Number)property; - if (value.longValue() != 0) - { - object.put(name, property); - } - } - } - - private void addIfPresent(Map object, String name, Object property) - { - if(property != null) - { - object.put(name, property); - } - } - - private void convertMessageHeaders(Map object, ServerMessage message) - { - final AMQMessageHeader messageHeader = message.getMessageHeader(); - if(messageHeader != null) - { - Map headers = new HashMap(); - for(String headerName : messageHeader.getHeaderNames()) - { - headers.put(headerName, messageHeader.getHeader(headerName)); - } - object.put("headers", headers); - } - } - - /* - * POST moves or copies messages to the given queue from a queue specified in the posted JSON data - */ - @Override - protected void doPostWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException - { - - try - { - final Queue sourceQueue = getQueueFromRequest(request); - - ObjectMapper mapper = new ObjectMapper(); - - @SuppressWarnings("unchecked") - Map providedObject = mapper.readValue(request.getInputStream(), LinkedHashMap.class); - - String destQueueName = (String) providedObject.get("destinationQueue"); - Boolean move = (Boolean) providedObject.get("move"); - - final VirtualHost vhost = sourceQueue.getParent(VirtualHost.class); - - boolean isMoveTransaction = move != null && Boolean.valueOf(move); - - // FIXME: added temporary authorization check until we introduce management layer - // and review current ACL rules to have common rules for all management interfaces - String methodName = isMoveTransaction? "moveMessages":"copyMessages"; - authorizeMethod(methodName, vhost); - - - final Queue destinationQueue = getQueueFromVirtualHost(destQueueName, vhost); - final List messageIds = new ArrayList((List) providedObject.get("messages")); - QueueEntryTransaction txn = - isMoveTransaction - ? new MoveTransaction(sourceQueue, messageIds, destinationQueue) - : new CopyTransaction(sourceQueue, messageIds, destinationQueue); - vhost.executeTransaction(txn); - response.setStatus(HttpServletResponse.SC_OK); - - } - catch(AccessControlException e) - { - response.setStatus(HttpServletResponse.SC_FORBIDDEN); - } - catch(RuntimeException e) - { - LOGGER.error("Failure to perform message operation", e); - response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); - } - } - - /* - * DELETE removes specified messages from, or clears the queue - */ - @Override - protected void doDeleteWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException - { - final Queue queue = getQueueFromRequest(request); - - final VirtualHost vhost = queue.getParent(VirtualHost.class); - boolean clearQueue = Boolean.parseBoolean(request.getParameter("clear")); - - try - { - if (clearQueue) - { - clearQueue(queue, vhost); - } - else - { - final List messageIds = new ArrayList<>(); - for(String idStr : request.getParameterValues("id")) - { - messageIds.add(Long.valueOf(idStr)); - } - - deleteMessages(queue, vhost, messageIds); - } - response.setStatus(HttpServletResponse.SC_OK); - } - catch (AccessControlException e) - { - response.setStatus(HttpServletResponse.SC_FORBIDDEN); - } - - } - - private void deleteMessages(final Queue queue, final VirtualHost vhost, final List messageIds) - { - // FIXME: added temporary authorization check until we introduce management layer - // and review current ACL rules to have common rules for all management interfaces - authorizeMethod("deleteMessages", vhost); - vhost.executeTransaction(new DeleteTransaction(queue, messageIds)); - } - - private void clearQueue(final Queue queue, final VirtualHost vhost) - { - // FIXME: added temporary authorization check until we introduce management layer - // and review current ACL rules to have common rules for all management interfaces - authorizeMethod("clearQueue", vhost); - vhost.executeTransaction(new ClearQueueTransaction(queue)); - } - - private void authorizeMethod(String methodName, VirtualHost vhost) - { - SecurityManager securityManager = getBroker().getSecurityManager(); - securityManager.authoriseMethod(Operation.UPDATE, "VirtualHost.Queue", methodName, vhost.getName()); - } - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/MetaDataServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/MetaDataServlet.java deleted file mode 100644 index 88705563af..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/MetaDataServlet.java +++ /dev/null @@ -1,200 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.servlet.rest; - -import java.io.IOException; -import java.io.Writer; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Set; -import java.util.TreeMap; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.SerializationConfig; - -import org.apache.qpid.server.model.BrokerModel; -import org.apache.qpid.server.model.ConfiguredAutomatedAttribute; -import org.apache.qpid.server.model.ConfiguredObject; -import org.apache.qpid.server.model.ConfiguredObjectAttribute; -import org.apache.qpid.server.model.ConfiguredObjectTypeRegistry; -import org.apache.qpid.server.model.ManagedObject; -import org.apache.qpid.server.model.Model; - -public class MetaDataServlet extends AbstractServlet -{ - - private Model _instance; - - public MetaDataServlet(final Model model) - { - _instance = model; - } - - @Override - public void init() throws ServletException - { - super.init(); - } - - - - @Override - protected void doGetWithSubjectAndActor(final HttpServletRequest request, final HttpServletResponse response) - throws ServletException, IOException - { - response.setContentType("application/json"); - response.setStatus(HttpServletResponse.SC_OK); - - Map classToDataMap = new TreeMap<>(); - - for(Class clazz : _instance.getSupportedCategories()) - { - classToDataMap.put(clazz.getSimpleName(), processCategory(clazz)); - } - - final Writer writer = getOutputWriter(request, response); - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true); - mapper.writeValue(writer, classToDataMap); - - response.setContentType("application/json"); - response.setStatus(HttpServletResponse.SC_OK); - - } - - private Map processCategory(final Class clazz) - { - Map typeToDataMap = new TreeMap<>(); - ConfiguredObjectTypeRegistry typeRegistry = _instance.getTypeRegistry(); - for(Class type : typeRegistry.getTypeSpecialisations(clazz)) - { - typeToDataMap.put(ConfiguredObjectTypeRegistry.getType(type), processType(type)); - } - return typeToDataMap; - } - - private Map processType(final Class type) - { - Map typeDetails = new LinkedHashMap<>(); - typeDetails.put("attributes", processAttributes(type)); - typeDetails.put("managedInterfaces", getManagedInterfaces(type)); - typeDetails.put("validChildTypes", getValidChildTypes(type)); - ManagedObject annotation = type.getAnnotation(ManagedObject.class); - if(annotation != null) - { - if(annotation.deprecated()) - { - typeDetails.put("deprecated",true); - } - if(!"".equals(annotation.description() ) ) - { - typeDetails.put("description", annotation.description()); - } - } - return typeDetails; - } - - private Map> getValidChildTypes(final Class type) - { - Map> validChildTypes = new HashMap<>(); - for(Class childType : _instance.getChildTypes(ConfiguredObjectTypeRegistry.getCategory(type))) - { - Collection validValues = _instance.getTypeRegistry().getValidChildTypes(type, childType); - if(validValues != null) - { - validChildTypes.put(childType.getSimpleName(), validValues); - } - } - return validChildTypes; - } - - private Set getManagedInterfaces(Class type) - { - Set interfaces = new HashSet<>(); - for(Class classObject: _instance.getTypeRegistry().getManagedInterfaces(type)) - { - interfaces.add(classObject.getSimpleName()); - } - return interfaces; - } - - private Map processAttributes(final Class type) - { - Collection> attributes = - _instance.getTypeRegistry().getAttributeTypes(type).values(); - - Map attributeDetails = new LinkedHashMap<>(); - for(ConfiguredObjectAttribute attribute : attributes) - { - Map attrDetails = new LinkedHashMap<>(); - attrDetails.put("type",attribute.getType().getSimpleName()); - if(!"".equals(attribute.getDescription())) - { - attrDetails.put("description",attribute.getDescription()); - } - if(attribute.isDerived()) - { - attrDetails.put("derived",attribute.isDerived()); - } - if(attribute.isAutomated()) - { - if(!"".equals(((ConfiguredAutomatedAttribute)attribute).defaultValue())) - { - attrDetails.put("defaultValue",((ConfiguredAutomatedAttribute)attribute).defaultValue()); - } - if(((ConfiguredAutomatedAttribute)attribute).isMandatory()) - { - attrDetails.put("mandatory",((ConfiguredAutomatedAttribute)attribute).isMandatory()); - } - if(!(((ConfiguredAutomatedAttribute)attribute).validValues()).isEmpty()) - { - Collection validValues = ((ConfiguredAutomatedAttribute) attribute).validValues(); - - Collection convertedValues = new ArrayList<>(validValues.size()); - for(String value : validValues) - { - convertedValues.add(attribute.convert(value,null)); - } - attrDetails.put("validValues", convertedValues); - } - - } - if(attribute.isSecure()) - { - attrDetails.put("secure",attribute.isSecure()); - } - if(attribute.isOversized()) - { - attrDetails.put("oversize", attribute.isOversized()); - } - attributeDetails.put(attribute.getName(), attrDetails); - } - return attributeDetails; - } -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/PluginClassProviderAction.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/PluginClassProviderAction.java deleted file mode 100644 index cd14abc582..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/PluginClassProviderAction.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.apache.qpid.server.management.plugin.servlet.rest;/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -import org.apache.qpid.server.model.Broker; -import org.apache.qpid.server.plugin.Pluggable; -import org.apache.qpid.server.plugin.QpidServiceLoader; - -public class PluginClassProviderAction implements Action -{ - @Override - public String getName() - { - return "pluginList"; - } - - @Override - public Object perform(Map request, Broker broker) - { - try - { - String className = (String) request.get("plugin"); - QpidServiceLoader serviceLoader = new QpidServiceLoader(); - final Class clazz = (Class) Class.forName("org.apache.qpid.server.plugin."+className); - List values = new ArrayList(); - for(Pluggable instance : serviceLoader.instancesOf(clazz)) - { - values.add(instance.getType()); - } - return values; - } - catch (ClassNotFoundException e) - { - return Collections.emptyList(); - } - - } -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/QueueReportServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/QueueReportServlet.java deleted file mode 100644 index 2b3def2dab..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/QueueReportServlet.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.servlet.rest; - -import java.io.IOException; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.qpid.server.management.plugin.report.ReportRunner; -import org.apache.qpid.server.model.Queue; -import org.apache.qpid.server.model.VirtualHost; - -public class QueueReportServlet extends AbstractServlet -{ - @Override - protected void doGetWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws - IOException, - ServletException - { - String[] pathInfoElements = getPathInfoElements(request); - if(pathInfoElements != null && pathInfoElements.length == 3) - { - Queue queue = getQueueFromRequest(request); - ReportRunner reportRunner = ReportRunner.createRunner(pathInfoElements[2],request.getParameterMap()); - Object output = reportRunner.runReport(queue); - response.setContentType(reportRunner.getContentType()); - if(reportRunner.isBinaryReport()) - { - response.getOutputStream().write((byte[])output); - } - else - { - response.getWriter().write((String)output); - } - } - else - { - throw new IllegalArgumentException("Invalid path is specified"); - } - - } - - private Queue getQueueFromRequest(HttpServletRequest request) - { - String[] pathInfoElements = getPathInfoElements(request); - if(pathInfoElements == null || pathInfoElements.length < 2) - { - throw new IllegalArgumentException("Invalid path is specified"); - } - String vhostName = pathInfoElements[0]; - String queueName = pathInfoElements[1]; - - VirtualHost vhost = getBroker().findVirtualHostByName(vhostName); - if (vhost == null) - { - throw new IllegalArgumentException("Could not find virtual host with name '" + vhostName + "'"); - } - - Queue queueFromVirtualHost = getQueueFromVirtualHost(queueName, vhost); - if (queueFromVirtualHost == null) - { - throw new IllegalArgumentException("Could not find queue with name '" + queueName + "' on virtual host '" + vhost.getName() + "'"); - } - return queueFromVirtualHost; - } - - private Queue getQueueFromVirtualHost(String queueName, VirtualHost vhost) - { - Queue queue = null; - - for(Queue q : vhost.getQueues()) - { - - if(q.getName().equals(queueName)) - { - queue = q; - break; - } - } - return queue; - } - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/RestServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/RestServlet.java deleted file mode 100644 index 275d7f6794..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/RestServlet.java +++ /dev/null @@ -1,774 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.qpid.server.management.plugin.servlet.rest; - -import java.io.IOException; -import java.io.Writer; -import java.security.AccessControlException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.Part; - -import org.apache.qpid.server.model.AbstractConfiguredObject; -import org.apache.qpid.server.model.IllegalStateTransitionException; -import org.apache.qpid.server.model.IntegrityViolationException; -import org.apache.qpid.server.virtualhost.ExchangeExistsException; -import org.apache.qpid.server.virtualhost.QueueExistsException; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.SerializationConfig; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.apache.qpid.server.configuration.IllegalConfigurationException; -import org.apache.qpid.server.model.Broker; -import org.apache.qpid.server.model.ConfiguredObject; -import org.apache.qpid.server.util.urlstreamhandler.data.Handler; -import org.apache.qpid.util.DataUrlUtils; - -public class RestServlet extends AbstractServlet -{ - private static final Logger LOGGER = LoggerFactory.getLogger(RestServlet.class); - /** - * An initialization parameter to specify hierarchy - */ - private static final String HIERARCHY_INIT_PARAMETER = "hierarchy"; - - public static final String DEPTH_PARAM = "depth"; - public static final String OVERSIZE_PARAM = "oversize"; - public static final String ACTUALS_PARAM = "actuals"; - public static final String SORT_PARAM = "sort"; - public static final String INCLUDE_SYS_CONTEXT_PARAM = "includeSysContext"; - public static final String INHERITED_ACTUALS_PARAM = "inheritedActuals"; - public static final String EXTRACT_INITIAL_CONFIG_PARAM = "extractInitialConfig"; - public static final int SC_UNPROCESSABLE_ENTITY = 422; - - /** - * Signifies that the agent wishes the servlet to set the Content-Disposition on the - * response with the value attachment. This filename will be derived from the parameter value. - */ - public static final String CONTENT_DISPOSITION_ATTACHMENT_FILENAME_PARAM = "contentDispositionAttachmentFilename"; - - public static final Set RESERVED_PARAMS = - new HashSet<>(Arrays.asList(DEPTH_PARAM, - SORT_PARAM, - OVERSIZE_PARAM, - ACTUALS_PARAM, - INCLUDE_SYS_CONTEXT_PARAM, - EXTRACT_INITIAL_CONFIG_PARAM, - INHERITED_ACTUALS_PARAM, - CONTENT_DISPOSITION_ATTACHMENT_FILENAME_PARAM)); - - private Class[] _hierarchy; - - private final ConfiguredObjectToMapConverter _objectConverter = new ConfiguredObjectToMapConverter(); - private final boolean _hierarchyInitializationRequired; - - public RestServlet() - { - super(); - _hierarchyInitializationRequired = true; - } - - public RestServlet(Class... hierarchy) - { - super(); - _hierarchy = hierarchy; - _hierarchyInitializationRequired = false; - } - - @Override - public void init() throws ServletException - { - super.init(); - if (_hierarchyInitializationRequired) - { - doInitialization(); - } - Handler.register(); - } - - @SuppressWarnings("unchecked") - private void doInitialization() throws ServletException - { - ServletConfig config = getServletConfig(); - String hierarchy = config.getInitParameter(HIERARCHY_INIT_PARAMETER); - if (hierarchy != null && !"".equals(hierarchy)) - { - List> classes = new ArrayList>(); - String[] hierarchyItems = hierarchy.split(","); - for (String item : hierarchyItems) - { - Class itemClass = null; - try - { - itemClass = Class.forName(item); - } - catch (ClassNotFoundException e) - { - try - { - itemClass = Class.forName("org.apache.qpid.server.model." + item); - } - catch (ClassNotFoundException e1) - { - throw new ServletException("Unknown configured object class '" + item - + "' is specified in hierarchy for " + config.getServletName()); - } - } - Class clazz = (Class)itemClass; - classes.add(clazz); - } - Class[] hierarchyClasses = (Class[])new Class[classes.size()]; - _hierarchy = classes.toArray(hierarchyClasses); - } - else - { - _hierarchy = (Class[])new Class[0]; - } - } - - protected Collection> getObjects(HttpServletRequest request) - { - String[] pathInfoElements = getPathInfoElements(request); - List names = new ArrayList(); - if(pathInfoElements != null) - { - if(pathInfoElements.length > _hierarchy.length) - { - throw new IllegalArgumentException("Too many entries in path for REST servlet " - + getServletName() + ". Expected hierarchy length: " + _hierarchy.length - + "; Request hierarchy length: " + pathInfoElements.length - + "; Path Elements: " + Arrays.toString(pathInfoElements)); - } - names.addAll(Arrays.asList(pathInfoElements)); - } - - Collection> parents = new ArrayList>(); - parents.add(getBroker()); - Collection> children = new ArrayList>(); - - Map, String> filters = - new HashMap, String>(); - - for(int i = 0; i < _hierarchy.length; i++) - { - if(i == 0 || getBroker().getModel().getChildTypes(_hierarchy[i - 1]).contains(_hierarchy[i])) - { - - for(ConfiguredObject parent : parents) - { - if(names.size() > i - && names.get(i) != null - && !names.get(i).equals("*") - && names.get(i).trim().length() != 0) - { - for(ConfiguredObject child : parent.getChildren(_hierarchy[i])) - { - if(child.getName().equals(names.get(i))) - { - children.add(child); - } - } - } - else - { - children.addAll((Collection>) parent.getChildren(_hierarchy[i])); - } - } - } - else - { - children = parents; - if(names.size() > i - && names.get(i) != null - && !names.get(i).equals("*") - && names.get(i).trim().length() != 0) - { - filters.put(_hierarchy[i], names.get(i)); - } - } - - parents = children; - children = new ArrayList>(); - } - - if(!filters.isEmpty()) - { - Collection> potentials = parents; - parents = new ArrayList>(); - - for(ConfiguredObject o : potentials) - { - - boolean match = true; - - for(Map.Entry, String> entry : filters.entrySet()) - { - Collection ancestors = - getAncestors(getConfiguredClass(),entry.getKey(), o); - match = false; - for(ConfiguredObject ancestor : ancestors) - { - if(ancestor.getName().equals(entry.getValue())) - { - match = true; - break; - } - } - if(!match) - { - break; - } - } - if(match) - { - parents.add(o); - } - - } - } - - return filter(parents, request); - } - - private Collection> filter(Collection> objects, HttpServletRequest request) - { - - - Map> filters = new HashMap>(); - - for(String param : (Collection) Collections.list(request.getParameterNames())) - { - if(!RESERVED_PARAMS.contains(param)) - { - filters.put(param, Arrays.asList(request.getParameterValues(param))); - } - } - - if(filters.isEmpty()) - { - return objects; - } - - Collection> filteredObj = new ArrayList>(objects); - - Iterator> iter = filteredObj.iterator(); - - while(iter.hasNext()) - { - ConfiguredObject obj = iter.next(); - for(Map.Entry> entry : filters.entrySet()) - { - Object value = obj.getAttribute(entry.getKey()); - if(!entry.getValue().contains(String.valueOf(value))) - { - iter.remove(); - } - } - - } - - return filteredObj; - } - - private Collection getAncestors(Class childType, - Class ancestorType, - ConfiguredObject child) - { - Collection ancestors = new HashSet(); - Collection> parentTypes = child.getModel().getParentTypes(childType); - - for(Class parentClazz : parentTypes) - { - if(parentClazz == ancestorType) - { - ConfiguredObject parent = child.getParent(parentClazz); - if(parent != null) - { - ancestors.add(parent); - } - } - else - { - ConfiguredObject parent = child.getParent(parentClazz); - if(parent != null) - { - ancestors.addAll(getAncestors(parentClazz, ancestorType, parent)); - } - } - } - - return ancestors; - } - - @Override - protected void doGetWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException - { - // TODO - sort special params, everything else should act as a filter - String attachmentFilename = request.getParameter(CONTENT_DISPOSITION_ATTACHMENT_FILENAME_PARAM); - boolean extractInitialConfig = getBooleanParameterFromRequest(request, EXTRACT_INITIAL_CONFIG_PARAM); - - response.setContentType("application/json"); - response.setStatus(HttpServletResponse.SC_OK); - - if (attachmentFilename == null) - { - setCachingHeadersOnResponse(response); - } - else - { - setContentDispositionHeaderIfNecessary(response, attachmentFilename); - } - - Collection> allObjects = getObjects(request); - - int depth; - boolean actuals; - boolean includeSystemContext; - boolean inheritedActuals; - int oversizeThreshold; - - if(extractInitialConfig) - { - depth = Integer.MAX_VALUE; - oversizeThreshold = Integer.MAX_VALUE; - actuals = true; - includeSystemContext = false; - inheritedActuals = false; - } - else - { - depth = getIntParameterFromRequest(request, DEPTH_PARAM, 1); - oversizeThreshold = getIntParameterFromRequest(request, OVERSIZE_PARAM, 120); - actuals = getBooleanParameterFromRequest(request, ACTUALS_PARAM); - includeSystemContext = getBooleanParameterFromRequest(request, INCLUDE_SYS_CONTEXT_PARAM); - inheritedActuals = getBooleanParameterFromRequest(request, INHERITED_ACTUALS_PARAM); - } - - List> output = new ArrayList<>(); - for(ConfiguredObject configuredObject : allObjects) - { - - output.add(_objectConverter.convertObjectToMap(configuredObject, getConfiguredClass(), - depth, actuals, inheritedActuals, includeSystemContext, extractInitialConfig, oversizeThreshold, request.isSecure())); - } - - - Writer writer = getOutputWriter(request, response); - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true); - mapper.writeValue(writer, extractInitialConfig && output.size() == 1 ? output.get(0) : output); - } - - private void setContentDispositionHeaderIfNecessary(final HttpServletResponse response, - final String attachmentFilename) - { - if (attachmentFilename != null) - { - String filenameRfc2183 = ensureFilenameIsRfc2183(attachmentFilename); - if (filenameRfc2183.length() > 0) - { - response.setHeader("Content-disposition", String.format("attachment; filename=\"%s\"", filenameRfc2183)); - } - else - { - response.setHeader("Content-disposition", String.format("attachment")); // Agent will allow user to choose a name - } - } - } - - private Class getConfiguredClass() - { - return _hierarchy.length == 0 ? Broker.class : _hierarchy[_hierarchy.length-1]; - } - - @Override - protected void doPutWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException - { - performCreateOrUpdate(request, response); - } - - private void performCreateOrUpdate(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException - { - response.setContentType("application/json"); - - List names = getParentNamesFromServletPath(request); - Map providedObject = getRequestProvidedObject(request); - boolean isFullObjectURL = names.size() == _hierarchy.length; - boolean updateOnlyAllowed = isFullObjectURL && "POST".equalsIgnoreCase(request.getMethod()); - try - { - if (names.isEmpty() && _hierarchy.length == 0) - { - getBroker().setAttributes(providedObject); - response.setStatus(HttpServletResponse.SC_OK); - return; - } - - ConfiguredObject theParent = getBroker(); - ConfiguredObject[] otherParents = null; - Class objClass = getConfiguredClass(); - if (_hierarchy.length > 1) - { - List parents = findAllObjectParents(names); - theParent = parents.remove(0); - otherParents = parents.toArray(new ConfiguredObject[parents.size()]); - } - - if (isFullObjectURL) - { - providedObject.put("name", names.get(names.size() - 1)); - ConfiguredObject configuredObject = findObjectToUpdateInParent(objClass, providedObject, theParent, otherParents); - - if (configuredObject != null) - { - configuredObject.setAttributes(providedObject); - response.setStatus(HttpServletResponse.SC_OK); - return; - } - else if (updateOnlyAllowed) - { - sendErrorResponse(request, response, HttpServletResponse.SC_NOT_FOUND, "Object with " - + (providedObject.containsKey("id") ? " id '" + providedObject.get("id") : " name '" + providedObject.get("name")) - + "' does not exist!"); - return; - } - } - - ConfiguredObject configuredObject = theParent.createChild(objClass, providedObject, otherParents); - StringBuffer requestURL = request.getRequestURL(); - if (!isFullObjectURL) - { - requestURL.append("/").append(configuredObject.getName()); - } - response.setHeader("Location", requestURL.toString()); - response.setStatus(HttpServletResponse.SC_CREATED); - } - catch (RuntimeException e) - { - setResponseStatus(request, response, e); - } - - } - - private List findAllObjectParents(List names) - { - Collection[] objects = new Collection[_hierarchy.length]; - for (int i = 0; i < _hierarchy.length - 1; i++) - { - objects[i] = new HashSet<>(); - if (i == 0) - { - for (ConfiguredObject object : getBroker().getChildren(_hierarchy[0])) - { - if (object.getName().equals(names.get(0))) - { - objects[0].add(object); - break; - } - } - } - else - { - for (int j = i - 1; j >= 0; j--) - { - if (getBroker().getModel().getChildTypes(_hierarchy[j]).contains(_hierarchy[i])) - { - for (ConfiguredObject parent : objects[j]) - { - for (ConfiguredObject object : parent.getChildren(_hierarchy[i])) - { - if (object.getName().equals(names.get(i))) - { - objects[i].add(object); - } - } - } - break; - } - } - } - - } - List parents = new ArrayList<>(); - Class objClass = getConfiguredClass(); - Collection> parentClasses = - getBroker().getModel().getParentTypes(objClass); - for (int i = _hierarchy.length - 2; i >= 0; i--) - { - if (parentClasses.contains(_hierarchy[i])) - { - if (objects[i].size() == 1) - { - parents.add(objects[i].iterator().next()); - } - else - { - throw new IllegalArgumentException("Cannot deduce parent of class " - + _hierarchy[i].getSimpleName()); - } - } - - } - return parents; - } - - private List getParentNamesFromServletPath(HttpServletRequest request) - { - List names = new ArrayList<>(); - String[] pathInfoElements = getPathInfoElements(request); - if (pathInfoElements != null) - { - if (!(pathInfoElements.length == _hierarchy.length || - (_hierarchy.length > 0 && pathInfoElements.length == _hierarchy.length - 1))) - { - throw new IllegalArgumentException("Either parent path or full object path must be specified on object creation." - + " Full object path must be specified on object update. " - + "Found " - + names - + " of size " - + names.size() - + " expecting " - + _hierarchy.length); - } - names.addAll(Arrays.asList(pathInfoElements)); - } - return names; - } - - private Map getRequestProvidedObject(HttpServletRequest request) throws IOException, ServletException - { - Map providedObject; - - ArrayList headers = Collections.list(request.getHeaderNames()); - ObjectMapper mapper = new ObjectMapper(); - - if(headers.contains("Content-Type") && request.getHeader("Content-Type").startsWith("multipart/form-data")) - { - providedObject = new HashMap<>(); - Map fileUploads = new HashMap<>(); - Collection parts = request.getParts(); - for(Part part : parts) - { - if("data".equals(part.getName()) && "application/json".equals(part.getContentType())) - { - providedObject = mapper.readValue(part.getInputStream(), LinkedHashMap.class); - } - else - { - byte[] data = new byte[(int) part.getSize()]; - part.getInputStream().read(data); - String inlineURL = DataUrlUtils.getDataUrlForBytes(data); - fileUploads.put(part.getName(),inlineURL.toString()); - } - } - providedObject.putAll(fileUploads); - } - else - { - - providedObject = mapper.readValue(request.getInputStream(), LinkedHashMap.class); - } - return providedObject; - } - - private ConfiguredObject findObjectToUpdateInParent(Class objClass, Map providedObject, ConfiguredObject theParent, ConfiguredObject[] otherParents) - { - Collection existingChildren = theParent.getChildren(objClass); - - for (ConfiguredObject obj : existingChildren) - { - if ((providedObject.containsKey("id") && String.valueOf(providedObject.get("id")).equals(obj.getId().toString())) - || (obj.getName().equals(providedObject.get("name")) && sameOtherParents(obj, otherParents, objClass))) - { - return obj; - } - } - return null; - } - - private boolean sameOtherParents(ConfiguredObject obj, ConfiguredObject[] otherParents, Class objClass) - { - Collection> parentClasses = obj.getModel().getParentTypes(objClass); - - if(otherParents == null || otherParents.length == 0) - { - return parentClasses.size() == 1; - } - - - for (ConfiguredObject parent : otherParents) - { - boolean found = false; - for (Class parentClass : parentClasses) - { - if (parent == obj.getParent(parentClass)) - { - found = true; - break; - } - } - - if (!found) - { - return false; - } - } - - return true; - } - - private void setResponseStatus(HttpServletRequest request, HttpServletResponse response, RuntimeException e) throws IOException - { - if (e instanceof AccessControlException) - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("AccessControlException, sending " + HttpServletResponse.SC_FORBIDDEN, e); - } - response.setStatus(HttpServletResponse.SC_FORBIDDEN); - } - else - { - int responseCode = HttpServletResponse.SC_BAD_REQUEST; - String message = e.getMessage(); - if (e instanceof ExchangeExistsException || e instanceof QueueExistsException - || e instanceof AbstractConfiguredObject.DuplicateIdException - || e instanceof AbstractConfiguredObject.DuplicateNameException - || e instanceof IntegrityViolationException - || e instanceof IllegalStateTransitionException) - { - responseCode = HttpServletResponse.SC_CONFLICT; - } - else if (e instanceof IllegalConfigurationException || e instanceof IllegalArgumentException) - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(e.getClass().getSimpleName() + " processing request : " + message); - } - else if (LOGGER.isTraceEnabled()) - { - LOGGER.trace(e.getClass().getSimpleName() + " processing request", e); - } - responseCode = SC_UNPROCESSABLE_ENTITY; - } - else - { - LOGGER.warn("Unexpected exception processing request ", e); - } - - - sendErrorResponse(request, response, responseCode, message); - - } - } - - private void sendErrorResponse(HttpServletRequest request, HttpServletResponse response, int responseCode, String message) throws IOException - { - response.setStatus(responseCode); - - response.setContentType("application/json"); - response.setCharacterEncoding("UTF-8"); - - Writer out = getOutputWriter(request, response); - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true); - mapper.writeValue(out, Collections.singletonMap("errorMessage", message)); - } - - @Override - protected void doDeleteWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException - { - response.setContentType("application/json"); - response.setStatus(HttpServletResponse.SC_OK); - - setCachingHeadersOnResponse(response); - try - { - Collection> allObjects = getObjects(request); - for(ConfiguredObject o : allObjects) - { - o.delete(); - } - - response.setStatus(HttpServletResponse.SC_OK); - } - catch(RuntimeException e) - { - setResponseStatus(request, response, e); - } - } - - @Override - protected void doPostWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException - { - performCreateOrUpdate(request, response); - } - - private void setCachingHeadersOnResponse(HttpServletResponse response) - { - response.setHeader("Cache-Control","no-cache"); - response.setHeader("Pragma","no-cache"); - response.setDateHeader ("Expires", 0); - } - - private int getIntParameterFromRequest(final HttpServletRequest request, - final String paramName, - final int defaultValue) - { - int intValue = defaultValue; - final String stringValue = request.getParameter(paramName); - if(stringValue!=null) - { - try - { - intValue = Integer.parseInt(stringValue); - } - catch (NumberFormatException e) - { - LOGGER.warn("Could not parse " + stringValue + " as integer for parameter " + paramName); - } - } - return intValue; - } - - private boolean getBooleanParameterFromRequest(HttpServletRequest request, final String paramName) - { - return Boolean.parseBoolean(request.getParameter(paramName)); - } - - private String ensureFilenameIsRfc2183(final String requestedFilename) - { - String fileNameRfc2183 = requestedFilename.replaceAll("[\\P{InBasic_Latin}\\\\:/]", ""); - return fileNameRfc2183; - } - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/SaslServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/SaslServlet.java deleted file mode 100644 index 5bff0e22e5..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/SaslServlet.java +++ /dev/null @@ -1,319 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.servlet.rest; - -import java.io.IOException; -import java.io.Writer; -import java.net.SocketAddress; -import java.security.Principal; -import java.security.SecureRandom; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; - -import javax.security.auth.Subject; -import javax.security.sasl.SaslException; -import javax.security.sasl.SaslServer; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import org.apache.commons.codec.binary.Base64; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.SerializationConfig; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.apache.qpid.server.management.plugin.HttpManagementConfiguration; -import org.apache.qpid.server.management.plugin.HttpManagementUtil; -import org.apache.qpid.server.management.plugin.servlet.ServletConnectionPrincipal; -import org.apache.qpid.server.model.Broker; -import org.apache.qpid.server.security.SubjectCreator; -import org.apache.qpid.server.security.auth.AuthenticatedPrincipal; -import org.apache.qpid.server.util.ConnectionScopedRuntimeException; - -public class SaslServlet extends AbstractServlet -{ - - private static final Logger LOGGER = LoggerFactory.getLogger(SaslServlet.class); - - private static final SecureRandom SECURE_RANDOM = new SecureRandom(); - private static final String ATTR_RANDOM = "SaslServlet.Random"; - private static final String ATTR_ID = "SaslServlet.ID"; - private static final String ATTR_SASL_SERVER = "SaslServlet.SaslServer"; - private static final String ATTR_EXPIRY = "SaslServlet.Expiry"; - private static final long SASL_EXCHANGE_EXPIRY = 3000L; - - public SaslServlet() - { - super(); - } - - protected void doGetWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws - ServletException, - IOException - { - response.setContentType("application/json"); - response.setStatus(HttpServletResponse.SC_OK); - - response.setHeader("Cache-Control","no-cache"); - response.setHeader("Pragma","no-cache"); - response.setDateHeader ("Expires", 0); - - HttpSession session = request.getSession(); - getRandom(session); - - SubjectCreator subjectCreator = getSubjectCreator(request); - List mechanismsList = subjectCreator.getMechanisms(); - String[] mechanisms = mechanismsList.toArray(new String[mechanismsList.size()]); - Map outputObject = new LinkedHashMap(); - - final Subject subject = getAuthorisedSubject(request); - if(subject != null) - { - Principal principal = AuthenticatedPrincipal.getAuthenticatedPrincipalFromSubject(subject); - outputObject.put("user", principal.getName()); - } - else if (request.getRemoteUser() != null) - { - outputObject.put("user", request.getRemoteUser()); - } - - outputObject.put("mechanisms", (Object) mechanisms); - - final Writer writer = getOutputWriter(request, response); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true); - mapper.writeValue(writer, outputObject); - - } - - private Random getRandom(final HttpSession session) - { - Random rand = (Random) session.getAttribute(ATTR_RANDOM); - if(rand == null) - { - synchronized (SECURE_RANDOM) - { - rand = new Random(SECURE_RANDOM.nextLong()); - } - session.setAttribute(ATTR_RANDOM, rand); - } - return rand; - } - - - @Override - protected void doPostWithSubjectAndActor(final HttpServletRequest request, final HttpServletResponse response) throws IOException - { - checkSaslAuthEnabled(request); - - try - { - response.setContentType("application/json"); - response.setHeader("Cache-Control","no-cache"); - response.setHeader("Pragma","no-cache"); - response.setDateHeader("Expires", 0); - - HttpSession session = request.getSession(); - - String mechanism = request.getParameter("mechanism"); - String id = request.getParameter("id"); - String saslResponse = request.getParameter("response"); - - SubjectCreator subjectCreator = getSubjectCreator(request); - - if(mechanism != null) - { - if(id == null) - { - if(LOGGER.isDebugEnabled()) - { - LOGGER.debug("Creating SaslServer for mechanism: " + mechanism); - } - SaslServer saslServer = subjectCreator.createSaslServer(mechanism, request.getServerName(), null/*TODO*/); - evaluateSaslResponse(request, response, session, saslResponse, saslServer, subjectCreator); - } - else - { - response.setStatus(HttpServletResponse.SC_EXPECTATION_FAILED); - session.removeAttribute(ATTR_ID); - session.removeAttribute(ATTR_SASL_SERVER); - session.removeAttribute(ATTR_EXPIRY); - } - } - else - { - if(id != null) - { - if(id.equals(session.getAttribute(ATTR_ID)) && System.currentTimeMillis() < (Long) session.getAttribute(ATTR_EXPIRY)) - { - SaslServer saslServer = (SaslServer) session.getAttribute(ATTR_SASL_SERVER); - evaluateSaslResponse(request, response, session, saslResponse, saslServer, subjectCreator); - } - else - { - response.setStatus(HttpServletResponse.SC_EXPECTATION_FAILED); - session.removeAttribute(ATTR_ID); - session.removeAttribute(ATTR_SASL_SERVER); - session.removeAttribute(ATTR_EXPIRY); - } - } - else - { - response.setStatus(HttpServletResponse.SC_EXPECTATION_FAILED); - session.removeAttribute(ATTR_ID); - session.removeAttribute(ATTR_SASL_SERVER); - session.removeAttribute(ATTR_EXPIRY); - } - } - } - catch(IOException e) - { - LOGGER.error("Error processing SASL request", e); - throw e; - } - catch(RuntimeException e) - { - LOGGER.error("Error processing SASL request", e); - throw e; - } - } - - private void checkSaslAuthEnabled(HttpServletRequest request) - { - boolean saslAuthEnabled = false; - HttpManagementConfiguration management = getManagementConfiguration(); - if (request.isSecure()) - { - saslAuthEnabled = management.isHttpsSaslAuthenticationEnabled(); - } - else - { - saslAuthEnabled = management.isHttpSaslAuthenticationEnabled(); - } - if (!saslAuthEnabled) - { - throw new ConnectionScopedRuntimeException("Sasl authentication disabled."); - } - } - - private void evaluateSaslResponse(final HttpServletRequest request, - final HttpServletResponse response, - final HttpSession session, final String saslResponse, final SaslServer saslServer, SubjectCreator subjectCreator) throws IOException - { - final String id; - byte[] challenge; - try - { - challenge = saslServer.evaluateResponse(saslResponse == null ? new byte[0] : Base64.decodeBase64(saslResponse.getBytes())); - } - catch(SaslException e) - { - session.removeAttribute(ATTR_ID); - session.removeAttribute(ATTR_SASL_SERVER); - session.removeAttribute(ATTR_EXPIRY); - response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); - - return; - } - - if(saslServer.isComplete()) - { - Subject originalSubject = subjectCreator.createSubjectWithGroups(new AuthenticatedPrincipal(saslServer.getAuthorizationID())); - Subject subject = new Subject(false, - originalSubject.getPrincipals(), - originalSubject.getPublicCredentials(), - originalSubject.getPrivateCredentials()); - subject.getPrincipals().add(new ServletConnectionPrincipal(request)); - subject.setReadOnly(); - - Broker broker = getBroker(); - try - { - HttpManagementUtil.assertManagementAccess(broker.getSecurityManager(), subject); - } - catch(SecurityException e) - { - sendError(response, HttpServletResponse.SC_FORBIDDEN); - return; - } - - HttpManagementUtil.saveAuthorisedSubject(request.getSession(), subject); - session.removeAttribute(ATTR_ID); - session.removeAttribute(ATTR_SASL_SERVER); - session.removeAttribute(ATTR_EXPIRY); - if(challenge != null && challenge.length != 0) - { - Map outputObject = new LinkedHashMap(); - outputObject.put("challenge", new String(Base64.encodeBase64(challenge))); - - final Writer writer = getOutputWriter(request, response); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true); - mapper.writeValue(writer, outputObject); - } - response.setStatus(HttpServletResponse.SC_OK); - } - else - { - Random rand = getRandom(session); - id = String.valueOf(rand.nextLong()); - session.setAttribute(ATTR_ID, id); - session.setAttribute(ATTR_SASL_SERVER, saslServer); - session.setAttribute(ATTR_EXPIRY, System.currentTimeMillis() + SASL_EXCHANGE_EXPIRY); - - response.setStatus(HttpServletResponse.SC_OK); - - Map outputObject = new LinkedHashMap(); - outputObject.put("id", id); - outputObject.put("challenge", new String(Base64.encodeBase64(challenge))); - - final Writer writer = getOutputWriter(request, response); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true); - mapper.writeValue(writer, outputObject); - } - } - - private SubjectCreator getSubjectCreator(HttpServletRequest request) - { - return HttpManagementUtil.getManagementConfiguration(getServletContext()).getAuthenticationProvider(request).getSubjectCreator( - request.isSecure()); - } - - @Override - protected Subject getAuthorisedSubject(HttpServletRequest request) - { - Subject subject = HttpManagementUtil.getAuthorisedSubject(request.getSession()); - if(subject == null) - { - subject = HttpManagementUtil.tryToAuthenticate(request, HttpManagementUtil.getManagementConfiguration(getServletContext())); - } - return subject; - } - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/StructureServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/StructureServlet.java deleted file mode 100644 index 7508aa2d0b..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/StructureServlet.java +++ /dev/null @@ -1,100 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.qpid.server.management.plugin.servlet.rest; - -import java.io.IOException; -import java.io.Writer; -import java.util.ArrayList; -import java.util.Collection; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.SerializationConfig; - -import org.apache.qpid.server.model.Broker; -import org.apache.qpid.server.model.ConfiguredObject; - -public class StructureServlet extends AbstractServlet -{ - public StructureServlet() - { - super(); - } - - @Override - protected void doGetWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException - { - response.setContentType("application/json"); - response.setStatus(HttpServletResponse.SC_OK); - - response.setHeader("Cache-Control","no-cache"); - response.setHeader("Pragma","no-cache"); - response.setDateHeader ("Expires", 0); - - // TODO filtering??? request.getParameter("filter"); // filter=1,2,3 /groups/*/* - - Map structure = generateStructure(getBroker(), Broker.class); - - final Writer writer = getOutputWriter(request, response); - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true); - mapper.writeValue(writer, structure); - - response.setStatus(HttpServletResponse.SC_OK); - - } - - private Map generateStructure(ConfiguredObject object, Class clazz) - { - Map structure = new LinkedHashMap(); - structure.put("id", object.getId()); - structure.put("name", object.getName()); - - for(Class childClass : object.getModel().getChildTypes(clazz)) - { - Collection children = object.getChildren(childClass); - if(children != null) - { - List> childObjects = new ArrayList>(); - - for(ConfiguredObject child : children) - { - childObjects.add(generateStructure(child, childClass)); - } - - if(!childObjects.isEmpty()) - { - structure.put(pluralize(childClass),childObjects); - } - } - } - - return structure; - } - - private String pluralize(Class childClass) - { - String name = childClass.getSimpleName().toLowerCase(); - return name + (name.endsWith("s") ? "es" : "s"); - } -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/UserPreferencesServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/UserPreferencesServlet.java deleted file mode 100644 index bbaecca017..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/UserPreferencesServlet.java +++ /dev/null @@ -1,237 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.apache.qpid.server.management.plugin.servlet.rest; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.apache.qpid.server.model.AuthenticationProvider; -import org.apache.qpid.server.model.Broker; -import org.apache.qpid.server.model.PreferencesProvider; -import org.apache.qpid.server.model.User; -import org.apache.qpid.server.security.access.Operation; - -public class UserPreferencesServlet extends AbstractServlet -{ - private static final Logger LOGGER = LoggerFactory.getLogger(UserPreferencesServlet.class); - private static final long serialVersionUID = 1L; - - @Override - protected void doGetWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws IOException, - ServletException - { - String[] pathElements = getPathInfoElements(request); - if (pathElements != null && pathElements.length > 1) - { - getUserPreferences(pathElements[0], pathElements[1], request, response); - } - else - { - getUserList(pathElements, request, response); - } - } - - private void getUserPreferences(String authenticationProviderName, String userId, HttpServletRequest request, HttpServletResponse response) - throws IOException - { - Map preferences = null; - PreferencesProvider preferencesProvider = getPreferencesProvider(authenticationProviderName); - if (preferencesProvider == null) - { - response.sendError(HttpServletResponse.SC_NOT_FOUND, "Preferences provider is not configured"); - return; - } - try - { - preferences = preferencesProvider.getPreferences(userId); - - sendJsonResponse(preferences, request, response); - } - catch (SecurityException e) - { - response.sendError(HttpServletResponse.SC_FORBIDDEN, "Viewing of preferences is not allowed"); - return; - } - } - - private void getUserList(String[] pathElements, HttpServletRequest request, HttpServletResponse response) throws IOException - { - List> users = null; - try - { - users = getUsers(pathElements); - } - catch (Exception e) - { - LOGGER.debug("Bad preferences request", e); - response.sendError(HttpServletResponse.SC_BAD_REQUEST, e.getMessage()); - } - sendJsonResponse(users, request, response); - } - - private PreferencesProvider getPreferencesProvider(String authenticationProviderName) - { - AuthenticationProvider authenticationProvider = getAuthenticationProvider(authenticationProviderName); - if (authenticationProvider == null) - { - throw new IllegalArgumentException(String.format("Authentication provider '%s' is not found", - authenticationProviderName)); - } - PreferencesProvider preferencesProvider = authenticationProvider.getPreferencesProvider(); - return preferencesProvider; - } - - private AuthenticationProvider getAuthenticationProvider(String authenticationProviderName) - { - Broker broker = getBroker(); - Collection authenticationProviders = broker.getAuthenticationProviders(); - for (AuthenticationProvider authenticationProvider : authenticationProviders) - { - if (authenticationProviderName.equals(authenticationProvider.getName())) - { - return authenticationProvider; - } - } - return null; - } - - private List> getUsers(String[] pathElements) - { - List> users = new ArrayList>(); - String authenticationProviderName = pathElements != null && pathElements.length > 0 ? pathElements[0] : null; - - Broker broker = getBroker(); - Collection authenticationProviders = broker.getAuthenticationProviders(); - for (AuthenticationProvider authenticationProvider : authenticationProviders) - { - if (authenticationProviderName != null && !authenticationProvider.getName().equals(authenticationProviderName)) - { - continue; - } - PreferencesProvider preferencesProvider = authenticationProvider.getPreferencesProvider(); - if (preferencesProvider != null) - { - Set usernames = preferencesProvider.listUserIDs(); - for (String name : usernames) - { - Map userMap = new HashMap(); - userMap.put(User.NAME, name); - userMap.put("authenticationProvider", authenticationProvider.getName()); - users.add(userMap); - } - } - } - return users; - } - - /* - * removes preferences - */ - @Override - protected void doDeleteWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws IOException - { - Broker broker = getBroker(); - Collection authenticationProviders = broker.getAuthenticationProviders(); - Map> providerUsers = new HashMap>(); - Map requestProviders = new HashMap(); - for (String path : request.getParameterValues("user")) - { - String[] elements = path.split("/"); - if (elements.length != 2) - { - throw new IllegalArgumentException("Illegal user parameter " + path); - } - - String userId = elements[1]; - - String providerName = elements[0]; - Set users = providerUsers.get(providerName); - - if (users == null) - { - AuthenticationProvider provider = findAuthenticationProviderByName(providerName, authenticationProviders); - if (provider == null) - { - throw new IllegalArgumentException("Cannot find provider with name '" + providerName + "'"); - } - users = new HashSet(); - providerUsers.put(providerName, users); - requestProviders.put(providerName, provider); - } - users.add(userId); - } - - if (!providerUsers.isEmpty()) - { - for (Map.Entry> entry : providerUsers.entrySet()) - { - String providerName = entry.getKey(); - AuthenticationProvider provider = requestProviders.get(providerName); - Set usersToDelete = entry.getValue(); - PreferencesProvider preferencesProvider = provider.getPreferencesProvider(); - - if (preferencesProvider != null && !usersToDelete.isEmpty()) - { - String[] users = usersToDelete.toArray(new String[usersToDelete.size()]); - try - { - preferencesProvider.deletePreferences(users); - } - catch (SecurityException e) - { - response.sendError(HttpServletResponse.SC_FORBIDDEN, "Deletion of preferences is not allowed"); - return; - } - } - } - } - - } - - protected AuthenticationProvider findAuthenticationProviderByName(String providerName, Collection authenticationProviders) - { - AuthenticationProvider provider = null; - for (AuthenticationProvider authenticationProvider : authenticationProviders) - { - if(authenticationProvider.getName().equals(providerName)) - { - provider = authenticationProvider; - break; - } - } - return provider; - } - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/AbstractSpecialisedAttributeLister.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/AbstractSpecialisedAttributeLister.java deleted file mode 100644 index c697603c6c..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/AbstractSpecialisedAttributeLister.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.servlet.rest.action; - -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; -import java.util.TreeMap; -import java.util.TreeSet; - -import org.apache.qpid.server.management.plugin.servlet.rest.Action; -import org.apache.qpid.server.model.Broker; -import org.apache.qpid.server.model.ConfiguredObject; -import org.apache.qpid.server.model.ConfiguredObjectAttribute; -import org.apache.qpid.server.model.ConfiguredObjectTypeRegistry; - -abstract class AbstractSpecialisedAttributeLister implements Action -{ - - - private static final String ATTRIBUTES = "attributes"; - private static final String DESCRIPTIONS = "descriptions"; - - @Override - final public Object perform(Map request, Broker broker) - { - ConfiguredObjectTypeRegistry typeRegistry = broker.getModel().getTypeRegistry(); - Collection> groupProviderTypes = - typeRegistry.getTypeSpecialisations(getCategoryClass()); - - Map attributes = new TreeMap(); - - for (Class groupProviderType : groupProviderTypes) - { - Collection> typeSpecificAttributes = - typeRegistry.getTypeSpecificAttributes(groupProviderType); - - Map data = new HashMap(); - - Collection attributeNames = new TreeSet<>(); - Map descriptions = new HashMap<>(); - for(ConfiguredObjectAttribute attr : typeSpecificAttributes) - { - attributeNames.add(attr.getName()); - if(!"".equals(attr.getDescription())) - { - descriptions.put(attr.getName(), attr.getDescription()); - } - } - data.put(ATTRIBUTES, attributeNames); - data.put(DESCRIPTIONS, descriptions); - - attributes.put(ConfiguredObjectTypeRegistry.getType(groupProviderType), data); - } - return attributes; - } - - abstract Class getCategoryClass(); - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/ListAccessControlProviderAttributes.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/ListAccessControlProviderAttributes.java deleted file mode 100644 index 1eb3f9a9ac..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/ListAccessControlProviderAttributes.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.servlet.rest.action; - -import org.apache.qpid.server.model.AccessControlProvider; - -public class ListAccessControlProviderAttributes extends AbstractSpecialisedAttributeLister -{ - @Override - public String getName() - { - return ListAccessControlProviderAttributes.class.getSimpleName(); - } - - @Override - Class getCategoryClass() - { - return AccessControlProvider.class; - } -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/ListBrokerAttribute.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/ListBrokerAttribute.java deleted file mode 100644 index dc414e6a64..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/ListBrokerAttribute.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.servlet.rest.action; - -import java.util.Map; - -import org.apache.qpid.server.management.plugin.servlet.rest.Action; -import org.apache.qpid.server.model.Broker; - -public class ListBrokerAttribute implements Action -{ - - private final String _attributeName; - private final String _name; - - public ListBrokerAttribute(String attributeName, String name) - { - _attributeName = attributeName; - _name = name; - } - - @Override - public String getName() - { - return _name; - } - - @Override - public Object perform(Map request, Broker broker) - { - return broker.getAttribute(_attributeName); - } - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/ListGroupProviderAttributes.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/ListGroupProviderAttributes.java deleted file mode 100644 index ecb4320f1f..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/ListGroupProviderAttributes.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - * - */ -package org.apache.qpid.server.management.plugin.servlet.rest.action; - -import org.apache.qpid.server.model.GroupProvider; - -public class ListGroupProviderAttributes extends AbstractSpecialisedAttributeLister -{ - @Override - public String getName() - { - return ListGroupProviderAttributes.class.getSimpleName(); - } - - @Override - Class getCategoryClass() - { - return GroupProvider.class; - } -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/ListTimeZones.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/ListTimeZones.java deleted file mode 100644 index 56bc7b1bf7..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/ListTimeZones.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.apache.qpid.server.management.plugin.servlet.rest.action; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Map; -import java.util.TimeZone; - -import org.apache.qpid.server.management.plugin.servlet.rest.Action; -import org.apache.qpid.server.model.Broker; - -public class ListTimeZones implements Action -{ - - private static final String[] TIMEZONE_REGIONS = { "Africa", "America", "Antarctica", "Arctic", "Asia", "Atlantic", "Australia", - "Europe", "Indian", "Pacific" }; - - @Override - public String getName() - { - return ListTimeZones.class.getSimpleName(); - } - - @Override - public Object perform(Map request, Broker broker) - { - List timeZoneDetails = new ArrayList(); - String[] ids = TimeZone.getAvailableIDs(); - long currentTime = System.currentTimeMillis(); - Date currentDate = new Date(currentTime); - for (String id : ids) - { - int cityPos = id.indexOf("/"); - if (cityPos > 0 && cityPos < id.length() - 1) - { - String region = id.substring(0, cityPos); - for (int i = 0; i < TIMEZONE_REGIONS.length; i++) - { - if (region.equals(TIMEZONE_REGIONS[i])) - { - TimeZone tz = TimeZone.getTimeZone(id); - int offset = tz.getOffset(currentTime)/60000; - String city = id.substring(cityPos + 1).replace('_', ' '); - timeZoneDetails.add(new TimeZoneDetails(id, tz.getDisplayName(tz.inDaylightTime(currentDate), TimeZone.SHORT), offset, city, region)); - break; - } - } - } - } - return timeZoneDetails; - } - - public static class TimeZoneDetails - { - private String id; - private String name; - private int offset; - private String city; - private String region; - - public TimeZoneDetails(String id, String name, int offset, String city, String region) - { - super(); - this.id = id; - this.name = name; - this.offset = offset; - this.city = city; - this.region = region; - } - - public String getId() - { - return id; - } - - public String getName() - { - return name; - } - - public int getOffset() - { - return offset; - } - - public String getCity() - { - return city; - } - - public String getRegion() - { - return region; - } - } -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/session/LoginLogoutReporter.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/session/LoginLogoutReporter.java deleted file mode 100644 index 7e0d13fddb..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/session/LoginLogoutReporter.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.session; - -import java.security.Principal; -import java.security.PrivilegedAction; - -import javax.security.auth.Subject; -import javax.servlet.http.HttpSession; -import javax.servlet.http.HttpSessionBindingEvent; -import javax.servlet.http.HttpSessionBindingListener; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.apache.qpid.server.logging.EventLogger; -import org.apache.qpid.server.logging.EventLoggerProvider; -import org.apache.qpid.server.logging.messages.ManagementConsoleMessages; -import org.apache.qpid.server.security.auth.AuthenticatedPrincipal; - -/** - * Logs {@link ManagementConsoleMessages#OPEN(String)} and {@link ManagementConsoleMessages#CLOSE(String)} - * messages. A single instance of this class must be placed in the {@link HttpSession} immediately after - * the user has successfully logged-in, and removed (or the whole session invalidated) as the user logs out. - */ -public class LoginLogoutReporter implements HttpSessionBindingListener -{ - private static final Logger LOGGER = LoggerFactory.getLogger(LoginLogoutReporter.class); - private final Subject _subject; - private final Principal _principal; - private final EventLoggerProvider _eventLoggerProvider; - - public LoginLogoutReporter(Subject subject, EventLoggerProvider eventLoggerProvider) - { - super(); - _subject = subject; - _principal = AuthenticatedPrincipal.getAuthenticatedPrincipalFromSubject(_subject); - _eventLoggerProvider = eventLoggerProvider; - } - - @Override - public void valueBound(HttpSessionBindingEvent arg0) - { - reportLogin(); - } - - @Override - public void valueUnbound(HttpSessionBindingEvent arg0) - { - reportLogout(); - } - - private void reportLogin() - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("User logging in : " + _principal); - } - - Subject.doAs(_subject, new PrivilegedAction() - { - @Override - public Void run() - { - getEventLogger().message(ManagementConsoleMessages.OPEN(_principal.getName())); - return null; - } - }); - } - - private void reportLogout() - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("User logging out : " + _principal); - } - - Subject.doAs(_subject, new PrivilegedAction() - { - @Override - public Void run() - { - getEventLogger().message(ManagementConsoleMessages.CLOSE(_principal.getName())); - return null; - } - }); - } - - public EventLogger getEventLogger() - { - return _eventLoggerProvider.getEventLogger(); - } -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/accesscontrolprovider/aclfile/add.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/accesscontrolprovider/aclfile/add.html deleted file mode 100644 index 796988c410..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/accesscontrolprovider/aclfile/add.html +++ /dev/null @@ -1,64 +0,0 @@ - - -

- -
-
Server path or upload*:
-
- - - - -
- -
-
-
- - -
- -
- - -
-
- -
-
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/accesscontrolprovider/showAclFile.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/accesscontrolprovider/showAclFile.html deleted file mode 100644 index 24cef75737..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/accesscontrolprovider/showAclFile.html +++ /dev/null @@ -1,27 +0,0 @@ - -
-
-
Path:
-
-
-
-
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/addAccessControlProvider.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/addAccessControlProvider.html deleted file mode 100644 index 64f8078314..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/addAccessControlProvider.html +++ /dev/null @@ -1,66 +0,0 @@ - -
-
-
-
-
-
-
Name*:
-
- -
-
-
-
Type*:
-
- -
-
- -
-
-
-
-
-
-
-
- -
- - -
-
-
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/addAuthenticationProvider.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/addAuthenticationProvider.html deleted file mode 100644 index 5a565e72e3..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/addAuthenticationProvider.html +++ /dev/null @@ -1,64 +0,0 @@ - -
-
-
-
-
-
- Authentication Provider -
-
Name*:
-
- -
-
-
-
Type*:
-
- -
-
-
-
-
-
-
- -
-
-
- - -
-
-
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/addBinding.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/addBinding.html deleted file mode 100644 index d4ac5877cb..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/addBinding.html +++ /dev/null @@ -1,64 +0,0 @@ - -
-
-
- -
-
Exchange Name*:
-
-
-
-
-
-
Queue Name*:
-
-
-
-
-
-
Binding Key*:
-
- -
-
- -
-
- Binding Arguments -
NOTE: Only arguments with name and value will be submitted. To edit, please, click on a grid cell.
-
-
- - -
-
-
- -
- -
-
-
-
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/addExchange.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/addExchange.html deleted file mode 100644 index 25e9752392..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/addExchange.html +++ /dev/null @@ -1,74 +0,0 @@ - -
-
-
-
-
Name*:
-
- -
-
-
-
Exchange Type:
-
- -
-
-
-
Durable?
-
- -
-
- - -
- -
- -
-
-
-
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/addGroupProvider.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/addGroupProvider.html deleted file mode 100644 index b622fe94d2..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/addGroupProvider.html +++ /dev/null @@ -1,66 +0,0 @@ - - -
-
-
-
-
-
-
Name*:
-
- -
-
-
-
Type*:
-
- -
-
-
-
-
-
-
-
-
-
- -
- - -
-
-
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/addPort.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/addPort.html deleted file mode 100644 index 10b79987a5..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/addPort.html +++ /dev/null @@ -1,260 +0,0 @@ - -
-
-
- -
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
-
- -
-
-
- -
-
- -
-
-
- -
-
- -
-
-
- -
-
- -
-
-
- -
-
-
- -
-
- -
-
-
- -
-
-
- -
-
- -
-
-
-
-
- -
-
-
- -
-
- -
-
-
- -
-
-
- -
-
- -
-
-
- -
-
-
-
- -
-
- -
-
-
-
- -
-
- -
-
-
- -
-
- Trust Stores: -
-
- -
-
- - - - - - - -
NamePeers Only
-
-
-
- - -
-
- - -
-
-
-
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/addPreferencesProvider.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/addPreferencesProvider.html deleted file mode 100644 index e3984e1ae2..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/addPreferencesProvider.html +++ /dev/null @@ -1,28 +0,0 @@ - -
-
- -
- -
- - - -
-
-
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/addQueue.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/addQueue.html deleted file mode 100644 index 61f0de22d8..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/addQueue.html +++ /dev/null @@ -1,344 +0,0 @@ - -
-
-
- -
-
Queue Name*:
-
- -
-
-
-
Queue Type:
-
- -
-
-
- - - - - - - -
-
Durable?
-
- -
-
-
-
Persist Messages?
-
- -
-
-
-
Maximum Ttl:
-
- -
-
-
-
Minimum Ttl:
-
- -
-
- -
-
- Flow Control Settings -
-
Capacity:
-
- -
-
-
-
Resume Capacity:
-
- -
-
-
-
-
- -
-
- Alerting Settings -
-
Queue Depth:
-
- -
-
-
-
Queue Depth:
-
- -
-
-
-
Message Age:
-
- -
-
-
-
Message Size:
-
- -
-
-
-
Gap between alerts:
-
- -
-
-
-
-
- -
-
- Other Settings -
-
Maximum Delivery Retries:
-
- -
-
-
-
Create DLQ?
-
- -
-
- -
-
Configuring maximum delivery retries on a queue which has no DLQ or alternate
exchange will result in messages being discarded after the limit is reached.
- -
-
Message Group Key:
-
- -
-
-
-
Shared Message Groups?
-
- -
-
-
-
-
- -
-
-
- -
- - -
- -
-
-
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/addStore.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/addStore.html deleted file mode 100644 index a1903d456e..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/addStore.html +++ /dev/null @@ -1,66 +0,0 @@ - - -
-
-
-
-
-
-
Name*:
-
- -
-
-
-
Type*:
-
- -
-
-
-
-
-
-
-
-
-
- -
- - -
-
-
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/addVirtualHostNodeAndVirtualHost.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/addVirtualHostNodeAndVirtualHost.html deleted file mode 100644 index a2ee2c1b4b..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/addVirtualHostNodeAndVirtualHost.html +++ /dev/null @@ -1,136 +0,0 @@ - -
-
-
- - -
-
-
- Virtual Host Node -
-
Name*:
-
- -
-
-
-
Type*:
-
- -
-
-
- -
- -
-
- -
-
- -
-
-
- -
-
- - - -
-
-
- -
- -
-
-
- - -
-
-
- - -
-
-
- Virtual Host -
-
Type*:
-
- -
-
-
- -
- -
-
-
- -
-
-
-
-
- - -
-
-
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/addUser.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/addUser.html deleted file mode 100644 index 785605f694..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/addUser.html +++ /dev/null @@ -1,42 +0,0 @@ - -
-
-
- - - - - - - - - -
User Name*:
Password*
-
- - - - -
-
-
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/external/add.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/external/add.html deleted file mode 100644 index 11a9bf8ea0..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/external/add.html +++ /dev/null @@ -1,30 +0,0 @@ - -
-
Use full DN:
-
- -
-
-
-
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/external/show.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/external/show.html deleted file mode 100644 index ac065c723c..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/external/show.html +++ /dev/null @@ -1,26 +0,0 @@ - -
-
-
Use full DN:
-
-
-
-
- diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/filebased/add.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/filebased/add.html deleted file mode 100644 index 53eb786722..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/filebased/add.html +++ /dev/null @@ -1,31 +0,0 @@ - -
-
Path*:
-
- -
-
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/filebased/show.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/filebased/show.html deleted file mode 100644 index 5060656964..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/filebased/show.html +++ /dev/null @@ -1,26 +0,0 @@ - -
-
-
Path to file:
-
-
-
-
- diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/setPassword.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/setPassword.html deleted file mode 100644 index 3d67463abd..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/setPassword.html +++ /dev/null @@ -1,42 +0,0 @@ - -
-
-
- - - - - - - - - -
User Name:
Password*
-
- - - - -
-
-
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/showPrincipalDatabaseAuthenticationManager.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/showPrincipalDatabaseAuthenticationManager.html deleted file mode 100644 index e6c067fddf..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/showPrincipalDatabaseAuthenticationManager.html +++ /dev/null @@ -1,27 +0,0 @@ - -
-
-
- - -
-
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/simpleldap/add.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/simpleldap/add.html deleted file mode 100644 index 3a3b613564..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/simpleldap/add.html +++ /dev/null @@ -1,133 +0,0 @@ - -
-
-
LDAP server URL*:
-
- -
-
-
-
LDAP authentication URL
-
- -
-
-
-
Trust Store:
-
- -
-
-
-
Search context*:
-
- -
-
-
-
Search filter*:
-
- -
-
-
-
Search username:
-
- -
-
-
-
Search password:
-
- -
-
-
-
Authenticate without search:
-
- -
-
-
-
-
-
LDAP Context Factory:
-
- -
-
-
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/simpleldap/show.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/simpleldap/show.html deleted file mode 100644 index e2f1da32af..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/simpleldap/show.html +++ /dev/null @@ -1,58 +0,0 @@ - -
-
-
LDAP server URL:
-
-
-
-
Search context:
-
-
-
-
Search filter:
-
-
-
-
Search user name:
-
-
-
-
Search password:
-
-
-
-
Trust Store:
-
-
-
-
Bind without search:
-
-
-
-
LDAP Context Factory:
-
-
-
-
LDAP authentication URL:
-
-
-
-
- diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/common/ContextVariablesEditor.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/common/ContextVariablesEditor.html deleted file mode 100644 index 60fc0843eb..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/common/ContextVariablesEditor.html +++ /dev/null @@ -1,35 +0,0 @@ - -
-
-
-
-
- - - - - - -
-
\ No newline at end of file diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/common/ResourceWidget.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/common/ResourceWidget.html deleted file mode 100644 index e47fa6ca6d..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/common/ResourceWidget.html +++ /dev/null @@ -1,48 +0,0 @@ - - - diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/common/TimeZoneSelector.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/common/TimeZoneSelector.html deleted file mode 100644 index 2b2fca7d8a..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/common/TimeZoneSelector.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - -
Use UTC time: - -
Time Zone: - - - - - - - -
RegionCity
-
\ No newline at end of file diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/css/apidocs.css b/qpid/java/broker-plugins/management-http/src/main/java/resources/css/apidocs.css deleted file mode 100644 index 5baecf7c02..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/css/apidocs.css +++ /dev/null @@ -1,86 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -html, body { - margin-top: 20px; - margin-left: 40px; - margin-right: 40px; - padding: 0; - font-family: Lucida Sans,Lucida Grande,Arial,sans-serif !important; - font-size: 13px !important; - background: white; - color: #333; -} - -th, td { - text-align: left; -} - -.type { - font-family: "Courier New", courier, monospace; -} - -table.types td.name { - width: 20em; -} - -table.attributes td.name { - font-family: "Courier New", courier, monospace; - width: 20em; -} - -table.attributes td.type { - width: 7em; -} - -table.api td,th { - vertical-align: top; -} - - -table.api td.type { - width: 12em; -} - - -table.api td.path { - width: 20em; -} - - -table.api td.description { - width: 25em; -} - -table.api a:link { - color: #333; - text-decoration: none; -} - -table.api a:visited { - color: #666; - text-decoration: none; -} - - -div.restriction { - border-bottom: 1px dotted #666; - display: inline; -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/css/common.css b/qpid/java/broker-plugins/management-http/src/main/java/resources/css/common.css deleted file mode 100644 index ec31709987..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/css/common.css +++ /dev/null @@ -1,339 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -* { - outline: none !important; -} - -html, body { - height: 100%; - margin: 0; - margin-right: 40px; - padding: 0; - overflow: hidden; - font-family: Lucida Sans,Lucida Grande,Arial !important; - font-size: 13px !important; - background: white; - color: #333; -} - -.clear { - clear: both; -} - -.hidden { - display: none; -} - -#pageLayout { - height: 100%; -} -button { - -webkit-transition: background-color 0.2s linear; - border-radius:4px; - -moz-border-radius: 4px 4px 4px 4px; - -moz-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15); - background-color: #E4F2FF; - background-position: center top; - background-repeat: repeat-x; - border: 1px solid #769DC0; - padding: 2px 8px 4px; - font-size:1em; -} - -button:hover { - background-color: #AFD9FF; - color: #000000; -} - -h1 { - font-size:1.5em; -} - -.header { - height:100px; - background:url("../images/qpid-logo.png") left center no-repeat -} - -.logo { - text-align:left; - vertical-align: top; - font-weight:600; - height: 90px; - padding-left: 200px; - padding-top: 1px; - padding-bottom: 10px; - font-size:14px; - font-family:"Verdana", cursive; -} - -.footer { - color:#000000; - clear:both; - text-align:center; - font-size:11px; - line-height:17px; - -} - -div .messages { - width: 100%; - height: 350px; -} - -.formBox { - margin: 10px 5px; -} - -.formBox legend { - font-weight: bold; - margin-left: 5px; - background-color: white; -} - -.formBox fieldset { - padding: 5px; - border: .1em solid lightgrey; - border-radius: 5px; -} - -.formLabel-labelCell, .tableContainer-labelCell { - width: 300px; - font-weight: bold; -} - -.tableContainer-labelCell { - float: none; -} - -.formLabel-labelCell { - margin-left: 5px; - float: left; - } - -.formValue-valueCell { - float: left; -} - -.formBox .addPermittedNodeList { - width: 15em; -} - -.formBox .addPermittedNodeList select { - width: 100%; -} - -.formLabel-controlCell { - padding: 1px; - float: left; -} - -.columnDefDialogButtonIcon { - background: url("../dojo/dojox/grid/enhanced/resources/images/sprite_icons.png") no-repeat; - background-position: -260px 2px; - width: 14px; - height: 14px; -} - -.logViewerIcon { - background: url("../images/log-viewer.png") no-repeat; - width: 14px; - height: 16px; -} - -.downloadLogsIcon { - background: url("../images/download.png") no-repeat; - width: 14px; - height: 14px; -} - -.dojoxGridFBarClearFilterButtontnIcon -{ - background: url("../dojo/dojox/grid/enhanced/resources/images/sprite_icons.png") no-repeat; - background-position: -120px -18px; - width: 14px; - height: 14px; -} - -.rowNumberLimitIcon -{ - background: url("../dojo/dojox/grid/enhanced/resources/images/sprite_icons.png") no-repeat; - background-position: -240px -18px; - width: 14px; - height: 14px; -} - -.gridRefreshIcon -{ - background: url("../images/refresh.png") no-repeat; - width: 16px; - height: 16px; -} - -.gridAutoRefreshIcon -{ - background: url("../images/auto-refresh.png") no-repeat; - width: 16px; - height: 16px; -} - -.redBackground tr{ background-color:#ffdcd7 !important; background-image: none !important;} -.yellowBackground tr{background-color:#fbfddf !important; background-image: none !important;} -.grayBackground tr{background-color:#eeeeee !important; background-image: none !important;} -.dojoxGridRowOdd.grayBackground tr{ background-color:#e9e9e9 !important; background-image: none !important;} -.dojoxGridRowOdd.yellowBackground tr{background-color:#fafdd5 !important; background-image: none !important;} -.dojoxGridRowOdd.redBackground tr{background-color:#f4c1c1 !important; background-image: none !important;} - -.preferencesIcon -{ - background: url("../images/gear.png") no-repeat; - width: 16px; - height: 16px; -} - -.helpIcon -{ - background: url("../images/help.png") no-repeat; - width: 16px; - height: 16px; -} - -.loadingIcon -{ - background: url("../dojo/dojox/image/resources/images/loading.gif") no-repeat; - width: 16px; - height: 16px; - background-size: contain; - display: inline-block; -} - -.loadedIcon -{ - background: url("../dojo/dijit/icons/images/commonIconsObjActEnabled_rtl.png") no-repeat; - background-position: -352px -0px; - width: 16px; - height: 16px; - display: inline-block; -} - -.fileUpload -{ - float: right; - padding: 5px; -} - -.infoMessage -{ - padding: 5px; - font-style: italic; -} - -.alignLeft { - float: left; - display: inline-block; -} - -.alignRight { - float: right; - display: inline-block; -} - -.multiLineValue { - display: inline-block; -} - -.haOptionLabel { - font-weight: bold; - margin-left: 5px; -} - -.editNoteBanner { - font-style: italic; - margin: 0px 0px 10px 5px; -} - -#errorDialog { - overflow: auto; - width: 400px; -} - -.errorDialogErrorPrimary { - font-weight: bold; - margin-bottom: 10px; - max-width: 350px; -} - -.errorDialogErrorSecondary { - font-style: italic; -} - -/* Required to keep queue type radio buttons on one line when dialog adds scrollbar */ -#addQueue { - overflow: auto; - width: 630px; -} - -#authenticatedUserControls { - max-width: 300px; -} - -.claro .dojoxCheckedMultiSelectWrapper { - height: auto; -} - -.claro .dojoxCheckedMultiSelect .dojoxCheckedMultiSelectWrapper { - border: none; - background-color: transparent; -} - -.dijitMultiSelect { - width : 14.75em; -} - -.highlightedText -{ - font-weight: bold; -} - -.normalText -{ - font-weight: normal; -} - -.contextEditor -{ - margin-left:5px; - margin-right:5px; -} - -.contextGrid -{ - width:100%; - max-height: 140px; - overflow: auto; -} - -.qpidDialogPaneActionBar -{ - margin-left:-10px; - margin-right:-10px; - margin-bottom:-10px; - margin-top:5px; -} \ No newline at end of file diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/editBroker.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/editBroker.html deleted file mode 100644 index 993a2c7505..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/editBroker.html +++ /dev/null @@ -1,119 +0,0 @@ - -
-
-
-
-
-
-
Name*:
-
- -
-
-
-
Default Virtual Host*:
-
- -
-
-
-
Statistics reporting period (ms):
-
- -
-
-
-
Statistics reporting period enabled:
-
- -
-
- -
-
- Global Connection Defaults -
-
Maximum number of sessions:
-
- -
-
-
-
Heart beat delay (ms)::
-
- -
-
-
-
- -
-
-
- -
-
-
- - -
-
-
-
-
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/editQueue.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/editQueue.html deleted file mode 100644 index e7b33ed6f9..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/editQueue.html +++ /dev/null @@ -1,300 +0,0 @@ - -
-
-
-
-
-
NOTE: All changes will only take effect after Virtual Host restart.
-
-
Queue Name:
-
- -
-
- -
-
Queue Type:
-
- -
-
-
- - - - - - - -
-
Durable?
-
- -
-
-
-
Persist Messages?
-
- -
-
-
-
Maximum Ttl:
-
- -
-
-
-
Minimum Ttl:
-
- -
-
- -
- -
-
- Flow Control Settings -
-
Capacity:
-
- -
-
-
-
Resume Capacity:
-
- -
-
-
-
-
- -
-
- Alerting Settings -
-
Queue Depth:
-
- -
-
-
-
Queue Depth:
-
- -
-
-
-
Message Age:
-
- -
-
-
-
Message Size:
-
- -
-
-
-
Gap between alerts:
-
- -
-
-
-
-
- -
-
- Other Settings -
-
Maximum Delivery Retries:
-
- -
-
-
-
-
- -
-
-
-
-
- - -
-
- -
-
-
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/editVirtualHost.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/editVirtualHost.html deleted file mode 100644 index 8e03dfdd17..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/editVirtualHost.html +++ /dev/null @@ -1,137 +0,0 @@ - -
-
-
-
-
-
NOTE: All changes will only take effect after Virtual Host restart.
-
-
Name*:
-
- -
-
- -
- -
-
- Store transaction settings -
-
Idle Timeout Warn:
-
- -
-
-
-
Idle Timeout Close:
-
- -
-
-
-
Open Timeout Warn:
-
- -
-
-
-
Open Timeout Close:
-
- -
-
-
-
- -
-
- House keeping settings -
-
Check period (ms):
-
- -
-
-
-
Thread count:
-
- -
-
-
-
-
- -
-
Dead letter queue enabled:
-
- - -
-
- -
- -
-
-
-
-
- - -
-
-
-
-
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/editVirtualHostNode.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/editVirtualHostNode.html deleted file mode 100644 index 59597845a2..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/editVirtualHostNode.html +++ /dev/null @@ -1,56 +0,0 @@ - -
-
-
-
-
-
NOTE: All changes will only take effect after Virtual Host Node restart.
-
-
Name*:
-
- -
-
- -
- -
- -
-
-
-
-
- -
- - -
-
-
-
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/footer.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/footer.html deleted file mode 100644 index 44fa4fda36..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/footer.html +++ /dev/null @@ -1,28 +0,0 @@ - - - diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/grid/showColumnDefDialog.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/grid/showColumnDefDialog.html deleted file mode 100644 index 535b9a1fe5..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/grid/showColumnDefDialog.html +++ /dev/null @@ -1,32 +0,0 @@ - -
-
-
Select columns to display:
-
-
-
- - -
-
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/grid/showRowNumberLimitDialog.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/grid/showRowNumberLimitDialog.html deleted file mode 100644 index cacdf49e66..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/grid/showRowNumberLimitDialog.html +++ /dev/null @@ -1,33 +0,0 @@ - -
-
-
Set the maximum number of rows to cache and display:
- -
-
- - -
-
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/group/addGroupMember.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/group/addGroupMember.html deleted file mode 100644 index e479e8cb74..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/group/addGroupMember.html +++ /dev/null @@ -1,38 +0,0 @@ - -
-
-
- - - - - -
Name*:
-
- -
- -
-
-
-
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/group/showGroup.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/group/showGroup.html deleted file mode 100644 index c84e794ac1..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/group/showGroup.html +++ /dev/null @@ -1,32 +0,0 @@ - -
- Name: -
-
-
-
- - -
-
-
- diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/groupprovider/addGroup.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/groupprovider/addGroup.html deleted file mode 100644 index 29ce2ebe6c..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/groupprovider/addGroup.html +++ /dev/null @@ -1,39 +0,0 @@ - -
-
-
- - - - - -
Group Name*:
-
- -
- -
- -
-
-
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/groupprovider/groupfile/add.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/groupprovider/groupfile/add.html deleted file mode 100644 index 7fc458cd4f..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/groupprovider/groupfile/add.html +++ /dev/null @@ -1,37 +0,0 @@ - -
-
-
Path*:
-
- -
-
- -
-
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/groupprovider/groupfile/show.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/groupprovider/groupfile/show.html deleted file mode 100644 index 740c65fd38..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/groupprovider/groupfile/show.html +++ /dev/null @@ -1,25 +0,0 @@ - -
-
-
Path to file:
-
-
-
-
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/groupprovider/showGroupManagingGroupProvider.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/groupprovider/showGroupManagingGroupProvider.html deleted file mode 100644 index 62a6c7537c..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/groupprovider/showGroupManagingGroupProvider.html +++ /dev/null @@ -1,30 +0,0 @@ - -
-
-
-
- - -
-
- -
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/images/auto-refresh.png b/qpid/java/broker-plugins/management-http/src/main/java/resources/images/auto-refresh.png deleted file mode 100644 index 493636f467..0000000000 Binary files a/qpid/java/broker-plugins/management-http/src/main/java/resources/images/auto-refresh.png and /dev/null differ diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/images/download.png b/qpid/java/broker-plugins/management-http/src/main/java/resources/images/download.png deleted file mode 100644 index b64b41d476..0000000000 Binary files a/qpid/java/broker-plugins/management-http/src/main/java/resources/images/download.png and /dev/null differ diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/images/gear.png b/qpid/java/broker-plugins/management-http/src/main/java/resources/images/gear.png deleted file mode 100644 index 0bb4394b46..0000000000 Binary files a/qpid/java/broker-plugins/management-http/src/main/java/resources/images/gear.png and /dev/null differ diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/images/help.png b/qpid/java/broker-plugins/management-http/src/main/java/resources/images/help.png deleted file mode 100644 index f7d3698d25..0000000000 Binary files a/qpid/java/broker-plugins/management-http/src/main/java/resources/images/help.png and /dev/null differ diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/images/log-viewer.png b/qpid/java/broker-plugins/management-http/src/main/java/resources/images/log-viewer.png deleted file mode 100644 index 858fd48beb..0000000000 Binary files a/qpid/java/broker-plugins/management-http/src/main/java/resources/images/log-viewer.png and /dev/null differ diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/images/qpid-logo.png b/qpid/java/broker-plugins/management-http/src/main/java/resources/images/qpid-logo.png deleted file mode 100644 index ae0fbb462f..0000000000 Binary files a/qpid/java/broker-plugins/management-http/src/main/java/resources/images/qpid-logo.png and /dev/null differ diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/images/refresh.png b/qpid/java/broker-plugins/management-http/src/main/java/resources/images/refresh.png deleted file mode 100644 index 083044979b..0000000000 Binary files a/qpid/java/broker-plugins/management-http/src/main/java/resources/images/refresh.png and /dev/null differ diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/index.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/index.html deleted file mode 100644 index 896640fd67..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/index.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - Qpid Management - - - - - - - - - - - - - - - - -
-
- -
- -
-
-
-
-
-
-
-
-
-
- -
-
-
-
- 000 - error -
- -
-
- Please login again and retry your operation. -
-
- Please correct the problem and retry your operation. -
-
-
-
- - -
-
-
-
- - - diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/crypto-js/README.txt b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/crypto-js/README.txt deleted file mode 100644 index 6ef692ce31..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/crypto-js/README.txt +++ /dev/null @@ -1,8 +0,0 @@ -Crypto-JS -========= - -Version: 3.1.2 - -These files are from Crypto-JS (https://code.google.com/p/crypto-js/) by Jeff Mott. - - diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/crypto-js/enc-base64-min.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/crypto-js/enc-base64-min.js deleted file mode 100644 index 7ab054d94b..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/crypto-js/enc-base64-min.js +++ /dev/null @@ -1,8 +0,0 @@ -/* -CryptoJS v3.1.2 -code.google.com/p/crypto-js -(c) 2009-2013 by Jeff Mott. All rights reserved. -code.google.com/p/crypto-js/wiki/License -*/ -(function(){var h=CryptoJS,j=h.lib.WordArray;h.enc.Base64={stringify:function(b){var e=b.words,f=b.sigBytes,c=this._map;b.clamp();b=[];for(var a=0;a>>2]>>>24-8*(a%4)&255)<<16|(e[a+1>>>2]>>>24-8*((a+1)%4)&255)<<8|e[a+2>>>2]>>>24-8*((a+2)%4)&255,g=0;4>g&&a+0.75*g>>6*(3-g)&63));if(e=c.charAt(64))for(;b.length%4;)b.push(e);return b.join("")},parse:function(b){var e=b.length,f=this._map,c=f.charAt(64);c&&(c=b.indexOf(c),-1!=c&&(e=c));for(var c=[],a=0,d=0;d< -e;d++)if(d%4){var g=f.indexOf(b.charAt(d-1))<<2*(d%4),h=f.indexOf(b.charAt(d))>>>6-2*(d%4);c[a>>>2]|=(g|h)<<24-8*(a%4);a++}return j.create(c,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}})(); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/crypto-js/hmac-sha1.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/crypto-js/hmac-sha1.js deleted file mode 100644 index 0d50d81a1e..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/crypto-js/hmac-sha1.js +++ /dev/null @@ -1,17 +0,0 @@ -/* -CryptoJS v3.1.2 -code.google.com/p/crypto-js -(c) 2009-2013 by Jeff Mott. All rights reserved. -code.google.com/p/crypto-js/wiki/License -*/ -var CryptoJS=CryptoJS||function(g,l){var e={},d=e.lib={},m=function(){},k=d.Base={extend:function(a){m.prototype=this;var c=new m;a&&c.mixIn(a);c.hasOwnProperty("init")||(c.init=function(){c.$super.init.apply(this,arguments)});c.init.prototype=c;c.$super=this;return c},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var c in a)a.hasOwnProperty(c)&&(this[c]=a[c]);a.hasOwnProperty("toString")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}}, -p=d.WordArray=k.extend({init:function(a,c){a=this.words=a||[];this.sigBytes=c!=l?c:4*a.length},toString:function(a){return(a||n).stringify(this)},concat:function(a){var c=this.words,q=a.words,f=this.sigBytes;a=a.sigBytes;this.clamp();if(f%4)for(var b=0;b>>2]|=(q[b>>>2]>>>24-8*(b%4)&255)<<24-8*((f+b)%4);else if(65535>>2]=q[b>>>2];else c.push.apply(c,q);this.sigBytes+=a;return this},clamp:function(){var a=this.words,c=this.sigBytes;a[c>>>2]&=4294967295<< -32-8*(c%4);a.length=g.ceil(c/4)},clone:function(){var a=k.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var c=[],b=0;b>>2]>>>24-8*(f%4)&255;b.push((d>>>4).toString(16));b.push((d&15).toString(16))}return b.join("")},parse:function(a){for(var c=a.length,b=[],f=0;f>>3]|=parseInt(a.substr(f, -2),16)<<24-4*(f%8);return new p.init(b,c/2)}},j=b.Latin1={stringify:function(a){var c=a.words;a=a.sigBytes;for(var b=[],f=0;f>>2]>>>24-8*(f%4)&255));return b.join("")},parse:function(a){for(var c=a.length,b=[],f=0;f>>2]|=(a.charCodeAt(f)&255)<<24-8*(f%4);return new p.init(b,c)}},h=b.Utf8={stringify:function(a){try{return decodeURIComponent(escape(j.stringify(a)))}catch(c){throw Error("Malformed UTF-8 data");}},parse:function(a){return j.parse(unescape(encodeURIComponent(a)))}}, -r=d.BufferedBlockAlgorithm=k.extend({reset:function(){this._data=new p.init;this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=h.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(a){var c=this._data,b=c.words,f=c.sigBytes,d=this.blockSize,e=f/(4*d),e=a?g.ceil(e):g.max((e|0)-this._minBufferSize,0);a=e*d;f=g.min(4*a,f);if(a){for(var k=0;ka;a++){if(16>a)m[a]=d[e+a]|0;else{var c=m[a-3]^m[a-8]^m[a-14]^m[a-16];m[a]=c<<1|c>>>31}c=(n<<5|n>>>27)+l+m[a];c=20>a?c+((j&h|~j&g)+1518500249):40>a?c+((j^h^g)+1859775393):60>a?c+((j&h|j&g|h&g)-1894007588):c+((j^h^ -g)-899497514);l=g;g=h;h=j<<30|j>>>2;j=n;n=c}b[0]=b[0]+n|0;b[1]=b[1]+j|0;b[2]=b[2]+h|0;b[3]=b[3]+g|0;b[4]=b[4]+l|0},_doFinalize:function(){var d=this._data,e=d.words,b=8*this._nDataBytes,g=8*d.sigBytes;e[g>>>5]|=128<<24-g%32;e[(g+64>>>9<<4)+14]=Math.floor(b/4294967296);e[(g+64>>>9<<4)+15]=b;d.sigBytes=4*e.length;this._process();return this._hash},clone:function(){var e=d.clone.call(this);e._hash=this._hash.clone();return e}});g.SHA1=d._createHelper(l);g.HmacSHA1=d._createHmacHelper(l)})(); -(function(){var g=CryptoJS,l=g.enc.Utf8;g.algo.HMAC=g.lib.Base.extend({init:function(e,d){e=this._hasher=new e.init;"string"==typeof d&&(d=l.parse(d));var g=e.blockSize,k=4*g;d.sigBytes>k&&(d=e.finalize(d));d.clamp();for(var p=this._oKey=d.clone(),b=this._iKey=d.clone(),n=p.words,j=b.words,h=0;h>>2]|=(d[e>>>2]>>>24-8*(e%4)&255)<<24-8*((b+e)%4);else if(65535>>2]=d[e>>>2];else c.push.apply(c,d);this.sigBytes+=a;return this},clamp:function(){var a=this.words,c=this.sigBytes;a[c>>>2]&=4294967295<< -32-8*(c%4);a.length=h.ceil(c/4)},clone:function(){var a=m.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var c=[],d=0;d>>2]>>>24-8*(b%4)&255;d.push((e>>>4).toString(16));d.push((e&15).toString(16))}return d.join("")},parse:function(a){for(var c=a.length,d=[],b=0;b>>3]|=parseInt(a.substr(b, -2),16)<<24-4*(b%8);return new r.init(d,c/2)}},n=l.Latin1={stringify:function(a){var c=a.words;a=a.sigBytes;for(var d=[],b=0;b>>2]>>>24-8*(b%4)&255));return d.join("")},parse:function(a){for(var c=a.length,d=[],b=0;b>>2]|=(a.charCodeAt(b)&255)<<24-8*(b%4);return new r.init(d,c)}},j=l.Utf8={stringify:function(a){try{return decodeURIComponent(escape(n.stringify(a)))}catch(c){throw Error("Malformed UTF-8 data");}},parse:function(a){return n.parse(unescape(encodeURIComponent(a)))}}, -u=g.BufferedBlockAlgorithm=m.extend({reset:function(){this._data=new r.init;this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=j.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(a){var c=this._data,d=c.words,b=c.sigBytes,e=this.blockSize,f=b/(4*e),f=a?h.ceil(f):h.max((f|0)-this._minBufferSize,0);a=f*e;b=h.min(4*a,b);if(a){for(var g=0;gn;){var j;a:{j=k;for(var u=h.sqrt(j),t=2;t<=u;t++)if(!(j%t)){j=!1;break a}j=!0}j&&(8>n&&(m[n]=l(h.pow(k,0.5))),r[n]=l(h.pow(k,1/3)),n++);k++}var a=[],f=f.SHA256=q.extend({_doReset:function(){this._hash=new g.init(m.slice(0))},_doProcessBlock:function(c,d){for(var b=this._hash.words,e=b[0],f=b[1],g=b[2],j=b[3],h=b[4],m=b[5],n=b[6],q=b[7],p=0;64>p;p++){if(16>p)a[p]= -c[d+p]|0;else{var k=a[p-15],l=a[p-2];a[p]=((k<<25|k>>>7)^(k<<14|k>>>18)^k>>>3)+a[p-7]+((l<<15|l>>>17)^(l<<13|l>>>19)^l>>>10)+a[p-16]}k=q+((h<<26|h>>>6)^(h<<21|h>>>11)^(h<<7|h>>>25))+(h&m^~h&n)+r[p]+a[p];l=((e<<30|e>>>2)^(e<<19|e>>>13)^(e<<10|e>>>22))+(e&f^e&g^f&g);q=n;n=m;m=h;h=j+k|0;j=g;g=f;f=e;e=k+l|0}b[0]=b[0]+e|0;b[1]=b[1]+f|0;b[2]=b[2]+g|0;b[3]=b[3]+j|0;b[4]=b[4]+h|0;b[5]=b[5]+m|0;b[6]=b[6]+n|0;b[7]=b[7]+q|0},_doFinalize:function(){var a=this._data,d=a.words,b=8*this._nDataBytes,e=8*a.sigBytes; -d[e>>>5]|=128<<24-e%32;d[(e+64>>>9<<4)+14]=h.floor(b/4294967296);d[(e+64>>>9<<4)+15]=b;a.sigBytes=4*d.length;this._process();return this._hash},clone:function(){var a=q.clone.call(this);a._hash=this._hash.clone();return a}});s.SHA256=q._createHelper(f);s.HmacSHA256=q._createHmacHelper(f)})(Math); -(function(){var h=CryptoJS,s=h.enc.Utf8;h.algo.HMAC=h.lib.Base.extend({init:function(f,g){f=this._hasher=new f.init;"string"==typeof g&&(g=s.parse(g));var h=f.blockSize,m=4*h;g.sigBytes>m&&(g=f.finalize(g));g.clamp();for(var r=this._oKey=g.clone(),l=this._iKey=g.clone(),k=r.words,n=l.words,j=0;j>5] |= (challengeBytes[i/8] & 0xFF)<<(i%32); - } - var challengeStr = digestsBase.wordToString(wa).substring(0,challengeBytes.length); - - var digest = user + " " + MD5._hmac(challengeStr, password, digestsBase.outputTypes.Hex); - var id = data.id; - - var response = base64.encode(encodeUTF8( digest )); - - dojo.xhrPost({ - // The URL of the request - url: saslServiceUrl, - content: { - id: id, - response: response - }, - handleAs: "json", - failOk: true - }).then(callbackFunction, errorHandler); - - }, - function(error) - { - if(error.status == 403) - { - alert("Authentication Failed"); - } - else - { - alert(error); - } - }); - - - -}; - - var saslScramSha1 = function saslScramSha1(user, password, saslMechanism, callbackFunction) { - saslScram("sha1",user,password,saslMechanism,callbackFunction); - }; - - var saslScramSha256 = function saslScramSha1(user, password, saslMechanism, callbackFunction) { - saslScram("sha256",user,password,saslMechanism,callbackFunction); - }; - - var saslScram = function saslScramSha1(mechanism, user, password, saslMechanism, callbackFunction) { - - var DIGEST = mechanism.toUpperCase(); - var HMAC = "Hmac"+DIGEST; - - script.get("js/crypto-js/hmac-"+mechanism+".js").then( function() - { - script.get("js/crypto-js/enc-base64-min.js").then ( function() - { - - var toBase64 = function toBase64( input ) - { - var result = []; - for(var i = 0; i < input.length; i++) - { - result[i] = input.charCodeAt(i); - } - return base64.encode( result ) - }; - - var fromBase64 = function fromBase64( input ) - { - var decoded = base64.decode( input ); - var result = ""; - for(var i = 0; i < decoded.length; i++) - { - result+= String.fromCharCode(decoded[i]); - } - return result; - }; - - var xor = function xor(lhs, rhs) { - var words = []; - for(var i = 0; i < lhs.words.length; i++) - { - words.push(lhs.words[i]^rhs.words[i]); - } - return CryptoJS.lib.WordArray.create(words); - }; - - var hasNonAscii = function hasNonAscii(name) { - for(var i = 0; i < name.length; i++) { - if(name.charCodeAt(i) > 127) { - return true; - } - } - return false; - }; - - var generateSaltedPassword = function generateSaltedPassword(salt, password, iterationCount) - { - var hmac = CryptoJS.algo.HMAC.create(CryptoJS.algo[DIGEST], password); - - hmac.update(salt); - hmac.update(CryptoJS.enc.Hex.parse("00000001")); - - var result = hmac.finalize(); - var previous = null; - for(var i = 1 ;i < iterationCount; i++) - { - hmac = CryptoJS.algo.HMAC.create(CryptoJS.algo[DIGEST], password); - hmac.update( previous != null ? previous : result ); - previous = hmac.finalize(); - result = xor(result, previous); - } - return result; - - }; - - GS2_HEADER = "n,,"; - - if(!hasNonAscii(user)) { - - user = user.replace(/=/g, "=3D"); - user = user.replace(/,/g, "=2C"); - - clientNonce = uuid(); - clientFirstMessageBare = "n=" + user + ",r=" + clientNonce; - dojo.xhrPost({ - // The URL of the request - url: saslServiceUrl, - content: { - mechanism: saslMechanism, - response: toBase64(GS2_HEADER + clientFirstMessageBare) - }, - handleAs: "json", - failOk: true - }).then(function (data) { - var serverFirstMessage = fromBase64(data.challenge); - var id = data.id; - - var parts = serverFirstMessage.split(","); - nonce = parts[0].substring(2); - if (!nonce.substr(0, clientNonce.length) == clientNonce) { - alert("Authentication error - server nonce does not start with client nonce") - } - else { - var salt = CryptoJS.enc.Base64.parse(parts[1].substring(2)); - var iterationCount = parts[2].substring(2); - var saltedPassword = generateSaltedPassword(salt, password, iterationCount) - var clientFinalMessageWithoutProof = "c=" + toBase64(GS2_HEADER) + ",r=" + nonce; - var authMessage = clientFirstMessageBare + "," + serverFirstMessage + "," + clientFinalMessageWithoutProof; - var clientKey = CryptoJS[HMAC]("Client Key", saltedPassword); - var storedKey = CryptoJS[DIGEST](clientKey); - var clientSignature = CryptoJS[HMAC](authMessage, storedKey); - var clientProof = xor(clientKey, clientSignature); - var serverKey = CryptoJS[HMAC]("Server Key", saltedPassword); - serverSignature = CryptoJS[HMAC](authMessage, serverKey); - dojo.xhrPost({ - // The URL of the request - url: saslServiceUrl, - content: { - id: id, - response: toBase64(clientFinalMessageWithoutProof - + ",p=" + clientProof.toString(CryptoJS.enc.Base64)) - }, - handleAs: "json", - failOk: true - }).then(function (data) { - var serverFinalMessage = fromBase64(data.challenge); - if (serverSignature.toString(CryptoJS.enc.Base64) == serverFinalMessage.substring(2)) { - callbackFunction(); - } - else { - errorHandler("Server signature did not match"); - } - - - }, errorHandler); - } - - }, errorHandler); - } - else - { - alert("Username '"+name+"' is invalid"); - } - - }, errorHandler); - }, errorHandler); - }; - -var containsMechanism = function containsMechanism(mechanisms, mech) -{ - for (var i = 0; i < mechanisms.length; i++) { - if (mechanisms[i] == mech) { - return true; - } - } - - return false; -}; - -var SaslClient = {}; - -SaslClient.authenticate = function(username, password, callbackFunction) -{ - dojo.xhrGet({ - url: saslServiceUrl, - handleAs: "json", - failOk: true - }).then(function(data) - { - var mechMap = data.mechanisms; - if(containsMechanism(mechMap, "SCRAM-SHA-256")) - { - saslScramSha256(username, password, "SCRAM-SHA-256", callbackFunction) - } - else if(containsMechanism(mechMap, "SCRAM-SHA-1")) - { - saslScramSha1(username, password, "SCRAM-SHA-1", callbackFunction) - } - else if (containsMechanism(mechMap, "CRAM-MD5")) - { - saslCramMD5(username, password, "CRAM-MD5", callbackFunction); - } - else if (containsMechanism(mechMap, "CRAM-MD5-HEX")) - { - var hashedPassword = MD5(password, digestsBase.outputTypes.Hex); - saslCramMD5(username, hashedPassword, "CRAM-MD5-HEX", callbackFunction); - } - else if (containsMechanism(mechMap, "PLAIN")) - { - saslPlain(username, password, callbackFunction); - } - else - { - alert("No supported SASL mechanism offered: " + mechMap); - } - }, errorHandler); -}; - -SaslClient.getUser = function(callbackFunction) -{ - dojo.xhrGet({ - url: saslServiceUrl, - handleAs: "json", - failOk: true - }).then(callbackFunction, errorHandler); -}; - -return SaslClient; -}); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ConsoleHelper.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ConsoleHelper.js deleted file mode 100644 index 9cebf48ce6..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ConsoleHelper.js +++ /dev/null @@ -1,72 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/xhr", "dojo/domReady!"], function (xhr) { - - var preferencesDialog = null; - var helpURL = null; - - return { - showPreferencesDialog: function () { - if (preferencesDialog == null) - { - require(["qpid/management/Preferences", "dojo/ready"], function(PreferencesDialog, ready){ - ready(function(){ - preferencesDialog = new PreferencesDialog(); - preferencesDialog.showDialog(); - }); - }); - } - else - { - preferencesDialog.showDialog(); - } - }, - getHelpUrl: function() - { - if (!helpURL) - { - xhr.get({ - sync: true, - url: "api/latest/broker", - content: { "depth" : 1, "includeSysContext" : true }, - handleAs: "json" - }).then(function(data) { - var broker = data[0]; - if ("context" in broker && "qpid.helpURL" in broker["context"] ) - { - helpURL = broker["context"]["qpid.helpURL"]; - } - else - { - helpURL = "http://qpid.apache.org/"; - } - }); - } - return helpURL; - }, - showHelp: function() - { - var newWindow = window.open(this.getHelpUrl(),'QpidHelp','height=600,width=600,scrollbars=1,location=1,resizable=1,status=0,toolbar=0,titlebar=1,menubar=0', true); - newWindow.focus(); - } - }; - -}); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ContextVariablesEditor.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ContextVariablesEditor.js deleted file mode 100644 index a3e4023273..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ContextVariablesEditor.js +++ /dev/null @@ -1,558 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define([ - "qpid/common/util", - "dojo/_base/xhr", - "dojo/_base/declare", - "dojo/_base/array", - "dojo/_base/connect", - "dojo/_base/lang", - "dojo/dom-construct", - "dojo/parser", - "dojo/query", - "dojo/store/Memory", - "dojo/data/ObjectStore", - "dijit/_WidgetBase", - "dijit/registry", - "dojo/text!common/ContextVariablesEditor.html", - "dijit/form/Button", - "dojox/grid/EnhancedGrid", - "dojox/grid/enhanced/_Plugin", - "dijit/form/Select", - "dojox/validate/us", - "dojox/validate/web", - "dojo/domReady!"], -function (util, xhr, declare, array, connect, lang, domConstruct, parser, query, Memory, ObjectStore, _WidgetBase, registry, template) - { - - return declare("qpid.common.ContextVariablesEditor", [_WidgetBase], { - - value: null, - effectiveValues: null, - inheritedActualValues: null, - domNode: null, - _grid: null, - _addButton: null, - _deleteButton: null, - _filterBox: null, - _nextGridItemId: 0, - _dynamicInheritedContext: {}, - - constructor: function(args) - { - this._args = args; - }, - - buildRendering: function() - { - this.domNode = domConstruct.create("div", {innerHTML: template}); - parser.parse(this.domNode); - }, - - postCreate: function() - { - this.inherited(arguments); - var that = this; - var gridNode = query(".grid", this.domNode)[0]; - var addButtonNode = query(".addButton", this.domNode)[0]; - var deleteButtonNode = query(".deleteButton", this.domNode)[0]; - var addButton = registry.byNode(addButtonNode); - var deleteButton = registry.byNode(deleteButtonNode); - var layout = [[ - { name: "Name", field: "name", width: "40%", editable: true}, - { name: 'Actual Value', field: 'actualValue', width: '30%', editable: true}, - { name: 'Effective Value', field: 'effectiveValue', width: '30%', editable: false} - ]]; - var data = []; - var objectStore = new dojo.data.ObjectStore({objectStore: new Memory({data:data, idProperty: "id"})}); - var grid = new dojox.grid.EnhancedGrid({ - selectionMode: "multiple", - store: objectStore, - singleClickEdit: true, - structure: layout, - autoHeight: true, - sortFields: [{attribute: 'name', descending: false}], - plugins: {indirectSelection: true} - }, gridNode); - grid.canEdit = function(inCell, inRowIndex) - { - var item = grid.getItem(inRowIndex); - return inCell.field == "actualValue" || (inCell.field=="name" && item && item["inherited"] == false); - }; - - this._grid = grid; - this._deleteButton = deleteButton; - this._addButtonNode = addButtonNode; - - var toggleGridButtons = function(index) - { - var data = grid.selection.getSelected(); - deleteButton.set("disabled", !data || data.length==0); - }; - - connect.connect(grid.selection, 'onSelected', toggleGridButtons); - connect.connect(grid.selection, 'onDeselected', toggleGridButtons); - connect.connect(grid, 'onStyleRow' , this, function(row) { that._onStyleRow(row); }); - - deleteButton.set("disabled", true); - addButton.on("click", function(event) { that._newItem(); }); - deleteButton.on("click", function(event) { that._deleteSelected(); }); - grid.on("applyEdit", function(inRowIndex) { that._onEdit(inRowIndex); }); - grid.startup(); - this._filterBox = registry.byNode(query(".filter", this.domNode)[0]); - this._filterBox.on("change", function(value) { if (value) { that._filter(value); } }); - }, - resize: function() - { - this._grid.render(); - }, - load: function(restUrl, data) - { - data = data || {}; - var actualValues = data.actualValues; - var allEffectiveValues = data.effectiveValues; - var inheritedActualValues = data.inheritedActualValues; - if (!actualValues) - { - xhr.get( - { - url: restUrl, - sync: true, - content: { actuals: true }, - handleAs: "json", - load: function(data) - { - actualValues = data[0].context; - } - } - ); - } - if (!allEffectiveValues) - { - xhr.get( - { - url: restUrl, - sync: true, - content: { actuals: false }, - handleAs: "json", - load: function(data) - { - allEffectiveValues = data[0].context; - } - } - ); - } - if (!inheritedActualValues) - { - xhr.get( - { - url: restUrl, - sync: true, - content: { actuals: true, inheritedActuals: true}, - handleAs: "json", - load: function(data) - { - inheritedActualValues = data[0].context; - } - } - ); - } - this.setData(actualValues, allEffectiveValues, inheritedActualValues); - }, - loadInheritedData: function(restUrl) - { - var allEffectiveValues = null; - xhr.get( - { - url: restUrl, - sync: true, - content: { actuals: false }, - handleAs: "json", - load: function(data) - { - allEffectiveValues = data[0].context; - } - } - ); - - var inheritedActualValues = null; - xhr.get( - { - url: restUrl, - sync: true, - content: { actuals: true, inheritedActuals: true}, - handleAs: "json", - load: function(data) - { - inheritedActualValues = data[0].context; - } - } - ); - - this.setData({}, allEffectiveValues, inheritedActualValues); - }, - setData: function(actualValues, allEffectiveValues, inheritedActualValues) - { - this.value = actualValues; - this.effectiveValues = allEffectiveValues; - this.inheritedActualValues = inheritedActualValues; - - var values = this._mergeValues(actualValues, allEffectiveValues, inheritedActualValues); - this._originalValues = values; - - var grid = this._grid; - if (grid) - { - // delete previous store data - grid.store.fetch({ - onComplete:function(items,request) - { - if(items.length) - { - array.forEach(items, function(item) - { - grid.store.deleteItem(item); - }); - } - } - }); - - // add new data into grid store - this._nextGridItemId = 0; - for(var i=0; i 0) - { - array.forEach(data, function(selectedItem) { - if (selectedItem !== null && !selectedItem["inherited"]) - { - grid.store.deleteItem(selectedItem); - that._deleteOriginalItem(selectedItem.name); - } - }); - grid.store.save(); - grid.selection.deselectAll(); - this._valueChanged(); - } - }, - _deleteOriginalItem: function(key) - { - for(var i=0;i< this._originalValues.length;i++) - { - if (this._originalValues[i].name == key) - { - this._originalValues = this._originalValues.splice(i, 1); - break; - } - } - }, - _onEdit:function(inRowIndex) - { - var grid = this._grid; - var item = grid.getItem(inRowIndex); - var previousItems = this._originalValues; - var previousItemActualValue = null; - for(var i=0;i 0) - { - array.forEach(items, function(item) - { - if (item !== null && item.name && ((item["inherited"] && item.changed) || !item["inherited"])) - { - value[item.name]=item.actualValue; - } - }); - } - } - }); - if (!util.equals(this.value, value)) - { - this.value = value; - this._handleOnChange(value); - } - } - }, - _setValueAttr: function(actualValues) - { - this.value = actualValues; - if (this.inheritedActualValues!=null && this.effectiveValues != null) - { - this.setData(this.value, this.effectiveValues, this.inheritedActualValues); - } - }, - _setEffectiveValuesAttr: function(effectiveValues) - { - this.effectiveValues = effectiveValues; - if (this.value != null && this.inheritedActualValues !=null) - { - this.setData(this.value, this.effectiveValues, this.inheritedActualValues); - } - }, - _setInheritedActualValues: function(inheritedActualValues) - { - this.inheritedActualValues = inheritedActualValues; - if (this.value!= null && this.effectiveValues != null) - { - this.setData(this.value, this.effectiveValues, this.inheritedActualValues); - } - }, - _mergeValues: function(actualValues, allEffectiveValues, inheritedActualValues) - { - var fields = []; - - if (allEffectiveValues) - { - for(var key in allEffectiveValues) - { - if (!actualValues || !(key in actualValues)) - { - var actualValue = inheritedActualValues && key in inheritedActualValues ? inheritedActualValues[key] : allEffectiveValues[key]; - fields.push({name: key, actualValue: actualValue, effectiveValue: allEffectiveValues[key], "inherited": true}); - } - } - } - - if (actualValues) - { - for(var key in actualValues) - { - var effectiveValue = allEffectiveValues && key in allEffectiveValues ? allEffectiveValues[key]: actualValues[key]; - fields.push({name: key, actualValue: actualValues[key], effectiveValue: effectiveValue, "inherited": false}); - } - } - return fields; - }, - _handleOnChange: function(newValue) - { - if (!util.equals(this._lastValueReported, newValue)) - { - this._lastValueReported = newValue; - if(this._onChangeHandle) - { - this._onChangeHandle.remove(); - } - this._onChangeHandle = this.defer(function() - { - this._onChangeHandle = null; - this.onChange(newValue); - }); - } - } - - }); -}); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/FormWidgetMixin.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/FormWidgetMixin.js deleted file mode 100644 index 11160e9608..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/FormWidgetMixin.js +++ /dev/null @@ -1,102 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/declare"], function(declare) -{ - return declare("qpid.common.FormWidgetMixin", null, - { - name: "", - value: "", - _onChangeActive: false, - - compare: function(val1, val2) - { - if(typeof val1 == "number" && typeof val2 == "number") - { - return (isNaN(val1) && isNaN(val2)) ? 0 : val1 - val2; - } - else if(val1 > val2) - { - return 1; - } - else if(val1 < val2) - { - return -1; - } - else - { - return 0; - } - }, - onChange: function() - { - }, - _setValueAttr: function(newValue, priorityChange) - { - this._handleOnChange(newValue, priorityChange); - }, - _handleOnChange: function(newValue, priorityChange) - { - this._set("value", newValue); - if(this._lastValueReported == undefined && (priorityChange === null || !this._onChangeActive)) - { - this._resetValue = this._lastValueReported = newValue; - } - this._pendingOnChange = this._pendingOnChange || (typeof newValue != typeof this._lastValueReported) - || (this.compare(newValue, this._lastValueReported) != 0); - if(( priorityChange || priorityChange === undefined) && this._pendingOnChange) - { - this._lastValueReported = newValue; - this._pendingOnChange = false; - if(this._onChangeActive) - { - if(this._onChangeHandle) - { - this._onChangeHandle.remove(); - } - this._onChangeHandle = this.defer(function() { this._onChangeHandle = null; this.onChange(newValue); }); - } - } - }, - create: function() - { - this.inherited(arguments); - this._onChangeActive = true; - }, - destroy: function() - { - if(this._onChangeHandle) - { - this._onChangeHandle.remove(); - this.onChange(this._lastValueReported); - } - this.inherited(arguments); - }, - undo: function() - { - this._setValueAttr(this._lastValueReported, false); - }, - reset: function() - { - this._hasBeenBlurred = false; - this._setValueAttr(this._resetValue, true); - } - }); -}); \ No newline at end of file diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ResourceWidget.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ResourceWidget.js deleted file mode 100644 index bee38149da..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ResourceWidget.js +++ /dev/null @@ -1,196 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define([ - "dojo/_base/declare", - "dojo/_base/array", - "dojo/_base/lang", - "qpid/common/util", - "dijit/_Widget", - "dijit/_TemplatedMixin", - "dijit/_WidgetsInTemplateMixin", - "qpid/common/FormWidgetMixin", - "dojo/text!common/ResourceWidget.html", - "dojox/html/entities", - "dojox/form/Uploader", - "dijit/form/Button", - "dijit/form/ValidationTextBox", - "dojox/validate/us", - "dojox/validate/web", - "dojo/domReady!"], -function (declare, array, lang, util, _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, FormWidgetMixin, template, entities) -{ - - return declare("qpid.common.ResourceWidget", [_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, FormWidgetMixin], - { - templateString: template, - fileReaderSupported: window.FileReader ? true : false, - displayWarningWhenFileReaderUnsupported: false, - isDebug: false, - uploaded: false, - - buildRendering: function() - { - //Strip out the apache comment header from the template html as comments unsupported. - this.templateString = this.templateString.replace(//g, ""); - this.inherited(arguments); - }, - postCreate: function() - { - this.inherited(arguments); - - if(this._resetValue === undefined) - { - this._lastValueReported = this._resetValue = this.value; - } - - var that = this; - - if (this.fileReaderSupported) - { - this.fileReader= new FileReader(); - this.fileReader.onload = function(evt) {that._uploadFileComplete(evt);}; - this.fileReader.onerror = function(ex) {console.error("Failed to load file for " + this.name, ex);}; - this.uploader.on("change", function(selected){that._fileChanged(selected)}); - this.clearButton.on("click", function(event){that._fileClearButtonClicked(event)}); - } - else - { - // Fall back for IE8/9 which do not support FileReader - this.uploadFields.style.display = "none"; - if (this.displayWarningWhenFileReaderUnsupported) - { - this.unsupportedWarning.className = this.unsupportedWarning.className.replace("hidden", ""); - } - } - this.resourceLocation.on("blur", function(){that._pathChanged()}); - this._originalValue = arguments.value; - if (this.placeHolder) - { - this.resourceLocation.set("placeHolder", this.placeHolder); - } - if (this.promptMessage) - { - this.resourceLocation.set("promptMessage", this.promptMessage); - } - if (this.title) - { - this.resourceLocation.set("title", this.title); - } - this.resourceLocation.set("required", this.required ? true : false); - this.uploadData.style.display = "none"; - }, - startup: function() - { - if (this.fileReaderSupported) - { - this.uploader.startup(); - } - }, - _fileChanged: function (evt) - { - var file = this.uploader.domNode.children[0].files[0]; - this.selectedFileName = file.name; - this.selectedFile.innerHTML = file.name; - this.selectedFileStatus.className = "loadingIcon"; - if (this.isDebug) - { - this._log("Beginning to read file " + file.name + " for " + this.name); - } - this.fileReader.readAsDataURL(file); - }, - _uploadFileComplete: function(evt) - { - var reader = evt.target; - var result = reader.result; - if (this.isDebug) - { - this._log(this.name + " file read complete, contents " + result); - } - this.set("value", result); - }, - _fileClearButtonClicked: function(event) - { - this.uploaded = false; - this.uploader.reset(); - this.set("value", this._resetValue); - }, - _pathChanged: function() - { - var serverPathValue = this.resourceLocation.get("value") || this._resetValue; - this.set("value", serverPathValue); - if (this.uploaded ) - { - this.uploaded = !serverPathValue; - } - }, - _setValueAttr: function(newValue, priorityChange) - { - var isDataUrl = this.uploaded || ( newValue && newValue.indexOf("data:") == 0 ); - if (isDataUrl) - { - this._initUploaded(true); - } - else - { - this.resourceLocation.set("value", newValue); - this.selectedFileName = null; - this.selectedFileStatus.className = ""; - this.selectedFile.innerHTML = ""; - this.resourceLocation.set("required", this.required ? true : false); - this.resourceLocation.setDisabled(false); - this.clearButton.setDisabled(true); - this.uploadData.style.display = "none"; - } - this.inherited(arguments); - }, - _log: function(message) - { - if (this.isDebug) - { - console.log(message); - } - }, - _setPlaceHolderAttr: function(newValue) - { - this.resourceLocation.set("placeHolder", newValue); - }, - _setUploadedAttr: function(uploaded) - { - this.uploaded = uploaded; - this._initUploaded(uploaded); - }, - _initUploaded: function(uploaded) - { - if (uploaded) - { - this.uploadData.style.display = "block"; - this.selectedFileStatus.className = "loadedIcon"; - this.selectedFile.innerHTML = this.selectedFileName || "uploaded data"; - this.resourceLocation.set("value", ""); - this.resourceLocation.setDisabled(true); - this.resourceLocation.set("required", false); - this.clearButton.setDisabled(false); - this.selectedFileStatus.className = "loadedIcon"; - } - } - } - ); -}); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/TimeZoneSelector.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/TimeZoneSelector.js deleted file mode 100644 index fa4bd8c873..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/TimeZoneSelector.js +++ /dev/null @@ -1,217 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define([ - "dojo/_base/declare", - "dojo/_base/array", - "dojo/dom-construct", - "dojo/parser", - "dojo/query", - "dojo/dom-style", - "dojo/store/Memory", - "dijit/_WidgetBase", - "dijit/registry", - "dojo/text!common/TimeZoneSelector.html", - "qpid/common/timezone", - "dijit/form/ComboBox", - "dijit/form/FilteringSelect", - "dijit/form/CheckBox", - "dojox/validate/us", - "dojox/validate/web", - "dojo/domReady!"], -function (declare, array, domConstruct, parser, query, domStyle, Memory, _WidgetBase, registry, template, timezone) { - - var preferencesRegions = ["Africa","America","Antarctica","Arctic","Asia","Atlantic","Australia","Europe","Indian","Pacific"]; - - function initSupportedRegions() - { - var supportedRegions = [{"id": "undefined", "name": "Undefined"}]; - for(var j = 0; j 1) - { - this._regionSelector.timeZone = value; - this._regionSelector.set("value", elements[0]); - this._citySelector.set("value", value); - } - else - { - this._regionSelector.set("value", "undefined"); - } - } - } - else - { - this._utcSelector.set("checked", false); - this._regionSelector.set("value", "undefined"); - } - this.value = value; - this._handleOnChange(value); - }, - - destroy: function() - { - if (this.domNode) - { - this.domNode.destroy(); - this.domNode = null; - } - _regionSelector: null; - _citySelector: null; - _utcSelector: null; - }, - - onChange: function(newValue){}, - - _handleOnChange: function(newValue) - { - if (this._lastValueReported != newValue) - { - this._lastValueReported = newValue; - if(this._onChangeHandle) - { - this._onChangeHandle.remove(); - } - this._onChangeHandle = this.defer(function() - { - this._onChangeHandle = null; - this.onChange(newValue); - }); - } - } - - }); -}); \ No newline at end of file diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/UpdatableStore.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/UpdatableStore.js deleted file mode 100644 index 64d557c242..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/UpdatableStore.js +++ /dev/null @@ -1,189 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/json", - "qpid/common/util", - "dojo/store/Memory", - "dojox/grid/DataGrid", - "dojo/data/ObjectStore", - "dojo/store/Observable"], function (json, util, Memory, DataGrid, ObjectStore, Observable) { - - function UpdatableStore( data, divName, structure, func, props, Grid, notObservable ) { - - var that = this; - var GridType = DataGrid; - - that.memoryStore = new Memory({data: data, idProperty: "id"}); - that.store = notObservable ? that.memoryStore : new Observable(that.memoryStore); - that.dataStore = ObjectStore({objectStore: that.store}); - - var gridProperties = { store: that.dataStore, - structure: structure, - autoHeight: true - }; - if(props) { - for(var prop in props) { - if(props.hasOwnProperty(prop)) - { - gridProperties[ prop ] = props[ prop ]; - } - } - } - - if(Grid) - { - GridType = Grid; - } - - that.grid = new GridType(gridProperties, divName); - - // since we created this grid programmatically, call startup to render it - that.grid.startup(); - - if( func ) - { - func(that); - } - - } - - UpdatableStore.prototype.update = function(data) - { - var changed = false; - var store = this.store; - var theItem; - - // handle deletes - // iterate over existing store... if not in new data then remove - store.query({ }).forEach(function(object) { - if(data) { - for(var i=0; i < data.length; i++) { - if(data[i].id == object.id) { - return; - } - } - } - store.remove(object.id); - changed = true; - }); - - // iterate over data... - if(data) { - for(var i=0; i < data.length; i++) - { - if(theItem = store.get(data[i].id)) - { - var modified = !util.equals(theItem, data[i]); - if(modified) - { - if (store.notify) - { - // Seems that we are required to update the item that the store already holds - for(var propName in data[i]) - { - if(data[i].hasOwnProperty(propName)) - { - if(theItem[ propName ] != data[i][ propName ]) - { - theItem[ propName ] = data[i][ propName ]; - } - } - } - // and tell it we have done so - store.notify(theItem, data[i].id); - } - else - { - store.put(data[i], {overwrite: true}); - } - changed = true; - } - } else { - // if not in the store then add - store.put(data[i]); - changed = true; - } - } - } - - return changed; - }; - - function removeItemsFromArray(items, numberToRemove) - { - if (items) - { - if (numberToRemove > 0 && items.length > 0) - { - if (numberToRemove >= items.length) - { - numberToRemove = numberToRemove - items.length; - items.length = 0 - } - else - { - items.splice(0, numberToRemove); - numberToRemove = 0; - } - } - } - return numberToRemove; - }; - - UpdatableStore.prototype.append = function(data, limit) - { - var changed = false; - var items = this.memoryStore.data; - - if (limit) - { - var totalSize = items.length + (data ? data.length : 0); - var numberToRemove = totalSize - limit; - - if (numberToRemove > 0) - { - changed = true; - numberToRemove = removeItemsFromArray(items, numberToRemove); - if (numberToRemove > 0) - { - removeItemsFromArray(data, numberToRemove); - } - } - } - - if (data && data.length > 0) - { - changed = true; - items.push.apply(items, data); - } - - this.memoryStore.setData(items); - return changed; - }; - - UpdatableStore.prototype.close = function() - { - this.dataStore.close(); - this.dataStore = null; - this.store = null; - this.memoryStore = null; - }; - return UpdatableStore; -}); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/footer.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/footer.js deleted file mode 100644 index ea13b1fc53..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/footer.js +++ /dev/null @@ -1,30 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/xhr", "dojo/query", "dojo/domReady!"], function (xhr, query) { - query('div[qpid-type="footer"]').forEach(function(node, index, arr) { - xhr.get({url: "footer.html", - sync: true, - load: function(data) { - node.innerHTML = data; - } }); - }); -}); - diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/formatter.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/formatter.js deleted file mode 100644 index 2f8683ee1c..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/formatter.js +++ /dev/null @@ -1,99 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -define(function () { - return { - - formatBytes: function formatBytes(amount) - { - var returnVal = { units: "B", - value: "0"}; - - - if(amount < 1000) - { - returnVal.value = amount.toPrecision(3);; - } - else if(amount < 1000 * 1024) - { - returnVal.units = "KB"; - returnVal.value = (amount / 1024).toPrecision(3); - } - else if(amount < 1000 * 1024 * 1024) - { - returnVal.units = "MB"; - returnVal.value = (amount / (1024 * 1024)).toPrecision(3); - } - else if(amount < 1000 * 1024 * 1024 * 1024) - { - returnVal.units = "GB"; - returnVal.value = (amount / (1024 * 1024 * 1024)).toPrecision(3); - } - - return returnVal; - - }, - - formatTime: function formatTime(amount) - { - var returnVal = { units: "ms", - value: "0"}; - - if(amount < 1000) - { - returnVal.units = "ms"; - returnVal.value = amount.toString(); - } - else if(amount < 1000 * 60) - { - returnVal.units = "s"; - returnVal.value = (amount / 1000).toPrecision(3); - } - else if(amount < 1000 * 60 * 60) - { - returnVal.units = "min"; - returnVal.value = (amount / (1000 * 60)).toPrecision(3); - } - else if(amount < 1000 * 60 * 60 * 24) - { - returnVal.units = "hr"; - returnVal.value = (amount / (1000 * 60 * 60)).toPrecision(3); - } - else if(amount < 1000 * 60 * 60 * 24 * 7) - { - returnVal.units = "d"; - returnVal.value = (amount / (1000 * 60 * 60 * 24)).toPrecision(3); - } - else if(amount < 1000 * 60 * 60 * 24 * 365) - { - returnVal.units = "wk"; - returnVal.value = (amount / (1000 * 60 * 60 * 24 * 7)).toPrecision(3); - } - else - { - returnVal.units = "yr"; - returnVal.value = (amount / (1000 * 60 * 60 * 24 * 365)).toPrecision(3); - } - - return returnVal; - } - }; -}); \ No newline at end of file diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/ColumnDefDialog.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/ColumnDefDialog.js deleted file mode 100644 index a0b62082cb..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/ColumnDefDialog.js +++ /dev/null @@ -1,145 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -define([ - "dojo/_base/declare", - "dojo/_base/event", - "dojo/_base/array", - "dojo/_base/lang", - "dojo/parser", - "dojo/dom-construct", - "dojo/query", - "dijit/registry", - "dijit/form/Button", - "dijit/form/CheckBox", - "dojox/grid/enhanced/plugins/Dialog", - "dojo/text!../../../grid/showColumnDefDialog.html", - "dojo/domReady!" -], function(declare, event, array, lang, parser, dom, query, registry, Button, CheckBox, Dialog, template ){ - - -return declare("qpid.common.grid.ColumnDefDialog", null, { - - grid: null, - containerNode: null, - _columns: [], - _dialog: null, - - constructor: function(args){ - var grid = this.grid = args.grid; - var that = this; - this.containerNode = dom.create("div", {innerHTML: template}); - parser.parse(this.containerNode).then(function(instances) - { - that._postParse(); - }); - }, - _postParse: function() - { - var submitButton = registry.byNode(query(".displayButton", this.containerNode)[0]); - this.closeButton = registry.byNode(query(".cancelButton", this.containerNode)[0]); - var columnsContainer = query(".columnList", this.containerNode)[0]; - - this._buildColumnWidgets(columnsContainer); - - this._dialog = new Dialog({ - "refNode": this.grid.domNode, - "title": "Grid Columns", - "content": this.containerNode - }); - - var self = this; - submitButton.on("click", function(e){self._onColumnsSelect(e); }); - this.closeButton.on("click", function(e){self._dialog.hide(); }); - - this._dialog.startup(); - }, - - destroy: function(){ - this._dialog.destroyRecursive(); - this._dialog = null; - this.grid = null; - this.containerNode = null; - this._columns = null; - }, - - showDialog: function(){ - this._initColumnWidgets(); - this._dialog.show(); - }, - - _initColumnWidgets: function() - { - var cells = this.grid.layout.cells; - for(var i in cells) - { - var cell = cells[i]; - this._columns[cell.name].checked = !cell.hidden; - } - }, - - _onColumnsSelect: function(evt){ - event.stop(evt); - var grid = this.grid; - grid.beginUpdate(); - var cells = grid.layout.cells; - try - { - for(var i in cells) - { - var cell = cells[i]; - var widget = this._columns[cell.name]; - grid.layout.setColumnVisibility(i, widget.checked); - } - } - finally - { - grid.endUpdate(); - this._dialog.hide(); - } - }, - - _buildColumnWidgets: function(columnsContainer) - { - var cells = this.grid.layout.cells; - for(var i in cells) - { - var cell = cells[i]; - var widget = new dijit.form.CheckBox({ - required: false, - checked: !cell.hidden, - label: cell.name, - name: this.grid.id + "_cchb_ " + i - }); - - this._columns[cell.name] = widget; - - var div = dom.create("div"); - div.appendChild(widget.domNode); - div.appendChild(dom.create("span", {innerHTML: cell.name})); - - columnsContainer.appendChild(div); - } - } - - }); - -}); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/EnhancedFilter.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/EnhancedFilter.js deleted file mode 100644 index 262210f879..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/EnhancedFilter.js +++ /dev/null @@ -1,230 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -define([ - "dojo/_base/declare", - "dojo/_base/lang", - "dojo/_base/array", - "dijit/Toolbar", - "dojox/grid/enhanced/_Plugin", - "dojox/grid/enhanced/plugins/Dialog", - "dojox/grid/enhanced/plugins/filter/FilterLayer", - "dojox/grid/enhanced/plugins/filter/FilterDefDialog", - "dojox/grid/enhanced/plugins/filter/FilterStatusTip", - "dojox/grid/enhanced/plugins/filter/ClearFilterConfirm", - "dojox/grid/EnhancedGrid", - "dojo/i18n!dojox/grid/enhanced/nls/Filter", - "qpid/common/grid/EnhancedFilterTools" -], function(declare, lang, array, Toolbar, _Plugin, - Dialog, FilterLayer, FilterDefDialog, FilterStatusTip, ClearFilterConfirm, EnhancedGrid, nls, EnhancedFilterTools){ - - // override CriteriaBox#_getColumnOptions to show criteria for hidden columns with EnhancedFilter - dojo.extend(dojox.grid.enhanced.plugins.filter.CriteriaBox, { - _getColumnOptions: function(){ - var colIdx = this.dlg.curColIdx >= 0 ? String(this.dlg.curColIdx) : "anycolumn"; - var filterHidden = this.plugin.filterHidden; - return array.map(array.filter(this.plugin.grid.layout.cells, function(cell){ - return !(cell.filterable === false || (!filterHidden && cell.hidden)); - }), function(cell){ - return { - label: cell.name || cell.field, - value: String(cell.index), - selected: colIdx == String(cell.index) - }; - }); - } - }); - - // Enhanced filter has extra functionality for refreshing, limiting rows, displaying/hiding columns in the grid - var EnhancedFilter = declare("qpid.common.grid.EnhancedFilter", _Plugin, { - // summary: - // Accept the same plugin parameters as dojox.grid.enhanced.plugins.Filter and the following: - // - // filterHidden: boolean: - // Whether to display filtering criteria for hidden columns. Default to true. - // - // defaulGridRowLimit: int: - // Default limit for numbers of items to cache in the gris dtore - // - // disableFiltering: boolean: - // Whether to disable a filtering including filter button, clear filter button and filter summary. - // - // toolbar: dijit.Toolbar: - // An instance of toolbar to add the enhanced filter widgets. - - - // name: String - // plugin name - name: "enhancedFilter", - - // filterHidden: Boolean - // whether to filter hidden columns - filterHidden: true, - - constructor: function(grid, args){ - // summary: - // See constructor of dojox.grid.enhanced._Plugin. - this.grid = grid; - this.nls = nls; - - args = this.args = lang.isObject(args) ? args : {}; - if(typeof args.ruleCount != 'number' || args.ruleCount < 0){ - args.ruleCount = 0; - } - this.ruleCountToConfirmClearFilter = args.ruleCountToConfirmClearFilter || 5; - - if (args.filterHidden){ - this.filterHidden = args.filterHidden; - } - this.defaulGridRowLimit = args.defaulGridRowLimit; - this.disableFiltering = args.disableFiltering; - this.displayLastUpdateTime = args.displayLastUpdateTime; - - //Install UI components - var obj = { "plugin": this }; - - this.filterBar = ( args.toolbar && args.toolbar instanceof dijit.Toolbar) ? args.toolbar: new Toolbar(); - - if (!this.disableFiltering) - { - //Install filter layer - this._wrapStore(); - - this.clearFilterDialog = new Dialog({ - refNode: this.grid.domNode, - title: this.nls["clearFilterDialogTitle"], - content: new ClearFilterConfirm(obj) - }); - - this.filterDefDialog = new FilterDefDialog(obj); - this.filterDefDialog.filterDefPane._clearFilterBtn.set("label", "Clear Filter"); - - nls["statusTipTitleNoFilter"] = "Filter is not set"; - nls["statusTipMsg"] = "Click on 'Set Filter' button to specify filtering conditions"; - this.filterStatusTip = new FilterStatusTip(obj); - - var self = this; - var toggleClearFilterBtn = function (arg){ self.enhancedFilterTools.toggleClearFilterBtn(arg); }; - - this.filterBar.toggleClearFilterBtn = toggleClearFilterBtn; - - this.grid.isFilterBarShown = function (){return true}; - - this.connect(this.grid.layer("filter"), "onFilterDefined", function(filter){ - toggleClearFilterBtn(true); - }); - - //Expose the layer event to grid. - grid.onFilterDefined = function(){}; - this.connect(grid.layer("filter"), "onFilterDefined", function(filter){ - grid.onFilterDefined(grid.getFilter(), grid.getFilterRelation()); - }); - } - - // add extra buttons into toolbar - this.enhancedFilterTools = new EnhancedFilterTools({ - grid: grid, - toolbar: this.filterBar, - filterStatusTip: this.filterStatusTip, - clearFilterDialog: this.clearFilterDialog, - filterDefDialog: this.filterDefDialog, - defaulGridRowLimit: this.defaulGridRowLimit, - disableFiltering: this.disableFiltering, - displayLastUpdateTime: this.displayLastUpdateTime, - nls: nls, - ruleCountToConfirmClearFilter: this.ruleCountToConfirmClearFilter - }); - - this.filterBar.placeAt(this.grid.viewsHeaderNode, "before"); - this.filterBar.startup(); - - }, - - destroy: function(){ - this.inherited(arguments); - try - { - if (this.filterDefDialog) - { - this.filterDefDialog.destroy(); - this.filterDefDialog = null; - } - if (this.grid) - { - this.grid.unwrap("filter"); - this.grid = null; - } - if (this.filterBar) - { - this.filterBar.destroyRecursive(); - this.filterBar = null; - } - if (this.enhancedFilterTools) - { - this.enhancedFilterTools.destroy(); - this.enhancedFilterTools = null; - } - if (this.clearFilterDialog) - { - this.clearFilterDialog.destroyRecursive(); - this.clearFilterDialog = null; - } - if (this.filterStatusTip) - { - this.filterStatusTip.destroy(); - this.filterStatusTip = null; - } - this.args = null; - - }catch(e){ - console.warn("Filter.destroy() error:",e); - } - }, - - _wrapStore: function(){ - var g = this.grid; - var args = this.args; - var filterLayer = args.isServerSide ? new FilterLayer.ServerSideFilterLayer(args) : - new FilterLayer.ClientSideFilterLayer({ - cacheSize: args.filterCacheSize, - fetchAll: args.fetchAllOnFirstFilter, - getter: this._clientFilterGetter - }); - FilterLayer.wrap(g, "_storeLayerFetch", filterLayer); - - this.connect(g, "_onDelete", lang.hitch(filterLayer, "invalidate")); - }, - - onSetStore: function(store){ - this.filterDefDialog.clearFilter(true); - }, - - _clientFilterGetter: function(/* data item */ datarow,/* cell */cell, /* int */rowIndex){ - return cell.get(rowIndex, datarow); - } - - }); - - EnhancedGrid.registerPlugin(EnhancedFilter); - - return EnhancedFilter; - -}); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/EnhancedFilterTools.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/EnhancedFilterTools.js deleted file mode 100644 index 187ed8cfc6..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/EnhancedFilterTools.js +++ /dev/null @@ -1,310 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -define([ - "dojo/_base/declare", - "dojo/_base/event", - "dojo/dom-construct", - "dojo/date/locale", - "dijit/form/Button", - "dijit/form/ToggleButton", - "qpid/common/grid/RowNumberLimitDialog", - "qpid/common/grid/ColumnDefDialog", - "qpid/common/grid/FilterSummary", - "qpid/management/UserPreferences" -], function(declare, event, domConstruct, locale, Button, ToggleButton, RowNumberLimitDialog, ColumnDefDialog, FilterSummary, UserPreferences){ - - var _stopEvent = function (evt){ - try{ - if(evt && evt.preventDefault){ - event.stop(evt); - } - }catch(e){} - }; - - return declare("qpid.common.grid.EnhancedFilterTools", null, { - - grid: null, - filterBar: null, - filterStatusTip: null, - clearFilterDialog: null, - filterDefDialog: null, - - columnDefDialog: null, - columnDefButton: null, - filterDefButton: null, - clearFilterButton: null, - filterSummary: null, - setRowNumberLimitButton: null, - setRowNumberLimitDialog: null, - refreshButton: null, - autoRefreshButton: null, - - constructor: function(params) - { - this.inherited(arguments); - - this.filterBar = params.toolbar; - this.grid = params.grid; - this.filterStatusTip= params.filterStatusTip; - this.clearFilterDialog = params.clearFilterDialog; - this.filterDefDialog = params.filterDefDialog; - this.ruleCountToConfirmClearFilter = params.ruleCountToConfirmClearFilter; - this.displayLastUpdateTime = params.hasOwnProperty("displayLastUpdateTime")?params.displayLastUpdateTime:true; - - this._addRefreshButtons(); - this._addRowLimitButton(params.defaulGridRowLimit); - this._addColumnsButton(); - - if (!params.disableFiltering) - { - this._addFilteringTools(params.nls); - } - }, - - toggleClearFilterBtn: function(clearFlag) - { - var filterLayer = this.grid.layer("filter"); - var filterSet = filterLayer && filterLayer.filterDef && filterLayer.filterDef(); - this.clearFilterButton.set("disabled", !filterSet); - }, - - destroy: function() - { - this.inherited(arguments); - - if (this.columnDefDialog) - { - this.columnDefDialog.destroy(); - this.columnDefDialog = null; - } - if (this.columnDefButton) - { - this.columnDefButton.destroy(); - this.columnDefButton = null; - } - if (this.filterDefButton) - { - this.filterDefButton.destroy(); - this.filterDefButton = null; - } - if (this.clearFilterButton) - { - this.clearFilterButton.destroy(); - this.clearFilterButton = null; - } - if (this.filterSummary) - { - this.filterSummary.destroy(); - this.filterSummary = null; - } - if (this.setRowNumberLimitButton) - { - this.setRowNumberLimitButton.destroy(); - this.setRowNumberLimitButton = null; - } - if (this.setRowNumberLimitDialog) - { - this.setRowNumberLimitDialog.destroy(); - this.setRowNumberLimitDialog = null; - } - if (this.refreshButton) - { - this.refreshButton.destroy(); - this.refreshButton = null; - } - if (this.autoRefreshButton) - { - this.autoRefreshButton.destroy(); - this.autoRefreshButton = null; - } - - this.grid = null; - this.filterBar = null; - this.filterStatusTip = null; - this.clearFilterDialog = null; - this.filterDefDialog = null; - }, - - _addRefreshButtons: function() - { - var self = this; - this.refreshButton = new dijit.form.Button({ - label: "Refresh", - type: "button", - iconClass: "gridRefreshIcon", - title: "Manual Refresh" - }); - - this.autoRefreshButton = new dijit.form.ToggleButton({ - label: "Auto Refresh", - type: "button", - iconClass: "gridAutoRefreshIcon", - title: "Auto Refresh" - }); - - this.autoRefreshButton.on("change", function(value){ - self.grid.updater.updatable=value; - self.refreshButton.set("disabled", value); - }); - - this.refreshButton.on("click", function(value){ - self.grid.updater.performUpdate(); - }); - - this.filterBar.addChild(this.autoRefreshButton); - this.filterBar.addChild(this.refreshButton); - - if (this.displayLastUpdateTime) - { - var updateStatusPanel = domConstruct.create("div"); - var updateTimeLabel = domConstruct.create("span", {innerHTML: "Update time: ", "class": "formLabel-labelCell", "style": "padding-right: 5px;padding-left: 5px"}, updateStatusPanel); - var updateTimeLabelPreferredTZ = domConstruct.create("span", {innerHTML: "Preferred timezone:", "style": "padding-right: 5px"}, updateStatusPanel); - var updateTimePreferredTZ = domConstruct.create("span", {"style": "padding-right: 5px"}, updateStatusPanel); - var updateTimeLabelBrowserTZ = domConstruct.create("span", {innerHTML: "Browser timezone:", "style": "padding-right: 5px"}, updateStatusPanel); - var updateTimeBrowserTZ = domConstruct.create("span", {"style": "padding-right: 5px"}, updateStatusPanel); - - var lastUpdateTimeUpdater = function(data) - { - var userTimeZone = UserPreferences.timeZone; - var displayStyle = userTimeZone? "inline" : "none"; - updateTimeLabelPreferredTZ.style.display = displayStyle; - updateTimePreferredTZ.style.display = displayStyle; - var formatOptions = {selector: "time", timePattern: "HH:mm:ss.SSS", appendTimeZone: true, addOffset: true}; - var updateTime = new Date(); - updateTimePreferredTZ.innerHTML = UserPreferences.formatDateTime(updateTime.getTime(), formatOptions); - updateTimeBrowserTZ.innerHTML = locale.format(updateTime, formatOptions); - }; - - if (self.grid.updater.store) - { - // data have been already provided/or fetched - // set last update time to current time - lastUpdateTimeUpdater(); - } - - self.grid.updater.addOnUpdate(lastUpdateTimeUpdater); - domConstruct.place(updateStatusPanel, this.grid.viewsHeaderNode, "before"); - } - }, - - _addRowLimitButton: function(defaulGridRowLimit) - { - var self = this; - this.setRowNumberLimitButton = new dijit.form.Button({ - label: "Set Row Limit", - type: "button", - iconClass: "rowNumberLimitIcon", - title: "Set Row Number Limit" - }); - this.setRowNumberLimitButton.set("title", "Set Row Number Limit (Current: " + defaulGridRowLimit +")"); - - this.setRowNumberLimitDialog = new RowNumberLimitDialog(this.grid.domNode, function(newLimit){ - if (newLimit > 0 && self.grid.updater.appendLimit != newLimit ) - { - self.grid.updater.appendLimit = newLimit; - self.grid.updater.performRefresh([]); - self.setRowNumberLimitButton.set("title", "Set Row Number Limit (Current: " + newLimit +")"); - } - }); - - this.setRowNumberLimitButton.on("click", function(evt){ - self.setRowNumberLimitDialog.showDialog(self.grid.updater.appendLimit); - }); - - this.filterBar.addChild(this.setRowNumberLimitButton); - }, - - _addColumnsButton: function() - { - var self = this; - this.columnDefDialog = new ColumnDefDialog({grid: this.grid}); - - this.columnDefButton = new dijit.form.Button({ - label: "Display Columns", - type: "button", - iconClass: "columnDefDialogButtonIcon", - title: "Show/Hide Columns" - }); - - this.columnDefButton.on("click", function(e){ - _stopEvent(e); - self.columnDefDialog.showDialog(); - }); - - this.filterBar.addChild(this.columnDefButton); - }, - - _addFilteringTools: function(nls) - { - var self = this; - - this.filterDefButton = new dijit.form.Button({ - "class": "dojoxGridFBarBtn", - label: "Set Filter", - iconClass: "dojoxGridFBarDefFilterBtnIcon", - showLabel: "true", - title: "Define filter" - }); - - this.clearFilterButton = new dijit.form.Button({ - "class": "dojoxGridFBarBtn", - label: "Clear filter", - iconClass: "dojoxGridFBarClearFilterButtontnIcon", - showLabel: "true", - title: "Clear filter", - disabled: true - }); - - - this.filterDefButton.on("click", function(e){ - _stopEvent(e); - - // a bit of a hack to force dialog to rebuild the criteria controls in order to get rid from empty rule controls - self.filterDefDialog._criteriasChanged = true; - self.filterDefDialog.showDialog(); - }); - - this.clearFilterButton.on("click", function(e){ - _stopEvent(e); - if (self.ruleCountToConfirmClearFilter && self.filterDefDialog.getCriteria() >= self.ruleCountToConfirmClearFilter) - { - self.clearFilterDialog.show(); - } - else - { - self.grid.layer("filter").filterDef(null); - self.toggleClearFilterBtn(true) - } - }); - - this.filterSummary = new FilterSummary({grid: this.grid, filterStatusTip: this.filterStatusTip, nls: nls}); - - this.filterBar.addChild(this.filterDefButton); - this.filterBar.addChild(this.clearFilterButton); - - this.filterBar.addChild(new dijit.ToolbarSeparator()); - this.filterBar.addChild(this.filterSummary, "last"); - this.filterBar.getColumnIdx = function(coordX){return self.filterSummary._getColumnIdx(coordX);}; - - } - }); -}); \ No newline at end of file diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/FilterSummary.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/FilterSummary.js deleted file mode 100644 index d29e4027df..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/FilterSummary.js +++ /dev/null @@ -1,173 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -define([ - "dojo/_base/declare", - "dojo/_base/lang", - "dojo/_base/html", - "dojo/query", - "dojo/dom-construct", - "dojo/string", - "dojo/on", - "dijit/_WidgetBase" -], function(declare, lang, html, query, domConstruct, string, on, _WidgetBase){ - -return declare("qpid.common.grid.FilterSummary", [_WidgetBase], { - - domNode: null, - itemName: null, - filterStatusTip: null, - grid: null, - _handle_statusTooltip: null, - _timeout_statusTooltip: 300, - _nls: null, - - constructor: function(params) - { - this.inherited(arguments); - this.itemName = params.itemsName; - this.initialize(params.filterStatusTip, params.grid); - this._nls = params.nls; - }, - - buildRendering: function(){ - this.inherited(arguments); - var itemsName = this.itemName || this._nls["defaultItemsName"]; - var message = string.substitute(this._nls["filterBarMsgNoFilterTemplate"], [0, itemsName ]); - this.domNode = domConstruct.create("span", {innerHTML: message, "class": "dijit dijitReset dijitInline dijitButtonInline", role: "presentation" }); - }, - - postCreate: function(){ - this.inherited(arguments); - on(this.domNode, "mouseenter", lang.hitch(this, this._onMouseEnter)); - on(this.domNode, "mouseleave", lang.hitch(this, this._onMouseLeave)); - on(this.domNode, "mousemove", lang.hitch(this, this._onMouseMove)); - }, - - destroy: function() - { - this.inherited(arguments); - this.itemName = null; - this.filterStatusTip = null; - this.grid = null; - this._handle_statusTooltip = null; - this._filteredClass = null; - this._nls = null; - }, - - initialize: function(filterStatusTip, grid) - { - this.filterStatusTip = filterStatusTip; - this.grid = grid; - if (this.grid) - { - var filterLayer = grid.layer("filter"); - this.connect(filterLayer, "onFiltered", this.onFiltered); - } - }, - - onFiltered: function(filteredSize, originSize) - { - try - { - var itemsName = this.itemName || this._nls["defaultItemsName"], - msg = "", g = this.grid, - filterLayer = g.layer("filter"); - if(filterLayer.filterDef()){ - msg = string.substitute(this._nls["filterBarMsgHasFilterTemplate"], [filteredSize, originSize, itemsName]); - }else{ - msg = string.substitute(this._nls["filterBarMsgNoFilterTemplate"], [originSize, itemsName]); - } - this.domNode.innerHTML = msg; - } - catch(e) - { - // swallow and log exception - // otherwise grid rendering is screwed - console.error(e); - } - }, - - _getColumnIdx: function(coordX){ - var headers = query("[role='columnheader']", this.grid.viewsHeaderNode); - var idx = -1; - for(var i = headers.length - 1; i >= 0; --i){ - var coord = html.position(headers[i]); - if(coordX >= coord.x && coordX < coord.x + coord.w){ - idx = i; - break; - } - } - if(idx >= 0 && this.grid.layout.cells[idx].filterable !== false){ - return idx; - }else{ - return -1; - } - }, - - _setStatusTipTimeout: function(){ - this._clearStatusTipTimeout(); - this._handle_statusTooltip = setTimeout(lang.hitch(this,this._showStatusTooltip),this._timeout_statusTooltip); - }, - - _clearStatusTipTimeout: function(){ - if (this._handle_statusTooltip){ - clearTimeout(this._handle_statusTooltip); - } - this._handle_statusTooltip = null; - }, - - _showStatusTooltip: function(){ - this._handle_statusTooltip = null; - if(this.filterStatusTip){ - this.filterStatusTip.showDialog(this._tippos.x, this._tippos.y, this._getColumnIdx(this._tippos.x)); - } - }, - - _updateTipPosition: function(evt){ - this._tippos = { - x: evt.pageX, - y: evt.pageY - }; - }, - - _onMouseEnter: function(e){ - this._updateTipPosition(e); - if(this.filterStatusTip){ - this._setStatusTipTimeout(); - } - }, - - _onMouseMove: function(e){ - if(this.filterStatusTip){ - this._setStatusTipTimeout(); - if(this._handle_statusTooltip){ - this._updateTipPosition(e); - } - } - }, - - _onMouseLeave: function(e){ - this._clearStatusTipTimeout(); - } - }); - -}); \ No newline at end of file diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/GridUpdater.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/GridUpdater.js deleted file mode 100644 index e5d96d44e7..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/GridUpdater.js +++ /dev/null @@ -1,297 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - - -define(["dojo/_base/xhr", - "dojo/parser", - "dojo/_base/array", - "dojo/_base/lang", - "qpid/common/properties", - "qpid/common/updater", - "qpid/common/UpdatableStore", - "qpid/common/util", - "dojo/store/Memory", - "dojo/data/ObjectStore", - "qpid/common/grid/EnhancedFilter", - "dojox/grid/enhanced/plugins/NestedSorting", - "dojo/domReady!"], - function (xhr, parser, array, lang, properties, updater, UpdatableStore, util, Memory, ObjectStore) { - - function GridUpdater(args, store) { - this.updatable = args.hasOwnProperty("updatable") ? args.updatable : true ; - this.serviceUrl = args.serviceUrl; - - this.onUpdate = []; - if (args.onUpdate) - { - this.onUpdate.push(args.onUpdate); - } - this.dataTransformer = args.dataTransformer; - - this.appendData = args.append; - this.appendLimit = args.appendLimit; - this.initialData = args.data; - this.initializeStore(store); - }; - - GridUpdater.prototype.buildUpdatableGridArguments = function(args) - { - var filterPluginFound = args && args.hasOwnProperty("plugins") && args.plugins.filter ? true: false; - - var gridProperties = { - autoHeight: true, - plugins: { - pagination: { - defaultPageSize: 25, - pageSizes: [10, 25, 50, 100], - description: true, - sizeSwitch: true, - pageStepper: true, - gotoButton: true, - maxPageStep: 4, - position: "bottom" - }, - enhancedFilter: { - disableFiltering: filterPluginFound - } - } - }; - - if(args) - { - for(var argProperty in args) - { - if(args.hasOwnProperty(argProperty)) - { - if (argProperty == "plugins") - { - var argPlugins = args[ argProperty ]; - for(var argPlugin in argPlugins) - { - if(argPlugins.hasOwnProperty(argPlugin)) - { - var argPluginProperties = argPlugins[ argPlugin ]; - if (argPluginProperties && gridProperties.plugins.hasOwnProperty(argPlugin)) - { - var gridPlugin = gridProperties.plugins[ argPlugin ]; - for(var pluginProperty in argPluginProperties) - { - if(argPluginProperties.hasOwnProperty(pluginProperty)) - { - gridPlugin[pluginProperty] = argPluginProperties[pluginProperty]; - } - } - } - else - { - gridProperties.plugins[ argPlugin ] = argPlugins[ argPlugin ]; - } - } - } - } - else - { - gridProperties[ argProperty ] = args[ argProperty ]; - } - } - } - } - - gridProperties.updater = this; - gridProperties.store = this.dataStore; - - return gridProperties; - }; - - GridUpdater.prototype.initializeStore = function(store) - { - var self = this; - - function processData(data) - { - if (self.dataTransformer) - { - data = self.dataTransformer(data); - } - var dataSet = false; - if (!store) - { - store = new ObjectStore({objectStore: new Memory({data: data, idProperty: "id"})}); - dataSet = true; - } - self.dataStore = store - self.store = store; - if (store instanceof ObjectStore) - { - if( store.objectStore instanceof Memory) - { - self.memoryStore = store.objectStore; - } - self.store = store.objectStore - } - - if (data) - { - if ((dataSet || self.updateOrAppend(data)) && self.onUpdate.length > 0) - { - self.fireUpdate(data); - } - } - }; - - if (this.serviceUrl) - { - var requestUrl = lang.isFunction(this.serviceUrl) ? this.serviceUrl() : this.serviceUrl; - xhr.get({url: requestUrl, sync: true, handleAs: "json"}).then(processData, util.xhrErrorHandler); - } - else - { - processData(this.initialData); - } - }; - - GridUpdater.prototype.start = function(grid) - { - this.grid = grid; - if (this.serviceUrl) - { - updater.add(this); - } - }; - - GridUpdater.prototype.destroy = function() - { - updater.remove(this); - if (this.dataStore) - { - this.dataStore.close(); - this.dataStore = null; - } - this.store = null; - this.memoryStore = null; - this.grid = null; - this.onUpdate = null; - }; - - GridUpdater.prototype.updateOrAppend = function(data) - { - return this.appendData ? - UpdatableStore.prototype.append.call(this, data, this.appendLimit): - UpdatableStore.prototype.update.call(this, data); - }; - - GridUpdater.prototype.refresh = function(data) - { - if (this.dataTransformer && data) - { - data = this.dataTransformer(data); - } - this.updating = true; - try - { - if (this.updateOrAppend(data)) - { - // EnhancedGrid with Filter plugin has "filter" layer. - // The filter expression needs to be re-applied after the data update - var filterLayer = this.grid.layer("filter"); - if ( filterLayer && filterLayer.filterDef) - { - var currentFilter = filterLayer.filterDef(); - - if (currentFilter) - { - // re-apply filter in the filter layer - filterLayer.filterDef(currentFilter); - } - } - - // refresh grid to render updates - this.grid._refresh(); - } - } - finally - { - this.updating = false; - this.fireUpdate(data); - } - } - - GridUpdater.prototype.update = function() - { - if (this.updatable) - { - this.performUpdate(); - } - }; - - GridUpdater.prototype.performUpdate = function() - { - var self = this; - var requestUrl = lang.isFunction(this.serviceUrl) ? this.serviceUrl() : this.serviceUrl; - var requestArguments = {url: requestUrl, sync: properties.useSyncGet, handleAs: "json"}; - xhr.get(requestArguments).then(function(data){self.refresh(data);}); - }; - - GridUpdater.prototype.performRefresh = function(data) - { - if (!this.updating) - { - this.refresh(data); - } - }; - - GridUpdater.prototype.fireUpdate=function(data) - { - if (this.onUpdate.length > 0) - { - for(var i=0; i 0) - { - try - { - limitChangedCallback(self.rowNumberLimit.value); - } - catch(e) - { - console.error(e); - } - finally - { - self.dialog.hide(); - } - } - }); - - this.closeButton.on("click", function(e){self.dialog.hide(); }); - this.dialog.startup(); - }, - - destroy: function(){ - this.submitButton.destroy(); - this.closeButton.destroy(); - this.dialog.destroy(); - this.dialog = null; - }, - - showDialog: function(currentLimit){ - this.rowNumberLimit.set("value", currentLimit); - this.dialog.show(); - } - - }); - -}); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/UpdatableGrid.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/UpdatableGrid.js deleted file mode 100644 index 04041388bd..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/UpdatableGrid.js +++ /dev/null @@ -1,56 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -define([ - "dojo/_base/declare", - "dojox/grid/EnhancedGrid", - "dojo/domReady!"], function(declare, EnhancedGrid){ - - return declare("qpid.common.grid.UpdatableGrid", [EnhancedGrid], { - - updater: null, - - postCreate: function(){ - this.inherited(arguments); - if (this.updater) - { - this.updater.start(this); - } - }, - - destroy: function(){ - if (this.updater) - { - try - { - this.updater.destroy(); - } - catch(e) - { - console.error(e) - } - this.updater = null; - } - this.inherited(arguments); - } - }); - -}); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/metadata.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/metadata.js deleted file mode 100644 index 1a9ceb7419..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/metadata.js +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -define(["dojo/_base/xhr", - "dojo/_base/array", - "dojox/lang/functional/object", - "qpid/common/properties", - "dojo/domReady!" - ], - function (xhr, array, fobject, properties) - { - var metadata = - { - _init: function () - { - var that = this; - xhr.get({sync: true, handleAs: "json", url: "service/metadata", load: function(data){that._onMetadata(data)}}); - }, - _onMetadata: function (metadata) - { - this.metadata = metadata; - }, - getMetaData: function (category, type) - { - return this.metadata[category][type]; - }, - getDefaultValueForAttribute: function (category, type, attributeName) - { - var metaDataForInstance = this.getMetaData(category, type); - var attributesForType = metaDataForInstance["attributes"]; - var attributesForName = attributesForType[attributeName]; - return attributesForName ? attributesForName["defaultValue"] : undefined; - }, - getTypesForCategory: function (category) - { - return fobject.keys(this.metadata[category]); - }, - extractUniqueListOfValues : function(data) - { - var values = []; - for (i = 0; i < data.length; i++) - { - for (j = 0; j < data[i].length; j++) - { - var current = data[i][j]; - if (array.indexOf(values, current) == -1) - { - values.push(current); - } - } - } - return values; - }, - implementsManagedInterface: function (category, type, managedInterfaceName) - { - var md = this.getMetaData(category, type); - if (md && md.managedInterfaces) - { - return array.indexOf(md.managedInterfaces, managedInterfaceName) >= 0 ; - } - return false; - }, - validChildTypes: function (category, type, childCategory) - { - var metaData = this.getMetaData(category, type); - return metaData ? metaData.validChildTypes[childCategory] : []; - } - - }; - - metadata._init(); - - return metadata; - }); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/properties.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/properties.js deleted file mode 100644 index 8d85345b74..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/properties.js +++ /dev/null @@ -1,26 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/has", "dojo/_base/sniff", "dojo/domReady!"], - function (has) { - var properties = {}; - properties.useSyncGet = (has("ie") <= 8); - return properties; - }); \ No newline at end of file diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/timezone.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/timezone.js deleted file mode 100644 index f886a72daa..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/timezone.js +++ /dev/null @@ -1,95 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -define(["dojo/_base/xhr"], function (xhr) { - - var timezones = {}; - - var timeZoneSortFunction = function(a, b){ - if (a.region == b.region) - { - if (a.city == b.city) - { - return 0; - } - return a.city < b.city ? -1 : 1; - } - return a.region < b.region ? -1 : 1; - } - - function loadTimezones() - { - xhr.get({ - url: "service/helper?action=ListTimeZones", - sync: true, - handleAs: "json", - load: function(zones) - { - zones.sort(timeZoneSortFunction); - timezones.data = zones; - }, - error: function(error) - { - if (console && console.error) - { - console.error(error); - } - } - }); - } - - return { - getAllTimeZones: function() - { - if (!timezones.data) - { - loadTimezones(); - } - return timezones.data; - }, - getTimeZoneInfo: function(timeZone) { - if (timeZone == "UTC") - { - return { - "id" : "UTC", - "name" : "UTC", - "offset" : 0 - } - } - var tzi = timezones[timeZone]; - if (!tzi) - { - var data = this.getAllTimeZones(); - for(var i = 0; i < data.length; i++) - { - var zone = data[i]; - if (zone.id == timeZone) - { - tzi = zone; - timezones[timeZone] = zone; - break; - } - } - } - return tzi; - } - }; -}); \ No newline at end of file diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/updater.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/updater.js deleted file mode 100644 index f31fd1aa1f..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/updater.js +++ /dev/null @@ -1,65 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["qpid/management/UserPreferences"], function (UserPreferences) { - var updateList = new Array(); - - function invokeUpdates() - { - for(var i = 0; i < updateList.length; i++) - { - var obj = updateList[i]; - obj.update(); - } - } - - var updatePeriod = UserPreferences.updatePeriod ? UserPreferences.updatePeriod: 5; - - var timer = setInterval(invokeUpdates, updatePeriod * 1000); - - var updateIntervalListener = { - onPreferencesChange: function(preferences) - { - if (preferences.updatePeriod && preferences.updatePeriod != updatePeriod) - { - updatePeriod = preferences.updatePeriod; - clearInterval(timer); - timer = setInterval(invokeUpdates, updatePeriod * 1000); - } - } - }; - - UserPreferences.addListener(updateIntervalListener); - - return { - add: function(obj) { - updateList.push(obj); - }, - - remove: function(obj) { - for(var i = 0; i < updateList.length; i++) { - if(updateList[i] === obj) { - updateList.splice(i,1); - return; - } - } - } - }; -}); \ No newline at end of file diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/util.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/util.js deleted file mode 100644 index 5bf5574347..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/util.js +++ /dev/null @@ -1,842 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/xhr", - "dojo/_base/array", - "dojo/_base/event", - "dojo/_base/lang", - "dojo/json", - "dojo/dom-construct", - "dojo/dom-geometry", - "dojo/dom-style", - "dojo/_base/window", - "dojo/query", - "dojo/parser", - "dojo/store/Memory", - "dojo/window", - "dojo/on", - "dojox/html/entities", - "qpid/common/metadata", - "qpid/common/widgetconfigurer", - "dijit/registry", - "dijit/TitlePane", - "dijit/Dialog", - "dijit/form/Form", - "dijit/form/Button", - "dijit/form/RadioButton", - "dijit/form/CheckBox", - "dijit/form/FilteringSelect", - "dijit/form/ValidationTextBox", - "dojox/layout/TableContainer", - "dijit/layout/ContentPane", - "dojox/validate/us", - "dojox/validate/web", - "dojo/domReady!" - ], - function (xhr, array, event, lang, json, dom, geometry, domStyle, win, query, parser, Memory, w, on, entities, metadata, widgetconfigurer, registry) { - var util = {}; - if (Array.isArray) { - util.isArray = function (object) { - return Array.isArray(object); - }; - } else { - util.isArray = function (object) { - return object instanceof Array; - }; - } - - util.flattenStatistics = function (data) { - var attrName, stats, propName, theList; - for(attrName in data) { - if(data.hasOwnProperty(attrName)) { - if(attrName == "statistics") { - stats = data.statistics; - for(propName in stats) { - if(stats.hasOwnProperty( propName )) { - data[ propName ] = stats[ propName ]; - } - } - } else if(data[ attrName ] instanceof Array) { - theList = data[ attrName ]; - - for(var i=0; i < theList.length; i++) { - util.flattenStatistics( theList[i] ); - } - } - } - } - }; - - util.isReservedExchangeName = function(exchangeName) - { - return exchangeName == null || exchangeName == "" || "<>" == exchangeName || exchangeName.indexOf("amq.") == 0 || exchangeName.indexOf("qpid.") == 0; - }; - - util.deleteGridSelections = function(updater, grid, url, confirmationMessageStart, idParam) - { - var data = grid.selection.getSelected(); - var success = false; - if(data.length) - { - var confirmationMessage = null; - if (data.length == 1) - { - confirmationMessage = confirmationMessageStart + " '" + data[0].name + "'?"; - } - else - { - var names = ''; - for(var i = 0; i