markap14 commented on a change in pull request #4110: NIFI-7226: Add Connection
Factory configuration properties to Publish…
URL: https://github.com/apache/nifi/pull/4110#discussion_r388483049
##########
File path:
nifi-nar-bundles/nifi-jms-bundle/nifi-jms-processors/src/main/java/org/apache/nifi/jms/cf/JndiJmsConnectionFactoryProvider.java
##########
@@ -21,214 +21,55 @@
import org.apache.nifi.annotation.documentation.SeeAlso;
import org.apache.nifi.annotation.documentation.Tags;
import org.apache.nifi.annotation.lifecycle.OnDisabled;
+import org.apache.nifi.annotation.lifecycle.OnEnabled;
import org.apache.nifi.components.PropertyDescriptor;
-import org.apache.nifi.components.PropertyDescriptor.Builder;
-import org.apache.nifi.components.Validator;
import org.apache.nifi.controller.AbstractControllerService;
import org.apache.nifi.controller.ConfigurationContext;
import org.apache.nifi.expression.ExpressionLanguageScope;
-import org.apache.nifi.processor.exception.ProcessException;
-import org.apache.nifi.processor.util.StandardValidators;
import javax.jms.ConnectionFactory;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.Arrays;
-import java.util.Hashtable;
import java.util.List;
-import static
org.apache.nifi.processor.util.StandardValidators.NON_EMPTY_VALIDATOR;
-
@Tags({"jms", "jndi", "messaging", "integration", "queue", "topic", "publish",
"subscribe"})
@CapabilityDescription("Provides a service to lookup an existing JMS
ConnectionFactory using the Java Naming and Directory Interface (JNDI).")
@DynamicProperty(
description = "In order to perform a JNDI Lookup, an Initial Context must
be established. When this is done, an Environment can be established for the
context. Any dynamic/user-defined property" +
" that is added to this Controller Service will be added as an
Environment configuration/variable to this Context.",
name = "The name of a JNDI Initial Context environment variable.",
- value = "The value of the JNDI Initial Context Environment variable.",
+ value = "The value of the JNDI Initial Context environment variable.",
expressionLanguageScope = ExpressionLanguageScope.VARIABLE_REGISTRY)
@SeeAlso(classNames = {"org.apache.nifi.jms.processors.ConsumeJMS",
"org.apache.nifi.jms.processors.PublishJMS",
"org.apache.nifi.jms.cf.JMSConnectionFactoryProvider"})
public class JndiJmsConnectionFactoryProvider extends
AbstractControllerService implements JMSConnectionFactoryProviderDefinition {
- static final PropertyDescriptor INITIAL_NAMING_FACTORY_CLASS = new
Builder()
- .name("java.naming.factory.initial")
- .displayName("Initial Naming Factory Class")
- .description("The fully qualified class name of the Java Initial
Naming Factory (java.naming.factory.initial).")
- .addValidator(NON_EMPTY_VALIDATOR)
- .expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
- .required(true)
- .build();
- static final PropertyDescriptor NAMING_PROVIDER_URL = new Builder()
- .name("java.naming.provider.url")
- .displayName("Naming Provider URL")
- .description("The URL of the JNDI Naming Provider to use")
- .required(true)
- .addValidator(NON_EMPTY_VALIDATOR)
- .expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
- .build();
- static final PropertyDescriptor CONNECTION_FACTORY_NAME = new Builder()
- .name("connection.factory.name")
- .displayName("Connection Factory Name")
- .description("The name of the JNDI Object to lookup for the Connection
Factory")
- .required(true)
- .addValidator(NON_EMPTY_VALIDATOR)
- .expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
- .build();
- static final PropertyDescriptor NAMING_FACTORY_LIBRARIES = new Builder()
- .name("naming.factory.libraries")
- .displayName("Naming Factory Libraries")
- .description("Specifies .jar files or directories to add to the
ClassPath in order to find the Initial Naming Factory Class")
- .required(false)
- .expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
- .addValidator(StandardValidators.createListValidator(true, true,
StandardValidators.createURLorFileValidator()))
- .dynamicallyModifiesClasspath(true)
- .build();
- static final PropertyDescriptor PRINCIPAL = new Builder()
- .name("java.naming.security.principal")
- .displayName("JNDI Principal")
- .description("The Principal to use when authenticating with JNDI")
- .required(false)
- .expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
- .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
- .build();
- static final PropertyDescriptor CREDENTIALS = new Builder()
- .name("java.naming.security.credentials")
- .displayName("Credentials")
- .description("The Credentials to use when authenticating with JNDI")
- .required(false)
- .expressionLanguageSupported(ExpressionLanguageScope.NONE)
- .addValidator(Validator.VALID)
- .sensitive(true)
- .build();
-
- private static final List<PropertyDescriptor> PROPERTY_DESCRIPTORS =
Arrays.asList(
- INITIAL_NAMING_FACTORY_CLASS,
- NAMING_PROVIDER_URL,
- CONNECTION_FACTORY_NAME,
- NAMING_FACTORY_LIBRARIES,
- PRINCIPAL,
- CREDENTIALS);
-
- private ConnectionFactory connectionFactory;
+ private JndiJmsConnectionFactoryHandler delegate;
Review comment:
This needs to be protected also in terms of concurrency. Looks like marking
as `volatile` will be sufficient in this case.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services