Package com.helger.as2lib.cert
Class CertificateFactory
- java.lang.Object
-
- com.helger.as2lib.AbstractDynamicComponent
-
- com.helger.as2lib.cert.AbstractCertificateFactory
-
- com.helger.as2lib.cert.CertificateFactory
-
- All Implemented Interfaces:
IAliasedCertificateFactory
,ICertificateFactory
,IKeyStoreCertificateFactory
,IStorableCertificateFactory
,IDynamicComponent
@ThreadSafe public class CertificateFactory extends AbstractCertificateFactory implements IStorableCertificateFactory
An implementation of a file-based certificate factory using a custom key store type. Since v4.6.4 this class is derived fromAbstractCertificateFactory
.- Author:
- Philip Helger
-
-
Field Summary
Fields Modifier and Type Field Description static String
ATTR_FILENAME
static String
ATTR_SAVE_CHANGES_TO_FILE
-
Fields inherited from class com.helger.as2lib.cert.AbstractCertificateFactory
ATTR_PASSWORD, ATTR_TYPE, DEFAULT_KEY_STORE_TYPE
-
Fields inherited from class com.helger.as2lib.AbstractDynamicComponent
m_aRWLock
-
Fields inherited from interface com.helger.as2lib.cert.IStorableCertificateFactory
DEFAULT_SAVE_CHANGES_TO_FILE
-
-
Constructor Summary
Constructors Constructor Description CertificateFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getFilename()
boolean
isSaveChangesToFile()
protected void
onChange()
Custom callback method that is invoked if something changes in the key store.void
reinitKeyStore()
Reload the key store from the configured source.void
setFilename(String sFilename)
void
setSaveChangesToFile(boolean bSaveChangesToFile)
Change the behavior if all changes should trigger a saving to the original file.-
Methods inherited from class com.helger.as2lib.cert.AbstractCertificateFactory
addCertificate, addPrivateKey, clearCertificates, createNewKeyStore, debugLog, equals, getAlias, getCertificate, getCertificate, getCertificates, getKeyStore, getKeyStoreType, getPassword, getPrivateKey, getUnifiedAlias, hashCode, initDynamicComponent, initEmptyKeyStore, internalGetCertificate, isDebugLogEnabled, load, removeCertificate, removeCertificate, save, setDebugLogEnaled, setKeyStore, setKeyStoreType, setKeyStoreType, setPassword
-
Methods inherited from class com.helger.as2lib.AbstractDynamicComponent
attrs, getAttributeAsIntRequired, getAttributeAsStringRequired, getName, getSession, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.helger.as2lib.cert.ICertificateFactory
getCertificate, getCertificateOrNull, getPrivateKey
-
Methods inherited from interface com.helger.as2lib.IDynamicComponent
attrs, getName, getSession, initDynamicComponent
-
Methods inherited from interface com.helger.as2lib.cert.IStorableCertificateFactory
getPassword, load, load, load, save, save, save, setPassword, setPassword
-
-
-
-
Field Detail
-
ATTR_FILENAME
public static final String ATTR_FILENAME
- See Also:
- Constant Field Values
-
ATTR_SAVE_CHANGES_TO_FILE
public static final String ATTR_SAVE_CHANGES_TO_FILE
- See Also:
- Constant Field Values
-
-
Method Detail
-
setFilename
public void setFilename(@Nullable String sFilename)
- Specified by:
setFilename
in interfaceIStorableCertificateFactory
-
getFilename
@Nullable public String getFilename()
- Specified by:
getFilename
in interfaceIStorableCertificateFactory
-
setSaveChangesToFile
public void setSaveChangesToFile(boolean bSaveChangesToFile)
Description copied from interface:IStorableCertificateFactory
Change the behavior if all changes should trigger a saving to the original file. The default value isIStorableCertificateFactory.DEFAULT_SAVE_CHANGES_TO_FILE
.- Specified by:
setSaveChangesToFile
in interfaceIStorableCertificateFactory
- Parameters:
bSaveChangesToFile
-true
to enable auto-saving,false
to disable it.
-
isSaveChangesToFile
public boolean isSaveChangesToFile()
- Specified by:
isSaveChangesToFile
in interfaceIStorableCertificateFactory
- Returns:
true
if changes to the key store should be persisted back to the original file,false
if not. The default value isIStorableCertificateFactory.DEFAULT_SAVE_CHANGES_TO_FILE
.
-
reinitKeyStore
public void reinitKeyStore() throws AS2Exception
Description copied from interface:IKeyStoreCertificateFactory
Reload the key store from the configured source.- Specified by:
reinitKeyStore
in interfaceIKeyStoreCertificateFactory
- Throws:
AS2Exception
- in case of error
-
onChange
@OverrideOnDemand protected void onChange() throws AS2Exception
Custom callback method that is invoked if something changes in the key store. By default the changes are written back to disk.- Overrides:
onChange
in classAbstractCertificateFactory
- Throws:
AS2Exception
- In case saving fails.- See Also:
isSaveChangesToFile()
,setSaveChangesToFile(boolean)
-
-