You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by jp...@apache.org on 2016/07/17 18:03:26 UTC

nifi git commit: NIFI-2280 marked methods as deprecated as appropriate to the cleanup discovered found in NIFI-1157

Repository: nifi
Updated Branches:
  refs/heads/0.x c6b0941de -> 537b3d0d7


NIFI-2280 marked methods as deprecated as appropriate to the cleanup discovered found in NIFI-1157

This closes #664

Signed-off-by: jpercivall <jo...@yahoo.com>


Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/537b3d0d
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/537b3d0d
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/537b3d0d

Branch: refs/heads/0.x
Commit: 537b3d0d73f95e07e3c69cedc374cb3cd19cd21c
Parents: c6b0941
Author: joewitt <jo...@apache.org>
Authored: Fri Jul 15 17:34:08 2016 -0400
Committer: jpercivall <jo...@yahoo.com>
Committed: Sun Jul 17 13:42:06 2016 -0400

----------------------------------------------------------------------
 .../controller/AbstractControllerService.java   |  9 +++++++++
 .../util/crypto/AESKeyedCipherProvider.java     |  2 ++
 .../util/crypto/CipherProviderFactory.java      | 21 ++++++++++----------
 .../util/crypto/KeyedCipherProvider.java        |  2 ++
 .../util/crypto/NiFiLegacyCipherProvider.java   |  2 ++
 .../util/crypto/OpenSSLPKCS5CipherProvider.java |  2 ++
 .../util/crypto/PBKDF2CipherProvider.java       |  2 ++
 7 files changed, 29 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/537b3d0d/nifi-api/src/main/java/org/apache/nifi/controller/AbstractControllerService.java
----------------------------------------------------------------------
diff --git a/nifi-api/src/main/java/org/apache/nifi/controller/AbstractControllerService.java b/nifi-api/src/main/java/org/apache/nifi/controller/AbstractControllerService.java
index 83d3301..c732898 100644
--- a/nifi-api/src/main/java/org/apache/nifi/controller/AbstractControllerService.java
+++ b/nifi-api/src/main/java/org/apache/nifi/controller/AbstractControllerService.java
@@ -49,6 +49,11 @@ public abstract class AbstractControllerService extends AbstractConfigurableComp
         return identifier;
     }
 
+    /**
+     * @param context config context
+     * @deprecated When methods annotated with OnEnabled are called the config context is supplied
+     */
+    @Deprecated
     @OnConfigured
     public void onConfigurationChange(final ConfigurationContext context) {
         this.configContext = context;
@@ -58,7 +63,9 @@ public abstract class AbstractControllerService extends AbstractConfigurableComp
      * @param descriptor to retrieve value of
      * @return the currently configured value for the given
      * {@link PropertyDescriptor}
+     * @deprecated will be removed.  Instead use config context as passed to OnEnabled annotated methods
      */
+    @Deprecated
     protected final PropertyValue getProperty(final PropertyDescriptor descriptor) {
         return configContext.getProperty(descriptor);
     }
@@ -66,7 +73,9 @@ public abstract class AbstractControllerService extends AbstractConfigurableComp
     /**
      * @return an unmodifiable map of all configured properties for this
      * {@link ControllerService}
+     * @deprecated will be removed.  Instead use config context as passed to OnEnabled annotated methods
      */
+    @Deprecated
     protected final Map<PropertyDescriptor, String> getProperties() {
         return configContext.getProperties();
     }

http://git-wip-us.apache.org/repos/asf/nifi/blob/537b3d0d/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/crypto/AESKeyedCipherProvider.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/crypto/AESKeyedCipherProvider.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/crypto/AESKeyedCipherProvider.java
index 907aed2..524a481 100644
--- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/crypto/AESKeyedCipherProvider.java
+++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/crypto/AESKeyedCipherProvider.java
@@ -76,8 +76,10 @@ public class AESKeyedCipherProvider extends KeyedCipherProvider {
      * @param encryptMode      true for encrypt, false for decrypt
      * @return the initialized cipher
      * @throws Exception if there is a problem initializing the cipher or if decryption is requested
+     * @deprecated use other getCipher requiring a salt
      */
     @Override
+    @Deprecated
     public Cipher getCipher(EncryptionMethod encryptionMethod, SecretKey key, boolean encryptMode) throws Exception {
         return getCipher(encryptionMethod, key, new byte[0], encryptMode);
     }

http://git-wip-us.apache.org/repos/asf/nifi/blob/537b3d0d/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/crypto/CipherProviderFactory.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/crypto/CipherProviderFactory.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/crypto/CipherProviderFactory.java
index e04a7b4..b3044a6 100644
--- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/crypto/CipherProviderFactory.java
+++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/crypto/CipherProviderFactory.java
@@ -27,23 +27,22 @@ import java.util.Map;
 public class CipherProviderFactory {
     private static final Logger logger = LoggerFactory.getLogger(CipherProviderFactory.class);
 
-    private static Map<KeyDerivationFunction, Class<? extends CipherProvider>> registeredCipherProviders;
+    private static final Map<KeyDerivationFunction, Class<? extends CipherProvider>> REGISTERED_CIPHER_PROVIDERS = new HashMap<>();
 
     static {
-        registeredCipherProviders = new HashMap<>();
-        registeredCipherProviders.put(KeyDerivationFunction.NIFI_LEGACY, NiFiLegacyCipherProvider.class);
-        registeredCipherProviders.put(KeyDerivationFunction.OPENSSL_EVP_BYTES_TO_KEY, OpenSSLPKCS5CipherProvider.class);
-        registeredCipherProviders.put(KeyDerivationFunction.PBKDF2, PBKDF2CipherProvider.class);
-        registeredCipherProviders.put(KeyDerivationFunction.BCRYPT, BcryptCipherProvider.class);
-        registeredCipherProviders.put(KeyDerivationFunction.SCRYPT, ScryptCipherProvider.class);
-        registeredCipherProviders.put(KeyDerivationFunction.NONE, AESKeyedCipherProvider.class);
+        REGISTERED_CIPHER_PROVIDERS.put(KeyDerivationFunction.NIFI_LEGACY, NiFiLegacyCipherProvider.class);
+        REGISTERED_CIPHER_PROVIDERS.put(KeyDerivationFunction.OPENSSL_EVP_BYTES_TO_KEY, OpenSSLPKCS5CipherProvider.class);
+        REGISTERED_CIPHER_PROVIDERS.put(KeyDerivationFunction.PBKDF2, PBKDF2CipherProvider.class);
+        REGISTERED_CIPHER_PROVIDERS.put(KeyDerivationFunction.BCRYPT, BcryptCipherProvider.class);
+        REGISTERED_CIPHER_PROVIDERS.put(KeyDerivationFunction.SCRYPT, ScryptCipherProvider.class);
+        REGISTERED_CIPHER_PROVIDERS.put(KeyDerivationFunction.NONE, AESKeyedCipherProvider.class);
     }
 
     public static CipherProvider getCipherProvider(KeyDerivationFunction kdf) {
-        logger.debug("{} KDFs registered", registeredCipherProviders.size());
+        logger.debug("{} KDFs registered", REGISTERED_CIPHER_PROVIDERS.size());
 
-        if (registeredCipherProviders.containsKey(kdf)) {
-            Class<? extends CipherProvider> clazz = registeredCipherProviders.get(kdf);
+        if (REGISTERED_CIPHER_PROVIDERS.containsKey(kdf)) {
+            Class<? extends CipherProvider> clazz = REGISTERED_CIPHER_PROVIDERS.get(kdf);
             try {
                 return clazz.newInstance();
             } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/nifi/blob/537b3d0d/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/crypto/KeyedCipherProvider.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/crypto/KeyedCipherProvider.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/crypto/KeyedCipherProvider.java
index f0fa4fc..cc9562b 100644
--- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/crypto/KeyedCipherProvider.java
+++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/crypto/KeyedCipherProvider.java
@@ -53,7 +53,9 @@ public abstract class KeyedCipherProvider implements CipherProvider {
      * @param encryptMode      true for encrypt, false for decrypt
      * @return the initialized cipher
      * @throws Exception if there is a problem initializing the cipher or if decryption is requested
+     * @deprecated use other getCipher method
      */
+    @Deprecated
     abstract Cipher getCipher(EncryptionMethod encryptionMethod, SecretKey key, boolean encryptMode) throws Exception;
 
     /**

http://git-wip-us.apache.org/repos/asf/nifi/blob/537b3d0d/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/crypto/NiFiLegacyCipherProvider.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/crypto/NiFiLegacyCipherProvider.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/crypto/NiFiLegacyCipherProvider.java
index 17295d7..6789ac7 100644
--- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/crypto/NiFiLegacyCipherProvider.java
+++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/crypto/NiFiLegacyCipherProvider.java
@@ -54,7 +54,9 @@ public class NiFiLegacyCipherProvider extends OpenSSLPKCS5CipherProvider impleme
      * @param encryptMode      true for encrypt, false for decrypt
      * @return the initialized cipher
      * @throws Exception if there is a problem initializing the cipher
+     * @deprecated use other getCipher requiring a salt
      */
+    @Deprecated
     @Override
     public Cipher getCipher(EncryptionMethod encryptionMethod, String password, int keyLength, boolean encryptMode) throws Exception {
         return getCipher(encryptionMethod, password, new byte[0], keyLength, encryptMode);

http://git-wip-us.apache.org/repos/asf/nifi/blob/537b3d0d/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/crypto/OpenSSLPKCS5CipherProvider.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/crypto/OpenSSLPKCS5CipherProvider.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/crypto/OpenSSLPKCS5CipherProvider.java
index a18d4fd..e69286d 100644
--- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/crypto/OpenSSLPKCS5CipherProvider.java
+++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/crypto/OpenSSLPKCS5CipherProvider.java
@@ -62,8 +62,10 @@ public class OpenSSLPKCS5CipherProvider implements PBECipherProvider {
      * @param encryptMode      true for encrypt, false for decrypt
      * @return the initialized cipher
      * @throws Exception if there is a problem initializing the cipher
+     * @deprecated use other getCipher requiring a salt
      */
     @Override
+    @Deprecated
     public Cipher getCipher(EncryptionMethod encryptionMethod, String password, int keyLength, boolean encryptMode) throws Exception {
         return getCipher(encryptionMethod, password, new byte[0], keyLength, encryptMode);
     }

http://git-wip-us.apache.org/repos/asf/nifi/blob/537b3d0d/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/crypto/PBKDF2CipherProvider.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/crypto/PBKDF2CipherProvider.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/crypto/PBKDF2CipherProvider.java
index 748d77f..88dced7 100644
--- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/crypto/PBKDF2CipherProvider.java
+++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/crypto/PBKDF2CipherProvider.java
@@ -112,8 +112,10 @@ public class PBKDF2CipherProvider extends RandomIVPBECipherProvider {
      * @param encryptMode      true for encrypt, false for decrypt
      * @return the initialized cipher
      * @throws Exception if there is a problem initializing the cipher
+     * @deprecated use other getCipher requiring a salt
      */
     @Override
+    @Deprecated
     public Cipher getCipher(EncryptionMethod encryptionMethod, String password, int keyLength, boolean encryptMode) throws Exception {
         return getCipher(encryptionMethod, password, new byte[0], new byte[0], keyLength, encryptMode);
     }