Package org.openas2
Class BaseComponent
- java.lang.Object
-
- org.openas2.BaseComponent
-
- All Implemented Interfaces:
Component
- Direct Known Subclasses:
BaseCertificateFactory
,BaseCommand
,BaseCommandRegistry
,BaseLogger
,BasePartnershipFactory
,BaseProcessor
,BaseProcessorModule
,DefaultProcessor
,EmailSender
,SchedulerComponent
public class BaseComponent extends java.lang.Object implements Component
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,java.lang.String>
parameters
private Session
session
-
Constructor Summary
Constructors Constructor Description BaseComponent()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy()
Component lifecycle hook.java.lang.String
getName()
Returns a name for the component.java.lang.String
getParameter(java.lang.String key, boolean required)
java.lang.String
getParameter(java.lang.String key, java.lang.String defaultValue)
int
getParameterInt(java.lang.String key, boolean required)
java.util.Map<java.lang.String,java.lang.String>
getParameters()
Returns the parameters used to initialize this Component, and can also be used to modify parameters.Session
getSession()
Returns the Session used to initialize this Component.void
init(Session session, java.util.Map<java.lang.String,java.lang.String> parameters)
Component lifecycle hook.void
setParameter(java.lang.String key, int value)
void
setParameter(java.lang.String key, java.lang.String value)
-
-
-
Field Detail
-
parameters
private java.util.Map<java.lang.String,java.lang.String> parameters
-
session
private Session session
-
-
Method Detail
-
getName
public java.lang.String getName()
Description copied from interface:Component
Returns a name for the component. These names are not guaranteed to be unique, and are intended for display and logging. Generally this is the class name of the Component object, without package information.
-
setParameter
public void setParameter(java.lang.String key, java.lang.String value)
-
setParameter
public void setParameter(java.lang.String key, int value)
-
getParameter
public java.lang.String getParameter(java.lang.String key, boolean required) throws InvalidParameterException
- Throws:
InvalidParameterException
-
getParameter
public java.lang.String getParameter(java.lang.String key, java.lang.String defaultValue) throws InvalidParameterException
- Throws:
InvalidParameterException
-
getParameterInt
public int getParameterInt(java.lang.String key, boolean required) throws InvalidParameterException
- Throws:
InvalidParameterException
-
getParameters
public java.util.Map<java.lang.String,java.lang.String> getParameters()
Description copied from interface:Component
Returns the parameters used to initialize this Component, and can also be used to modify parameters.- Specified by:
getParameters
in interfaceComponent
- Returns:
- map of parameter name to parameter value
-
getSession
public Session getSession()
Description copied from interface:Component
Returns the Session used to initialize this Component. The returned session is also used to locate other components if needed.- Specified by:
getSession
in interfaceComponent
- Returns:
- this component's session
-
init
public void init(Session session, java.util.Map<java.lang.String,java.lang.String> parameters) throws OpenAS2Exception
Description copied from interface:Component
Component lifecycle hook. After creating a Component object, this method should be called to set any parameters used by the component. Component implementations typically have required parameter checking and code to start timers and threads within this method.- Specified by:
init
in interfaceComponent
- Parameters:
session
- the component uses this object to access other componentsparameters
- configuration values for the component- Throws:
OpenAS2Exception
- If an error occurs while initializing the component- See Also:
Session
-
destroy
public void destroy() throws java.lang.Exception
Description copied from interface:Component
Component lifecycle hook. If lifecycle ofComponent
requires a destroy function this method can be used.- Specified by:
destroy
in interfaceComponent
- Throws:
java.lang.Exception
- Something went wrong- See Also:
Component.init(Session, Map)
,Session
-
-