NIFI-2574 fix spring context definitions

This commit is contained in:
joewitt 2016-08-17 03:38:31 -07:00
parent 6bf7e7f325
commit d9633757a6
6 changed files with 23 additions and 7 deletions

View File

@ -42,6 +42,9 @@
<bean id="clusterCoordinationProtocolSender" class="org.apache.nifi.cluster.protocol.impl.StandardClusterCoordinationProtocolSender"> <bean id="clusterCoordinationProtocolSender" class="org.apache.nifi.cluster.protocol.impl.StandardClusterCoordinationProtocolSender">
<constructor-arg ref="protocolSocketConfiguration"/> <constructor-arg ref="protocolSocketConfiguration"/>
<constructor-arg ref="protocolContext"/> <constructor-arg ref="protocolContext"/>
<constructor-arg>
<bean factory-bean="nifiProperties" factory-method="getClusterNodeProtocolThreads"/>
</constructor-arg>
<property name="handshakeTimeout"> <property name="handshakeTimeout">
<bean factory-bean="nifiProperties" factory-method="getClusterNodeConnectionTimeout"/> <bean factory-bean="nifiProperties" factory-method="getClusterNodeConnectionTimeout"/>
</property> </property>

View File

@ -25,7 +25,10 @@
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd"> http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd">
<!-- nifi properties created via getInstance using a file path specified as a system property --> <!-- nifi properties created via getInstance using a file path specified as a system property -->
<bean id="nifiProperties" class="org.apache.nifi.util.NiFiProperties" factory-method="getInstance"/> <bean id="nifiProperties" class="org.apache.nifi.util.NiFiProperties" factory-method="createBasicNiFiProperties">
<constructor-arg index="0"><null /></constructor-arg>
<constructor-arg index="1"><null /></constructor-arg>
</bean>
<!-- variable registry --> <!-- variable registry -->
<bean id="variableRegistry" class="org.apache.nifi.util.FileBasedVariableRegistry"> <bean id="variableRegistry" class="org.apache.nifi.util.FileBasedVariableRegistry">
@ -36,7 +39,9 @@
<bean id="flowFileEventRepository" class="org.apache.nifi.spring.RingBufferEventRepositoryBean"> <bean id="flowFileEventRepository" class="org.apache.nifi.spring.RingBufferEventRepositoryBean">
</bean> </bean>
<bean id="stringEncryptor" class="org.apache.nifi.encrypt.StringEncryptor" factory-method="createEncryptor"/> <bean id="stringEncryptor" class="org.apache.nifi.encrypt.StringEncryptor" factory-method="createEncryptor">
<constructor-arg ref="nifiProperties" />
</bean>
<!-- flow controller --> <!-- flow controller -->
<bean id="flowController" class="org.apache.nifi.spring.FlowControllerFactoryBean"> <bean id="flowController" class="org.apache.nifi.spring.FlowControllerFactoryBean">

View File

@ -116,10 +116,8 @@ public class DataTransferResource extends ApplicationResource {
private final ResponseCreator responseCreator = new ResponseCreator(); private final ResponseCreator responseCreator = new ResponseCreator();
private final VersionNegotiator transportProtocolVersionNegotiator = new TransportProtocolVersionNegotiator(1); private final VersionNegotiator transportProtocolVersionNegotiator = new TransportProtocolVersionNegotiator(1);
private final HttpRemoteSiteListener transactionManager; private final HttpRemoteSiteListener transactionManager;
private final NiFiProperties nifiProperties;
public DataTransferResource(final NiFiProperties nifiProperties) { public DataTransferResource(final NiFiProperties nifiProperties) {
this.nifiProperties = nifiProperties;
transactionManager = HttpRemoteSiteListener.getInstance(nifiProperties); transactionManager = HttpRemoteSiteListener.getInstance(nifiProperties);
} }
@ -311,13 +309,13 @@ public class DataTransferResource extends ApplicationResource {
((HttpCommunicationsSession) peer.getCommunicationsSession()).setDataTransferUrl(dataTransferUrl); ((HttpCommunicationsSession) peer.getCommunicationsSession()).setDataTransferUrl(dataTransferUrl);
HttpFlowFileServerProtocol serverProtocol = getHttpFlowFileServerProtocol(versionNegotiator); HttpFlowFileServerProtocol serverProtocol = getHttpFlowFileServerProtocol(versionNegotiator);
HttpRemoteSiteListener.getInstance(nifiProperties).setupServerProtocol(serverProtocol); HttpRemoteSiteListener.getInstance(getProperties()).setupServerProtocol(serverProtocol);
serverProtocol.handshake(peer); serverProtocol.handshake(peer);
return serverProtocol; return serverProtocol;
} }
HttpFlowFileServerProtocol getHttpFlowFileServerProtocol(final VersionNegotiator versionNegotiator) { HttpFlowFileServerProtocol getHttpFlowFileServerProtocol(final VersionNegotiator versionNegotiator) {
return new StandardHttpFlowFileServerProtocol(versionNegotiator, nifiProperties); return new StandardHttpFlowFileServerProtocol(versionNegotiator, getProperties());
} }
private Peer constructPeer(final HttpServletRequest req, final InputStream inputStream, private Peer constructPeer(final HttpServletRequest req, final InputStream inputStream,

View File

@ -215,6 +215,7 @@
<property name="authorizer" ref="authorizer"/> <property name="authorizer" ref="authorizer"/>
</bean> </bean>
<bean id="siteToSiteResource" class="org.apache.nifi.web.api.SiteToSiteResource" scope="singleton"> <bean id="siteToSiteResource" class="org.apache.nifi.web.api.SiteToSiteResource" scope="singleton">
<constructor-arg ref="nifiProperties"/>
<property name="serviceFacade" ref="serviceFacade"/> <property name="serviceFacade" ref="serviceFacade"/>
<property name="properties" ref="nifiProperties"/> <property name="properties" ref="nifiProperties"/>
<property name="clusterCoordinator" ref="clusterCoordinator"/> <property name="clusterCoordinator" ref="clusterCoordinator"/>
@ -222,6 +223,7 @@
<property name="authorizer" ref="authorizer"/> <property name="authorizer" ref="authorizer"/>
</bean> </bean>
<bean id="dataTransferResource" class="org.apache.nifi.web.api.DataTransferResource" scope="singleton"> <bean id="dataTransferResource" class="org.apache.nifi.web.api.DataTransferResource" scope="singleton">
<constructor-arg ref="nifiProperties"/>
<property name="properties" ref="nifiProperties"/> <property name="properties" ref="nifiProperties"/>
<property name="clusterCoordinator" ref="clusterCoordinator"/> <property name="clusterCoordinator" ref="clusterCoordinator"/>
<property name="requestReplicator" ref="requestReplicator" /> <property name="requestReplicator" ref="requestReplicator" />

View File

@ -17,6 +17,7 @@
package org.apache.nifi.processors.hive; package org.apache.nifi.processors.hive;
import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.google.common.util.concurrent.ThreadFactoryBuilder;
import java.io.File;
import org.apache.avro.Schema; import org.apache.avro.Schema;
import org.apache.avro.file.CodecFactory; import org.apache.avro.file.CodecFactory;
import org.apache.avro.file.DataFileConstants; import org.apache.avro.file.DataFileConstants;
@ -243,6 +244,9 @@ public class PutHiveStreaming extends AbstractProcessor {
private static final long TICKET_RENEWAL_PERIOD = 60000; private static final long TICKET_RENEWAL_PERIOD = 60000;
protected KerberosProperties kerberosProperties; protected KerberosProperties kerberosProperties;
private volatile String kerberosServicePrincipal = null;
private volatile File kerberosConfigFile = null;
private volatile File kerberosServiceKeytab = null;
protected volatile HiveConfigurator hiveConfigurator = new HiveConfigurator(); protected volatile HiveConfigurator hiveConfigurator = new HiveConfigurator();
protected volatile UserGroupInformation ugi; protected volatile UserGroupInformation ugi;
@ -281,7 +285,10 @@ public class PutHiveStreaming extends AbstractProcessor {
@Override @Override
protected void init(ProcessorInitializationContext context) { protected void init(ProcessorInitializationContext context) {
kerberosProperties = getKerberosProperties(); kerberosServicePrincipal = context.getKerberosServicePrincipal();
kerberosConfigFile = context.getKerberosConfigurationFile();
kerberosServiceKeytab = context.getKerberosServiceKeytab();
kerberosProperties = new KerberosProperties(kerberosConfigFile);
propertyDescriptors.add(kerberosProperties.getKerberosPrincipal()); propertyDescriptors.add(kerberosProperties.getKerberosPrincipal());
propertyDescriptors.add(kerberosProperties.getKerberosKeytab()); propertyDescriptors.add(kerberosProperties.getKerberosKeytab());
} }

View File

@ -73,6 +73,7 @@ public class MonitorDiskUsage extends AbstractReportingTask {
final List<PropertyDescriptor> descriptors = new ArrayList<>(2); final List<PropertyDescriptor> descriptors = new ArrayList<>(2);
descriptors.add(DIR_THRESHOLD); descriptors.add(DIR_THRESHOLD);
descriptors.add(DIR_LOCATION); descriptors.add(DIR_LOCATION);
descriptors.add(DIR_DISPLAY_NAME);
return descriptors; return descriptors;
} }