KNOX-1663 - Enforce more Checkstyle rules * UpperEll * ModifierOrder * RedundantModifier * Trailing whitespace
Signed-off-by: Kevin Risden <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/knox/repo Commit: http://git-wip-us.apache.org/repos/asf/knox/commit/6736393d Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/6736393d Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/6736393d Branch: refs/heads/master Commit: 6736393ddb51b5eed583b437af683cdd17df5be9 Parents: 8e00496 Author: Kevin Risden <[email protected]> Authored: Fri Dec 7 17:35:50 2018 -0500 Committer: Kevin Risden <[email protected]> Committed: Fri Dec 7 18:11:07 2018 -0500 ---------------------------------------------------------------------- .../build-tools/checkstyle/checker.xml | 9 + .../admin-ui/app/assets/vkbeautify.js | 516 +- .../knoxauth/app/libs/bower/jquery/js/jquery.js | 37 +- .../applications/knoxauth/app/login.html | 98 +- .../applications/knoxauth/app/redirecting.html | 28 +- .../applications/knoxauth/app/redirecting.jsp | 58 +- .../applications/knoxauth/app/styles/knox.css | 130 +- .../ambari/AmbariServiceDiscoveryMessages.java | 68 +- .../ambari/AmbariServiceDiscoveryTest.java | 5 +- .../loggers/log4j/Log4jMessageLogger.java | 6 +- .../knox/gateway/i18n/messages/Message.java | 4 +- .../knox/gateway/i18n/messages/Messages.java | 6 +- .../gateway/i18n/messages/MessagesInvoker.java | 12 +- .../messages/loggers/jdk/JdkMessageLogger.java | 6 +- .../loggers/sout/SoutMessageLogger.java | 2 +- .../loggers/test/TestMessageRecord.java | 2 +- .../knox/gateway/i18n/resources/Resource.java | 2 +- .../knox/gateway/i18n/resources/Resources.java | 2 +- .../i18n/resources/ResourcesInvoker.java | 4 +- .../knox/gateway/ha/provider/HaDescriptor.java | 12 +- .../knox/gateway/ha/provider/HaProvider.java | 74 +- .../gateway/ha/provider/HaServiceConfig.java | 33 +- .../knox/gateway/ha/provider/URLManager.java | 15 +- .../provider/impl/AtlasZookeeperURLManager.java | 2 +- .../provider/impl/BaseZookeeperURLManager.java | 4 +- .../provider/impl/HBaseZookeeperURLManager.java | 6 +- .../ha/provider/impl/HaDescriptorConstants.java | 22 +- .../provider/impl/HaServiceConfigConstants.java | 30 +- .../provider/impl/KafkaZookeeperURLManager.java | 8 +- .../provider/impl/SOLRZookeeperURLManager.java | 4 +- .../ha/provider/impl/StringResponseHandler.java | 2 +- .../HaProviderDeploymentContributorTest.java | 1 - .../impl/HBaseZookeeperURLManagerTest.java | 2 +- .../impl/KafkaZookeeperURLManagerTest.java | 4 +- .../impl/SOLRZookeeperURLManagerTest.java | 9 +- .../filter/AbstractIdentityAssertionFilter.java | 23 +- .../filter/CommonIdentityAssertionFilter.java | 6 +- ...entityAsserterHttpServletRequestWrapper.java | 6 +- .../CommonIdentityAssertionFilterTest.java | 4 +- ...yAssertionHttpServletRequestWrapperTest.java | 2 +- .../function/UsernameFunctionProcessorTest.java | 2 +- .../ConcatIdentityAssertionFilterTest.java | 6 +- ...adoopGroupProviderDeploymentContributor.java | 6 +- .../filter/HadoopGroupProviderMessages.java | 14 +- ...pGroupProviderDeploymentContributorTest.java | 3 +- .../hadoop/groups/filter/HadoopGroupsTest.java | 2 +- .../DefaultIdentityAssertionFilterTest.java | 23 +- .../filter/RegexIdentityAssertionFilter.java | 2 +- .../jersey/JerseyDeploymentContributorTest.java | 2 +- .../impl/HostmapFunctionProcessorTest.java | 5 +- .../impl/ServiceRegistryFunctionsTest.java | 4 +- .../SecureQueryDecryptProcessor.java | 4 +- .../SecureQueryDeploymentContributor.java | 4 +- .../SecureQueryDeploymentContributorTest.java | 6 +- .../SecureQueryEncodeProcessorTest.java | 2 +- .../SecureQueryEncryptDecryptProcessorTest.java | 4 +- .../api/UrlRewriteFilterBufferDescriptor.java | 3 +- .../api/UrlRewriteFilterGroupDescriptor.java | 6 +- .../rewrite/impl/UrlRewriteFilterReader.java | 6 +- .../rewrite/impl/html/HtmlPrefixProcessor.java | 2 +- .../impl/html/HtmlUrlRewriteFilterReader.java | 2 +- .../rewrite/impl/json/JsonFilterReader.java | 3 +- .../rewrite/impl/xml/XmlFilterReader.java | 7 +- .../impl/xml/XmlRewriteRulesDigester.java | 5 +- .../rewrite/impl/xml/XmlRewriteRulesTags.java | 27 +- .../impl/xml/XmlUrlRewriteRulesExporter.java | 2 +- .../rewrite/api/UrlRewriteProcessorTest.java | 8 +- .../api/UrlRewriteServletFilterTest.java | 3 +- .../impl/FrontendFunctionProcessorTest.java | 4 +- .../impl/html/HtmlFilterReaderBaseTest.java | 8 +- .../impl/AclsAuthzDeploymentContributor.java | 4 +- .../apache/knox/gateway/filter/AclParser.java | 4 +- .../gateway/filter/AclsAuthorizationFilter.java | 13 +- .../knox/gateway/filter/AclParserTest.java | 11 +- .../gateway/filter/AclsAuthzFilterTest.java | 38 +- .../gateway/hadoopauth/HadoopAuthMessages.java | 2 - .../hadoopauth/filter/HadoopAuthFilter.java | 4 +- .../hadoopauth/filter/HadoopAuthPostFilter.java | 47 +- .../HadoopAuthDeploymentContributorTest.java | 2 +- .../JWTAccessTokenAssertionContributor.java | 2 +- .../deploy/SSOCookieFederationContributor.java | 2 +- .../jwt/filter/AccessTokenFederationFilter.java | 27 +- .../jwt/filter/SSOCookieFederationFilter.java | 4 +- .../knox/gateway/pac4j/Pac4jMessages.java | 14 +- .../Pac4jFederationProviderContributor.java | 2 +- .../gateway/pac4j/session/KnoxSessionStore.java | 17 +- .../filter/AbstractPreAuthFederationFilter.java | 13 +- .../filter/HeaderPreAuthFederationFilter.java | 2 +- .../preauth/filter/PreAuthValidator.java | 4 +- .../provider/federation/IPValidatorTest.java | 2 +- .../knox/gateway/deploy/impl/ShiroConfig.java | 6 +- .../gateway/filter/ResponseCookieFilter.java | 2 +- .../filter/ShiroSubjectIdentityAdapter.java | 31 +- .../shirorealm/KnoxLdapContextFactory.java | 24 +- .../knox/gateway/shirorealm/KnoxLdapRealm.java | 49 +- .../gateway/shirorealm/KnoxLdapRealmTest.java | 25 +- .../webappsec/deploy/WebAppSecContributor.java | 2 +- .../webappsec/filter/CSRFPreventionFilter.java | 5 +- .../webappsec/filter/StrictTransportFilter.java | 4 +- .../webappsec/filter/XFrameOptionsFilter.java | 2 +- .../webappsec/StrictTransportFilterTest.java | 2 +- .../webappsec/XFrameOptionsFilterTest.java | 8 +- .../webappsec/XSSProtectionFilterTest.java | 2 +- .../org/apache/knox/gateway/GatewayFilter.java | 12 +- .../knox/gateway/GatewayForwardingServlet.java | 4 +- .../apache/knox/gateway/GatewayMessages.java | 88 +- .../org/apache/knox/gateway/GatewayServer.java | 2 +- .../gateway/config/impl/GatewayConfigImpl.java | 12 +- .../impl/DispatchDeploymentContributor.java | 2 +- .../xml/XmlGatewayDescriptorTags.java | 24 +- .../gateway/filter/RequestUpdateHandler.java | 2 +- .../gateway/services/CLIGatewayServices.java | 4 +- .../services/DefaultGatewayServices.java | 4 +- .../services/registry/impl/Registry.java | 9 +- .../security/impl/CLIMasterService.java | 1 - .../security/impl/DefaultCryptoService.java | 2 +- .../security/impl/DefaultKeystoreService.java | 28 +- .../security/impl/DefaultMasterService.java | 1 - .../services/security/impl/JettySSLService.java | 11 +- .../security/impl/RemoteAliasService.java | 8 +- .../simple/SimpleDescriptorMessages.java | 14 +- .../apache/knox/gateway/trace/TraceUtil.java | 8 +- .../org/apache/knox/gateway/util/KnoxCLI.java | 4 +- .../websockets/GatewayWebsocketHandler.java | 2 +- .../websockets/MessageEventCallback.java | 23 +- .../websockets/ProxyWebSocketAdapter.java | 2 +- .../websockets/WebsocketLogMessages.java | 11 +- .../apache/knox/gateway/GatewayFilterTest.java | 2 +- .../gateway/GatewayForwardingServletTest.java | 2 - .../gateway/GatewayPortMappingConfigTest.java | 2 +- .../config/impl/GatewayConfigImplTest.java | 12 +- .../services/security/CryptoServiceTest.java | 43 +- .../apache/knox/gateway/util/KnoxCLITest.java | 10 +- .../knox/gateway/websockets/BadBackendTest.java | 23 +- .../websockets/ConnectionDroppedTest.java | 5 +- .../knox/gateway/websockets/EchoSocket.java | 3 +- .../gateway/websockets/MessageFailureTest.java | 13 +- .../websockets/WebsocketEchoHandler.java | 10 +- .../gateway/websockets/WebsocketEchoTest.java | 5 +- .../WebsocketMultipleConnectionTest.java | 2 +- .../xml/simple-topology-knox-format.xml | 12 +- .../gateway/service/admin/VersionResource.java | 6 +- .../services/sparkthriftui/2.1.0/service.xml | 2 +- .../services/yarn-rm/2.5.0/rewrite.xml | 90 +- .../service/knoxsso/WebSSOResourceTest.java | 2 +- .../service/knoxtoken/TokenResource.java | 2 +- .../remote/RemoteConfigurationMessages.java | 7 +- .../service/vault/CredentialResource.java | 10 +- .../hdfs/dispatch/AbstractHdfsHaDispatch.java | 4 +- .../hdfs/dispatch/WebHdfsHaDispatch.java | 2 +- .../shell/AbstractCredentialCollector.java | 3 - .../AbstractJavaConsoleCredentialCollector.java | 8 +- .../knox/gateway/shell/AbstractRequest.java | 4 +- .../apache/knox/gateway/shell/Credentials.java | 6 +- .../org/apache/knox/gateway/shell/KnoxSh.java | 12 +- .../org/apache/knox/gateway/shell/job/Java.java | 6 +- .../apache/knox/gateway/shell/job/Queue.java | 7 +- .../apache/knox/gateway/shell/job/Status.java | 6 +- .../apache/knox/gateway/SpiGatewayMessages.java | 8 +- .../knox/gateway/config/GatewayConfig.java | 30 +- .../ServiceDeploymentContributorBase.java | 4 +- .../descriptor/GatewayDescriptorExporter.java | 6 +- .../descriptor/GatewayDescriptorImporter.java | 4 +- .../dispatch/AbstractGatewayDispatch.java | 8 +- .../apache/knox/gateway/dispatch/Dispatch.java | 2 +- .../gateway/dispatch/HttpClientFactory.java | 3 +- .../dispatch/PassAllHeadersDispatch.java | 2 +- .../AbstractIdentityAssertionFilter.java | 4 +- .../knox/gateway/i18n/GatewaySpiMessages.java | 18 +- .../knox/gateway/i18n/GatewaySpiResources.java | 2 +- .../knox/gateway/security/GroupPrincipal.java | 2 +- .../gateway/security/ImpersonatedPrincipal.java | 4 +- .../knox/gateway/security/PrimaryPrincipal.java | 2 +- .../knox/gateway/security/SubjectUtils.java | 21 +- .../principal/SimplePrincipalMapper.java | 6 +- .../knox/gateway/services/GatewayServices.java | 33 +- .../gateway/services/ServerInfoService.java | 2 +- .../apache/knox/gateway/services/Service.java | 4 +- .../gateway/services/hostmap/HostMapper.java | 5 +- .../services/registry/ServiceRegistry.java | 8 +- .../services/security/CryptoService.java | 15 +- .../services/security/EncryptionResult.java | 19 +- .../services/security/KeystoreService.java | 2 +- .../services/security/MasterService.java | 2 +- .../security/impl/BaseKeystoreService.java | 14 +- .../security/impl/CMFKeystoreService.java | 18 +- .../security/impl/CMFMasterService.java | 14 +- .../security/impl/ConfigurableEncryptor.java | 10 +- .../security/impl/X509CertificateUtil.java | 2 +- .../services/security/token/impl/JWT.java | 2 +- .../org/apache/knox/gateway/topology/Param.java | 2 - .../apache/knox/gateway/topology/Provider.java | 2 +- .../apache/knox/gateway/topology/Service.java | 2 +- .../apache/knox/gateway/topology/Topology.java | 2 +- .../dispatch/CappedBufferHttpEntityTest.java | 4 +- .../security/principal/PrincipalMapperTest.java | 2 +- .../security/impl/CMFMasterServiceTest.java | 2 +- .../security/impl/TestCMFMasterService.java | 2 - .../apache/knox/gateway/GatewayTestConfig.java | 2 +- .../apache/knox/test/log/CollectAppender.java | 2 +- .../knox/test/mock/MockRequestMatcher.java | 2 +- .../knox/gateway/GatewayCorrelationIdTest.java | 2 +- .../monitor/RemoteConfigurationMonitorTest.java | 2 +- .../gateway/GatewayBasicFuncTest/changes.txt | 8 +- .../GatewayBasicFuncTest/yarn/app_running.json | 46 +- .../GatewayBasicFuncTest/yarn/app_running.xml | 42 +- .../yarn/app_succeeded.json | 46 +- .../GatewayBasicFuncTest/yarn/app_succeeded.xml | 42 +- .../GatewayBasicFuncTest/yarn/appattempts.json | 24 +- .../GatewayBasicFuncTest/yarn/appattempts.xml | 16 +- .../gateway/GatewayBasicFuncTest/yarn/apps.json | 138 +- .../gateway/GatewayBasicFuncTest/yarn/apps.xml | 130 +- .../yarn/appstatistics.json | 48 +- .../GatewayBasicFuncTest/yarn/appstatistics.xml | 40 +- .../GatewayBasicFuncTest/yarn/cluster-info.json | 24 +- .../GatewayBasicFuncTest/yarn/cluster-info.xml | 30 +- .../yarn/cluster-metrics.json | 42 +- .../yarn/cluster-metrics.xml | 38 +- .../gateway/GatewayBasicFuncTest/yarn/node.json | 26 +- .../gateway/GatewayBasicFuncTest/yarn/node.xml | 22 +- .../GatewayBasicFuncTest/yarn/nodes.json | 34 +- .../gateway/GatewayBasicFuncTest/yarn/nodes.xml | 26 +- .../yarn/proxy-mapreduce-info.json | 14 +- .../yarn/proxy-mapreduce-info.xml | 10 +- .../yarn/proxy-mapreduce-job-attempts.json | 24 +- .../yarn/proxy-mapreduce-job-attempts.xml | 16 +- .../yarn/proxy-mapreduce-job-conf.json | 10522 ++++++++--------- .../yarn/proxy-mapreduce-job-conf.xml | 8000 ++++++------- .../yarn/proxy-mapreduce-job-counters.json | 610 +- .../yarn/proxy-mapreduce-job-counters.xml | 588 +- .../yarn/proxy-mapreduce-job.json | 62 +- .../yarn/proxy-mapreduce-job.xml | 58 +- .../yarn/proxy-mapreduce-jobs.json | 70 +- .../yarn/proxy-mapreduce-jobs.xml | 62 +- .../proxy-mapreduce-task-attempt-counters.json | 306 +- .../proxy-mapreduce-task-attempt-counters.xml | 288 +- .../yarn/proxy-mapreduce-task-attempt.json | 38 +- .../yarn/proxy-mapreduce-task-attempt.xml | 36 +- .../yarn/proxy-mapreduce-task-attempts.json | 48 +- .../yarn/proxy-mapreduce-task-attempts.xml | 42 +- .../yarn/proxy-mapreduce-task-counters.json | 306 +- .../yarn/proxy-mapreduce-task-counters.xml | 282 +- .../yarn/proxy-mapreduce-task.json | 22 +- .../yarn/proxy-mapreduce-task.xml | 18 +- .../yarn/proxy-mapreduce-tasks.json | 52 +- .../yarn/proxy-mapreduce-tasks.xml | 46 +- .../GatewayBasicFuncTest/yarn/scheduler.json | 78 +- .../GatewayBasicFuncTest/yarn/scheduler.xml | 68 +- .../knox/gateway/audit/api/ActionOutcome.java | 1 - .../knox/gateway/audit/api/AuditContext.java | 4 +- .../apache/knox/gateway/audit/api/Auditor.java | 9 +- .../gateway/audit/api/CorrelationContext.java | 4 +- .../gateway/audit/api/CorrelationService.java | 12 +- .../audit/log4j/audit/AuditConstants.java | 6 +- .../audit/log4j/audit/Log4jAuditContext.java | 9 +- .../audit/log4j/audit/Log4jAuditService.java | 2 +- .../gateway/audit/log4j/audit/Log4jAuditor.java | 6 +- .../correlation/Log4jCorrelationService.java | 7 +- .../gateway/audit/log4j/layout/AuditLayout.java | 6 +- .../org/apache/knox/gateway/util/HttpUtils.java | 6 +- .../knox/gateway/util/IpAddressValidator.java | 15 +- .../org/apache/knox/gateway/util/JsonPath.java | 2 +- .../org/apache/knox/gateway/util/JsonUtils.java | 19 +- .../knox/gateway/util/X500PrincipalParser.java | 2 +- .../org/apache/knox/gateway/util/XmlUtils.java | 12 +- .../knox/gateway/audit/AuditLayoutTest.java | 9 +- .../knox/gateway/audit/AuditServiceTest.java | 38 +- .../gateway/util/IpAddressValidatorTest.java | 15 +- .../apache/knox/gateway/util/JsonUtilsTest.java | 6 +- .../org/apache/knox/gateway/config/Alias.java | 2 +- .../org/apache/knox/gateway/config/Default.java | 2 +- .../impl/DefaultConfigurationInjector.java | 4 +- .../knox/gateway/config/AdapterSampleTest.java | 2 +- .../knox/gateway/util/urltemplate/Parser.java | 16 +- .../gateway/util/urltemplate/SegmentTest.java | 13 +- 275 files changed, 12620 insertions(+), 12815 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/knox/blob/6736393d/build-tools/src/main/resources/build-tools/checkstyle/checker.xml ---------------------------------------------------------------------- diff --git a/build-tools/src/main/resources/build-tools/checkstyle/checker.xml b/build-tools/src/main/resources/build-tools/checkstyle/checker.xml index d3d4b5f..268259d 100644 --- a/build-tools/src/main/resources/build-tools/checkstyle/checker.xml +++ b/build-tools/src/main/resources/build-tools/checkstyle/checker.xml @@ -95,5 +95,14 @@ limitations under the License. </module> <module name="IllegalImport"/> <module name="AvoidStarImport"/> + + <module name="UpperEll"/> + <module name="ModifierOrder"/> + <module name="RedundantModifier"/> + <module name="Regexp"> + <property name="format" value="[ \t]+$"/> + <property name="illegalPattern" value="true"/> + <property name="message" value="Trailing whitespace"/> + </module> </module> </module> http://git-wip-us.apache.org/repos/asf/knox/blob/6736393d/gateway-applications/src/main/resources/applications/admin-ui/app/assets/vkbeautify.js ---------------------------------------------------------------------- diff --git a/gateway-applications/src/main/resources/applications/admin-ui/app/assets/vkbeautify.js b/gateway-applications/src/main/resources/applications/admin-ui/app/assets/vkbeautify.js index 076c3d5..383f3f3 100644 --- a/gateway-applications/src/main/resources/applications/admin-ui/app/assets/vkbeautify.js +++ b/gateway-applications/src/main/resources/applications/admin-ui/app/assets/vkbeautify.js @@ -48,307 +48,307 @@ function createShiftArr(step) { - var space = ' '; - - if ( isNaN(parseInt(step)) ) { // argument is string - space = step; - } else { // argument is integer - switch(step) { - case 1: space = ' '; break; - case 2: space = ' '; break; - case 3: space = ' '; break; - case 4: space = ' '; break; - case 5: space = ' '; break; - case 6: space = ' '; break; - case 7: space = ' '; break; - case 8: space = ' '; break; - case 9: space = ' '; break; - case 10: space = ' '; break; - case 11: space = ' '; break; - case 12: space = ' '; break; - } - } - - var shift = ['\n']; // array of shifts - for(ix=0;ix<100;ix++){ - shift.push(shift[ix]+space); - } - return shift; + var space = ' '; + + if ( isNaN(parseInt(step)) ) { // argument is string + space = step; + } else { // argument is integer + switch(step) { + case 1: space = ' '; break; + case 2: space = ' '; break; + case 3: space = ' '; break; + case 4: space = ' '; break; + case 5: space = ' '; break; + case 6: space = ' '; break; + case 7: space = ' '; break; + case 8: space = ' '; break; + case 9: space = ' '; break; + case 10: space = ' '; break; + case 11: space = ' '; break; + case 12: space = ' '; break; + } + } + + var shift = ['\n']; // array of shifts + for(ix=0;ix<100;ix++){ + shift.push(shift[ix]+space); + } + return shift; } function vkbeautify(){ - this.step = '\t'; // 4 spaces - this.shift = createShiftArr(this.step); + this.step = '\t'; // 4 spaces + this.shift = createShiftArr(this.step); }; vkbeautify.prototype.xml = function(text,step) { - var ar = text.replace(/>\s{0,}</g,"><") - .replace(/</g,"~::~<") - .replace(/\s*xmlns\:/g,"~::~xmlns:") - .replace(/\s*xmlns\=/g,"~::~xmlns=") - .split('~::~'), - len = ar.length, - inComment = false, - deep = 0, - str = '', - ix = 0, - shift = step ? createShiftArr(step) : this.shift; - - for(ix=0;ix<len;ix++) { - // start comment or <![CDATA[...]]> or <!DOCTYPE // - if(ar[ix].search(/<!/) > -1) { - str += shift[deep]+ar[ix]; - inComment = true; - // end comment or <![CDATA[...]]> // - if(ar[ix].search(/-->/) > -1 || ar[ix].search(/\]>/) > -1 || ar[ix].search(/!DOCTYPE/) > -1 ) { - inComment = false; - } - } else - // end comment or <![CDATA[...]]> // - if(ar[ix].search(/-->/) > -1 || ar[ix].search(/\]>/) > -1) { - str += ar[ix]; - inComment = false; - } else - // <elm></elm> // - if( /^<\w/.exec(ar[ix-1]) && /^<\/\w/.exec(ar[ix]) && - /^<[\w:\-\.\,]+/.exec(ar[ix-1]) == /^<\/[\w:\-\.\,]+/.exec(ar[ix])[0].replace('/','')) { - str += ar[ix]; - if(!inComment) deep--; - } else - // <elm> // - if(ar[ix].search(/<\w/) > -1 && ar[ix].search(/<\//) == -1 && ar[ix].search(/\/>/) == -1 ) { - str = !inComment ? str += shift[deep++]+ar[ix] : str += ar[ix]; - } else - // <elm>...</elm> // - if(ar[ix].search(/<\w/) > -1 && ar[ix].search(/<\//) > -1) { - str = !inComment ? str += shift[deep]+ar[ix] : str += ar[ix]; - } else - // </elm> // - if(ar[ix].search(/<\//) > -1) { - str = !inComment ? str += shift[--deep]+ar[ix] : str += ar[ix]; - } else - // <elm/> // - if(ar[ix].search(/\/>/) > -1 ) { - str = !inComment ? str += shift[deep]+ar[ix] : str += ar[ix]; - } else - // <? xml ... ?> // - if(ar[ix].search(/<\?/) > -1) { - str += shift[deep]+ar[ix]; - } else - // xmlns // - if( ar[ix].search(/xmlns\:/) > -1 || ar[ix].search(/xmlns\=/) > -1) { - str += shift[deep]+ar[ix]; - } - - else { - str += ar[ix]; - } - } - - return (str[0] == '\n') ? str.slice(1) : str; + var ar = text.replace(/>\s{0,}</g,"><") + .replace(/</g,"~::~<") + .replace(/\s*xmlns\:/g,"~::~xmlns:") + .replace(/\s*xmlns\=/g,"~::~xmlns=") + .split('~::~'), + len = ar.length, + inComment = false, + deep = 0, + str = '', + ix = 0, + shift = step ? createShiftArr(step) : this.shift; + + for(ix=0;ix<len;ix++) { + // start comment or <![CDATA[...]]> or <!DOCTYPE // + if(ar[ix].search(/<!/) > -1) { + str += shift[deep]+ar[ix]; + inComment = true; + // end comment or <![CDATA[...]]> // + if(ar[ix].search(/-->/) > -1 || ar[ix].search(/\]>/) > -1 || ar[ix].search(/!DOCTYPE/) > -1 ) { + inComment = false; + } + } else + // end comment or <![CDATA[...]]> // + if(ar[ix].search(/-->/) > -1 || ar[ix].search(/\]>/) > -1) { + str += ar[ix]; + inComment = false; + } else + // <elm></elm> // + if( /^<\w/.exec(ar[ix-1]) && /^<\/\w/.exec(ar[ix]) && + /^<[\w:\-\.\,]+/.exec(ar[ix-1]) == /^<\/[\w:\-\.\,]+/.exec(ar[ix])[0].replace('/','')) { + str += ar[ix]; + if(!inComment) deep--; + } else + // <elm> // + if(ar[ix].search(/<\w/) > -1 && ar[ix].search(/<\//) == -1 && ar[ix].search(/\/>/) == -1 ) { + str = !inComment ? str += shift[deep++]+ar[ix] : str += ar[ix]; + } else + // <elm>...</elm> // + if(ar[ix].search(/<\w/) > -1 && ar[ix].search(/<\//) > -1) { + str = !inComment ? str += shift[deep]+ar[ix] : str += ar[ix]; + } else + // </elm> // + if(ar[ix].search(/<\//) > -1) { + str = !inComment ? str += shift[--deep]+ar[ix] : str += ar[ix]; + } else + // <elm/> // + if(ar[ix].search(/\/>/) > -1 ) { + str = !inComment ? str += shift[deep]+ar[ix] : str += ar[ix]; + } else + // <? xml ... ?> // + if(ar[ix].search(/<\?/) > -1) { + str += shift[deep]+ar[ix]; + } else + // xmlns // + if( ar[ix].search(/xmlns\:/) > -1 || ar[ix].search(/xmlns\=/) > -1) { + str += shift[deep]+ar[ix]; + } + + else { + str += ar[ix]; + } + } + + return (str[0] == '\n') ? str.slice(1) : str; } vkbeautify.prototype.json = function(text,step) { - var step = step ? step : this.step; - - if (typeof JSON === 'undefined' ) return text; - - if ( typeof text === "string" ) return JSON.stringify(JSON.parse(text), null, step); - if ( typeof text === "object" ) return JSON.stringify(text, null, step); - - return text; // text is not string nor object + var step = step ? step : this.step; + + if (typeof JSON === 'undefined' ) return text; + + if ( typeof text === "string" ) return JSON.stringify(JSON.parse(text), null, step); + if ( typeof text === "object" ) return JSON.stringify(text, null, step); + + return text; // text is not string nor object } vkbeautify.prototype.css = function(text, step) { - var ar = text.replace(/\s{1,}/g,' ') - .replace(/\{/g,"{~::~") - .replace(/\}/g,"~::~}~::~") - .replace(/\;/g,";~::~") - .replace(/\/\*/g,"~::~/*") - .replace(/\*\//g,"*/~::~") - .replace(/~::~\s{0,}~::~/g,"~::~") - .split('~::~'), - len = ar.length, - deep = 0, - str = '', - ix = 0, - shift = step ? createShiftArr(step) : this.shift; - - for(ix=0;ix<len;ix++) { - - if( /\{/.exec(ar[ix])) { - str += shift[deep++]+ar[ix]; - } else - if( /\}/.exec(ar[ix])) { - str += shift[--deep]+ar[ix]; - } else - if( /\*\\/.exec(ar[ix])) { - str += shift[deep]+ar[ix]; - } - else { - str += shift[deep]+ar[ix]; - } - } - return str.replace(/^\n{1,}/,''); + var ar = text.replace(/\s{1,}/g,' ') + .replace(/\{/g,"{~::~") + .replace(/\}/g,"~::~}~::~") + .replace(/\;/g,";~::~") + .replace(/\/\*/g,"~::~/*") + .replace(/\*\//g,"*/~::~") + .replace(/~::~\s{0,}~::~/g,"~::~") + .split('~::~'), + len = ar.length, + deep = 0, + str = '', + ix = 0, + shift = step ? createShiftArr(step) : this.shift; + + for(ix=0;ix<len;ix++) { + + if( /\{/.exec(ar[ix])) { + str += shift[deep++]+ar[ix]; + } else + if( /\}/.exec(ar[ix])) { + str += shift[--deep]+ar[ix]; + } else + if( /\*\\/.exec(ar[ix])) { + str += shift[deep]+ar[ix]; + } + else { + str += shift[deep]+ar[ix]; + } + } + return str.replace(/^\n{1,}/,''); } //---------------------------------------------------------------------------- function isSubquery(str, parenthesisLevel) { - return parenthesisLevel - (str.replace(/\(/g,'').length - str.replace(/\)/g,'').length ) + return parenthesisLevel - (str.replace(/\(/g,'').length - str.replace(/\)/g,'').length ) } function split_sql(str, tab) { - return str.replace(/\s{1,}/g," ") - - .replace(/ AND /ig,"~::~"+tab+tab+"AND ") - .replace(/ BETWEEN /ig,"~::~"+tab+"BETWEEN ") - .replace(/ CASE /ig,"~::~"+tab+"CASE ") - .replace(/ ELSE /ig,"~::~"+tab+"ELSE ") - .replace(/ END /ig,"~::~"+tab+"END ") - .replace(/ FROM /ig,"~::~FROM ") - .replace(/ GROUP\s{1,}BY/ig,"~::~GROUP BY ") - .replace(/ HAVING /ig,"~::~HAVING ") - //.replace(/ SET /ig," SET~::~") - .replace(/ IN /ig," IN ") - - .replace(/ JOIN /ig,"~::~JOIN ") - .replace(/ CROSS~::~{1,}JOIN /ig,"~::~CROSS JOIN ") - .replace(/ INNER~::~{1,}JOIN /ig,"~::~INNER JOIN ") - .replace(/ LEFT~::~{1,}JOIN /ig,"~::~LEFT JOIN ") - .replace(/ RIGHT~::~{1,}JOIN /ig,"~::~RIGHT JOIN ") - - .replace(/ ON /ig,"~::~"+tab+"ON ") - .replace(/ OR /ig,"~::~"+tab+tab+"OR ") - .replace(/ ORDER\s{1,}BY/ig,"~::~ORDER BY ") - .replace(/ OVER /ig,"~::~"+tab+"OVER ") - - .replace(/\(\s{0,}SELECT /ig,"~::~(SELECT ") - .replace(/\)\s{0,}SELECT /ig,")~::~SELECT ") - - .replace(/ THEN /ig," THEN~::~"+tab+"") - .replace(/ UNION /ig,"~::~UNION~::~") - .replace(/ USING /ig,"~::~USING ") - .replace(/ WHEN /ig,"~::~"+tab+"WHEN ") - .replace(/ WHERE /ig,"~::~WHERE ") - .replace(/ WITH /ig,"~::~WITH ") - - //.replace(/\,\s{0,}\(/ig,",~::~( ") - //.replace(/\,/ig,",~::~"+tab+tab+"") - - .replace(/ ALL /ig," ALL ") - .replace(/ AS /ig," AS ") - .replace(/ ASC /ig," ASC ") - .replace(/ DESC /ig," DESC ") - .replace(/ DISTINCT /ig," DISTINCT ") - .replace(/ EXISTS /ig," EXISTS ") - .replace(/ NOT /ig," NOT ") - .replace(/ NULL /ig," NULL ") - .replace(/ LIKE /ig," LIKE ") - .replace(/\s{0,}SELECT /ig,"SELECT ") - .replace(/\s{0,}UPDATE /ig,"UPDATE ") - .replace(/ SET /ig," SET ") - - .replace(/~::~{1,}/g,"~::~") - .split('~::~'); + return str.replace(/\s{1,}/g," ") + + .replace(/ AND /ig,"~::~"+tab+tab+"AND ") + .replace(/ BETWEEN /ig,"~::~"+tab+"BETWEEN ") + .replace(/ CASE /ig,"~::~"+tab+"CASE ") + .replace(/ ELSE /ig,"~::~"+tab+"ELSE ") + .replace(/ END /ig,"~::~"+tab+"END ") + .replace(/ FROM /ig,"~::~FROM ") + .replace(/ GROUP\s{1,}BY/ig,"~::~GROUP BY ") + .replace(/ HAVING /ig,"~::~HAVING ") + //.replace(/ SET /ig," SET~::~") + .replace(/ IN /ig," IN ") + + .replace(/ JOIN /ig,"~::~JOIN ") + .replace(/ CROSS~::~{1,}JOIN /ig,"~::~CROSS JOIN ") + .replace(/ INNER~::~{1,}JOIN /ig,"~::~INNER JOIN ") + .replace(/ LEFT~::~{1,}JOIN /ig,"~::~LEFT JOIN ") + .replace(/ RIGHT~::~{1,}JOIN /ig,"~::~RIGHT JOIN ") + + .replace(/ ON /ig,"~::~"+tab+"ON ") + .replace(/ OR /ig,"~::~"+tab+tab+"OR ") + .replace(/ ORDER\s{1,}BY/ig,"~::~ORDER BY ") + .replace(/ OVER /ig,"~::~"+tab+"OVER ") + + .replace(/\(\s{0,}SELECT /ig,"~::~(SELECT ") + .replace(/\)\s{0,}SELECT /ig,")~::~SELECT ") + + .replace(/ THEN /ig," THEN~::~"+tab+"") + .replace(/ UNION /ig,"~::~UNION~::~") + .replace(/ USING /ig,"~::~USING ") + .replace(/ WHEN /ig,"~::~"+tab+"WHEN ") + .replace(/ WHERE /ig,"~::~WHERE ") + .replace(/ WITH /ig,"~::~WITH ") + + //.replace(/\,\s{0,}\(/ig,",~::~( ") + //.replace(/\,/ig,",~::~"+tab+tab+"") + + .replace(/ ALL /ig," ALL ") + .replace(/ AS /ig," AS ") + .replace(/ ASC /ig," ASC ") + .replace(/ DESC /ig," DESC ") + .replace(/ DISTINCT /ig," DISTINCT ") + .replace(/ EXISTS /ig," EXISTS ") + .replace(/ NOT /ig," NOT ") + .replace(/ NULL /ig," NULL ") + .replace(/ LIKE /ig," LIKE ") + .replace(/\s{0,}SELECT /ig,"SELECT ") + .replace(/\s{0,}UPDATE /ig,"UPDATE ") + .replace(/ SET /ig," SET ") + + .replace(/~::~{1,}/g,"~::~") + .split('~::~'); } vkbeautify.prototype.sql = function(text,step) { - var ar_by_quote = text.replace(/\s{1,}/g," ") - .replace(/\'/ig,"~::~\'") - .split('~::~'), - len = ar_by_quote.length, - ar = [], - deep = 0, - tab = this.step,//+this.step, - inComment = true, - inQuote = false, - parenthesisLevel = 0, - str = '', - ix = 0, - shift = step ? createShiftArr(step) : this.shift;; - - for(ix=0;ix<len;ix++) { - if(ix%2) { - ar = ar.concat(ar_by_quote[ix]); - } else { - ar = ar.concat(split_sql(ar_by_quote[ix], tab) ); - } - } - - len = ar.length; - for(ix=0;ix<len;ix++) { - - parenthesisLevel = isSubquery(ar[ix], parenthesisLevel); - - if( /\s{0,}\s{0,}SELECT\s{0,}/.exec(ar[ix])) { - ar[ix] = ar[ix].replace(/\,/g,",\n"+tab+tab+"") - } - - if( /\s{0,}\s{0,}SET\s{0,}/.exec(ar[ix])) { - ar[ix] = ar[ix].replace(/\,/g,",\n"+tab+tab+"") - } - - if( /\s{0,}\(\s{0,}SELECT\s{0,}/.exec(ar[ix])) { - deep++; - str += shift[deep]+ar[ix]; - } else - if( /\'/.exec(ar[ix]) ) { - if(parenthesisLevel<1 && deep) { - deep--; - } - str += ar[ix]; - } - else { - str += shift[deep]+ar[ix]; - if(parenthesisLevel<1 && deep) { - deep--; - } - } - var junk = 0; - } - - str = str.replace(/^\n{1,}/,'').replace(/\n{1,}/g,"\n"); - return str; + var ar_by_quote = text.replace(/\s{1,}/g," ") + .replace(/\'/ig,"~::~\'") + .split('~::~'), + len = ar_by_quote.length, + ar = [], + deep = 0, + tab = this.step,//+this.step, + inComment = true, + inQuote = false, + parenthesisLevel = 0, + str = '', + ix = 0, + shift = step ? createShiftArr(step) : this.shift;; + + for(ix=0;ix<len;ix++) { + if(ix%2) { + ar = ar.concat(ar_by_quote[ix]); + } else { + ar = ar.concat(split_sql(ar_by_quote[ix], tab) ); + } + } + + len = ar.length; + for(ix=0;ix<len;ix++) { + + parenthesisLevel = isSubquery(ar[ix], parenthesisLevel); + + if( /\s{0,}\s{0,}SELECT\s{0,}/.exec(ar[ix])) { + ar[ix] = ar[ix].replace(/\,/g,",\n"+tab+tab+"") + } + + if( /\s{0,}\s{0,}SET\s{0,}/.exec(ar[ix])) { + ar[ix] = ar[ix].replace(/\,/g,",\n"+tab+tab+"") + } + + if( /\s{0,}\(\s{0,}SELECT\s{0,}/.exec(ar[ix])) { + deep++; + str += shift[deep]+ar[ix]; + } else + if( /\'/.exec(ar[ix]) ) { + if(parenthesisLevel<1 && deep) { + deep--; + } + str += ar[ix]; + } + else { + str += shift[deep]+ar[ix]; + if(parenthesisLevel<1 && deep) { + deep--; + } + } + var junk = 0; + } + + str = str.replace(/^\n{1,}/,'').replace(/\n{1,}/g,"\n"); + return str; } vkbeautify.prototype.xmlmin = function(text, preserveComments) { - var str = preserveComments ? text - : text.replace(/\<![ \r\n\t]*(--([^\-]|[\r\n]|-[^\-])*--[ \r\n\t]*)\>/g,"") - .replace(/[ \r\n\t]{1,}xmlns/g, ' xmlns'); - return str.replace(/>\s{0,}</g,"><"); + var str = preserveComments ? text + : text.replace(/\<![ \r\n\t]*(--([^\-]|[\r\n]|-[^\-])*--[ \r\n\t]*)\>/g,"") + .replace(/[ \r\n\t]{1,}xmlns/g, ' xmlns'); + return str.replace(/>\s{0,}</g,"><"); } vkbeautify.prototype.jsonmin = function(text) { - if (typeof JSON === 'undefined' ) return text; - - return JSON.stringify(JSON.parse(text), null, 0); - + if (typeof JSON === 'undefined' ) return text; + + return JSON.stringify(JSON.parse(text), null, 0); + } vkbeautify.prototype.cssmin = function(text, preserveComments) { - - var str = preserveComments ? text - : text.replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+\//g,"") ; - - return str.replace(/\s{1,}/g,' ') - .replace(/\{\s{1,}/g,"{") - .replace(/\}\s{1,}/g,"}") - .replace(/\;\s{1,}/g,";") - .replace(/\/\*\s{1,}/g,"/*") - .replace(/\*\/\s{1,}/g,"*/"); + + var str = preserveComments ? text + : text.replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+\//g,"") ; + + return str.replace(/\s{1,}/g,' ') + .replace(/\{\s{1,}/g,"{") + .replace(/\}\s{1,}/g,"}") + .replace(/\;\s{1,}/g,";") + .replace(/\/\*\s{1,}/g,"/*") + .replace(/\*\/\s{1,}/g,"*/"); } vkbeautify.prototype.sqlmin = function(text) { - return text.replace(/\s{1,}/g," ").replace(/\s{1,}\(/,"(").replace(/\s{1,}\)/,")"); + return text.replace(/\s{1,}/g," ").replace(/\s{1,}\(/,"(").replace(/\s{1,}\)/,")"); } window.vkbeautify = new vkbeautify(); http://git-wip-us.apache.org/repos/asf/knox/blob/6736393d/gateway-applications/src/main/resources/applications/knoxauth/app/libs/bower/jquery/js/jquery.js ---------------------------------------------------------------------- diff --git a/gateway-applications/src/main/resources/applications/knoxauth/app/libs/bower/jquery/js/jquery.js b/gateway-applications/src/main/resources/applications/knoxauth/app/libs/bower/jquery/js/jquery.js index 2a702b0..e6c1903 100644 --- a/gateway-applications/src/main/resources/applications/knoxauth/app/libs/bower/jquery/js/jquery.js +++ b/gateway-applications/src/main/resources/applications/knoxauth/app/libs/bower/jquery/js/jquery.js @@ -848,8 +848,8 @@ function Sizzle( selector, context, results, seed ) { /** * Create key-value caches of limited size * @returns {function(string, object)} Returns the Object data after storing it on itself with - * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) - * deleting the oldest entry + * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) + * deleting the oldest entry */ function createCache() { var keys = []; @@ -3203,23 +3203,24 @@ function createOptions( options ) { /* * Create a callback list using the following parameters: * - * options: an optional list of space-separated options that will change how - * the callback list behaves or a more traditional option object + * options: an optional list of space-separated options that will change how + * the callback list behaves or a more traditional option object * * By default a callback list will act like an event callback list and can be * "fired" multiple times. * * Possible options: * - * once: will ensure the callback list can only be fired once (like a Deferred) * - * memory: will keep track of previous values and will call any callback added - * after the list has been fired right away with the latest "memorized" - * values (like a Deferred) + * once: will ensure the callback list can only be fired once (like a Deferred) * - * unique: will ensure a callback can only be added once (no duplicate in the list) + * memory: will keep track of previous values and will call any callback added + * after the list has been fired right away with the latest "memorized" + * values (like a Deferred) * - * stopOnFalse: interrupt callings when a callback returns false + * unique: will ensure a callback can only be added once (no duplicate in the list) + * + * stopOnFalse: interrupt callings when a callback returns false * */ jQuery.Callbacks = function( options ) { @@ -4157,15 +4158,15 @@ var dataUser = new Data(); -// Implementation Summary +// Implementation Summary // -// 1. Enforce API surface and semantic compatibility with 1.9.x branch -// 2. Improve the module's maintainability by reducing the storage -// paths to a single mechanism. -// 3. Use the same single mechanism to support "private" and "user" data. -// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) -// 5. Avoid exposing implementation details on user objects (eg. expando properties) -// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 +// 1. Enforce API surface and semantic compatibility with 1.9.x branch +// 2. Improve the module's maintainability by reducing the storage +// paths to a single mechanism. +// 3. Use the same single mechanism to support "private" and "user" data. +// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) +// 5. Avoid exposing implementation details on user objects (eg. expando properties) +// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, rmultiDash = /[A-Z]/g; http://git-wip-us.apache.org/repos/asf/knox/blob/6736393d/gateway-applications/src/main/resources/applications/knoxauth/app/login.html ---------------------------------------------------------------------- diff --git a/gateway-applications/src/main/resources/applications/knoxauth/app/login.html b/gateway-applications/src/main/resources/applications/knoxauth/app/login.html index 427fdf0..64fa16c 100644 --- a/gateway-applications/src/main/resources/applications/knoxauth/app/login.html +++ b/gateway-applications/src/main/resources/applications/knoxauth/app/login.html @@ -18,59 +18,59 @@ <!--[if IE 8]><html class="no-js lt-ie9"><![endif]--> <!--[if gt IE 8]><!--> <html class="no-js"> - <!--<![endif]--> - <head> - <meta charset="utf-8"> - <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> - <title>KnoxSSO - Sign In</title> - <meta name="description" content=""> - <meta name="viewport" content="width=device-width"> - - <link rel="shortcut icon" href="images/favicon.ico"> - <link href="styles/bootstrap.min.css" media="all" rel="stylesheet" type="text/css" id="bootstrap-css"> - <link href="styles/knox.css" media="all" rel="stylesheet" type="text/css" > + <!--<![endif]--> + <head> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> + <title>KnoxSSO - Sign In</title> + <meta name="description" content=""> + <meta name="viewport" content="width=device-width"> - <script src="libs/bower/jquery/js/jquery.js" ></script> + <link rel="shortcut icon" href="images/favicon.ico"> + <link href="styles/bootstrap.min.css" media="all" rel="stylesheet" type="text/css" id="bootstrap-css"> + <link href="styles/knox.css" media="all" rel="stylesheet" type="text/css" > + + <script src="libs/bower/jquery/js/jquery.js" ></script> <script type="text/javascript" src="js/knoxauth.js"></script> - <script type="text/javascript"> + <script type="text/javascript"> $(function() { - var updateBoxPosition = function() { - $('#signin-container').css({ - 'margin-top' : ($(window).height() - $('#signin-container').height()) / 2 - }); - }; - $(window).resize(updateBoxPosition); - setTimeout(updateBoxPosition, 50); - }); - </script> + var updateBoxPosition = function() { + $('#signin-container').css({ + 'margin-top' : ($(window).height() - $('#signin-container').height()) / 2 + }); + }; + $(window).resize(updateBoxPosition); + setTimeout(updateBoxPosition, 50); + }); + </script> - </head> - <body class="login" style=""> - <!-- Page content - ================================================== --> - <section id="signin-container" style="margin-top: 4.5px;"> - <div class="l-logo"> - <img src="images/knox-logo.gif" alt="Knox logo"> - </div> - <form action="" method="post" accept-charset="utf-8"> - <fieldset> - <div class="fields"> - <label><i class="icon-user"></i> Username:</label> - <input type="text" name="username" id="username" tabindex="1" onkeypress=keypressed(event) autofocus> - <label><i class="icon-lock"></i> Password:</label> - <input type="password" name="password" id="password" tabindex="2" autocomplete="off" onkeypress=keypressed(event)> - </div> - <span id="errorBox" class="help-inline" style="color:white;display:none;"><span class="errorMsg"></span> - <i class="icon-warning-sign" style="color:#ae2817;"></i> - </span> - <button type="button" class="btn btn-primary btn-block" id="signIn" tabindex="4" onkeypress="keypressed(event)" onclick="login();"> - Sign In - <i id="signInLoading" class="icon-spinner icon-spin pull-right icon-sign-in"></i> - </button> - </fieldset> - </form> - </section> + </head> + <body class="login" style=""> + <!-- Page content + ================================================== --> + <section id="signin-container" style="margin-top: 4.5px;"> + <div class="l-logo"> + <img src="images/knox-logo.gif" alt="Knox logo"> + </div> + <form action="" method="post" accept-charset="utf-8"> + <fieldset> + <div class="fields"> + <label><i class="icon-user"></i> Username:</label> + <input type="text" name="username" id="username" tabindex="1" onkeypress=keypressed(event) autofocus> + <label><i class="icon-lock"></i> Password:</label> + <input type="password" name="password" id="password" tabindex="2" autocomplete="off" onkeypress=keypressed(event)> + </div> + <span id="errorBox" class="help-inline" style="color:white;display:none;"><span class="errorMsg"></span> + <i class="icon-warning-sign" style="color:#ae2817;"></i> + </span> + <button type="button" class="btn btn-primary btn-block" id="signIn" tabindex="4" onkeypress="keypressed(event)" onclick="login();"> + Sign In + <i id="signInLoading" class="icon-spinner icon-spin pull-right icon-sign-in"></i> + </button> + </fieldset> + </form> + </section> - </body> + </body> </html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/knox/blob/6736393d/gateway-applications/src/main/resources/applications/knoxauth/app/redirecting.html ---------------------------------------------------------------------- diff --git a/gateway-applications/src/main/resources/applications/knoxauth/app/redirecting.html b/gateway-applications/src/main/resources/applications/knoxauth/app/redirecting.html index 64ad5e6..3e55a4e 100644 --- a/gateway-applications/src/main/resources/applications/knoxauth/app/redirecting.html +++ b/gateway-applications/src/main/resources/applications/knoxauth/app/redirecting.html @@ -18,18 +18,18 @@ <!--[if IE 8]><html class="no-js lt-ie9"><![endif]--> <!--[if gt IE 8]><!--> <html class="no-js"> - <!--<![endif]--> - <head> - <meta charset="utf-8"> - <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> + <!--<![endif]--> + <head> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title>Apache KnoxSSO Redirect</title> - <meta name="description" content=""> - <meta name="viewport" content="width=device-width"> - <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> + <meta name="description" content=""> + <meta name="viewport" content="width=device-width"> + <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> - <link rel="shortcut icon" href="images/favicon.ico"> - <link href="styles/bootstrap.min.css" media="all" rel="stylesheet" type="text/css" id="bootstrap-css"> - <link href="styles/knox.css" media="all" rel="stylesheet" type="text/css" > + <link rel="shortcut icon" href="images/favicon.ico"> + <link href="styles/bootstrap.min.css" media="all" rel="stylesheet" type="text/css" id="bootstrap-css"> + <link href="styles/knox.css" media="all" rel="stylesheet" type="text/css" > <script> document.addEventListener("load", redirectOnLoad()); @@ -41,13 +41,13 @@ </head> <body> - <section id="signin-container" style="margin-top: 80px;"> + <section id="signin-container" style="margin-top: 80px;"> <div style="background: gray;text-color: white;text-align:center;"> <h1 style="color: white;">Redirecting...</h1> <div style="background: white;" class="l-logo"> - <img src="images/loading.gif" alt="Knox logo" style="text-align:center;width: 2%; height: 2%"> - </div> - </div> + <img src="images/loading.gif" alt="Knox logo" style="text-align:center;width: 2%; height: 2%"> + </div> + </div> </section> </body> </html> http://git-wip-us.apache.org/repos/asf/knox/blob/6736393d/gateway-applications/src/main/resources/applications/knoxauth/app/redirecting.jsp ---------------------------------------------------------------------- diff --git a/gateway-applications/src/main/resources/applications/knoxauth/app/redirecting.jsp b/gateway-applications/src/main/resources/applications/knoxauth/app/redirecting.jsp index 193c69a..05ed96e 100644 --- a/gateway-applications/src/main/resources/applications/knoxauth/app/redirecting.jsp +++ b/gateway-applications/src/main/resources/applications/knoxauth/app/redirecting.jsp @@ -25,25 +25,25 @@ <!--[if IE 8]><html class="no-js lt-ie9"><![endif]--> <!--[if gt IE 8]><!--> <html class="no-js"> - <!--<![endif]--> - <head> - <meta charset="utf-8"> - <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> - <meta name="description" content=""> - <meta name="viewport" content="width=device-width"> - <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> + <!--<![endif]--> + <head> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> + <meta name="description" content=""> + <meta name="viewport" content="width=device-width"> + <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> - <link rel="shortcut icon" href="images/favicon.ico"> - <link href="styles/bootstrap.min.css" media="all" rel="stylesheet" type="text/css" id="bootstrap-css"> - <link href="styles/knox.css" media="all" rel="stylesheet" type="text/css" > + <link rel="shortcut icon" href="images/favicon.ico"> + <link href="styles/bootstrap.min.css" media="all" rel="stylesheet" type="text/css" id="bootstrap-css"> + <link href="styles/knox.css" media="all" rel="stylesheet" type="text/css" > <script src="libs/bower/jquery/js/jquery.js" ></script> <script type="text/javascript" src="js/knoxauth.js"></script> - <% + <% Topology topology = (Topology)request.getSession().getServletContext().getAttribute("org.apache.knox.gateway.topology"); String whitelist = null; - Collection services = topology.getServices(); + Collection services = topology.getServices(); for (Object service : services) { Service svc = (Service)service; if (svc.getRole().equals("KNOXSSO")) { @@ -59,45 +59,45 @@ } boolean validRedirect = RegExUtils.checkWhitelist(whitelist, request.getParameter("originalUrl")); if (validRedirect) { - %> + %> <script> document.addEventListener("load", redirectOnLoad()); function redirectOnLoad() { var originalUrl = get("originalUrl"); if (originalUrl != null) { - redirect(originalUrl); + redirect(originalUrl); } } </script> - <% + <% } - %> + %> </head> <body> - <section id="signin-container" style="margin-top: 80px;"> - <% + <section id="signin-container" style="margin-top: 80px;"> + <% if (validRedirect) { - %> + %> <div style="background: gray;text-color: white;text-align:center;"> <h1 style="color: white;">Loading...</h1> <div style="background: white;" class="l-logo"> - <img src="images/loading.gif" alt="Knox logo" style="text-align:center;width: 2%; height: 2%"> - </div> - <p style="color: white;display: block">Loading should complete in few a seconds. If not, click <a href="#" onclick='redirect(get("originalUrl"));' >here</a></p> - <% + <img src="images/loading.gif" alt="Knox logo" style="text-align:center;width: 2%; height: 2%"> + </div> + <p style="color: white;display: block">Loading should complete in few a seconds. If not, click <a href="#" onclick='redirect(get("originalUrl"));' >here</a></p> + <% } else { - %> + %> <div style="background: gray;text-color: white;text-align:center;"> <h1 style="color: red;">ERROR</h1> <div style="background: white;" class="l-logo"> - </div> - <p style="color: white;display: block">Invalid Redirect: Possible Phishing Attempt</p> - <% + </div> + <p style="color: white;display: block">Invalid Redirect: Possible Phishing Attempt</p> + <% } - %> - </div> + %> + </div> </section> </body> </html> http://git-wip-us.apache.org/repos/asf/knox/blob/6736393d/gateway-applications/src/main/resources/applications/knoxauth/app/styles/knox.css ---------------------------------------------------------------------- diff --git a/gateway-applications/src/main/resources/applications/knoxauth/app/styles/knox.css b/gateway-applications/src/main/resources/applications/knoxauth/app/styles/knox.css index 80280db..2de4274 100644 --- a/gateway-applications/src/main/resources/applications/knoxauth/app/styles/knox.css +++ b/gateway-applications/src/main/resources/applications/knoxauth/app/styles/knox.css @@ -1674,131 +1674,131 @@ body.login { box-shadow: none; } .label-yellow{ - background-color: #f3a139; + background-color: #f3a139; } .label-inverse { background-color: #444444; } .alert { - border:none; + border:none; } tr.disable-policy td { - background-color: #F0F0F0; + background-color: #F0F0F0; } .policy-disabled .formHeader, .policy-disabled .control-label { - color:#aaa; + color:#aaa; } td.html-cell.renderable:last-child { - text-align:center; + text-align:center; } .policy-manager span.policy-title { - font-size: 20px; - line-height: 32px; - text-transform: uppercase; - color: #707070; + font-size: 20px; + line-height: 32px; + text-transform: uppercase; + color: #707070; } .policy-manager table thead tr th:first-child { - background-color: #d8d8d8; + background-color: #d8d8d8; } .policy-manager table thead tr th:first-child a { - color: #707070; + color: #707070; } .label-green{ - background-color: #3ea211; + background-color: #3ea211; } .connection-error-font { - font-size: 11px; - font-family: monospace; + font-size: 11px; + font-family: monospace; } /**************/ .policy-form .field-name{ - float: left; - margin-bottom: 0 !important; + float: left; + margin-bottom: 0 !important; } .policy-form .field-isEnabled{ margin-left: 413px; margin-bottom: 12px !important; } .policy-form .field-isEnabled .controls{ - margin-left:30px; + margin-left:30px; } .margin-bottom-5{ margin-bottom: 5px; } .popover-content { - /*overflow-y: auto; - max-height: 250px;*/ - padding-right: 25px; + /*overflow-y: auto; + max-height: 250px;*/ + padding-right: 25px; } .margin-bottom-57 { - margin-bottom:57px; + margin-bottom:57px; } .table .table { - width:auto; + width:auto; } .width-25{ - width:25%; + width:25%; } .margin-left-0{ - margin-left:0%!important; + margin-left:0%!important; } .policy-manager .row-fluid [class*="span"]:first-child { - margin-left: 1%; + margin-left: 1%; } .policy-manager .row-fluid [class*="span"] { - margin-left: 1%; - margin-right: 1%; + margin-left: 1%; + margin-right: 1%; } .policy-manager .row-fluid [class*="span"]:nth-child(3n+4) { - clear: both; + clear: both; } .field-isEnabled + div { clear:both; } .include-toggle{ - margin-left: 264px; - margin-top: -29px; + margin-left: 264px; + margin-top: -29px; } .recursive-toggle{ - margin-left: 363px; - margin-top: -20px; + margin-left: 363px; + margin-top: -20px; } .recursive-toggle-path { margin-left: 347px; margin-top: -29px; } .policy-form .help-inline { - position: relative; - top: 10px; + position: relative; + top: 10px; } .hideResource{ - display:none; + display:none; } .btn-mini { - padding: 0px 8px; - font-size: 11.05px; + padding: 0px 8px; + font-size: 11.05px; } .label-ranger { - background-color: #3C9C11; + background-color: #3C9C11; } .sameLevelDropdown{ - margin-right: 31px; - margin-left: -130px; - width: 100px; - height: 29px; - font-family: Tahoma; - font-size: 14px; - border-radius: 10px; - border: 2px #cccccc solid; + margin-right: 31px; + margin-left: -130px; + width: 100px; + height: 29px; + font-family: Tahoma; + font-size: 14px; + border-radius: 10px; + border: 2px #cccccc solid; } .margin-left-5{ - margin-left:5px; + margin-left:5px; } .tr-inactive { background-color: #F5F5F5; @@ -1816,24 +1816,24 @@ td.select-row-cell { text-align: center; } .ranger-notifications { - right: 33px!important; - top: 41px!important; + right: 33px!important; + top: 41px!important; }table.table-permission.visible-border tr td:last-child { border: 1px solid #dddddd; padding-left: 0; } .set-height-groups{ - width: 100%; - height: 100px; - overflow-x: hidden; + width: 100%; + height: 100px; + overflow-x: hidden; } .float-left-margin-2{ - float: left; - margin: 2px; + float: left; + margin: 2px; } #r_topNav .dropdown-menu { - margin:0; + margin:0; } .table-policy-condition th, @@ -1872,15 +1872,15 @@ input[type="radio"], input[type="checkbox"] {margin-top: 0;} margin-top: 6px; } .tag-fixed-popover { - top: 50px !important; - left: 55% !important; - margin-left: -350px !important; - max-width: 700px !important; - max-height: 500px; - overflow-y: auto; + top: 50px !important; + left: 55% !important; + margin-left: -350px !important; + max-width: 700px !important; + max-height: 500px; + overflow-y: auto; } .tag-fixed-popover-wrapper { - position: fixed !important; + position: fixed !important; top: 0 !important; bottom: 0 !important; right: 0 !important; @@ -1889,8 +1889,8 @@ input[type="radio"], input[type="checkbox"] {margin-top: 0;} background-color: rgba(0,0,0,0.5); } .table-policy-condition label { - font-size: 12px; - text-align: left; + font-size: 12px; + text-align: left; } .table-policy-condition tr[data-id=storm] td label { min-width: 170px; @@ -1900,7 +1900,7 @@ input[type="radio"], input[type="checkbox"] {margin-top: 0;} min-width: 170px; } */ .pause-play-close{ - margin-left: -5px; + margin-left: -5px; margin-top: -2px; font-size: 11px; } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/knox/blob/6736393d/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariServiceDiscoveryMessages.java ---------------------------------------------------------------------- diff --git a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariServiceDiscoveryMessages.java b/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariServiceDiscoveryMessages.java index f7f9d5a..88b8557 100644 --- a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariServiceDiscoveryMessages.java +++ b/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariServiceDiscoveryMessages.java @@ -26,18 +26,18 @@ public interface AmbariServiceDiscoveryMessages { @Message(level = MessageLevel.ERROR, text = "Failed to persist data for cluster configuration monitor {0} {1}: {2}") - void failedToPersistClusterMonitorData(final String monitor, - final String filename, + void failedToPersistClusterMonitorData(String monitor, + String filename, @StackTrace(level = MessageLevel.DEBUG) Exception e); @Message(level = MessageLevel.ERROR, text = "Failed to load persisted service discovery configuration for cluster monitor {0} : {1}") - void failedToLoadClusterMonitorServiceDiscoveryConfig(final String monitor, + void failedToLoadClusterMonitorServiceDiscoveryConfig(String monitor, @StackTrace(level = MessageLevel.DEBUG) Exception e); @Message(level = MessageLevel.ERROR, text = "Failed to load persisted cluster configuration version data for cluster monitor {0} : {1}") - void failedToLoadClusterMonitorConfigVersions(final String monitor, + void failedToLoadClusterMonitorConfigVersions(String monitor, @StackTrace(level = MessageLevel.DEBUG) Exception e); @Message(level = MessageLevel.ERROR, @@ -54,24 +54,24 @@ public interface AmbariServiceDiscoveryMessages { @Message(level = MessageLevel.ERROR, text = "Failed to load service discovery URL definition configuration {0}: {1}") - void failedToLoadServiceDiscoveryURLDefConfiguration(final String configuration, + void failedToLoadServiceDiscoveryURLDefConfiguration(String configuration, @StackTrace(level = MessageLevel.ERROR) Exception e); @Message(level = MessageLevel.ERROR, text = "Encountered an error during cluster ({0}) discovery: {1}") - void clusterDiscoveryError(final String clusterName, @StackTrace(level = MessageLevel.DEBUG) Exception e); + void clusterDiscoveryError(String clusterName, @StackTrace(level = MessageLevel.DEBUG) Exception e); @Message(level = MessageLevel.ERROR, text = "Failed to access the service configurations for cluster ({0}) discovery") - void failedToAccessServiceConfigs(final String clusterName); + void failedToAccessServiceConfigs(String clusterName); @Message(level = MessageLevel.ERROR, text = "REST invocation {0} timed out") - void restInvocationTimedOut(final String url, @StackTrace(level = MessageLevel.DEBUG) Exception e); + void restInvocationTimedOut(String url, @StackTrace(level = MessageLevel.DEBUG) Exception e); @Message(level = MessageLevel.ERROR, text = "REST invocation {0} failed: {1}") - void restInvocationError(final String url, @StackTrace(level = MessageLevel.ERROR) Exception e); + void restInvocationError(String url, @StackTrace(level = MessageLevel.ERROR) Exception e); @Message(level = MessageLevel.ERROR, text = "No address for Ambari service discovery has been configured.") @@ -83,92 +83,74 @@ public interface AmbariServiceDiscoveryMessages { @Message(level = MessageLevel.ERROR, text = "Encountered an error attempting to determine the value for alias {0} : {1}") - void aliasServiceError(final String alias, final String error); - + void aliasServiceError(String alias, String error); @Message(level = MessageLevel.ERROR, text = "Encountered an error attempting to determine the user for alias {0} : {1}") - void aliasServiceUserError(final String alias, final String error); - + void aliasServiceUserError(String alias, String error); @Message(level = MessageLevel.ERROR, text = "Encountered an error attempting to determine the password for alias {0} : {1}") - void aliasServicePasswordError(final String alias, final String error); - + void aliasServicePasswordError(String alias, String error); @Message(level = MessageLevel.ERROR, text = "No user configured for Ambari service discovery.") void aliasServiceUserNotFound(); - @Message(level = MessageLevel.ERROR, text = "No password configured for Ambari service discovery.") void aliasServicePasswordNotFound(); - @Message(level = MessageLevel.ERROR, text = "Unexpected REST invocation response code for {0} : {1}") - void unexpectedRestResponseStatusCode(final String url, int responseStatusCode); - + void unexpectedRestResponseStatusCode(String url, int responseStatusCode); @Message(level = MessageLevel.ERROR, text = "REST invocation {0} yielded a response without any JSON.") - void noJSON(final String url); - + void noJSON(String url); @Message(level = MessageLevel.TRACE, text = "REST invocation result: {0}") - void debugJSON(final String json); - + void debugJSON(String json); @Message(level = MessageLevel.DEBUG, text = "Loaded component configuration mappings: {0}") - void loadedComponentConfigMappings(final String mappings); - + void loadedComponentConfigMappings(String mappings); @Message(level = MessageLevel.ERROR, text = "Failed to load component configuration property mappings {0}: {1}") - void failedToLoadComponentConfigMappings(final String mappings, + void failedToLoadComponentConfigMappings(String mappings, @StackTrace(level = MessageLevel.DEBUG) Exception e); - @Message(level = MessageLevel.TRACE, text = "Discovered: Service: {0}, Host: {1}") - void discoveredServiceHost(final String serviceName, final String hostName); - + void discoveredServiceHost(String serviceName, String hostName); @Message(level = MessageLevel.DEBUG, text = "Querying the cluster for the {0} configuration ({1}) property: {2}") - void lookingUpServiceConfigProperty(final String serviceName, final String configType, final String propertyName); - + void lookingUpServiceConfigProperty(String serviceName, String configType, String propertyName); @Message(level = MessageLevel.DEBUG, text = "Querying the cluster for the {0} component configuration property: {1}") - void lookingUpComponentConfigProperty(final String componentName, final String propertyName); - + void lookingUpComponentConfigProperty(String componentName, String propertyName); @Message(level = MessageLevel.DEBUG, text = "Querying the cluster for the {0} component's hosts") - void lookingUpComponentHosts(final String componentName); - + void lookingUpComponentHosts(String componentName); @Message(level = MessageLevel.DEBUG, text = "Handling a derived service URL mapping property for the {0} service: type = {1}, name = {2}") - void handlingDerivedProperty(final String serviceName, final String propertyType, final String propertyName); - + void handlingDerivedProperty(String serviceName, String propertyType, String propertyName); @Message(level = MessageLevel.DEBUG, text = "Determined the service URL mapping property {0} value: {1}") - void determinedPropertyValue(final String propertyName, final String propertyValue); - + void determinedPropertyValue(String propertyName, String propertyValue); @Message(level = MessageLevel.INFO, text = "Started Ambari cluster configuration monitor (checking every {0} seconds)") - void startedAmbariConfigMonitor(final long pollingInterval); - + void startedAmbariConfigMonitor(long pollingInterval); @Message(level = MessageLevel.WARN, text = "The declared nameservice {0} is not defined in the HDFS configuration.") - void undefinedHDFSNameService(final String nameservice); - + void undefinedHDFSNameService(String nameservice); } http://git-wip-us.apache.org/repos/asf/knox/blob/6736393d/gateway-discovery-ambari/src/test/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariServiceDiscoveryTest.java ---------------------------------------------------------------------- diff --git a/gateway-discovery-ambari/src/test/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariServiceDiscoveryTest.java b/gateway-discovery-ambari/src/test/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariServiceDiscoveryTest.java index 4e6a261..6ce77d4 100644 --- a/gateway-discovery-ambari/src/test/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariServiceDiscoveryTest.java +++ b/gateway-discovery-ambari/src/test/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariServiceDiscoveryTest.java @@ -336,7 +336,7 @@ public class AmbariServiceDiscoveryTest { */ private static final class TestAmbariServiceDiscovery extends AmbariServiceDiscovery { - final static String CLUSTER_PLACEHOLDER = TestRESTInvoker.CLUSTER_PLACEHOLDER; + static final String CLUSTER_PLACEHOLDER = TestRESTInvoker.CLUSTER_PLACEHOLDER; TestAmbariServiceDiscovery(String clusterName) { super(new TestRESTInvoker(clusterName)); @@ -360,8 +360,7 @@ public class AmbariServiceDiscoveryTest { } private static final class TestRESTInvoker extends RESTInvoker { - - final static String CLUSTER_PLACEHOLDER = "CLUSTER_NAME"; + static final String CLUSTER_PLACEHOLDER = "CLUSTER_NAME"; private Map<String, JSONObject> cannedResponses = new HashMap<>(); http://git-wip-us.apache.org/repos/asf/knox/blob/6736393d/gateway-i18n-logging-log4j/src/main/java/org/apache/knox/gateway/i18n/messages/loggers/log4j/Log4jMessageLogger.java ---------------------------------------------------------------------- diff --git a/gateway-i18n-logging-log4j/src/main/java/org/apache/knox/gateway/i18n/messages/loggers/log4j/Log4jMessageLogger.java b/gateway-i18n-logging-log4j/src/main/java/org/apache/knox/gateway/i18n/messages/loggers/log4j/Log4jMessageLogger.java index 2e40471..c8b42dc 100644 --- a/gateway-i18n-logging-log4j/src/main/java/org/apache/knox/gateway/i18n/messages/loggers/log4j/Log4jMessageLogger.java +++ b/gateway-i18n-logging-log4j/src/main/java/org/apache/knox/gateway/i18n/messages/loggers/log4j/Log4jMessageLogger.java @@ -56,7 +56,7 @@ public class Log4jMessageLogger implements MessageLogger { logger.callAppenders( event ); } - private static final ThrowableInformation toThrownInformation( final Throwable thrown ) { + private static ThrowableInformation toThrownInformation( final Throwable thrown ) { ThrowableInformation info = null; if( thrown != null ) { info = new ThrowableInformation( thrown ); @@ -64,7 +64,7 @@ public class Log4jMessageLogger implements MessageLogger { return info; } - private static final LocationInfo toLocationInfo( final StackTraceElement caller ) { + private static LocationInfo toLocationInfo( final StackTraceElement caller ) { LocationInfo info = null; if( caller != null ) { info = new LocationInfo( caller.getFileName(), caller.getClassName(), caller.getMethodName(), Integer.toString(caller.getLineNumber()) ); @@ -72,7 +72,7 @@ public class Log4jMessageLogger implements MessageLogger { return info; } - private static final Level toLevel( final MessageLevel level ) { + private static Level toLevel( final MessageLevel level ) { switch( level ) { case FATAL: return Level.FATAL; case ERROR: return Level.ERROR; http://git-wip-us.apache.org/repos/asf/knox/blob/6736393d/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/Message.java ---------------------------------------------------------------------- diff --git a/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/Message.java b/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/Message.java index 89e4662..a628b61 100644 --- a/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/Message.java +++ b/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/Message.java @@ -25,8 +25,8 @@ import java.lang.annotation.Target; @Retention( RetentionPolicy.RUNTIME ) @Target( ElementType.METHOD ) public @interface Message { - static final String DEFAULT_TEXT = "{}"; - static final int DEFAULT_CODE = -1; + String DEFAULT_TEXT = "{}"; + int DEFAULT_CODE = -1; MessageLevel level() default MessageLevel.INFO; int code() default DEFAULT_CODE; String text() default DEFAULT_TEXT; http://git-wip-us.apache.org/repos/asf/knox/blob/6736393d/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/Messages.java ---------------------------------------------------------------------- diff --git a/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/Messages.java b/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/Messages.java index 6908146..8c8da1c 100644 --- a/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/Messages.java +++ b/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/Messages.java @@ -25,9 +25,9 @@ import java.lang.annotation.Target; @Retention( RetentionPolicy.RUNTIME ) @Target( ElementType.TYPE ) public @interface Messages { - static final String DEFAULT_BUNDLE = ""; - static final String DEFAULT_LOGGER = ""; - static final String DEFAULT_CODES = "{0}"; + String DEFAULT_BUNDLE = ""; + String DEFAULT_LOGGER = ""; + String DEFAULT_CODES = "{0}"; String bundle() default DEFAULT_BUNDLE; String logger() default DEFAULT_LOGGER; String codes() default DEFAULT_CODES; http://git-wip-us.apache.org/repos/asf/knox/blob/6736393d/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/MessagesInvoker.java ---------------------------------------------------------------------- diff --git a/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/MessagesInvoker.java b/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/MessagesInvoker.java index 77ddf25..62dae84 100644 --- a/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/MessagesInvoker.java +++ b/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/MessagesInvoker.java @@ -59,7 +59,7 @@ public class MessagesInvoker extends ResourcesInvoker implements InvocationHandl return message; } - private final String getCode( final Method method ) { + private String getCode( final Method method ) { String code = null; Message anno = method.getAnnotation( Message.class ); if( anno != null ) { @@ -72,7 +72,7 @@ public class MessagesInvoker extends ResourcesInvoker implements InvocationHandl return code; } - private static final StackTrace getStackTraceAnno( final Method method, final int param ) { + private static StackTrace getStackTraceAnno( final Method method, final int param ) { final Annotation[] annos = method.getParameterAnnotations()[ param ]; for( Annotation anno: annos ) { if( anno instanceof StackTrace ) { @@ -82,7 +82,7 @@ public class MessagesInvoker extends ResourcesInvoker implements InvocationHandl return null; } - private static final Throwable findLoggableThrowable( final MessageLogger logger, final Method method, final Object[] args ) { + private static Throwable findLoggableThrowable( final MessageLogger logger, final Method method, final Object[] args ) { Throwable throwable = null; if( args != null ) { for( int i=0; i<args.length; i++ ) { @@ -111,7 +111,7 @@ public class MessagesInvoker extends ResourcesInvoker implements InvocationHandl return pattern; } - private static final MessageLevel getLevel( final Method method ) { + private static MessageLevel getLevel( final Method method ) { MessageLevel level; Message anno = method.getAnnotation( Message.class ); if( anno == null ) { @@ -144,7 +144,7 @@ public class MessagesInvoker extends ResourcesInvoker implements InvocationHandl return bundle; } - private static final String calcLoggerName( final Class<?> clazz, final Messages anno ) { + private static String calcLoggerName( final Class<?> clazz, final Messages anno ) { String logger = null; if( anno != null ) { logger = anno.logger(); @@ -163,7 +163,7 @@ public class MessagesInvoker extends ResourcesInvoker implements InvocationHandl return bundle; } - private static final MessageLogger getLogger( final Class<?> clazz, final Messages anno, final MessageLoggerFactory loggers ) { + private static MessageLogger getLogger( final Class<?> clazz, final Messages anno, final MessageLoggerFactory loggers ) { return loggers.getLogger( calcLoggerName( clazz, anno ) ); } http://git-wip-us.apache.org/repos/asf/knox/blob/6736393d/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/loggers/jdk/JdkMessageLogger.java ---------------------------------------------------------------------- diff --git a/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/loggers/jdk/JdkMessageLogger.java b/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/loggers/jdk/JdkMessageLogger.java index c8d63fe..7f6f08d 100644 --- a/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/loggers/jdk/JdkMessageLogger.java +++ b/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/loggers/jdk/JdkMessageLogger.java @@ -33,13 +33,13 @@ final class JdkMessageLogger implements MessageLogger { } @Override - public final boolean isLoggable( final MessageLevel level ) { + public boolean isLoggable( final MessageLevel level ) { return logger.isLoggable( toLevel( level ) ); } //TODO: Handle message ID. @Override - public final void log( final StackTraceElement caller, final MessageLevel level, final String id, final String message, final Throwable thrown ) { + public void log( final StackTraceElement caller, final MessageLevel level, final String id, final String message, final Throwable thrown ) { LogRecord record = new LogRecord( toLevel( level ), message ); record.setSourceClassName( caller.getClassName() ); record.setSourceMethodName( caller.getMethodName() ); @@ -49,7 +49,7 @@ final class JdkMessageLogger implements MessageLogger { logger.log( record ); } - private static final Level toLevel( final MessageLevel level ) { + private static Level toLevel( final MessageLevel level ) { switch( level ) { case FATAL: return Level.SEVERE; case ERROR: return Level.SEVERE; http://git-wip-us.apache.org/repos/asf/knox/blob/6736393d/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/loggers/sout/SoutMessageLogger.java ---------------------------------------------------------------------- diff --git a/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/loggers/sout/SoutMessageLogger.java b/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/loggers/sout/SoutMessageLogger.java index b214ae4..4109eaf 100644 --- a/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/loggers/sout/SoutMessageLogger.java +++ b/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/loggers/sout/SoutMessageLogger.java @@ -39,7 +39,7 @@ public class SoutMessageLogger implements MessageLogger { return true; } - private static final String getFormat( final String id ) { + private static String getFormat( final String id ) { return( id == null ) ? FORMAT_WITHOUT_ID : FORMAT_WITH_ID; } http://git-wip-us.apache.org/repos/asf/knox/blob/6736393d/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/loggers/test/TestMessageRecord.java ---------------------------------------------------------------------- diff --git a/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/loggers/test/TestMessageRecord.java b/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/loggers/test/TestMessageRecord.java index 786cfff..6c3c10e 100644 --- a/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/loggers/test/TestMessageRecord.java +++ b/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/loggers/test/TestMessageRecord.java @@ -36,7 +36,7 @@ public class TestMessageRecord { this.message = message; this.throwable = throwable; } - + public TestMessageLogger getLogger() { return logger; } http://git-wip-us.apache.org/repos/asf/knox/blob/6736393d/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/resources/Resource.java ---------------------------------------------------------------------- diff --git a/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/resources/Resource.java b/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/resources/Resource.java index 021f81b..77f2010 100644 --- a/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/resources/Resource.java +++ b/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/resources/Resource.java @@ -25,6 +25,6 @@ import java.lang.annotation.Target; @Retention( RetentionPolicy.RUNTIME ) @Target( ElementType.METHOD ) public @interface Resource { - static final String DEFAULT_TEXT = "{}"; + String DEFAULT_TEXT = "{}"; String text() default DEFAULT_TEXT; } http://git-wip-us.apache.org/repos/asf/knox/blob/6736393d/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/resources/Resources.java ---------------------------------------------------------------------- diff --git a/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/resources/Resources.java b/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/resources/Resources.java index cba4a9d..0833734 100644 --- a/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/resources/Resources.java +++ b/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/resources/Resources.java @@ -25,6 +25,6 @@ import java.lang.annotation.Target; @Retention( RetentionPolicy.RUNTIME ) @Target( ElementType.TYPE ) public @interface Resources { - static final String DEFAULT_BUNDLE = ""; + String DEFAULT_BUNDLE = ""; String bundle() default DEFAULT_BUNDLE; } http://git-wip-us.apache.org/repos/asf/knox/blob/6736393d/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/resources/ResourcesInvoker.java ---------------------------------------------------------------------- diff --git a/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/resources/ResourcesInvoker.java b/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/resources/ResourcesInvoker.java index d1a3926..c551366 100644 --- a/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/resources/ResourcesInvoker.java +++ b/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/resources/ResourcesInvoker.java @@ -106,7 +106,7 @@ public class ResourcesInvoker implements InvocationHandler { return prefix + suffix; } - private static final String createDefaultPatternSuffix( final int size ) { + private static String createDefaultPatternSuffix( final int size ) { StringBuilder builder = new StringBuilder( 1 + size*7 ); builder.append( "(" ); for( int i=0; i<size; i++ ) { @@ -120,7 +120,7 @@ public class ResourcesInvoker implements InvocationHandler { } - private static final String calcBundleName( final Class<?> clazz ) { + private static String calcBundleName( final Class<?> clazz ) { String bundle = null; final Resources anno = clazz.getAnnotation( Resources.class ); if( anno != null ) { http://git-wip-us.apache.org/repos/asf/knox/blob/6736393d/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/HaDescriptor.java ---------------------------------------------------------------------- diff --git a/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/HaDescriptor.java b/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/HaDescriptor.java index 421c459..33abb52 100644 --- a/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/HaDescriptor.java +++ b/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/HaDescriptor.java @@ -20,15 +20,13 @@ package org.apache.knox.gateway.ha.provider; import java.util.List; public interface HaDescriptor { + void addServiceConfig(HaServiceConfig serviceConfig); - public void addServiceConfig(HaServiceConfig serviceConfig); + HaServiceConfig getServiceConfig(String serviceName); - public HaServiceConfig getServiceConfig(String serviceName); + List<String> getServiceNames(); - public List<String> getServiceNames(); - - public List<String> getEnabledServiceNames(); - - public List<HaServiceConfig> getServiceConfigs(); + List<String> getEnabledServiceNames(); + List<HaServiceConfig> getServiceConfigs(); } http://git-wip-us.apache.org/repos/asf/knox/blob/6736393d/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/HaProvider.java ---------------------------------------------------------------------- diff --git a/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/HaProvider.java b/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/HaProvider.java index e1642ee..6df79cb 100644 --- a/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/HaProvider.java +++ b/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/HaProvider.java @@ -21,47 +21,47 @@ import java.util.List; public interface HaProvider { - public HaDescriptor getHaDescriptor(); + HaDescriptor getHaDescriptor(); - /** - * Add a service name (role) as a HA service with the URLs that it is configured for - * - * @param serviceName the name of the service - * @param urls the list of urls that can be used for that service - */ - public void addHaService(String serviceName, List<String> urls); + /** + * Add a service name (role) as a HA service with the URLs that it is configured for + * + * @param serviceName the name of the service + * @param urls the list of urls that can be used for that service + */ + void addHaService(String serviceName, List<String> urls); - /** - * Returns whether the service is enabled for HA - * - * @param serviceName the name of the service - * @return true if the service is enabled; false otherwise - */ - public boolean isHaEnabled(String serviceName); + /** + * Returns whether the service is enabled for HA + * + * @param serviceName the name of the service + * @return true if the service is enabled; false otherwise + */ + boolean isHaEnabled(String serviceName); - /** - * Returns the current URL that is known to be active for the service - * - * @param serviceName the name of the service - * @return the URL as a string or null if the service name is not found - */ - public String getActiveURL(String serviceName); + /** + * Returns the current URL that is known to be active for the service + * + * @param serviceName the name of the service + * @return the URL as a string or null if the service name is not found + */ + String getActiveURL(String serviceName); - /** - * Sets a given URL that is known to be active for the service - * - * @param serviceName the name of the service - * @param url the active url - */ - public void setActiveURL(String serviceName, String url); + /** + * Sets a given URL that is known to be active for the service + * + * @param serviceName the name of the service + * @param url the active url + */ + void setActiveURL(String serviceName, String url); - /** - * Mark the URL for the service as one that has failed. This method puts changes the active URL to - * the next available URL for the service. - * - * @param serviceName the name of the service - * @param url the URL that has failed in some way - */ - public void markFailedURL(String serviceName, String url); + /** + * Mark the URL for the service as one that has failed. This method puts changes the active URL to + * the next available URL for the service. + * + * @param serviceName the name of the service + * @param url the URL that has failed in some way + */ + void markFailedURL(String serviceName, String url); }
