Repository: camel
Updated Branches:
  refs/heads/master 667443aee -> 5f9e4f23e


CAMEL-7201 Aligned the class name accessor


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5f9e4f23
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/5f9e4f23
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/5f9e4f23

Branch: refs/heads/master
Commit: 5f9e4f23e5b6c623a66fa81f0d42af7c85ae183c
Parents: 667443a
Author: Willem Jiang <willem.ji...@gmail.com>
Authored: Wed Feb 19 18:04:35 2014 +0800
Committer: Willem Jiang <willem.ji...@gmail.com>
Committed: Wed Feb 19 19:00:51 2014 +0800

----------------------------------------------------------------------
 .../crypto/DefaultPGPPublicKeyAccess.java       |  53 ----------
 .../crypto/DefaultPGPPublicKeyAccessor.java     |  53 ++++++++++
 .../crypto/DefaultPGPSecretKeyAccess.java       | 100 -------------------
 .../crypto/DefaultPGPSecretKeyAccessor.java     | 100 +++++++++++++++++++
 .../camel/converter/crypto/PGPDataFormat.java   |  10 +-
 .../crypto/PGPKeyAccessDataFormat.java          |  34 +++----
 .../converter/crypto/PGPPublicKeyAccess.java    |  50 ----------
 .../converter/crypto/PGPPublicKeyAccessor.java  |  50 ++++++++++
 .../converter/crypto/PGPSecretKeyAccess.java    |  55 ----------
 .../converter/crypto/PGPSecretKeyAccessor.java  |  55 ++++++++++
 .../converter/crypto/PGPDataFormatTest.java     |  12 +--
 .../crypto/PGPKeyAccessDataFormatTest.java      |   8 +-
 12 files changed, 290 insertions(+), 290 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/5f9e4f23/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/DefaultPGPPublicKeyAccess.java
----------------------------------------------------------------------
diff --git 
a/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/DefaultPGPPublicKeyAccess.java
 
b/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/DefaultPGPPublicKeyAccess.java
deleted file mode 100644
index 5017732..0000000
--- 
a/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/DefaultPGPPublicKeyAccess.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.converter.crypto;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.util.List;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.util.ObjectHelper;
-import org.bouncycastle.openpgp.PGPException;
-import org.bouncycastle.openpgp.PGPPublicKey;
-import org.bouncycastle.openpgp.PGPPublicKeyRingCollection;
-import org.bouncycastle.openpgp.PGPUtil;
-
-/**
- * Caches a public key ring.
- * 
- */
-public class DefaultPGPPublicKeyAccess implements PGPPublicKeyAccess {
-
-    private final PGPPublicKeyRingCollection pgpPublicKeyRing;
-
-    public DefaultPGPPublicKeyAccess(byte[] publicKeyRing) throws IOException, 
PGPException {
-        ObjectHelper.notNull(publicKeyRing, "publicKeyRing");
-        pgpPublicKeyRing = new 
PGPPublicKeyRingCollection(PGPUtil.getDecoderStream(new 
ByteArrayInputStream(publicKeyRing)));
-    }
-
-    @Override
-    public List<PGPPublicKey> getEncryptionKeys(Exchange exchange, 
List<String> useridParts) throws Exception {
-        return PGPDataFormatUtil.findPublicKeys(useridParts, true, 
pgpPublicKeyRing);
-    }
-
-    @Override
-    public PGPPublicKey getPublicKey(Exchange exchange, long keyId) throws 
Exception {
-        return pgpPublicKeyRing.getPublicKey(keyId);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/5f9e4f23/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/DefaultPGPPublicKeyAccessor.java
----------------------------------------------------------------------
diff --git 
a/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/DefaultPGPPublicKeyAccessor.java
 
b/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/DefaultPGPPublicKeyAccessor.java
new file mode 100644
index 0000000..55b8b72
--- /dev/null
+++ 
b/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/DefaultPGPPublicKeyAccessor.java
@@ -0,0 +1,53 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.converter.crypto;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.util.List;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.util.ObjectHelper;
+import org.bouncycastle.openpgp.PGPException;
+import org.bouncycastle.openpgp.PGPPublicKey;
+import org.bouncycastle.openpgp.PGPPublicKeyRingCollection;
+import org.bouncycastle.openpgp.PGPUtil;
+
+/**
+ * Caches a public key ring.
+ * 
+ */
+public class DefaultPGPPublicKeyAccessor implements PGPPublicKeyAccessor {
+
+    private final PGPPublicKeyRingCollection pgpPublicKeyRing;
+
+    public DefaultPGPPublicKeyAccessor(byte[] publicKeyRing) throws 
IOException, PGPException {
+        ObjectHelper.notNull(publicKeyRing, "publicKeyRing");
+        pgpPublicKeyRing = new 
PGPPublicKeyRingCollection(PGPUtil.getDecoderStream(new 
ByteArrayInputStream(publicKeyRing)));
+    }
+
+    @Override
+    public List<PGPPublicKey> getEncryptionKeys(Exchange exchange, 
List<String> useridParts) throws Exception {
+        return PGPDataFormatUtil.findPublicKeys(useridParts, true, 
pgpPublicKeyRing);
+    }
+
+    @Override
+    public PGPPublicKey getPublicKey(Exchange exchange, long keyId) throws 
Exception {
+        return pgpPublicKeyRing.getPublicKey(keyId);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/5f9e4f23/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/DefaultPGPSecretKeyAccess.java
----------------------------------------------------------------------
diff --git 
a/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/DefaultPGPSecretKeyAccess.java
 
b/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/DefaultPGPSecretKeyAccess.java
deleted file mode 100644
index f57ee40..0000000
--- 
a/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/DefaultPGPSecretKeyAccess.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.converter.crypto;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.util.ObjectHelper;
-import org.bouncycastle.openpgp.PGPException;
-import org.bouncycastle.openpgp.PGPPrivateKey;
-import org.bouncycastle.openpgp.PGPSecretKeyRingCollection;
-import org.bouncycastle.openpgp.PGPUtil;
-
-/**
- * Caches a Secret Keyring. Assumes that the password for all private keys is
- * the same.
- * 
- */
-public class DefaultPGPSecretKeyAccess implements PGPSecretKeyAccess {
-
-    private final Map<String, List<PGPSecretKeyAndPrivateKeyAndUserId>> 
userIdPart2SecretKeyList = new HashMap<String, 
List<PGPSecretKeyAndPrivateKeyAndUserId>>(
-            3);
-
-    private final Map<Long, PGPPrivateKey> keyId2PrivateKey = new 
HashMap<Long, PGPPrivateKey>(3);
-
-    private final PGPSecretKeyRingCollection pgpSecretKeyring;
-
-    private final String password;
-
-    private final String provider;
-
-    /**
-     * 
-     * @param secretKeyRing
-     *            secret key ring as byte array
-     * @param password
-     *            password for the private keys, assuming that all private keys
-     *            have the same password
-     * @param provider
-     * @throws PGPException
-     * @throws IOException
-     */
-    public DefaultPGPSecretKeyAccess(byte[] secretKeyRing, String password, 
String provider) throws PGPException, IOException {
-        ObjectHelper.notNull(secretKeyRing, "secretKeyRing");
-        ObjectHelper.notEmpty(password, "password");
-        ObjectHelper.notEmpty(provider, "provider");
-        pgpSecretKeyring = new 
PGPSecretKeyRingCollection(PGPUtil.getDecoderStream(new 
ByteArrayInputStream(secretKeyRing)));
-        this.password = password;
-        this.provider = provider;
-    }
-
-    @Override
-    public List<PGPSecretKeyAndPrivateKeyAndUserId> getSignerKeys(Exchange 
exchange, List<String> useridParts) throws Exception {
-        List<PGPSecretKeyAndPrivateKeyAndUserId> result = new 
ArrayList<PGPSecretKeyAndPrivateKeyAndUserId>(3);
-        for (String useridPart : useridParts) {
-            List<PGPSecretKeyAndPrivateKeyAndUserId> partResult = 
userIdPart2SecretKeyList.get(useridPart);
-            if (partResult == null) {
-                partResult = 
PGPDataFormatUtil.findSecretKeysWithPrivateKeyAndUserId(Collections.singletonMap(useridPart,
 password),
-                        provider, pgpSecretKeyring);
-                userIdPart2SecretKeyList.put(useridPart, partResult);
-            }
-            result.addAll(partResult);
-        }
-        return result;
-    }
-
-    @Override
-    public PGPPrivateKey getPrivateKey(Exchange exchange, long keyId) throws 
Exception {
-        Long keyIdLong = Long.valueOf(keyId);
-        PGPPrivateKey result = keyId2PrivateKey.get(keyIdLong);
-        if (result == null) {
-            result = PGPDataFormatUtil.findPrivateKeyWithkeyId(keyId, 
password, null, provider, pgpSecretKeyring);
-            if (result != null) {
-                keyId2PrivateKey.put(keyIdLong, result);
-            }
-        }
-        return result;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/5f9e4f23/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/DefaultPGPSecretKeyAccessor.java
----------------------------------------------------------------------
diff --git 
a/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/DefaultPGPSecretKeyAccessor.java
 
b/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/DefaultPGPSecretKeyAccessor.java
new file mode 100644
index 0000000..06e0185
--- /dev/null
+++ 
b/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/DefaultPGPSecretKeyAccessor.java
@@ -0,0 +1,100 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.converter.crypto;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.util.ObjectHelper;
+import org.bouncycastle.openpgp.PGPException;
+import org.bouncycastle.openpgp.PGPPrivateKey;
+import org.bouncycastle.openpgp.PGPSecretKeyRingCollection;
+import org.bouncycastle.openpgp.PGPUtil;
+
+/**
+ * Caches a Secret Keyring. Assumes that the password for all private keys is
+ * the same.
+ * 
+ */
+public class DefaultPGPSecretKeyAccessor implements PGPSecretKeyAccessor {
+
+    private final Map<String, List<PGPSecretKeyAndPrivateKeyAndUserId>> 
userIdPart2SecretKeyList = new HashMap<String, 
List<PGPSecretKeyAndPrivateKeyAndUserId>>(
+            3);
+
+    private final Map<Long, PGPPrivateKey> keyId2PrivateKey = new 
HashMap<Long, PGPPrivateKey>(3);
+
+    private final PGPSecretKeyRingCollection pgpSecretKeyring;
+
+    private final String password;
+
+    private final String provider;
+
+    /**
+     * 
+     * @param secretKeyRing
+     *            secret key ring as byte array
+     * @param password
+     *            password for the private keys, assuming that all private keys
+     *            have the same password
+     * @param provider
+     * @throws PGPException
+     * @throws IOException
+     */
+    public DefaultPGPSecretKeyAccessor(byte[] secretKeyRing, String password, 
String provider) throws PGPException, IOException {
+        ObjectHelper.notNull(secretKeyRing, "secretKeyRing");
+        ObjectHelper.notEmpty(password, "password");
+        ObjectHelper.notEmpty(provider, "provider");
+        pgpSecretKeyring = new 
PGPSecretKeyRingCollection(PGPUtil.getDecoderStream(new 
ByteArrayInputStream(secretKeyRing)));
+        this.password = password;
+        this.provider = provider;
+    }
+
+    @Override
+    public List<PGPSecretKeyAndPrivateKeyAndUserId> getSignerKeys(Exchange 
exchange, List<String> useridParts) throws Exception {
+        List<PGPSecretKeyAndPrivateKeyAndUserId> result = new 
ArrayList<PGPSecretKeyAndPrivateKeyAndUserId>(3);
+        for (String useridPart : useridParts) {
+            List<PGPSecretKeyAndPrivateKeyAndUserId> partResult = 
userIdPart2SecretKeyList.get(useridPart);
+            if (partResult == null) {
+                partResult = 
PGPDataFormatUtil.findSecretKeysWithPrivateKeyAndUserId(Collections.singletonMap(useridPart,
 password),
+                        provider, pgpSecretKeyring);
+                userIdPart2SecretKeyList.put(useridPart, partResult);
+            }
+            result.addAll(partResult);
+        }
+        return result;
+    }
+
+    @Override
+    public PGPPrivateKey getPrivateKey(Exchange exchange, long keyId) throws 
Exception {
+        Long keyIdLong = Long.valueOf(keyId);
+        PGPPrivateKey result = keyId2PrivateKey.get(keyIdLong);
+        if (result == null) {
+            result = PGPDataFormatUtil.findPrivateKeyWithkeyId(keyId, 
password, null, provider, pgpSecretKeyring);
+            if (result != null) {
+                keyId2PrivateKey.put(keyIdLong, result);
+            }
+        }
+        return result;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/5f9e4f23/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPDataFormat.java
----------------------------------------------------------------------
diff --git 
a/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPDataFormat.java
 
b/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPDataFormat.java
index 6fcb961..07f855f 100644
--- 
a/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPDataFormat.java
+++ 
b/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPDataFormat.java
@@ -36,7 +36,7 @@ import org.bouncycastle.openpgp.PGPPublicKey;
  * See also {@link PGPKeyAccessDataFormat}.
  * 
  */
-public class PGPDataFormat extends PGPKeyAccessDataFormat implements 
PGPPublicKeyAccess, PGPSecretKeyAccess {
+public class PGPDataFormat extends PGPKeyAccessDataFormat implements 
PGPPublicKeyAccessor, PGPSecretKeyAccessor {
 
     public static final String KEY_FILE_NAME = "CamelPGPDataFormatKeyFileName";
     public static final String ENCRYPTION_KEY_RING = 
"CamelPGPDataFormatEncryptionKeyRing";
@@ -61,8 +61,8 @@ public class PGPDataFormat extends PGPKeyAccessDataFormat 
implements PGPPublicKe
 
     public PGPDataFormat() {
         super();
-        publicKeyAccess = this;
-        secretKeyAccess = this;
+        publicKeyAccessor = this;
+        secretKeyAccessor = this;
     }
 
     protected String findKeyFileName(Exchange exchange) {
@@ -263,12 +263,12 @@ public class PGPDataFormat extends PGPKeyAccessDataFormat 
implements PGPPublicKe
     }
 
     @Override
-    public void setPublicKeyAccess(PGPPublicKeyAccess publicKeyAccess) {
+    public void setPublicKeyAccessor(PGPPublicKeyAccessor publicKeyAccessor) {
         throw new UnsupportedOperationException("Use PGPKeyAccessDataFormat if 
you want to set the public key access");
     }
 
     @Override
-    public void setSecretKeyAccess(PGPSecretKeyAccess secretKeyAccess) {
+    public void setSecretKeyAccessor(PGPSecretKeyAccessor secretKeyAccessor) {
         throw new UnsupportedOperationException("Use PGPKeyAccessDataFormat if 
you want to set the secret key access");
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/5f9e4f23/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPKeyAccessDataFormat.java
----------------------------------------------------------------------
diff --git 
a/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPKeyAccessDataFormat.java
 
b/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPKeyAccessDataFormat.java
index 456bb7e..f0e0281 100644
--- 
a/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPKeyAccessDataFormat.java
+++ 
b/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPKeyAccessDataFormat.java
@@ -68,8 +68,8 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * This PGP Data Format uses the interfaces {@link PGPPublicKeyAccess} and
- * {@link PGPSecretKeyAccess} to access the keys for encryption/signing and
+ * This PGP Data Format uses the interfaces {@link PGPPublicKeyAccessor} and
+ * {@link PGPSecretKeyAccessor} to access the keys for encryption/signing and
  * decryption/signature verification. These interfaces allow caching of the 
keys
  * which can improve the performance.
  * <p>
@@ -105,9 +105,9 @@ public class PGPKeyAccessDataFormat extends ServiceSupport 
implements DataFormat
     private static final String BC = "BC";
     private static final int BUFFER_SIZE = 16 * 1024;
     
-    PGPPublicKeyAccess publicKeyAccess;
+    PGPPublicKeyAccessor publicKeyAccessor;
 
-    PGPSecretKeyAccess secretKeyAccess;
+    PGPSecretKeyAccessor secretKeyAccessor;
 
     // Java Cryptography Extension provider, default is Bouncy Castle
     private String provider = BC;
@@ -166,7 +166,7 @@ public class PGPKeyAccessDataFormat extends ServiceSupport 
implements DataFormat
 
     public void marshal(Exchange exchange, Object graph, OutputStream 
outputStream) throws Exception {
         List<String> userids = determineEncryptionUserIds(exchange);
-        List<PGPPublicKey> keys = publicKeyAccess.getEncryptionKeys(exchange, 
userids);
+        List<PGPPublicKey> keys = 
publicKeyAccessor.getEncryptionKeys(exchange, userids);
         if (keys.isEmpty()) {
             throw new IllegalArgumentException("Cannot PGP encrypt message. No 
public encryption key found for the User Ids " + userids
                     + " in the public keyring. Either specify other User IDs 
or add correct public keys to the keyring.");
@@ -272,12 +272,12 @@ public class PGPKeyAccessDataFormat extends 
ServiceSupport implements DataFormat
 
     protected List<PGPSignatureGenerator> createSignatureGenerator(Exchange 
exchange, OutputStream out) throws Exception {
 
-        if (secretKeyAccess == null) {
+        if (secretKeyAccessor == null) {
             return null;
         }
 
         List<String> sigKeyUserids = determineSignaturenUserIds(exchange);
-        List<PGPSecretKeyAndPrivateKeyAndUserId> 
sigSecretKeysWithPrivateKeyAndUserId = secretKeyAccess.getSignerKeys(exchange,
+        List<PGPSecretKeyAndPrivateKeyAndUserId> 
sigSecretKeysWithPrivateKeyAndUserId = secretKeyAccessor.getSignerKeys(exchange,
                 sigKeyUserids);
         if (sigSecretKeysWithPrivateKeyAndUserId.isEmpty()) {
             return null;
@@ -324,7 +324,7 @@ public class PGPKeyAccessDataFormat extends ServiceSupport 
implements DataFormat
         // find encrypted data for which a private key exists in the secret 
key ring
         for (int i = 0; i < enc.size() && key == null; i++) {
             pbe = (PGPPublicKeyEncryptedData) enc.get(i);
-            key = secretKeyAccess.getPrivateKey(exchange, pbe.getKeyID());
+            key = secretKeyAccessor.getPrivateKey(exchange, pbe.getKeyID());
             if (key != null) {
                 // take the first key
                 break;
@@ -409,7 +409,7 @@ public class PGPKeyAccessDataFormat extends ServiceSupport 
implements DataFormat
         for (int i = 0; i < signatureList.size(); i++) {
             PGPOnePassSignature signature = signatureList.get(i);
             // Determine public key from signature keyId
-            PGPPublicKey sigPublicKey = publicKeyAccess.getPublicKey(exchange, 
signature.getKeyID());
+            PGPPublicKey sigPublicKey = 
publicKeyAccessor.getPublicKey(exchange, signature.getKeyID());
             if (sigPublicKey == null) {
                 continue;
             }
@@ -609,20 +609,20 @@ public class PGPKeyAccessDataFormat extends 
ServiceSupport implements DataFormat
         this.algorithm = algorithm;
     }
 
-    public PGPPublicKeyAccess getPublicKeyAccess() {
-        return publicKeyAccess;
+    public PGPPublicKeyAccessor getPublicKeyAccessor() {
+        return publicKeyAccessor;
     }
 
-    public void setPublicKeyAccess(PGPPublicKeyAccess publicKeyAccess) {
-        this.publicKeyAccess = publicKeyAccess;
+    public void setPublicKeyAccessor(PGPPublicKeyAccessor publicKeyAccessor) {
+        this.publicKeyAccessor = publicKeyAccessor;
     }
 
-    public PGPSecretKeyAccess getSecretKeyAccess() {
-        return secretKeyAccess;
+    public PGPSecretKeyAccessor getSecretKeyAccessor() {
+        return secretKeyAccessor;
     }
 
-    public void setSecretKeyAccess(PGPSecretKeyAccess secretKeyAccess) {
-        this.secretKeyAccess = secretKeyAccess;
+    public void setSecretKeyAccessor(PGPSecretKeyAccessor secretKeyAccessor) {
+        this.secretKeyAccessor = secretKeyAccessor;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/camel/blob/5f9e4f23/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPPublicKeyAccess.java
----------------------------------------------------------------------
diff --git 
a/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPPublicKeyAccess.java
 
b/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPPublicKeyAccess.java
deleted file mode 100644
index 0ee9f67..0000000
--- 
a/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPPublicKeyAccess.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.converter.crypto;
-
-import java.util.List;
-
-import org.apache.camel.Exchange;
-import org.bouncycastle.openpgp.PGPPublicKey;
-
-public interface PGPPublicKeyAccess {
-
-    /**
-     * Returns the encryption keys for the given user ID parts. This method is
-     * used for encryption.
-     * 
-     * @param exchange
-     *            exchange, can be <code>null</code>
-     * @param useridParts
-     *            parts of User IDs, must not be <code>null</code>
-     * @return list of public keys, must not be <code>null</code>
-     */
-    List<PGPPublicKey> getEncryptionKeys(Exchange exchange, List<String> 
useridParts) throws Exception;
-
-    /**
-     * Returns the public key with a certain key ID. This method is used for
-     * verifying the signature.
-     * 
-     * @param exchange
-     *            exchange
-     * @param keyId
-     *            key ID
-     * @return public key or <code>null</code> if the key cannot be found
-     */
-    PGPPublicKey getPublicKey(Exchange exchange, long keyId) throws Exception;
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/5f9e4f23/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPPublicKeyAccessor.java
----------------------------------------------------------------------
diff --git 
a/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPPublicKeyAccessor.java
 
b/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPPublicKeyAccessor.java
new file mode 100644
index 0000000..0d55931
--- /dev/null
+++ 
b/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPPublicKeyAccessor.java
@@ -0,0 +1,50 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.converter.crypto;
+
+import java.util.List;
+
+import org.apache.camel.Exchange;
+import org.bouncycastle.openpgp.PGPPublicKey;
+
+public interface PGPPublicKeyAccessor {
+
+    /**
+     * Returns the encryption keys for the given user ID parts. This method is
+     * used for encryption.
+     * 
+     * @param exchange
+     *            exchange, can be <code>null</code>
+     * @param useridParts
+     *            parts of User IDs, must not be <code>null</code>
+     * @return list of public keys, must not be <code>null</code>
+     */
+    List<PGPPublicKey> getEncryptionKeys(Exchange exchange, List<String> 
useridParts) throws Exception;
+
+    /**
+     * Returns the public key with a certain key ID. This method is used for
+     * verifying the signature.
+     * 
+     * @param exchange
+     *            exchange
+     * @param keyId
+     *            key ID
+     * @return public key or <code>null</code> if the key cannot be found
+     */
+    PGPPublicKey getPublicKey(Exchange exchange, long keyId) throws Exception;
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/5f9e4f23/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPSecretKeyAccess.java
----------------------------------------------------------------------
diff --git 
a/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPSecretKeyAccess.java
 
b/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPSecretKeyAccess.java
deleted file mode 100644
index d70a081..0000000
--- 
a/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPSecretKeyAccess.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.converter.crypto;
-
-import java.util.List;
-
-import org.apache.camel.Exchange;
-import org.bouncycastle.openpgp.PGPPrivateKey;
-
-public interface PGPSecretKeyAccess {
-
-    /**
-     * Returns the signer keys for the given user ID parts. This method is used
-     * for signing.
-     * 
-     * @param exchange
-     *            exchange, can be <code>null</code>
-     * @param useridParts
-     *            parts of User IDs, can be <code>null</code> or empty, then an
-     *            empty list must be returned
-     * @return list of secret keys with their private keys and User Ids which
-     *         corresponds to one of the useridParts, must not be
-     *         <code>null</code>, can be empty
-     */
-    List<PGPSecretKeyAndPrivateKeyAndUserId> getSignerKeys(Exchange exchange, 
List<String> useridParts) throws Exception;
-
-    /**
-     * Returns the private key with a certain key ID. This method is used for
-     * decrypting.
-     * 
-     * @param exchange
-     *            exchange, can be <code>null</code>
-     * 
-     * @param keyId
-     *            key ID
-     * @return private key or <code>null</code> if the key cannot be found
-     */
-    PGPPrivateKey getPrivateKey(Exchange exchange, long keyId) throws 
Exception;
-
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/5f9e4f23/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPSecretKeyAccessor.java
----------------------------------------------------------------------
diff --git 
a/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPSecretKeyAccessor.java
 
b/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPSecretKeyAccessor.java
new file mode 100644
index 0000000..4e0b9e7
--- /dev/null
+++ 
b/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPSecretKeyAccessor.java
@@ -0,0 +1,55 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.converter.crypto;
+
+import java.util.List;
+
+import org.apache.camel.Exchange;
+import org.bouncycastle.openpgp.PGPPrivateKey;
+
+public interface PGPSecretKeyAccessor {
+
+    /**
+     * Returns the signer keys for the given user ID parts. This method is used
+     * for signing.
+     * 
+     * @param exchange
+     *            exchange, can be <code>null</code>
+     * @param useridParts
+     *            parts of User IDs, can be <code>null</code> or empty, then an
+     *            empty list must be returned
+     * @return list of secret keys with their private keys and User Ids which
+     *         corresponds to one of the useridParts, must not be
+     *         <code>null</code>, can be empty
+     */
+    List<PGPSecretKeyAndPrivateKeyAndUserId> getSignerKeys(Exchange exchange, 
List<String> useridParts) throws Exception;
+
+    /**
+     * Returns the private key with a certain key ID. This method is used for
+     * decrypting.
+     * 
+     * @param exchange
+     *            exchange, can be <code>null</code>
+     * 
+     * @param keyId
+     *            key ID
+     * @return private key or <code>null</code> if the key cannot be found
+     */
+    PGPPrivateKey getPrivateKey(Exchange exchange, long keyId) throws 
Exception;
+
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/5f9e4f23/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/PGPDataFormatTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/PGPDataFormatTest.java
 
b/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/PGPDataFormatTest.java
index 1bc343d..7cd9f74 100644
--- 
a/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/PGPDataFormatTest.java
+++ 
b/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/PGPDataFormatTest.java
@@ -398,19 +398,19 @@ public class PGPDataFormatTest extends 
AbstractPGPDataFormatTest {
         }, new RouteBuilder() {
             public void configure() throws Exception {
 
-                PGPPublicKeyAccess publicKeyAccess = new 
DefaultPGPPublicKeyAccess(getPublicKeyRing());
+                PGPPublicKeyAccessor publicKeyAccessor = new 
DefaultPGPPublicKeyAccessor(getPublicKeyRing());
                 //password cannot be set dynamically!
-                PGPSecretKeyAccess secretKeyAccess = new 
DefaultPGPSecretKeyAccess(getSecKeyRing(), "sdude", getProvider());
+                PGPSecretKeyAccessor secretKeyAccessor = new 
DefaultPGPSecretKeyAccessor(getSecKeyRing(), "sdude", getProvider());
 
                 PGPKeyAccessDataFormat dfEncryptSignKeyAccess = new 
PGPKeyAccessDataFormat();
-                dfEncryptSignKeyAccess.setPublicKeyAccess(publicKeyAccess);
-                dfEncryptSignKeyAccess.setSecretKeyAccess(secretKeyAccess);
+                dfEncryptSignKeyAccess.setPublicKeyAccessor(publicKeyAccessor);
+                dfEncryptSignKeyAccess.setSecretKeyAccessor(secretKeyAccessor);
                 dfEncryptSignKeyAccess.setKeyUserid(getKeyUserId());
                 dfEncryptSignKeyAccess.setSignatureKeyUserid(getKeyUserId());
 
                 PGPKeyAccessDataFormat dfDecryptVerifyKeyAccess = new 
PGPKeyAccessDataFormat();
-                dfDecryptVerifyKeyAccess.setPublicKeyAccess(publicKeyAccess);
-                dfDecryptVerifyKeyAccess.setSecretKeyAccess(secretKeyAccess);
+                
dfDecryptVerifyKeyAccess.setPublicKeyAccessor(publicKeyAccessor);
+                
dfDecryptVerifyKeyAccess.setSecretKeyAccessor(secretKeyAccessor);
                 dfDecryptVerifyKeyAccess.setSignatureKeyUserid(getKeyUserId());
 
                 
from("direct:key_access").marshal(dfEncryptSignKeyAccess).to("mock:encrypted").unmarshal(dfDecryptVerifyKeyAccess)

http://git-wip-us.apache.org/repos/asf/camel/blob/5f9e4f23/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/PGPKeyAccessDataFormatTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/PGPKeyAccessDataFormatTest.java
 
b/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/PGPKeyAccessDataFormatTest.java
index 0731402..5f2082a 100644
--- 
a/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/PGPKeyAccessDataFormatTest.java
+++ 
b/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/PGPKeyAccessDataFormatTest.java
@@ -26,11 +26,11 @@ public class PGPKeyAccessDataFormatTest extends 
CamelTestSupport {
         return new RouteBuilder() {
             public void configure() throws Exception {
 
-                PGPPublicKeyAccess publicKeyAccess = new 
DefaultPGPPublicKeyAccess(PGPDataFormatTest.getPublicKeyRing());
-                PGPSecretKeyAccess secretKeyAccess = new 
DefaultPGPSecretKeyAccess(PGPDataFormatTest.getSecKeyRing(), "sdude", "BC");
+                PGPPublicKeyAccessor publicKeyAccessor = new 
DefaultPGPPublicKeyAccessor(PGPDataFormatTest.getPublicKeyRing());
+                PGPSecretKeyAccessor secretKeyAccessor = new 
DefaultPGPSecretKeyAccessor(PGPDataFormatTest.getSecKeyRing(), "sdude", "BC");
                 PGPKeyAccessDataFormat dt = new PGPKeyAccessDataFormat();
-                dt.setPublicKeyAccess(publicKeyAccess);
-                dt.setSecretKeyAccess(secretKeyAccess);               
+                dt.setPublicKeyAccessor(publicKeyAccessor);
+                dt.setSecretKeyAccessor(secretKeyAccessor);               
                 dt.setKeyUserid("sdude");
                 dt.setSignatureKeyUserid("sdude");
 

Reply via email to