Fixed merge issues with master KNOX-481
Project: http://git-wip-us.apache.org/repos/asf/knox/repo Commit: http://git-wip-us.apache.org/repos/asf/knox/commit/d7f2b51d Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/d7f2b51d Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/d7f2b51d Branch: refs/heads/KNOX-481 Commit: d7f2b51ddbc8bcaf92d2c8f84631e944ea05f643 Parents: 826f3d5 Author: Sumit Gupta <su...@apache.org> Authored: Thu Jan 29 19:39:08 2015 -0500 Committer: Sumit Gupta <su...@apache.org> Committed: Thu Feb 12 16:01:14 2015 -0500 ---------------------------------------------------------------------- .../impl/DispatchDeploymentContributor.java | 23 ++++++++++++-------- .../HBaseDispatchDeploymentContributor.java | 22 +++++++++++-------- .../hive/HiveDispatchDeploymentContributor.java | 22 +++++++++++-------- .../gateway/dispatch/HttpClientDispatch.java | 3 --- .../deploy/DeploymentFactoryFuncTest.java | 2 ++ 5 files changed, 42 insertions(+), 30 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/knox/blob/d7f2b51d/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/impl/DispatchDeploymentContributor.java ---------------------------------------------------------------------- diff --git a/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/impl/DispatchDeploymentContributor.java b/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/impl/DispatchDeploymentContributor.java index 345784f..30f2c65 100644 --- a/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/impl/DispatchDeploymentContributor.java +++ b/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/impl/DispatchDeploymentContributor.java @@ -28,6 +28,7 @@ import org.apache.hadoop.gateway.topology.Provider; import org.apache.hadoop.gateway.topology.Service; import java.util.List; +import java.util.Map; public class DispatchDeploymentContributor extends ProviderDeploymentContributorBase { @@ -50,18 +51,22 @@ public class DispatchDeploymentContributor extends ProviderDeploymentContributor @Override public void contributeFilter( DeploymentContext context, Provider provider, Service service, ResourceDescriptor resource, List<FilterParamDescriptor> params ) { - String replayBufferSize = DEFAULT_REPLAY_BUFFER_SIZE; - if (params != null) { - for (FilterParamDescriptor paramDescriptor : params) { - if (REPLAY_BUFFER_SIZE_PARAM.equals( paramDescriptor.name() )) { - replayBufferSize = paramDescriptor.value(); - break; + FilterDescriptor filter = resource.addFilter().name( getName() ).role( getRole() ).impl( GatewayDispatchFilter.class ); + filter.param().name(DISPATCH_IMPL_PARAM).value(HttpClientDispatch.class.getName()); + FilterParamDescriptor filterParam = filter.param().name( REPLAY_BUFFER_SIZE_PARAM ).value( DEFAULT_REPLAY_BUFFER_SIZE ); + for ( Map.Entry<String,String> serviceParam : service.getParams().entrySet() ) { + if ( REPLAY_BUFFER_SIZE_PARAM.equals( serviceParam.getKey() ) ) { + filterParam.value( serviceParam.getValue() ); + } + } + if ( params != null ) { + for ( FilterParamDescriptor customParam : params ) { + if ( REPLAY_BUFFER_SIZE_PARAM.equals( customParam.name() ) ) { + filterParam.value( customParam.value() ); } } } - FilterDescriptor filter = resource.addFilter().name( getName() ).role( getRole() ).impl( GatewayDispatchFilter.class ); - filter.param().name(DISPATCH_IMPL_PARAM).value(HttpClientDispatch.class.getName()); - filter.param().name(REPLAY_BUFFER_SIZE_PARAM).value(replayBufferSize); + if( context.getGatewayConfig().isHadoopKerberosSecured() ) { filter.param().name("kerberos").value("true"); } http://git-wip-us.apache.org/repos/asf/knox/blob/d7f2b51d/gateway-service-hbase/src/main/java/org/apache/hadoop/gateway/hbase/HBaseDispatchDeploymentContributor.java ---------------------------------------------------------------------- diff --git a/gateway-service-hbase/src/main/java/org/apache/hadoop/gateway/hbase/HBaseDispatchDeploymentContributor.java b/gateway-service-hbase/src/main/java/org/apache/hadoop/gateway/hbase/HBaseDispatchDeploymentContributor.java index c5d1ab9..a87b84c 100644 --- a/gateway-service-hbase/src/main/java/org/apache/hadoop/gateway/hbase/HBaseDispatchDeploymentContributor.java +++ b/gateway-service-hbase/src/main/java/org/apache/hadoop/gateway/hbase/HBaseDispatchDeploymentContributor.java @@ -28,6 +28,7 @@ import org.apache.hadoop.gateway.topology.Provider; import org.apache.hadoop.gateway.topology.Service; import java.util.List; +import java.util.Map; public class HBaseDispatchDeploymentContributor extends ProviderDeploymentContributorBase { @@ -50,18 +51,21 @@ public class HBaseDispatchDeploymentContributor extends ProviderDeploymentContri @Override public void contributeFilter( DeploymentContext context, Provider provider, Service service, ResourceDescriptor resource, List<FilterParamDescriptor> params ) { - String replayBufferSize = DEFAULT_REPLAY_BUFFER_SIZE; - if (params != null) { - for (FilterParamDescriptor paramDescriptor : params) { - if (REPLAY_BUFFER_SIZE_PARAM.equals( paramDescriptor.name() )) { - replayBufferSize = paramDescriptor.value(); - break; + FilterDescriptor filter = resource.addFilter().name( getName() ).role( getRole() ).impl( GatewayDispatchFilter.class ); + filter.param().name(DISPATCH_IMPL_PARAM).value(HBaseHttpClientDispatch.class.getName()); + FilterParamDescriptor filterParam = filter.param().name( REPLAY_BUFFER_SIZE_PARAM ).value( DEFAULT_REPLAY_BUFFER_SIZE ); + for ( Map.Entry<String,String> serviceParam : service.getParams().entrySet() ) { + if ( REPLAY_BUFFER_SIZE_PARAM.equals( serviceParam.getKey() ) ) { + filterParam.value( serviceParam.getValue() ); + } + } + if ( params != null ) { + for ( FilterParamDescriptor customParam : params ) { + if ( REPLAY_BUFFER_SIZE_PARAM.equals( customParam.name() ) ) { + filterParam.value( customParam.value() ); } } } - FilterDescriptor filter = resource.addFilter().name( getName() ).role( getRole() ).impl( GatewayDispatchFilter.class ); - filter.param().name(DISPATCH_IMPL_PARAM).value(HBaseHttpClientDispatch.class.getName()); - filter.param().name("replayBufferSize").value(replayBufferSize); if( context.getGatewayConfig().isHadoopKerberosSecured() ) { filter.param().name("kerberos").value("true"); } http://git-wip-us.apache.org/repos/asf/knox/blob/d7f2b51d/gateway-service-hive/src/main/java/org/apache/hadoop/gateway/hive/HiveDispatchDeploymentContributor.java ---------------------------------------------------------------------- diff --git a/gateway-service-hive/src/main/java/org/apache/hadoop/gateway/hive/HiveDispatchDeploymentContributor.java b/gateway-service-hive/src/main/java/org/apache/hadoop/gateway/hive/HiveDispatchDeploymentContributor.java index 493ed6d..ea8d3ce 100644 --- a/gateway-service-hive/src/main/java/org/apache/hadoop/gateway/hive/HiveDispatchDeploymentContributor.java +++ b/gateway-service-hive/src/main/java/org/apache/hadoop/gateway/hive/HiveDispatchDeploymentContributor.java @@ -18,6 +18,7 @@ package org.apache.hadoop.gateway.hive; import java.util.List; +import java.util.Map; import org.apache.hadoop.gateway.deploy.DeploymentContext; import org.apache.hadoop.gateway.deploy.ProviderDeploymentContributorBase; @@ -52,18 +53,21 @@ public class HiveDispatchDeploymentContributor extends ProviderDeploymentContrib @Override public void contributeFilter( DeploymentContext context, Provider provider, Service service, ResourceDescriptor resource, List<FilterParamDescriptor> params ) { - String replayBufferSize = DEFAULT_REPLAY_BUFFER_SIZE; - if (params != null) { - for (FilterParamDescriptor paramDescriptor : params) { - if (REPLAY_BUFFER_SIZE_PARAM.equals( paramDescriptor.name() )) { - replayBufferSize = paramDescriptor.value(); - break; + FilterDescriptor filter = resource.addFilter().name( getName() ).role( getRole() ).impl( GatewayDispatchFilter.class ); + filter.param().name(DISPATCH_IMPL_PARAM).value(HiveHttpClientDispatch.class.getName()); + FilterParamDescriptor filterParam = filter.param().name( REPLAY_BUFFER_SIZE_PARAM ).value( DEFAULT_REPLAY_BUFFER_SIZE ); + for ( Map.Entry<String,String> serviceParam : service.getParams().entrySet() ) { + if ( REPLAY_BUFFER_SIZE_PARAM.equals( serviceParam.getKey() ) ) { + filterParam.value( serviceParam.getValue() ); + } + } + if ( params != null ) { + for ( FilterParamDescriptor customParam : params ) { + if ( REPLAY_BUFFER_SIZE_PARAM.equals( customParam.name() ) ) { + filterParam.value( customParam.value() ); } } } - FilterDescriptor filter = resource.addFilter().name( getName() ).role( getRole() ).impl( GatewayDispatchFilter.class ); - filter.param().name(DISPATCH_IMPL_PARAM).value(HiveHttpClientDispatch.class.getName()); - filter.param().name("replayBufferSize").value(replayBufferSize); if( context.getGatewayConfig().isHadoopKerberosSecured() ) { filter.param().name("kerberos").value("true"); } http://git-wip-us.apache.org/repos/asf/knox/blob/d7f2b51d/gateway-spi/src/main/java/org/apache/hadoop/gateway/dispatch/HttpClientDispatch.java ---------------------------------------------------------------------- diff --git a/gateway-spi/src/main/java/org/apache/hadoop/gateway/dispatch/HttpClientDispatch.java b/gateway-spi/src/main/java/org/apache/hadoop/gateway/dispatch/HttpClientDispatch.java index 78fbdb1..8c5b4f9 100644 --- a/gateway-spi/src/main/java/org/apache/hadoop/gateway/dispatch/HttpClientDispatch.java +++ b/gateway-spi/src/main/java/org/apache/hadoop/gateway/dispatch/HttpClientDispatch.java @@ -75,12 +75,9 @@ public class HttpClientDispatch extends AbstractGatewayDispatch { protected static SpiGatewayResources RES = ResourcesFactory.get(SpiGatewayResources.class); protected static Auditor auditor = AuditServiceFactory.getAuditService().getAuditor(AuditConstants.DEFAULT_AUDITOR_NAME, AuditConstants.KNOX_SERVICE_NAME, AuditConstants.KNOX_COMPONENT_NAME); - private static final int DEFAULT_REPLAY_BUFFER_SIZE = 4 * 1024; // 4K protected AppCookieManager appCookieManager; - protected static final String REPLAY_BUFFER_SIZE_PARAM = "replayBufferSize"; - private int replayBufferSize = 0; @Override http://git-wip-us.apache.org/repos/asf/knox/blob/d7f2b51d/gateway-test/src/test/java/org/apache/hadoop/gateway/deploy/DeploymentFactoryFuncTest.java ---------------------------------------------------------------------- diff --git a/gateway-test/src/test/java/org/apache/hadoop/gateway/deploy/DeploymentFactoryFuncTest.java b/gateway-test/src/test/java/org/apache/hadoop/gateway/deploy/DeploymentFactoryFuncTest.java index d4ba647..b6ab0f5 100644 --- a/gateway-test/src/test/java/org/apache/hadoop/gateway/deploy/DeploymentFactoryFuncTest.java +++ b/gateway-test/src/test/java/org/apache/hadoop/gateway/deploy/DeploymentFactoryFuncTest.java @@ -383,6 +383,7 @@ public class DeploymentFactoryFuncTest { ((GatewayTestConfig) config).setGatewayHomeDir(gatewayDir.getAbsolutePath()); File deployDir = new File(config.getGatewayDeploymentDir()); deployDir.mkdirs(); + addStacksDir(config, targetDir); DefaultGatewayServices srvcs = new DefaultGatewayServices(); Map<String, String> options = new HashMap<String, String>(); @@ -457,6 +458,7 @@ public class DeploymentFactoryFuncTest { ((GatewayTestConfig) config).setGatewayHomeDir(gatewayDir.getAbsolutePath()); File deployDir = new File(config.getGatewayDeploymentDir()); deployDir.mkdirs(); + addStacksDir(config, targetDir); DefaultGatewayServices srvcs = new DefaultGatewayServices(); Map<String, String> options = new HashMap<String, String>();