Package com.helger.as2lib.session
Class AS2Session
- java.lang.Object
-
- com.helger.as2lib.session.AS2Session
-
- All Implemented Interfaces:
IAS2Session
,Serializable
@NotThreadSafe public class AS2Session extends Object implements IAS2Session
Default implementation ofIAS2Session
- Author:
- Philip Helger
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
COMPONENT_ID_CERTIFICATE_FACTORY
static String
COMPONENT_ID_MESSAGE_PROCESSOR
static String
COMPONENT_ID_PARTNERSHIP_FACTORY
static boolean
DEFAULT_CRYPTO_SIGN_INCLUDE_CERTIFICATE_IN_BODY_PART
static boolean
DEFAULT_CRYPTO_VERIFY_USE_CERTIFICATE_IN_BODY_PART
-
Constructor Summary
Constructors Constructor Description AS2Session()
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addComponent(String sComponentID, IDynamicComponent aComponent)
Registers a component to a specified ID.protected com.helger.commons.collection.impl.ICommonsMap<String,IDynamicComponent>
components()
All modifications done here, have impact on the whole sessioncom.helger.commons.collection.impl.ICommonsMap<String,IDynamicComponent>
getAllComponents()
Return a map of component ID's toComponent
objects.String
getAS2VersionID()
ICertificateFactory
getCertificateFactory()
Short-cut method to retrieve a certificate factory.IDynamicComponent
getComponent(String sComponentID)
Gets theComponent
currently registered with an IDProxy
getHttpProxy()
Get the optional HTTP/HTTPS proxy settings to be used for sending AS2 messages and asynchronous MDNs.IMessageProcessor
getMessageProcessor()
Short-cut method to retrieve a processor.IPartnershipFactory
getPartnershipFactory()
Short-cut method to retrieve a partner factory.boolean
isCryptoSignIncludeCertificateInBodyPart()
boolean
isCryptoVerifyUseCertificateInBodyPart()
static void
makeAS2CommandMapChanges()
void
resetToDefault()
void
setAS2VersionID(String sAS2Version)
void
setCertificateFactory(ICertificateFactory aCertFactory)
void
setCryptoSignIncludeCertificateInBodyPart(boolean bCryptoSignIncludeCertificateInBodyPart)
Settings flag, whether a the signing certificate should be included in the signed MIME body part or not.void
setCryptoVerifyUseCertificateInBodyPart(boolean bCryptoVerifyUseCertificateInBodyPart)
Settings flag, whether a contained certificate is used for message verification.void
setHttpProxy(Proxy aHttpProxy)
Set the optional HTTP/HTTPS proxy settings to be used for sending AS2 messages and asynchronous MDNs.void
setMessageProcessor(IMessageProcessor aMsgProcessor)
void
setPartnershipFactory(IPartnershipFactory aPartnershipFactory)
String
toString()
-
-
-
Field Detail
-
COMPONENT_ID_CERTIFICATE_FACTORY
public static final String COMPONENT_ID_CERTIFICATE_FACTORY
- See Also:
- Constant Field Values
-
COMPONENT_ID_PARTNERSHIP_FACTORY
public static final String COMPONENT_ID_PARTNERSHIP_FACTORY
- See Also:
- Constant Field Values
-
COMPONENT_ID_MESSAGE_PROCESSOR
public static final String COMPONENT_ID_MESSAGE_PROCESSOR
- See Also:
- Constant Field Values
-
DEFAULT_CRYPTO_SIGN_INCLUDE_CERTIFICATE_IN_BODY_PART
public static final boolean DEFAULT_CRYPTO_SIGN_INCLUDE_CERTIFICATE_IN_BODY_PART
- See Also:
- Constant Field Values
-
DEFAULT_CRYPTO_VERIFY_USE_CERTIFICATE_IN_BODY_PART
public static final boolean DEFAULT_CRYPTO_VERIFY_USE_CERTIFICATE_IN_BODY_PART
- See Also:
- Constant Field Values
-
-
Method Detail
-
makeAS2CommandMapChanges
public static void makeAS2CommandMapChanges()
-
addComponent
public final void addComponent(@Nonnull @Nonempty String sComponentID, @Nonnull IDynamicComponent aComponent) throws AS2ComponentDuplicateException
Description copied from interface:IAS2Session
Registers a component to a specified ID.- Specified by:
addComponent
in interfaceIAS2Session
- Parameters:
sComponentID
- registers the component to this IDaComponent
- component to register- Throws:
AS2ComponentDuplicateException
- In case a component with the same ID is already present- See Also:
IDynamicComponent
-
setCertificateFactory
public void setCertificateFactory(@Nonnull ICertificateFactory aCertFactory) throws AS2ComponentDuplicateException
- Throws:
AS2ComponentDuplicateException
-
setPartnershipFactory
public void setPartnershipFactory(@Nonnull IPartnershipFactory aPartnershipFactory) throws AS2ComponentDuplicateException
- Throws:
AS2ComponentDuplicateException
-
setMessageProcessor
public void setMessageProcessor(@Nonnull IMessageProcessor aMsgProcessor) throws AS2ComponentDuplicateException
- Throws:
AS2ComponentDuplicateException
-
getComponent
@Nonnull public final IDynamicComponent getComponent(@Nonnull @Nonempty String sComponentID) throws AS2ComponentNotFoundException
Description copied from interface:IAS2Session
Gets theComponent
currently registered with an ID- Specified by:
getComponent
in interfaceIAS2Session
- Parameters:
sComponentID
- ID to search for- Returns:
- the component registered to the ID and never
null
. - Throws:
AS2ComponentNotFoundException
- If a component is not registered with the ID
-
components
@Nonnull @ReturnsMutableObject protected final com.helger.commons.collection.impl.ICommonsMap<String,IDynamicComponent> components()
All modifications done here, have impact on the whole session- Returns:
- The mutual component map. Never
null
handle with care.
-
getAllComponents
@Nonnull @ReturnsMutableCopy public final com.helger.commons.collection.impl.ICommonsMap<String,IDynamicComponent> getAllComponents()
Description copied from interface:IAS2Session
Return a map of component ID's toComponent
objects.- Specified by:
getAllComponents
in interfaceIAS2Session
- Returns:
- all registered components, mapped by ID
-
getCertificateFactory
@Nonnull public final ICertificateFactory getCertificateFactory() throws AS2ComponentNotFoundException
Description copied from interface:IAS2Session
Short-cut method to retrieve a certificate factory.- Specified by:
getCertificateFactory
in interfaceIAS2Session
- Returns:
- the currently registered
CertificateFactory
component - Throws:
AS2ComponentNotFoundException
- If aCertificateFactory
component has not been registered- See Also:
ICertificateFactory
,IDynamicComponent
-
getPartnershipFactory
@Nonnull public final IPartnershipFactory getPartnershipFactory() throws AS2ComponentNotFoundException
Description copied from interface:IAS2Session
Short-cut method to retrieve a partner factory.- Specified by:
getPartnershipFactory
in interfaceIAS2Session
- Returns:
- the currently registered
PartnerFactory
component - Throws:
AS2ComponentNotFoundException
- If aPartnerFactory
component has not been registered- See Also:
IPartnershipFactory
,IDynamicComponent
-
getMessageProcessor
@Nonnull public final IMessageProcessor getMessageProcessor() throws AS2ComponentNotFoundException
Description copied from interface:IAS2Session
Short-cut method to retrieve a processor.- Specified by:
getMessageProcessor
in interfaceIAS2Session
- Returns:
- the currently registered
Processor
component - Throws:
AS2ComponentNotFoundException
- If aProcessor
component has not been registered- See Also:
IMessageProcessor
,IDynamicComponent
-
isCryptoSignIncludeCertificateInBodyPart
public final boolean isCryptoSignIncludeCertificateInBodyPart()
- Specified by:
isCryptoSignIncludeCertificateInBodyPart
in interfaceIAS2Session
- Returns:
true
if the certificate used for signing a message should be included in the signed MIME body part or not. Defaults totrue
.- See Also:
IAS2Session.setCryptoSignIncludeCertificateInBodyPart(boolean)
-
setCryptoSignIncludeCertificateInBodyPart
public final void setCryptoSignIncludeCertificateInBodyPart(boolean bCryptoSignIncludeCertificateInBodyPart)
Description copied from interface:IAS2Session
Settings flag, whether a the signing certificate should be included in the signed MIME body part or not.- Specified by:
setCryptoSignIncludeCertificateInBodyPart
in interfaceIAS2Session
- Parameters:
bCryptoSignIncludeCertificateInBodyPart
-true
to include the signing certificate in the signed MIME body part,false
to not do so.- See Also:
IAS2Session.isCryptoSignIncludeCertificateInBodyPart()
-
isCryptoVerifyUseCertificateInBodyPart
public final boolean isCryptoVerifyUseCertificateInBodyPart()
- Specified by:
isCryptoVerifyUseCertificateInBodyPart
in interfaceIAS2Session
- Returns:
true
if any certificate passed in a message body is used for certificate verification orfalse
if only the certificate present in the partnership factory is to be used. Defaults totrue
.- See Also:
IAS2Session.setCryptoVerifyUseCertificateInBodyPart(boolean)
-
setCryptoVerifyUseCertificateInBodyPart
public final void setCryptoVerifyUseCertificateInBodyPart(boolean bCryptoVerifyUseCertificateInBodyPart)
Description copied from interface:IAS2Session
Settings flag, whether a contained certificate is used for message verification.- Specified by:
setCryptoVerifyUseCertificateInBodyPart
in interfaceIAS2Session
- Parameters:
bCryptoVerifyUseCertificateInBodyPart
-true
if any certificate passed in a message body is used for certificate verification orfalse
if only the certificate present in the partnership factory is to be used.- See Also:
IAS2Session.isCryptoVerifyUseCertificateInBodyPart()
-
getHttpProxy
@Nullable public final Proxy getHttpProxy()
Description copied from interface:IAS2Session
Get the optional HTTP/HTTPS proxy settings to be used for sending AS2 messages and asynchronous MDNs.- Specified by:
getHttpProxy
in interfaceIAS2Session
- Returns:
- The HTTP/HTTPS proxy object to be used. May be
null
. - See Also:
IAS2Session.setHttpProxy(Proxy)
-
setHttpProxy
public final void setHttpProxy(@Nullable Proxy aHttpProxy)
Description copied from interface:IAS2Session
Set the optional HTTP/HTTPS proxy settings to be used for sending AS2 messages and asynchronous MDNs.- Specified by:
setHttpProxy
in interfaceIAS2Session
- Parameters:
aHttpProxy
- The HTTP/HTTPS proxy object to be used. May benull
.- See Also:
IAS2Session.getHttpProxy()
-
getAS2VersionID
@Nonnull @Nonempty public final String getAS2VersionID()
- Specified by:
getAS2VersionID
in interfaceIAS2Session
- Returns:
- The AS2 version to use. The default is
CAS2Header.DEFAULT_AS2_VERSION
. Neithernull
nor empty.
-
setAS2VersionID
public final void setAS2VersionID(@Nonnull @Nonempty String sAS2Version)
- Specified by:
setAS2VersionID
in interfaceIAS2Session
- Parameters:
sAS2Version
- Set the AS2 version to use. May neither benull
nor empty.
-
resetToDefault
@OverridingMethodsMustInvokeSuper public void resetToDefault()
-
-