Package org.openas2
Class BaseSession
- java.lang.Object
-
- org.openas2.BaseSession
-
- All Implemented Interfaces:
Session
- Direct Known Subclasses:
XMLSession
public abstract class BaseSession extends java.lang.Object implements Session
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
baseDirectory
private java.util.Map<java.lang.String,Component>
components
-
Fields inherited from interface org.openas2.Session
DEFAULT_CONTENT_TRANSFER_ENCODING, LOG_LEVEL_OVERRIDE_KEY
-
-
Constructor Summary
Constructors Constructor Description BaseSession()
Creates aBaseSession
object, then calls theinit()
method.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getBaseDirectory()
CertificateFactory
getCertificateFactory()
Short-cut method to retrieve a certificate factory.Component
getComponent(java.lang.String componentID)
Gets theComponent
currently registered with an IDjava.util.Map<java.lang.String,Component>
getComponents()
Return a map of component ID's toComponent
objects.PartnershipFactory
getPartnershipFactory()
Short-cut method to retrieve a partner factory.Processor
getProcessor()
Short-cut method to retrieve a processor.protected void
init()
This method is called by theBaseSession
constructor to set up any global configuration settings.private void
initJavaMail()
Adds a group of content handlers to the MailcapCommandMap
.(package private) void
setBaseDirectory(java.lang.String dir)
(package private) void
setComponent(java.lang.String componentID, Component comp)
Registers a component to a specified ID.void
start()
Lifecycle control method.void
stop()
Lifecycle control method.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.openas2.Session
getAppTitle, getAppVersion
-
-
-
-
Field Detail
-
components
private java.util.Map<java.lang.String,Component> components
-
baseDirectory
private java.lang.String baseDirectory
-
-
Constructor Detail
-
BaseSession
public BaseSession() throws OpenAS2Exception
Creates aBaseSession
object, then calls theinit()
method.- Throws:
OpenAS2Exception
- - - Houston we have a problem- See Also:
init()
-
-
Method Detail
-
start
public void start() throws OpenAS2Exception
Description copied from interface:Session
Lifecycle control method.- Specified by:
start
in interfaceSession
- Throws:
OpenAS2Exception
-
stop
public void stop() throws java.lang.Exception
Description copied from interface:Session
Lifecycle control method.
-
getCertificateFactory
public CertificateFactory getCertificateFactory() throws ComponentNotFoundException
Description copied from interface:Session
Short-cut method to retrieve a certificate factory.- Specified by:
getCertificateFactory
in interfaceSession
- Returns:
- the currently registered
CertificateFactory
component - Throws:
ComponentNotFoundException
- If aCertificateFactory
component has not been registered- See Also:
CertificateFactory
,Component
-
setComponent
void setComponent(java.lang.String componentID, Component comp)
Registers a component to a specified ID.- Parameters:
componentID
- registers the component to this IDcomp
- component to register- See Also:
Component
-
getComponent
public Component getComponent(java.lang.String componentID) throws ComponentNotFoundException
Description copied from interface:Session
Gets theComponent
currently registered with an ID- Specified by:
getComponent
in interfaceSession
- Parameters:
componentID
- ID to search for- Returns:
- the component registered to the ID or null
- Throws:
ComponentNotFoundException
- If a component is not registered with the ID
-
getComponents
public java.util.Map<java.lang.String,Component> getComponents()
Description copied from interface:Session
Return a map of component ID's toComponent
objects.- Specified by:
getComponents
in interfaceSession
- Returns:
- all registered components, mapped by ID
-
getPartnershipFactory
public PartnershipFactory getPartnershipFactory() throws ComponentNotFoundException
Description copied from interface:Session
Short-cut method to retrieve a partner factory.- Specified by:
getPartnershipFactory
in interfaceSession
- Returns:
- the currently registered
PartnerFactory
component - Throws:
ComponentNotFoundException
- If aPartnerFactory
component has not been registered- See Also:
PartnershipFactory
,Component
-
getProcessor
public Processor getProcessor() throws ComponentNotFoundException
Description copied from interface:Session
Short-cut method to retrieve a processor.- Specified by:
getProcessor
in interfaceSession
- Returns:
- the currently registered
Processor
component - Throws:
ComponentNotFoundException
- If aProcessor
component has not been registered- See Also:
Processor
,Component
-
init
protected void init() throws OpenAS2Exception
This method is called by theBaseSession
constructor to set up any global configuration settings.- Throws:
OpenAS2Exception
- If an error occurs while initializing systems
-
initJavaMail
private void initJavaMail() throws OpenAS2Exception
Adds a group of content handlers to the MailcapCommandMap
. These handlers are used by the JavaMail API to encode and decode information of specific mime types.- Throws:
OpenAS2Exception
- If an error occurs while initializing mime types
-
getBaseDirectory
public java.lang.String getBaseDirectory()
- Specified by:
getBaseDirectory
in interfaceSession
-
setBaseDirectory
void setBaseDirectory(java.lang.String dir)
-
-