mirror of
https://codeberg.org/PGPainless/cert-d-java.git
synced 2024-12-22 13:47:59 +01:00
Rename MergeCallback to CertificateMerger
This commit is contained in:
parent
dd2877ccee
commit
96b22ff40a
6 changed files with 30 additions and 30 deletions
|
@ -5,12 +5,12 @@
|
|||
package pgp.cert_d;
|
||||
|
||||
import pgp.certificate_store.CertificateReaderBackend;
|
||||
import pgp.certificate_store.MergeCallback;
|
||||
import pgp.certificate_store.CertificateMerger;
|
||||
|
||||
public abstract class BackendProvider {
|
||||
|
||||
public abstract CertificateReaderBackend provideCertificateReaderBackend();
|
||||
|
||||
public abstract MergeCallback provideDefaultMergeCallback();
|
||||
public abstract CertificateMerger provideDefaultMergeCallback();
|
||||
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ package pgp.cert_d;
|
|||
import pgp.certificate_store.exception.BadDataException;
|
||||
import pgp.certificate_store.exception.BadNameException;
|
||||
import pgp.certificate_store.Certificate;
|
||||
import pgp.certificate_store.MergeCallback;
|
||||
import pgp.certificate_store.CertificateMerger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
@ -127,7 +127,7 @@ public class CachingSharedPGPCertificateDirectoryWrapper
|
|||
}
|
||||
|
||||
@Override
|
||||
public Certificate insert(InputStream data, MergeCallback merge)
|
||||
public Certificate insert(InputStream data, CertificateMerger merge)
|
||||
throws IOException, BadDataException, InterruptedException {
|
||||
Certificate certificate = underlyingCertificateDirectory.insert(data, merge);
|
||||
remember(certificate.getFingerprint(), certificate);
|
||||
|
@ -135,7 +135,7 @@ public class CachingSharedPGPCertificateDirectoryWrapper
|
|||
}
|
||||
|
||||
@Override
|
||||
public Certificate tryInsert(InputStream data, MergeCallback merge)
|
||||
public Certificate tryInsert(InputStream data, CertificateMerger merge)
|
||||
throws IOException, BadDataException {
|
||||
Certificate certificate = underlyingCertificateDirectory.tryInsert(data, merge);
|
||||
if (certificate != null) {
|
||||
|
@ -145,7 +145,7 @@ public class CachingSharedPGPCertificateDirectoryWrapper
|
|||
}
|
||||
|
||||
@Override
|
||||
public Certificate insertWithSpecialName(String specialName, InputStream data, MergeCallback merge)
|
||||
public Certificate insertWithSpecialName(String specialName, InputStream data, CertificateMerger merge)
|
||||
throws IOException, BadDataException, BadNameException, InterruptedException {
|
||||
Certificate certificate = underlyingCertificateDirectory.insertWithSpecialName(specialName, data, merge);
|
||||
remember(specialName, certificate);
|
||||
|
@ -153,7 +153,7 @@ public class CachingSharedPGPCertificateDirectoryWrapper
|
|||
}
|
||||
|
||||
@Override
|
||||
public Certificate tryInsertWithSpecialName(String specialName, InputStream data, MergeCallback merge)
|
||||
public Certificate tryInsertWithSpecialName(String specialName, InputStream data, CertificateMerger merge)
|
||||
throws IOException, BadDataException, BadNameException {
|
||||
Certificate certificate = underlyingCertificateDirectory.tryInsertWithSpecialName(specialName, data, merge);
|
||||
if (certificate != null) {
|
||||
|
|
|
@ -11,7 +11,7 @@ import java.util.Iterator;
|
|||
import pgp.certificate_store.exception.BadDataException;
|
||||
import pgp.certificate_store.exception.BadNameException;
|
||||
import pgp.certificate_store.Certificate;
|
||||
import pgp.certificate_store.MergeCallback;
|
||||
import pgp.certificate_store.CertificateMerger;
|
||||
|
||||
public interface SharedPGPCertificateDirectory {
|
||||
|
||||
|
@ -29,16 +29,16 @@ public interface SharedPGPCertificateDirectory {
|
|||
Certificate getBySpecialNameIfChanged(String specialName, String tag)
|
||||
throws IOException, BadNameException, BadDataException;
|
||||
|
||||
Certificate insert(InputStream data, MergeCallback merge)
|
||||
Certificate insert(InputStream data, CertificateMerger merge)
|
||||
throws IOException, BadDataException, InterruptedException;
|
||||
|
||||
Certificate tryInsert(InputStream data, MergeCallback merge)
|
||||
Certificate tryInsert(InputStream data, CertificateMerger merge)
|
||||
throws IOException, BadDataException;
|
||||
|
||||
Certificate insertWithSpecialName(String specialName, InputStream data, MergeCallback merge)
|
||||
Certificate insertWithSpecialName(String specialName, InputStream data, CertificateMerger merge)
|
||||
throws IOException, BadDataException, BadNameException, InterruptedException;
|
||||
|
||||
Certificate tryInsertWithSpecialName(String specialName, InputStream data, MergeCallback merge)
|
||||
Certificate tryInsertWithSpecialName(String specialName, InputStream data, CertificateMerger merge)
|
||||
throws IOException, BadDataException, BadNameException;
|
||||
|
||||
Iterator<Certificate> items();
|
||||
|
|
|
@ -21,7 +21,7 @@ import pgp.certificate_store.exception.BadNameException;
|
|||
import pgp.certificate_store.exception.NotAStoreException;
|
||||
import pgp.certificate_store.Certificate;
|
||||
import pgp.certificate_store.CertificateReaderBackend;
|
||||
import pgp.certificate_store.MergeCallback;
|
||||
import pgp.certificate_store.CertificateMerger;
|
||||
|
||||
public class SharedPGPCertificateDirectoryImpl implements SharedPGPCertificateDirectory {
|
||||
|
||||
|
@ -131,7 +131,7 @@ public class SharedPGPCertificateDirectoryImpl implements SharedPGPCertificateDi
|
|||
}
|
||||
|
||||
@Override
|
||||
public Certificate insert(InputStream data, MergeCallback merge)
|
||||
public Certificate insert(InputStream data, CertificateMerger merge)
|
||||
throws IOException, BadDataException, InterruptedException {
|
||||
writeLock.lockDirectory();
|
||||
|
||||
|
@ -142,7 +142,7 @@ public class SharedPGPCertificateDirectoryImpl implements SharedPGPCertificateDi
|
|||
}
|
||||
|
||||
@Override
|
||||
public Certificate tryInsert(InputStream data, MergeCallback merge)
|
||||
public Certificate tryInsert(InputStream data, CertificateMerger merge)
|
||||
throws IOException, BadDataException {
|
||||
if (!writeLock.tryLockDirectory()) {
|
||||
return null;
|
||||
|
@ -154,7 +154,7 @@ public class SharedPGPCertificateDirectoryImpl implements SharedPGPCertificateDi
|
|||
return certificate;
|
||||
}
|
||||
|
||||
private Certificate _insert(InputStream data, MergeCallback merge)
|
||||
private Certificate _insert(InputStream data, CertificateMerger merge)
|
||||
throws IOException, BadDataException {
|
||||
Certificate newCertificate = certificateReaderBackend.readCertificate(data);
|
||||
Certificate existingCertificate;
|
||||
|
@ -196,7 +196,7 @@ public class SharedPGPCertificateDirectoryImpl implements SharedPGPCertificateDi
|
|||
}
|
||||
|
||||
@Override
|
||||
public Certificate insertWithSpecialName(String specialName, InputStream data, MergeCallback merge)
|
||||
public Certificate insertWithSpecialName(String specialName, InputStream data, CertificateMerger merge)
|
||||
throws IOException, BadNameException, BadDataException, InterruptedException {
|
||||
writeLock.lockDirectory();
|
||||
|
||||
|
@ -207,7 +207,7 @@ public class SharedPGPCertificateDirectoryImpl implements SharedPGPCertificateDi
|
|||
}
|
||||
|
||||
@Override
|
||||
public Certificate tryInsertWithSpecialName(String specialName, InputStream data, MergeCallback merge)
|
||||
public Certificate tryInsertWithSpecialName(String specialName, InputStream data, CertificateMerger merge)
|
||||
throws IOException, BadNameException, BadDataException {
|
||||
if (!writeLock.tryLockDirectory()) {
|
||||
return null;
|
||||
|
@ -219,7 +219,7 @@ public class SharedPGPCertificateDirectoryImpl implements SharedPGPCertificateDi
|
|||
return certificate;
|
||||
}
|
||||
|
||||
private Certificate _insertSpecial(String specialName, InputStream data, MergeCallback merge)
|
||||
private Certificate _insertSpecial(String specialName, InputStream data, CertificateMerger merge)
|
||||
throws IOException, BadNameException, BadDataException {
|
||||
Certificate newCertificate = certificateReaderBackend.readCertificate(data);
|
||||
Certificate existingCertificate = getBySpecialName(specialName);
|
||||
|
|
|
@ -54,12 +54,12 @@ public interface CertificateDirectory {
|
|||
|
||||
/**
|
||||
* Insert a certificate into the store.
|
||||
* If an instance of the certificate is already present in the store, the given {@link MergeCallback} will be
|
||||
* If an instance of the certificate is already present in the store, the given {@link CertificateMerger} will be
|
||||
* used to merge both the existing and the new instance of the {@link Certificate}. The resulting merged certificate
|
||||
* will be stored in the store and returned.
|
||||
*
|
||||
* This method will block until a write-lock on the store can be acquired. If you cannot afford blocking,
|
||||
* consider to use {@link #tryInsertCertificate(InputStream, MergeCallback)} instead.
|
||||
* consider to use {@link #tryInsertCertificate(InputStream, CertificateMerger)} instead.
|
||||
*
|
||||
* @param data input stream containing the new certificate instance
|
||||
* @param merge callback for merging with an existing certificate instance
|
||||
|
@ -69,12 +69,12 @@ public interface CertificateDirectory {
|
|||
* @throws InterruptedException in case the inserting thread gets interrupted
|
||||
* @throws BadDataException if the data stream does not contain valid OpenPGP data
|
||||
*/
|
||||
Certificate insertCertificate(InputStream data, MergeCallback merge)
|
||||
Certificate insertCertificate(InputStream data, CertificateMerger merge)
|
||||
throws IOException, InterruptedException, BadDataException;
|
||||
|
||||
/**
|
||||
* Insert a certificate into the store.
|
||||
* If an instance of the certificate is already present in the store, the given {@link MergeCallback} will be
|
||||
* If an instance of the certificate is already present in the store, the given {@link CertificateMerger} will be
|
||||
* used to merge both the existing and the new instance of the {@link Certificate}. The resulting merged certificate
|
||||
* will be stored in the store and returned.
|
||||
*
|
||||
|
@ -90,19 +90,19 @@ public interface CertificateDirectory {
|
|||
* @throws IOException in case of an IO-error
|
||||
* @throws BadDataException if the data stream does not contain valid OpenPGP data
|
||||
*/
|
||||
Certificate tryInsertCertificate(InputStream data, MergeCallback merge)
|
||||
Certificate tryInsertCertificate(InputStream data, CertificateMerger merge)
|
||||
throws IOException, BadDataException;
|
||||
|
||||
/**
|
||||
* Insert a certificate into the store.
|
||||
* The certificate will be stored under the given special name instead of its fingerprint.
|
||||
*
|
||||
* If an instance of the certificate is already present under the special name in the store, the given {@link MergeCallback} will be
|
||||
* If an instance of the certificate is already present under the special name in the store, the given {@link CertificateMerger} will be
|
||||
* used to merge both the existing and the new instance of the {@link Certificate}. The resulting merged certificate
|
||||
* will be stored in the store and returned.
|
||||
*
|
||||
* This method will block until a write-lock on the store can be acquired. If you cannot afford blocking,
|
||||
* consider to use {@link #tryInsertCertificateBySpecialName(String, InputStream, MergeCallback)} instead.
|
||||
* consider to use {@link #tryInsertCertificateBySpecialName(String, InputStream, CertificateMerger)} instead.
|
||||
*
|
||||
* @param specialName special name of the certificate
|
||||
* @param data input stream containing the new certificate instance
|
||||
|
@ -114,14 +114,14 @@ public interface CertificateDirectory {
|
|||
* @throws BadDataException if the certificate file does not contain valid OpenPGP data
|
||||
* @throws BadNameException if the special name is unknown
|
||||
*/
|
||||
Certificate insertCertificateBySpecialName(String specialName, InputStream data, MergeCallback merge)
|
||||
Certificate insertCertificateBySpecialName(String specialName, InputStream data, CertificateMerger merge)
|
||||
throws IOException, InterruptedException, BadDataException, BadNameException;
|
||||
|
||||
/**
|
||||
* Insert a certificate into the store.
|
||||
* The certificate will be stored under the given special name instead of its fingerprint.
|
||||
*
|
||||
* If an instance of the certificate is already present under the special name in the store, the given {@link MergeCallback} will be
|
||||
* If an instance of the certificate is already present under the special name in the store, the given {@link CertificateMerger} will be
|
||||
* used to merge both the existing and the new instance of the {@link Certificate}. The resulting merged certificate
|
||||
* will be stored in the store and returned.
|
||||
*
|
||||
|
@ -139,7 +139,7 @@ public interface CertificateDirectory {
|
|||
* @throws BadDataException if the data stream does not contain valid OpenPGP data
|
||||
* @throws BadNameException if the special name is not known
|
||||
*/
|
||||
Certificate tryInsertCertificateBySpecialName(String specialName, InputStream data, MergeCallback merge)
|
||||
Certificate tryInsertCertificateBySpecialName(String specialName, InputStream data, CertificateMerger merge)
|
||||
throws IOException, BadDataException, BadNameException;
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,7 +9,7 @@ import java.io.IOException;
|
|||
/**
|
||||
* Merge a given certificate (update) with an existing certificate.
|
||||
*/
|
||||
public interface MergeCallback {
|
||||
public interface CertificateMerger {
|
||||
|
||||
/**
|
||||
* Merge the given certificate data with the existing certificate and return the result.
|
Loading…
Reference in a new issue